From b9d9b918258153f2f8e9ff33263cf6f0b5b20ed4 Mon Sep 17 00:00:00 2001 From: Kamron Brooks Date: Thu, 29 Jun 2023 21:20:45 +1000 Subject: [PATCH] Replace Swagger-Codegen with OpenAPI Generator --- README.md | 4 +- composer.json | 8 +- src/lib/Api/AbaSettingsApi.php | 811 +- src/lib/Api/AuthenticationApi.php | 712 +- src/lib/Api/BrandApi.php | 1155 +- src/lib/Api/BusinessApi.php | 5386 ++--- src/lib/Api/ChartOfAccountsApi.php | 2361 ++- src/lib/Api/DeductionCategoriesApi.php | 885 +- src/lib/Api/EmployeeAccessApi.php | 841 +- src/lib/Api/EmployeeApi.php | 3989 ++-- src/lib/Api/EmployeeBankAccountApi.php | 871 +- src/lib/Api/EmployeeDocumentApi.php | 1625 +- src/lib/Api/EmployeeEarningsLineSplitApi.php | 808 +- src/lib/Api/EmployeeExpenseCategoriesApi.php | 993 +- src/lib/Api/EmployeeExpenseRequestApi.php | 1208 +- src/lib/Api/EmployeeGroupsApi.php | 877 +- src/lib/Api/EmployeeLeaveAllowancesApi.php | 360 +- src/lib/Api/EmployeeOnboardingApi.php | 213 +- src/lib/Api/EmployeePayRateScheduleApi.php | 834 +- src/lib/Api/EmployeeQualificationsApi.php | 1341 +- .../Api/EmployeeRecurringTransactionsApi.php | 5001 +++-- ...ReportingDimensionEarningsLineSplitApi.php | 820 +- .../Api/EmployeeSelfManagedSuperFundApi.php | 706 +- src/lib/Api/EmployeeSuperFundApi.php | 871 +- .../Api/EmployerLiabilityCategoriesApi.php | 811 +- src/lib/Api/EmployingEntitiesApi.php | 885 +- src/lib/Api/EmploymentAgreementApi.php | 1314 +- src/lib/Api/EssApi.php | 17081 +++++++++------- src/lib/Api/InvoicesApi.php | 1807 +- src/lib/Api/LeaveAllowanceApi.php | 1719 +- src/lib/Api/LeaveCategoriesApi.php | 885 +- src/lib/Api/LeaveRequestsApi.php | 1866 +- src/lib/Api/LocationApi.php | 1050 +- src/lib/Api/LookupDataApi.php | 1065 +- src/lib/Api/ManagerApi.php | 15843 ++++++++------ src/lib/Api/OtherApi.php | 354 +- src/lib/Api/PayCategoryApi.php | 885 +- src/lib/Api/PayRateTemplateApi.php | 885 +- src/lib/Api/PayRunApi.php | 8768 ++++---- src/lib/Api/PayScheduleApi.php | 1321 +- src/lib/Api/PaymentSummaryApi.php | 746 +- src/lib/Api/PublicHolidayApi.php | 961 +- src/lib/Api/QualificationsApi.php | 811 +- src/lib/Api/ReportingApi.php | 7729 ++++--- src/lib/Api/ReportingDimensionsApi.php | 1703 +- src/lib/Api/ResellerApi.php | 361 +- src/lib/Api/RosterShiftApi.php | 1532 +- src/lib/Api/SuperFundApi.php | 1026 +- src/lib/Api/TimeAndAttendanceApi.php | 3842 ++-- src/lib/Api/TimesheetsApi.php | 1095 +- src/lib/Api/UnavailabilityApi.php | 880 +- src/lib/Api/UserApi.php | 546 +- src/lib/Api/WebhookApi.php | 1137 +- src/lib/Api/WhiteLabelApi.php | 893 +- src/lib/Api/WorkTypeApi.php | 885 +- src/lib/ApiException.php | 48 +- src/lib/Configuration.php | 152 +- src/lib/HeaderSelector.php | 234 +- src/lib/Model/AccessModel.php | 212 +- src/lib/Model/ActivityReportExportModel.php | 346 +- src/lib/Model/AddNoteModel.php | 276 +- .../Model/AdditionalEarningsInputModel.php | 328 +- src/lib/Model/AdditionalEarningsModel.php | 416 +- src/lib/Model/ApiEmployeeExpenseGridModel.php | 238 +- src/lib/Model/ApiPaySlipDeductionModel.php | 238 +- src/lib/Model/ApiPaySlipLeaveModel.php | 226 +- .../Model/ApiPaySlipPaygAdjustmentModel.php | 214 +- .../Model/ApiPaySlipSuperAdjustmentModel.php | 214 +- src/lib/Model/ApiPaySlipSuperPaymentModel.php | 226 +- .../ApiYearToDateEarningsBreakdownModel.php | 214 +- src/lib/Model/ApplyLeaveRequestModel.php | 262 +- src/lib/Model/ApplyLeaveRequestResult.php | 214 +- src/lib/Model/Attachment.php | 288 +- src/lib/Model/AttachmentModel.php | 260 +- .../AuAcceptRosterShiftResponseModel.php | 250 +- .../AuAcceptRosterShiftsResponseModel.php | 250 +- src/lib/Model/AuActiveEmployeesModel.php | 392 +- src/lib/Model/AuAddShiftModel.php | 426 +- src/lib/Model/AuAddressModel.php | 308 +- .../Model/AuApiPaySlipBankPaymentModel.php | 250 +- .../Model/AuApiPaySlipEarningsLineModel.php | 318 +- src/lib/Model/AuApiPaySlipModel.php | 942 +- src/lib/Model/AuAutoPayConfigurationModel.php | 482 +- src/lib/Model/AuAvailableBusinessModel.php | 950 +- src/lib/Model/AuBankAccountModel.php | 352 +- src/lib/Model/AuBankPaymentModel.php | 310 +- src/lib/Model/AuBillingPlanResponseModel.php | 488 +- src/lib/Model/AuBusinessExportModel.php | 916 +- .../AuBusinessTimesheetSettingsModel.php | 344 +- .../AuChartOfAccountsDefaultAccountsModel.php | 428 +- src/lib/Model/AuChartOfAccountsGroupModel.php | 272 +- ...AuChartOfAccountsLocationAccountsModel.php | 308 +- .../AuChartOfAccountsLocationGroupModel.php | 284 +- src/lib/Model/AuChartOfAccountsModel.php | 228 +- src/lib/Model/AuClockOnModel.php | 388 +- src/lib/Model/AuCostingReportApiModel.php | 240 +- src/lib/Model/AuDashboardModel.php | 558 +- src/lib/Model/AuDeductionCategoryModel.php | 524 +- src/lib/Model/AuDeductionModel.php | 442 +- .../AuDetailedActivityReportExportModel.php | 428 +- .../Model/AuDetailedEmployeeGroupModel.php | 264 +- src/lib/Model/AuEarningsLineModel.php | 522 +- .../Model/AuEditBusinessPaySlipApiModel.php | 370 +- src/lib/Model/AuEmployeeFilterModel.php | 260 +- src/lib/Model/AuEmployeeGroupModel.php | 250 +- src/lib/Model/AuEmployeePayRateModel.php | 302 +- .../Model/AuEmployeePortalSettingsModel.php | 474 +- .../AuEmployeeRecurringDeductionModel.php | 568 +- src/lib/Model/AuEmployingEntityModel.php | 464 +- src/lib/Model/AuEssBankAccountModel.php | 352 +- .../AuEssBulkRosterShiftActionResponse.php | 238 +- .../Model/AuEssEmployeeDetailsEditModel.php | 384 +- .../Model/AuEssEmployeeDetailsViewModel.php | 456 +- .../Model/AuEssRosterShiftActionResponse.php | 238 +- src/lib/Model/AuEssRosterShiftModel.php | 494 +- .../AuEssSaveBankAccountResponseModel.php | 214 +- src/lib/Model/AuEssTimesheetDataModel.php | 244 +- src/lib/Model/AuEssWorkTypeModel.php | 388 +- src/lib/Model/AuFeaturesModel.php | 590 +- src/lib/Model/AuGrossToNetResponseModel.php | 540 +- .../Model/AuIndividualTimesheetLineModel.php | 664 +- src/lib/Model/AuInitialDeductionModel.php | 274 +- src/lib/Model/AuInitialEarningsModel.php | 312 +- .../AuInitiateEmployeeOnboardingApiModel.php | 296 +- src/lib/Model/AuJournalItemResponse.php | 470 +- src/lib/Model/AuLeaveAccrualRuleModel.php | 330 +- src/lib/Model/AuLeaveAllowanceModel.php | 316 +- ...AllowanceTemplateLeaveCategoryApiModel.php | 480 +- .../Model/AuLeaveAllowanceTemplateModel.php | 496 +- src/lib/Model/AuLeaveAllowancesRequest.php | 252 +- src/lib/Model/AuLeaveBalancesExportModel.php | 370 +- src/lib/Model/AuLeaveCategoryModel.php | 564 +- src/lib/Model/AuLeaveLiabilityExportModel.php | 420 +- src/lib/Model/AuLocationModel.php | 344 +- src/lib/Model/AuManagerRosterDataModel.php | 258 +- src/lib/Model/AuManagerRosterShiftModel.php | 570 +- src/lib/Model/AuOpeningBalancesModel.php | 420 +- .../Model/AuOrdinaryTimeEarningsApiModel.php | 326 +- src/lib/Model/AuPayCategoriesModel.php | 340 +- src/lib/Model/AuPayCategoryModel.php | 734 +- src/lib/Model/AuPayRateTemplateModel.php | 302 +- src/lib/Model/AuPayRunDeductionResponse.php | 214 +- src/lib/Model/AuPayRunDetailsModel.php | 230 +- .../AuPayRunEarningsLineResponseModel.php | 214 +- src/lib/Model/AuPayRunGrandTotalModel.php | 382 +- .../Model/AuPayRunInclusionExportModel.php | 492 +- src/lib/Model/AuPayRunTotalDetailModel.php | 744 +- src/lib/Model/AuPayRunTotalModel.php | 418 +- src/lib/Model/AuPayRunTotalResponse.php | 214 +- src/lib/Model/AuPayScheduleModel.php | 458 +- src/lib/Model/AuPaymentHistoryModel.php | 378 +- src/lib/Model/AuRosterShiftEditModel.php | 374 +- .../AuRosterShiftGenerateTimesheetModel.php | 542 +- .../AuRosterShiftMatchingResultModel.php | 202 +- ...erTimesheetComparisonReportExportModel.php | 592 +- ...rTimesheetComparisonReportRequestModel.php | 380 +- .../Model/AuSaveBankAccountResponseModel.php | 214 +- src/lib/Model/AuSingleLocationModel.php | 358 +- .../AuSmsfElectronicServiceAddressModel.php | 200 +- src/lib/Model/AuStpRegistrationModel.php | 480 +- .../AuSubmitPayRunEarningsLineRequest.php | 314 +- src/lib/Model/AuSubmitTimesheetsRequest.php | 338 +- src/lib/Model/AuSubmitTimesheetsResponse.php | 202 +- .../Model/AuTimeAndAttendanceKioskModel.php | 394 +- .../AuTimeAndAttendanceLookupDataModel.php | 272 +- .../Model/AuTimeAndAttendanceShiftModel.php | 398 +- src/lib/Model/AuTimesheetExportModel.php | 686 +- src/lib/Model/AuTimesheetLineModel.php | 676 +- src/lib/Model/AuTimesheetReferenceData.php | 244 +- src/lib/Model/AuUnstructuredEmployeeModel.php | 1986 +- src/lib/Model/AuWorkTypeModel.php | 364 +- src/lib/Model/AvailableEmployeeModel.php | 310 +- src/lib/Model/BankAccountEditModel.php | 580 +- .../Model/BasicEmploymentAgreementModel.php | 292 +- src/lib/Model/BasicKioskEmployeeModel.php | 384 +- src/lib/Model/BiddingEmployee.php | 224 +- src/lib/Model/BirthdayReportExportModel.php | 284 +- src/lib/Model/BrandModel.php | 212 +- src/lib/Model/BulkApplyLeaveRequestModel.php | 212 +- src/lib/Model/BusinessAbaModel.php | 380 +- src/lib/Model/BusinessAccessModel.php | 292 +- src/lib/Model/BusinessAction.php | 236 +- src/lib/Model/BusinessAtoSupplierModel.php | 442 +- src/lib/Model/BusinessTemplateModel.php | 212 +- src/lib/Model/ByteArrayContent.php | 202 +- src/lib/Model/ChangeKioskPinModel.php | 224 +- .../Model/ChartOfAccountsCategoryModel.php | 236 +- .../ChartOfAccountsLeaveCategoryModel.php | 260 +- .../ChartOfAccountsLiabilityCategoryModel.php | 248 +- ...AccountsLiabilityLocationCategoryModel.php | 236 +- .../ChartOfAccountsLocationCategoryModel.php | 224 +- ...rtOfAccountsLocationLeaveCategoryModel.php | 248 +- src/lib/Model/CheckKioskEmployeeIdModel.php | 200 +- src/lib/Model/CheckKioskPinModel.php | 212 +- src/lib/Model/ClassificationLookupModel.php | 212 +- src/lib/Model/ClassificationSelectModel.php | 212 +- src/lib/Model/ClockOffModel.php | 352 +- src/lib/Model/ClockOnModel.php | 388 +- src/lib/Model/CostingReportRequestModel.php | 272 +- src/lib/Model/CreateBusinessAccessModel.php | 316 +- src/lib/Model/CreateEmployeeAccessModel.php | 224 +- src/lib/Model/CreateEmployeeNoteModel.php | 200 +- src/lib/Model/DeclineLeaveRequest.php | 200 +- src/lib/Model/DeclineReason.php | 200 +- src/lib/Model/DeductionModel.php | 454 +- .../DeductionsReportDeductionAmountModel.php | 226 +- src/lib/Model/DeductionsReportExportModel.php | 298 +- .../Model/DeductionsReportRequestModel.php | 296 +- src/lib/Model/DetailedPayRunWarningModel.php | 426 +- src/lib/Model/DeviceTokenModel.php | 224 +- .../DimensionEarningsLineSplitApiModel.php | 240 +- ...umentAcknowledgementsReportExportModel.php | 284 +- src/lib/Model/DocumentFile.php | 240 +- src/lib/Model/DocumentModel.php | 324 +- src/lib/Model/EarningsLineSplitApiModel.php | 238 +- src/lib/Model/EarningsLineSplitEditModel.php | 238 +- src/lib/Model/EmergencyContactEditModel.php | 260 +- src/lib/Model/EmployeeAccessModel.php | 212 +- .../EmployeeDetailsAuditReportApiModel.php | 332 +- ...EmployeeDetailsAuditReportRequestModel.php | 364 +- src/lib/Model/EmployeeDetailsFields.php | 308 +- src/lib/Model/EmployeeDetailsModel.php | 548 +- src/lib/Model/EmployeeDetailsReportField.php | 212 +- .../EmployeeDetailsReportRequestModel.php | 248 +- src/lib/Model/EmployeeDocumentModel.php | 260 +- .../EmployeeEmergencyContactsEditModel.php | 228 +- .../Model/EmployeeExpenseCategoryModel.php | 298 +- src/lib/Model/EmployeeExpenseModel.php | 386 +- .../EmployeeExpensePaymentSummaryModel.php | 252 +- src/lib/Model/EmployeeGroupAccessModel.php | 266 +- src/lib/Model/EmployeeGroupItemModel.php | 212 +- .../Model/EmployeeGroupPermissionModel.php | 308 +- src/lib/Model/EmployeeItemCountModel.php | 212 +- src/lib/Model/EmployeeLeaveRequestFilter.php | 236 +- src/lib/Model/EmployeeNoteModel.php | 236 +- src/lib/Model/EmployeePartialEditModel.php | 1138 +- src/lib/Model/EmployeePublicHolidayFilter.php | 204 +- .../EmployeeQualificationDocumentModel.php | 236 +- src/lib/Model/EmployeeQualificationModel.php | 262 +- .../Model/EmployeeRecurringExpenseModel.php | 376 +- .../EmployeeRecurringSuperAdjustmentModel.php | 362 +- .../EmployeeRecurringTaxAdjustmentModel.php | 328 +- src/lib/Model/EmployeeTimesheetFilter.php | 204 +- .../Model/EmployeeUnavailabilityFilter.php | 212 +- src/lib/Model/EmployeeUpdateResponseModel.php | 224 +- src/lib/Model/EmployeeViewModel.php | 248 +- src/lib/Model/EmployeesFilter.php | 212 +- .../Model/EmployerLiabilityCategoryModel.php | 272 +- src/lib/Model/EmployerLiabilityModel.php | 322 +- .../Model/EmployerRecurringLiabilityModel.php | 544 +- src/lib/Model/EmploymentAgreementModel.php | 548 +- ...mploymentAgreementPayRateTemplateModel.php | 262 +- src/lib/Model/EndBreakModel.php | 340 +- src/lib/Model/EntitlementFeatureModel.php | 200 +- src/lib/Model/EntitlementsModel.php | 226 +- .../Model/EssBulkAcceptRosterShiftsModel.php | 200 +- .../Model/EssBulkDeclineRosterShiftsModel.php | 212 +- src/lib/Model/EssBulkRosterShiftSwapModel.php | 200 +- src/lib/Model/EssCurrentExpensesModel.php | 260 +- src/lib/Model/EssCurrentShiftModel.php | 276 +- src/lib/Model/EssCurrentTimesheetsModel.php | 274 +- src/lib/Model/EssDeclineRosterShiftModel.php | 200 +- src/lib/Model/EssDocumentModel.php | 248 +- src/lib/Model/EssEmployeeDetailsModel.php | 1190 +- .../EssEmployeeQualificationDocumentModel.php | 248 +- .../Model/EssEmployeeQualificationModel.php | 310 +- .../Model/EssExpenseRequestResponseModel.php | 348 +- src/lib/Model/EssLeaveCategoryModel.php | 238 +- src/lib/Model/EssLeaveEstimate.php | 244 +- src/lib/Model/EssLeaveRequestModel.php | 576 +- src/lib/Model/EssPaymentSummaryModel.php | 236 +- src/lib/Model/EssPayslipModel.php | 310 +- src/lib/Model/EssRosterShiftCountModel.php | 236 +- src/lib/Model/EssSatisfactionSurvey.php | 228 +- src/lib/Model/EssShiftSwapCandidate.php | 224 +- src/lib/Model/EssTimesheetModel.php | 990 +- src/lib/Model/EssUnavailabilityModel.php | 366 +- src/lib/Model/EssWorkTypeModel.php | 392 +- .../Model/ExpenseCategoryResponseModel.php | 250 +- .../Model/ExpenseManagementFilterModel.php | 328 +- src/lib/Model/ExpenseReferenceData.php | 242 +- .../Model/ExpenseRequestEditLineItemModel.php | 302 +- src/lib/Model/ExpenseRequestEditModel.php | 250 +- src/lib/Model/ExpenseRequestLineItemModel.php | 326 +- src/lib/Model/ExpenseRequestResponseModel.php | 324 +- src/lib/Model/ExpenseTaxCode.php | 226 +- src/lib/Model/FilterClause.php | 230 +- src/lib/Model/FilterQueryOption.php | 242 +- src/lib/Model/FilterQueryValidator.php | 276 - src/lib/Model/FinalisePayRunOptions.php | 614 +- src/lib/Model/GetShiftNotesModel.php | 264 +- src/lib/Model/GetShiftPeriodsModel.php | 212 +- src/lib/Model/GetShiftsModel.php | 248 +- src/lib/Model/GrossToNetReportRequest.php | 284 +- src/lib/Model/HourLeaveEstimateModel.php | 226 +- src/lib/Model/HourLeaveRequestModel.php | 312 +- .../Model/HourLeaveRequestResponseModel.php | 336 +- .../IEdmDirectValueAnnotationsManager.php | 276 - src/lib/Model/IEdmModel.php | 244 +- src/lib/Model/IEdmSchemaElement.php | 242 +- src/lib/Model/IEdmTerm.php | 270 +- src/lib/Model/IEdmType.php | 224 +- src/lib/Model/IEdmTypeReference.php | 214 +- src/lib/Model/IEdmVocabularyAnnotatable.php | 276 - src/lib/Model/IEdmVocabularyAnnotation.php | 228 +- src/lib/Model/IFutureValueOfInt32.php | 200 +- src/lib/Model/ILeaveBasedRosterShift.php | 200 +- .../Model/InitialEmployerLiabilityModel.php | 226 +- src/lib/Model/InitialLeaveBalanceModel.php | 252 +- src/lib/Model/InlineCountQueryOption.php | 238 +- src/lib/Model/InvoiceLineItemDetailModel.php | 212 +- src/lib/Model/InvoiceLineItemModel.php | 328 +- src/lib/Model/InvoiceModel.php | 304 +- src/lib/Model/InvoiceQueryOptionsModel.php | 212 +- .../Model/JournalAccountBulkCreateModel.php | 214 +- src/lib/Model/JournalAccountModel.php | 282 +- src/lib/Model/JournalExportResult.php | 448 +- src/lib/Model/JournalServiceProviderModel.php | 200 +- src/lib/Model/JournalServiceTaxCode.php | 226 +- ...aluePairOfStringAndIEnumerableOfString.php | 212 +- src/lib/Model/KioskAccessModel.php | 294 +- src/lib/Model/KioskCreateEmployeeModel.php | 248 +- src/lib/Model/KioskEmployeeModel.php | 396 +- src/lib/Model/LeaveAccrualModel.php | 262 +- src/lib/Model/LeaveAccrualResponse.php | 214 +- ...aveAllowanceTemplateLeaveCategoryModel.php | 434 +- src/lib/Model/LeaveAllowanceTemplateModel.php | 472 +- .../LeaveApplicationWithAttachmentModel.php | 306 +- src/lib/Model/LeaveBalanceModel.php | 252 +- .../Model/LeaveBalancesReportRequestModel.php | 260 +- src/lib/Model/LeaveHistoryApiReportModel.php | 272 +- .../Model/LeaveHistoryReportDetailModel.php | 266 +- .../Model/LeaveHistoryReportGroupModel.php | 316 +- src/lib/Model/LeaveHoursEstimateFilter.php | 216 +- src/lib/Model/LeaveRequestFilterModel.php | 314 +- src/lib/Model/LocationAccessModel.php | 292 +- src/lib/Model/LocationItemModel.php | 212 +- src/lib/Model/LocationModel.php | 332 +- src/lib/Model/LocationPermissionModel.php | 308 +- src/lib/Model/LocationSelectModel.php | 212 +- .../Model/LocationShiftConditionsModel.php | 212 +- .../Model/ManagerBiddableRosterShiftModel.php | 572 +- src/lib/Model/ManagerCurrentRosterShift.php | 240 +- src/lib/Model/ManagerDashboardModel.php | 230 +- src/lib/Model/ManagerEmployeeGroup.php | 212 +- src/lib/Model/ManagerExpenseEmployeeModel.php | 260 +- src/lib/Model/ManagerExpenseRequestModel.php | 360 +- src/lib/Model/ManagerItemCountModel.php | 214 +- .../Model/ManagerLeaveApplicationModel.php | 306 +- src/lib/Model/ManagerLeaveCategoryModel.php | 212 +- src/lib/Model/ManagerLeaveEmployeeModel.php | 248 +- src/lib/Model/ManagerLeaveEstimate.php | 244 +- src/lib/Model/ManagerLeaveRequestModel.php | 674 +- src/lib/Model/ManagerRosterEmployeeModel.php | 248 +- .../Model/ManagerRosterShiftFilterModel.php | 260 +- .../Model/ManagerTimesheetEmployeeModel.php | 260 +- src/lib/Model/ManagerTimesheetLineModel.php | 1042 +- src/lib/Model/ManagerTimesheetSubmitModel.php | 614 +- src/lib/Model/ManagerUnavailabilityModel.php | 402 +- src/lib/Model/MarkNotesReadViewModel.php | 224 +- src/lib/Model/MatchingEmployeeModel.php | 224 +- src/lib/Model/ModelInterface.php | 47 +- src/lib/Model/NameIdPair.php | 212 +- src/lib/Model/NetToGrossModel.php | 202 +- src/lib/Model/NetToGrossRequest.php | 226 +- src/lib/Model/NewUserCreatedModel.php | 272 +- src/lib/Model/NewUserModel.php | 252 +- src/lib/Model/NominalClassification.php | 224 +- src/lib/Model/NominalLeaveCategory.php | 212 +- src/lib/Model/NominalLocation.php | 224 +- src/lib/Model/NominalWorkType.php | 238 +- src/lib/Model/NumericSelectListItem.php | 212 +- src/lib/Model/ODataQueryContext.php | 228 +- .../Model/ODataQueryOptionsOfAbaDetails.php | 350 +- ...ryOptionsOfAuUnstructuredEmployeeModel.php | 350 +- src/lib/Model/ODataQueryOptionsOfBusiness.php | 350 +- .../ODataQueryOptionsOfDeductionCategory.php | 350 +- src/lib/Model/ODataQueryOptionsOfEmployee.php | 350 +- ...aQueryOptionsOfEmployeeExpenseCategory.php | 350 +- ...taQueryOptionsOfEmployeeExpenseRequest.php | 350 +- ...ueryOptionsOfEmployerLiabilityCategory.php | 350 +- .../ODataQueryOptionsOfEmployingEntity.php | 350 +- ...ODataQueryOptionsOfEmploymentAgreement.php | 350 +- ...eryOptionsOfHourLeaveRequestQueryModel.php | 350 +- ...taQueryOptionsOfLeaveAllowanceTemplate.php | 350 +- .../ODataQueryOptionsOfLeaveCategory.php | 350 +- src/lib/Model/ODataQueryOptionsOfLocation.php | 350 +- .../Model/ODataQueryOptionsOfPayCategory.php | 350 +- src/lib/Model/ODataQueryOptionsOfPayCycle.php | 350 +- .../ODataQueryOptionsOfPayRateTemplate.php | 350 +- src/lib/Model/ODataQueryOptionsOfPayRun.php | 350 +- ...eryOptionsOfPaygPaymentSummarySnapshot.php | 350 +- .../ODataQueryOptionsOfQualification.php | 350 +- .../ODataQueryOptionsOfReportingDimension.php | 350 +- ...aQueryOptionsOfReportingDimensionValue.php | 350 +- ...DataQueryOptionsOfSelfManagedSuperFund.php | 350 +- .../ODataQueryOptionsOfTimesheetLine.php | 350 +- src/lib/Model/ODataQueryOptionsOfWorkType.php | 350 +- src/lib/Model/ODataQueryValidator.php | 276 - src/lib/Model/ODataRawQueryOptions.php | 296 +- src/lib/Model/OpeningBalancesEtpModel.php | 306 +- src/lib/Model/OrderByClause.php | 268 +- src/lib/Model/OrderByNode.php | 212 +- src/lib/Model/OrderByQueryOption.php | 256 +- src/lib/Model/OrderByQueryValidator.php | 276 - ...OrdinaryTimeEarningsReportRequestModel.php | 224 +- src/lib/Model/OtherAmounts.php | 230 +- ...esultModelOfManagerExpenseRequestModel.php | 264 +- ...ResultModelOfManagerTimesheetLineModel.php | 264 +- .../Model/PagedResultModelOfSuburbModel.php | 264 +- ...artiallyAppliedLeaveRequestBannerModel.php | 212 +- .../Model/PayCategoriesReportRequestModel.php | 272 +- src/lib/Model/PayConditionRuleSetModel.php | 360 +- src/lib/Model/PayRateScheduleModel.php | 250 +- src/lib/Model/PayRateTemplateModel.php | 302 +- .../PayRateTemplatePayCategoryExportModel.php | 242 +- .../Model/PayRateTemplatePayCategoryModel.php | 256 +- src/lib/Model/PayRunCreateRequest.php | 298 +- .../Model/PayRunEmployeeExpenseResponse.php | 214 +- .../Model/PayRunEmployerLiabilityResponse.php | 214 +- .../PayRunFinaliseDefaultSettingsModel.php | 616 +- src/lib/Model/PayRunFinaliseResult.php | 592 +- .../PayRunInclusionsReportRequestModel.php | 274 +- src/lib/Model/PayRunJobModel.php | 212 +- src/lib/Model/PayRunJobStatusModel.php | 236 +- src/lib/Model/PayRunModel.php | 308 +- src/lib/Model/PayRunNotationModel.php | 200 +- .../Model/PayRunPaygAdjustmentResponse.php | 214 +- src/lib/Model/PayRunSummaryModel.php | 350 +- .../Model/PayRunSuperAdjustmentResponse.php | 214 +- src/lib/Model/PayRunTotalModel.php | 916 +- src/lib/Model/PayRunTotalNotationModel.php | 200 +- src/lib/Model/PayRunUnlockRequest.php | 200 +- src/lib/Model/PayRunWarningDto.php | 474 +- src/lib/Model/PayRunWarningModel.php | 212 +- src/lib/Model/PayRunWarningResult.php | 226 +- .../PayScheduleApprovalSettingsModel.php | 284 +- .../PayScheduleDateForecastResultApiModel.php | 236 +- src/lib/Model/PayScheduleMetaDataModel.php | 276 +- src/lib/Model/PaySlipNotificationResponse.php | 238 +- src/lib/Model/PaySlipReportRequestModel.php | 236 +- src/lib/Model/PaygAdjustmentModel.php | 298 +- src/lib/Model/PaygPaymentSummaryModel.php | 994 +- src/lib/Model/PaygReportExportModel.php | 282 +- src/lib/Model/PaygReportRequestModel.php | 248 +- .../PaymentHistoryReportRequestModel.php | 248 +- src/lib/Model/PayrollTaxReportExportModel.php | 370 +- .../Model/PayrollTaxReportRequestModel.php | 262 +- src/lib/Model/PinResetModel.php | 200 +- src/lib/Model/ProfileImageMetadata.php | 236 +- src/lib/Model/PublicHolidayModel.php | 296 +- src/lib/Model/QualificationModel.php | 212 +- src/lib/Model/RangeVariable.php | 226 +- src/lib/Model/RateOverride.php | 226 +- src/lib/Model/RecoverPasswordModel.php | 456 +- ...ReducedReportingDimensionValueApiModel.php | 224 +- src/lib/Model/ReportAccessModel.php | 438 +- .../ReportLeaveLiabilityRequestModel.php | 248 +- src/lib/Model/ReportPackModel.php | 212 +- .../ReportRequestWithPayScheduleModel.php | 260 +- src/lib/Model/ReportingDimensionApiModel.php | 398 +- .../Model/ReportingDimensionValueApiModel.php | 464 +- .../ReportingDimensionValueFilterApiModel.php | 212 +- src/lib/Model/ResellerModel.php | 212 +- src/lib/Model/RosterShiftBreakApiModel.php | 236 +- src/lib/Model/RosterShiftEditModel.php | 350 +- src/lib/Model/RosterShiftFilterModel.php | 408 +- src/lib/Model/RosterShiftRole.php | 236 +- src/lib/Model/RosterShiftSwapModel.php | 308 +- src/lib/Model/RuleEvaluationResult.php | 230 +- src/lib/Model/SaveLeaveAccrualModel.php | 288 +- src/lib/Model/SaveSuperFundModel.php | 276 +- src/lib/Model/SaveSuperFundResponseModel.php | 214 +- src/lib/Model/SelectExpandClause.php | 214 +- src/lib/Model/SelectExpandQueryOption.php | 254 +- src/lib/Model/SelectExpandQueryValidator.php | 276 - src/lib/Model/SelectItem.php | 276 - src/lib/Model/SelectListGroup.php | 200 +- src/lib/Model/SelectListItem.php | 250 +- src/lib/Model/SelfManagedSuperFundModel.php | 308 +- src/lib/Model/SetBillingPlanRequestModel.php | 200 +- .../Model/SetPayRunUIUnlockStateRequest.php | 200 +- src/lib/Model/ShiftAllowanceModel.php | 322 +- src/lib/Model/ShiftBreakModel.php | 368 +- src/lib/Model/ShiftCondition.php | 212 +- src/lib/Model/ShiftConditionModel.php | 212 +- src/lib/Model/ShiftConditionSelectModel.php | 236 +- src/lib/Model/ShiftCostingBreakdownModel.php | 338 +- src/lib/Model/ShiftCostingData.php | 242 +- src/lib/Model/ShiftCostingsEmployeeModel.php | 264 +- src/lib/Model/ShiftCostingsRequestModel.php | 304 +- .../Model/ShiftCostingsRequestShiftModel.php | 714 +- src/lib/Model/ShiftCostingsResponseModel.php | 274 +- .../Model/ShiftCostingsResponseShiftModel.php | 278 +- src/lib/Model/ShiftLiabilityModel.php | 280 +- src/lib/Model/ShiftNoteViewModel.php | 326 +- src/lib/Model/ShiftPartModel.php | 420 +- src/lib/Model/ShiftPeriodModel.php | 212 +- .../Model/ShiftSwappingReportExportModel.php | 372 +- .../Model/ShiftSwappingReportRequestModel.php | 300 +- src/lib/Model/SignupModel.php | 320 +- ...SingleSignOnRequestAdditionalDataModel.php | 212 +- src/lib/Model/SingleSignOnRequestModel.php | 266 +- src/lib/Model/SingleSignOnResponseModel.php | 200 +- src/lib/Model/SingleValueNode.php | 266 +- src/lib/Model/SkipQueryOption.php | 240 +- src/lib/Model/SkipQueryValidator.php | 276 - src/lib/Model/StandardHoursDayModel.php | 322 +- src/lib/Model/StandardHoursModel.php | 254 +- src/lib/Model/StartBreakModel.php | 340 +- src/lib/Model/StubRosterShiftViewModel.php | 200 +- src/lib/Model/SubmitLeaveAccrualsModel.php | 250 +- .../Model/SubmitPayRunDeductionRequest.php | 288 +- .../SubmitPayRunEmployeeExpenseRequest.php | 314 +- .../SubmitPayRunEmployerLiabilityRequest.php | 288 +- .../SubmitPayRunPaygAdjustmentRequest.php | 262 +- .../SubmitPayRunSuperAdjustmentRequest.php | 262 +- src/lib/Model/SuburbModel.php | 260 +- src/lib/Model/SuburbResult.php | 202 +- src/lib/Model/SuperAccrualExportModel.php | 372 +- src/lib/Model/SuperAdjustmentModel.php | 310 +- .../SuperContributionsReportExportModel.php | 298 +- src/lib/Model/SuperFundModel.php | 314 +- src/lib/Model/SuperProductEditModel.php | 534 +- src/lib/Model/SuperProductModel.php | 522 +- src/lib/Model/SwapShiftModel.php | 272 +- src/lib/Model/TagViewModel.php | 212 +- src/lib/Model/TasksReportExportModel.php | 334 +- src/lib/Model/TasksReportNoteModel.php | 236 +- src/lib/Model/TasksReportRequestModel.php | 274 +- src/lib/Model/TerminateEmployeeRequest.php | 224 +- src/lib/Model/TimeAndAttendanceBreakModel.php | 248 +- src/lib/Model/TimeAndAttendanceKioskModel.php | 406 +- src/lib/Model/TimesheetBreakManagerModel.php | 284 +- src/lib/Model/TimesheetBreakModel.php | 224 +- src/lib/Model/TimesheetBreakModelv3.php | 224 +- src/lib/Model/TimesheetBreakSubmitModel.php | 224 +- src/lib/Model/TimesheetBreakViewModel.php | 284 +- src/lib/Model/TimesheetLineCommentsModel.php | 224 +- src/lib/Model/TimesheetLineModel.php | 650 +- src/lib/Model/TimesheetReportRequestModel.php | 320 +- src/lib/Model/TimesheetRequestFilterModel.php | 348 +- src/lib/Model/TimesheetRoundingRulesModel.php | 420 +- .../Model/TimesheetShiftConditionModel.php | 212 +- .../Model/TimesheetShiftConditionModelv3.php | 212 +- src/lib/Model/TitleViewModel.php | 212 +- src/lib/Model/TopQueryOption.php | 240 +- src/lib/Model/TopQueryValidator.php | 276 - src/lib/Model/UnavailabilityEditModel.php | 366 +- src/lib/Model/UnavailabilityFilter.php | 236 +- src/lib/Model/UnavailabilityModel.php | 378 +- src/lib/Model/UnavailabilitySaveModel.php | 306 +- .../Model/UnitAndHourLeaveEstimateModel.php | 240 +- .../Model/UpdateDocumentPermissionsModel.php | 296 +- ...UpdateEmployeeDocumentPermissionsModel.php | 272 +- src/lib/Model/UpdateUserModel.php | 208 +- src/lib/Model/UserModel.php | 236 +- src/lib/Model/UserUpdatedModel.php | 212 +- src/lib/Model/WebHook.php | 290 +- .../WhiteLabelActiveEmployeesRequestModel.php | 260 +- src/lib/Model/WhiteLabelBrandingModel.php | 308 +- src/lib/Model/WhiteLabelModel.php | 212 +- .../WhiteLabelReportSignupsRequestModel.php | 248 +- src/lib/Model/WorkTypeSelectModel.php | 260 +- src/lib/ObjectSerializer.php | 409 +- 565 files changed, 179746 insertions(+), 95346 deletions(-) delete mode 100644 src/lib/Model/FilterQueryValidator.php delete mode 100644 src/lib/Model/IEdmDirectValueAnnotationsManager.php delete mode 100644 src/lib/Model/IEdmVocabularyAnnotatable.php delete mode 100644 src/lib/Model/ODataQueryValidator.php delete mode 100644 src/lib/Model/OrderByQueryValidator.php delete mode 100644 src/lib/Model/SelectExpandQueryValidator.php delete mode 100644 src/lib/Model/SelectItem.php delete mode 100644 src/lib/Model/SkipQueryValidator.php delete mode 100644 src/lib/Model/TopQueryValidator.php diff --git a/README.md b/README.md index a77fea1..a9437aa 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ Once you have a valid access token, you can instantiate a KeypayPHP\Application, $application = new \KeypayPHP\Application($access_token); ``` ### Access a particular API Group -All of the API classes are available under ``Swagget\Client\Api``. Using ``forApi()`` will allow you to access the API using your application object's transport +All of the API classes are available under ``OpenAPI\Client\Api``. Using ``forApi()`` will allow you to access the API using your application object's transport ```php -$employees = $application->forApi('Swagger\Client\Api\EmployeeApi')->auEmployeeGetEmployees($business_id); +$employees = $application->forApi('\OpenAPI\Client\Api\EmployeeApi')->auEmployeeGetEmployees($business_id); ``` ## Testing diff --git a/composer.json b/composer.json index 3b6b7a2..b5c1fd4 100644 --- a/composer.json +++ b/composer.json @@ -17,19 +17,19 @@ ], "require": { "healyhatman/oauth2-keypay" : "^1", - "guzzlehttp/psr7": "^1.5|^1.6", + "guzzlehttp/psr7": "^2", "php": "^7.4 || ^8.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.5|^7.0" + "guzzlehttp/guzzle": "^7.0" }, "autoload": { "psr-4": { "KeypayPHP\\": "src/KeypayPHP/", - "Swagger\\Client\\" : "src/lib/" + "OpenAPI\\Client\\" : "src/lib/" } }, "minimum-stability": "dev", "prefer-stable": true -} +} \ No newline at end of file diff --git a/src/lib/Api/AbaSettingsApi.php b/src/lib/Api/AbaSettingsApi.php index ec9754c..21e5bcd 100644 --- a/src/lib/Api/AbaSettingsApi.php +++ b/src/lib/Api/AbaSettingsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auAbaGet' => [ + 'application/json', + ], + 'auAbaGetAbaDetails' => [ + 'application/json', + ], + 'auAbaPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auAbaPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auAbaDelete($id, $business_id) + public function auAbaDelete($id, $business_id, string $contentType = self::contentTypes['auAbaDelete'][0]) { - $this->auAbaDeleteWithHttpInfo($id, $business_id); + $this->auAbaDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auAbaDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auAbaDeleteWithHttpInfo($id, $business_id) + public function auAbaDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auAbaDelete'][0]) { - $returnType = ''; - $request = $this->auAbaDeleteRequest($id, $business_id); + $request = $this->auAbaDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auAbaDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auAbaDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auAbaDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaDeleteAsync($id, $business_id) + public function auAbaDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auAbaDelete'][0]) { - return $this->auAbaDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auAbaDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaDeleteAsyncWithHttpInfo($id, $business_id) + public function auAbaDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auAbaDelete'][0]) { $returnType = ''; - $request = $this->auAbaDeleteRequest($id, $business_id); + $request = $this->auAbaDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auAbaDeleteRequest($id, $business_id) + public function auAbaDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auAbaDelete'][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 auAbaDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auAbaDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/aba/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auAbaDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auAbaDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auAbaDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auAbaDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAbaModel + * @return \OpenAPI\Client\Model\BusinessAbaModel */ - public function auAbaGet($id, $business_id) + public function auAbaGet($id, $business_id, string $contentType = self::contentTypes['auAbaGet'][0]) { - list($response) = $this->auAbaGetWithHttpInfo($id, $business_id); + list($response) = $this->auAbaGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auAbaGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAbaModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAbaModel, HTTP status code, HTTP response headers (array of strings) */ - public function auAbaGetWithHttpInfo($id, $business_id) + public function auAbaGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auAbaGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAbaModel'; - $request = $this->auAbaGetRequest($id, $business_id); + $request = $this->auAbaGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auAbaGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auAbaGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAbaModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAbaModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAbaModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAbaModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auAbaGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAbaModel', + '\OpenAPI\Client\Model\BusinessAbaModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auAbaGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaGetAsync($id, $business_id) + public function auAbaGetAsync($id, $business_id, string $contentType = self::contentTypes['auAbaGet'][0]) { - return $this->auAbaGetAsyncWithHttpInfo($id, $business_id) + return $this->auAbaGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaGetAsyncWithHttpInfo($id, $business_id) + public function auAbaGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auAbaGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAbaModel'; - $request = $this->auAbaGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\BusinessAbaModel'; + $request = $this->auAbaGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auAbaGetRequest($id, $business_id) + public function auAbaGetRequest($id, $business_id, string $contentType = self::contentTypes['auAbaGet'][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 auAbaGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auAbaGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/aba/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auAbaGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auAbaGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auAbaGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auAbaGetRequest($id, $business_id) * List ABA Settings * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGetAbaDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAbaModel[] + * @return \OpenAPI\Client\Model\BusinessAbaModel[] */ - public function auAbaGetAbaDetails($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auAbaGetAbaDetails($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auAbaGetAbaDetails'][0]) { - list($response) = $this->auAbaGetAbaDetailsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auAbaGetAbaDetailsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auAbaGetAbaDetails($business_id, $filter = null, $orderby = null * List ABA Settings * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGetAbaDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAbaModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAbaModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auAbaGetAbaDetailsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auAbaGetAbaDetailsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auAbaGetAbaDetails'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAbaModel[]'; - $request = $this->auAbaGetAbaDetailsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auAbaGetAbaDetailsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auAbaGetAbaDetailsWithHttpInfo($business_id, $filter = null, $or } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auAbaGetAbaDetailsWithHttpInfo($business_id, $filter = null, $or sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAbaModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAbaModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAbaModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAbaModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auAbaGetAbaDetailsWithHttpInfo($business_id, $filter = null, $or case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAbaModel[]', + '\OpenAPI\Client\Model\BusinessAbaModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auAbaGetAbaDetailsWithHttpInfo($business_id, $filter = null, $or * List ABA Settings * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGetAbaDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaGetAbaDetailsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auAbaGetAbaDetailsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auAbaGetAbaDetails'][0]) { - return $this->auAbaGetAbaDetailsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auAbaGetAbaDetailsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List ABA Settings * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGetAbaDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaGetAbaDetailsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auAbaGetAbaDetailsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auAbaGetAbaDetails'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAbaModel[]'; - $request = $this->auAbaGetAbaDetailsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\BusinessAbaModel[]'; + $request = $this->auAbaGetAbaDetailsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auAbaGetAbaDetails' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaGetAbaDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auAbaGetAbaDetailsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auAbaGetAbaDetailsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auAbaGetAbaDetails'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auAbaGetAbaDetailsRequest($business_id, $filter = null, $orde ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/aba'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auAbaGetAbaDetailsRequest($business_id, $filter = null, $orde $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auAbaGetAbaDetailsRequest($business_id, $filter = null, $orde ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auAbaGetAbaDetailsRequest($business_id, $filter = null, $orde $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auAbaGetAbaDetailsRequest($business_id, $filter = null, $orde * * Create ABA Settings Record * - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details aba_details (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auAbaPost($aba_details, $business_id) + public function auAbaPost($business_id, $aba_details, string $contentType = self::contentTypes['auAbaPost'][0]) { - $this->auAbaPostWithHttpInfo($aba_details, $business_id); + $this->auAbaPostWithHttpInfo($business_id, $aba_details, $contentType); } /** @@ -968,17 +1085,17 @@ public function auAbaPost($aba_details, $business_id) * * Create ABA Settings Record * - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auAbaPostWithHttpInfo($aba_details, $business_id) + public function auAbaPostWithHttpInfo($business_id, $aba_details, string $contentType = self::contentTypes['auAbaPost'][0]) { - $returnType = ''; - $request = $this->auAbaPostRequest($aba_details, $business_id); + $request = $this->auAbaPostRequest($business_id, $aba_details, $contentType); try { $options = $this->createHttpClientOption(); @@ -987,9 +1104,16 @@ public function auAbaPostWithHttpInfo($aba_details, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1000,11 +1124,11 @@ public function auAbaPostWithHttpInfo($aba_details, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1022,15 +1146,16 @@ public function auAbaPostWithHttpInfo($aba_details, $business_id) * * Create ABA Settings Record * - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaPostAsync($aba_details, $business_id) + public function auAbaPostAsync($business_id, $aba_details, string $contentType = self::contentTypes['auAbaPost'][0]) { - return $this->auAbaPostAsyncWithHttpInfo($aba_details, $business_id) + return $this->auAbaPostAsyncWithHttpInfo($business_id, $aba_details, $contentType) ->then( function ($response) { return $response[0]; @@ -1043,16 +1168,17 @@ function ($response) { * * Create ABA Settings Record * - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaPostAsyncWithHttpInfo($aba_details, $business_id) + public function auAbaPostAsyncWithHttpInfo($business_id, $aba_details, string $contentType = self::contentTypes['auAbaPost'][0]) { $returnType = ''; - $request = $this->auAbaPostRequest($aba_details, $business_id); + $request = $this->auAbaPostRequest($business_id, $aba_details, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1071,7 +1197,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1080,20 +1206,16 @@ function ($exception) { /** * Create request for operation 'auAbaPost' * - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auAbaPostRequest($aba_details, $business_id) + public function auAbaPostRequest($business_id, $aba_details, string $contentType = self::contentTypes['auAbaPost'][0]) { - // verify the required parameter 'aba_details' is set - if ($aba_details === null || (is_array($aba_details) && count($aba_details) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $aba_details when calling auAbaPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1101,6 +1223,14 @@ protected function auAbaPostRequest($aba_details, $business_id) ); } + // verify the required parameter 'aba_details' is set + if ($aba_details === null || (is_array($aba_details) && count($aba_details) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $aba_details when calling auAbaPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/aba'; $formParams = []; $queryParams = []; @@ -1109,6 +1239,7 @@ protected function auAbaPostRequest($aba_details, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1118,56 +1249,42 @@ protected function auAbaPostRequest($aba_details, $business_id) ); } - // body params - $_tempBody = null; - if (isset($aba_details)) { - $_tempBody = $aba_details; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($aba_details)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($aba_details)); + } else { + $httpBody = $aba_details; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1188,10 +1305,11 @@ protected function auAbaPostRequest($aba_details, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1203,16 +1321,17 @@ protected function auAbaPostRequest($aba_details, $business_id) * Update ABA Settings Record * * @param int $id id (required) - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details aba_details (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auAbaPut($id, $aba_details, $business_id) + public function auAbaPut($id, $business_id, $aba_details, string $contentType = self::contentTypes['auAbaPut'][0]) { - $this->auAbaPutWithHttpInfo($id, $aba_details, $business_id); + $this->auAbaPutWithHttpInfo($id, $business_id, $aba_details, $contentType); } /** @@ -1221,17 +1340,17 @@ public function auAbaPut($id, $aba_details, $business_id) * Update ABA Settings Record * * @param int $id (required) - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auAbaPutWithHttpInfo($id, $aba_details, $business_id) + public function auAbaPutWithHttpInfo($id, $business_id, $aba_details, string $contentType = self::contentTypes['auAbaPut'][0]) { - $returnType = ''; - $request = $this->auAbaPutRequest($id, $aba_details, $business_id); + $request = $this->auAbaPutRequest($id, $business_id, $aba_details, $contentType); try { $options = $this->createHttpClientOption(); @@ -1240,9 +1359,16 @@ public function auAbaPutWithHttpInfo($id, $aba_details, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1253,11 +1379,11 @@ public function auAbaPutWithHttpInfo($id, $aba_details, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1276,15 +1402,16 @@ public function auAbaPutWithHttpInfo($id, $aba_details, $business_id) * Update ABA Settings Record * * @param int $id (required) - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaPutAsync($id, $aba_details, $business_id) + public function auAbaPutAsync($id, $business_id, $aba_details, string $contentType = self::contentTypes['auAbaPut'][0]) { - return $this->auAbaPutAsyncWithHttpInfo($id, $aba_details, $business_id) + return $this->auAbaPutAsyncWithHttpInfo($id, $business_id, $aba_details, $contentType) ->then( function ($response) { return $response[0]; @@ -1298,16 +1425,17 @@ function ($response) { * Update ABA Settings Record * * @param int $id (required) - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auAbaPutAsyncWithHttpInfo($id, $aba_details, $business_id) + public function auAbaPutAsyncWithHttpInfo($id, $business_id, $aba_details, string $contentType = self::contentTypes['auAbaPut'][0]) { $returnType = ''; - $request = $this->auAbaPutRequest($id, $aba_details, $business_id); + $request = $this->auAbaPutRequest($id, $business_id, $aba_details, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1326,7 +1454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1336,26 +1464,23 @@ function ($exception) { * Create request for operation 'auAbaPut' * * @param int $id (required) - * @param \Swagger\Client\Model\BusinessAbaModel $aba_details (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAbaModel $aba_details (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auAbaPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auAbaPutRequest($id, $aba_details, $business_id) + public function auAbaPutRequest($id, $business_id, $aba_details, string $contentType = self::contentTypes['auAbaPut'][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 auAbaPut' ); } - // verify the required parameter 'aba_details' is set - if ($aba_details === null || (is_array($aba_details) && count($aba_details) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $aba_details when calling auAbaPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1363,6 +1488,14 @@ protected function auAbaPutRequest($id, $aba_details, $business_id) ); } + // verify the required parameter 'aba_details' is set + if ($aba_details === null || (is_array($aba_details) && count($aba_details) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $aba_details when calling auAbaPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/aba/{id}'; $formParams = []; $queryParams = []; @@ -1371,6 +1504,7 @@ protected function auAbaPutRequest($id, $aba_details, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1388,56 +1522,42 @@ protected function auAbaPutRequest($id, $aba_details, $business_id) ); } - // body params - $_tempBody = null; - if (isset($aba_details)) { - $_tempBody = $aba_details; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($aba_details)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($aba_details)); + } else { + $httpBody = $aba_details; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1458,10 +1578,11 @@ protected function auAbaPutRequest($id, $aba_details, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/AuthenticationApi.php b/src/lib/Api/AuthenticationApi.php index 66cf713..97e08bf 100644 --- a/src/lib/Api/AuthenticationApi.php +++ b/src/lib/Api/AuthenticationApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'singleSignOnPostApiV2BusinessByBusinessIdSinglesignon' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'tokenPost' => [ + '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 + 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; } /** @@ -92,15 +148,16 @@ public function getConfig() * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model model (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SingleSignOnResponseModel + * @return \OpenAPI\Client\Model\SingleSignOnResponseModel */ - public function singleSignOnPost($model) + public function singleSignOnPost($model, string $contentType = self::contentTypes['singleSignOnPost'][0]) { - list($response) = $this->singleSignOnPostWithHttpInfo($model); + list($response) = $this->singleSignOnPostWithHttpInfo($model, $contentType); return $response; } @@ -109,16 +166,16 @@ public function singleSignOnPost($model) * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SingleSignOnResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SingleSignOnResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function singleSignOnPostWithHttpInfo($model) + public function singleSignOnPostWithHttpInfo($model, string $contentType = self::contentTypes['singleSignOnPost'][0]) { - $returnType = '\Swagger\Client\Model\SingleSignOnResponseModel'; - $request = $this->singleSignOnPostRequest($model); + $request = $this->singleSignOnPostRequest($model, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,9 +184,16 @@ public function singleSignOnPostWithHttpInfo($model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -140,19 +204,37 @@ public function singleSignOnPostWithHttpInfo($model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SingleSignOnResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SingleSignOnResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SingleSignOnResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SingleSignOnResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -169,7 +251,7 @@ public function singleSignOnPostWithHttpInfo($model) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SingleSignOnResponseModel', + '\OpenAPI\Client\Model\SingleSignOnResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -184,14 +266,15 @@ public function singleSignOnPostWithHttpInfo($model) * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function singleSignOnPostAsync($model) + public function singleSignOnPostAsync($model, string $contentType = self::contentTypes['singleSignOnPost'][0]) { - return $this->singleSignOnPostAsyncWithHttpInfo($model) + return $this->singleSignOnPostAsyncWithHttpInfo($model, $contentType) ->then( function ($response) { return $response[0]; @@ -204,25 +287,25 @@ function ($response) { * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function singleSignOnPostAsyncWithHttpInfo($model) + public function singleSignOnPostAsyncWithHttpInfo($model, string $contentType = self::contentTypes['singleSignOnPost'][0]) { - $returnType = '\Swagger\Client\Model\SingleSignOnResponseModel'; - $request = $this->singleSignOnPostRequest($model); + $returnType = '\OpenAPI\Client\Model\SingleSignOnResponseModel'; + $request = $this->singleSignOnPostRequest($model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -245,7 +328,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -254,13 +337,15 @@ function ($exception) { /** * Create request for operation 'singleSignOnPost' * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function singleSignOnPostRequest($model) + public function singleSignOnPostRequest($model, string $contentType = self::contentTypes['singleSignOnPost'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -268,6 +353,7 @@ protected function singleSignOnPostRequest($model) ); } + $resourcePath = '/api/v2/singlesignon'; $formParams = []; $queryParams = []; @@ -277,56 +363,43 @@ protected function singleSignOnPostRequest($model) - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -347,10 +420,11 @@ protected function singleSignOnPostRequest($model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -361,17 +435,18 @@ protected function singleSignOnPostRequest($model) * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SingleSignOnResponseModel + * @return \OpenAPI\Client\Model\SingleSignOnResponseModel */ - public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon($model, $business_id, $employee_id) + public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon($business_id, $employee_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'][0]) { - list($response) = $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -380,18 +455,18 @@ public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSin * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SingleSignOnResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SingleSignOnResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonWithHttpInfo($model, $business_id, $employee_id) + public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'][0]) { - $returnType = '\Swagger\Client\Model\SingleSignOnResponseModel'; - $request = $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonRequest($model, $business_id, $employee_id); + $request = $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -400,9 +475,16 @@ public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -413,19 +495,37 @@ public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SingleSignOnResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SingleSignOnResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SingleSignOnResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SingleSignOnResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -442,7 +542,7 @@ public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSin case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SingleSignOnResponseModel', + '\OpenAPI\Client\Model\SingleSignOnResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -457,16 +557,17 @@ public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSin * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonAsync($model, $business_id, $employee_id) + public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'][0]) { - return $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -479,27 +580,27 @@ function ($response) { * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonAsyncWithHttpInfo($model, $business_id, $employee_id) + public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'][0]) { - $returnType = '\Swagger\Client\Model\SingleSignOnResponseModel'; - $request = $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SingleSignOnResponseModel'; + $request = $this->singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -522,7 +623,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -531,27 +632,24 @@ function ($exception) { /** * Create request for operation 'singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon' * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonRequest($model, $business_id, $employee_id) + public function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignonRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -559,6 +657,14 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeId ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeIdSinglesignon' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/singlesignon'; $formParams = []; $queryParams = []; @@ -567,6 +673,7 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeId $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -584,56 +691,42 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeId ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -654,10 +747,11 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeId $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -668,16 +762,17 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdEmployeeByEmployeeId * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SingleSignOnResponseModel + * @return \OpenAPI\Client\Model\SingleSignOnResponseModel */ - public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignon($model, $business_id) + public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignon($business_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'][0]) { - list($response) = $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInfo($model, $business_id); + list($response) = $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -686,17 +781,17 @@ public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignon($model, $b * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SingleSignOnResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SingleSignOnResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInfo($model, $business_id) + public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'][0]) { - $returnType = '\Swagger\Client\Model\SingleSignOnResponseModel'; - $request = $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest($model, $business_id); + $request = $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -705,9 +800,16 @@ public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInf } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -718,19 +820,37 @@ public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInf sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SingleSignOnResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SingleSignOnResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SingleSignOnResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SingleSignOnResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -747,7 +867,7 @@ public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInf case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SingleSignOnResponseModel', + '\OpenAPI\Client\Model\SingleSignOnResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -762,15 +882,16 @@ public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonWithHttpInf * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonAsync($model, $business_id) + public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonAsync($business_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'][0]) { - return $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonAsyncWithHttpInfo($model, $business_id) + return $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -783,26 +904,26 @@ function ($response) { * * Single Sign On * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonAsyncWithHttpInfo($model, $business_id) + public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'][0]) { - $returnType = '\Swagger\Client\Model\SingleSignOnResponseModel'; - $request = $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest($model, $business_id); + $returnType = '\OpenAPI\Client\Model\SingleSignOnResponseModel'; + $request = $this->singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -825,7 +946,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -834,20 +955,16 @@ function ($exception) { /** * Create request for operation 'singleSignOnPostApiV2BusinessByBusinessIdSinglesignon' * - * @param \Swagger\Client\Model\SingleSignOnRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SingleSignOnRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest($model, $business_id) + public function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest($business_id, $model, string $contentType = self::contentTypes['singleSignOnPostApiV2BusinessByBusinessIdSinglesignon'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling singleSignOnPostApiV2BusinessByBusinessIdSinglesignon' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -855,6 +972,14 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest( ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling singleSignOnPostApiV2BusinessByBusinessIdSinglesignon' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/singlesignon'; $formParams = []; $queryParams = []; @@ -863,6 +988,7 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest( $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -872,56 +998,42 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest( ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -942,10 +1054,11 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest( $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -956,15 +1069,16 @@ protected function singleSignOnPostApiV2BusinessByBusinessIdSinglesignonRequest( * * OAuth Token * - * @param map[string,string] $request request (required) + * @param object $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function tokenPost($request) + public function tokenPost($request, string $contentType = self::contentTypes['tokenPost'][0]) { - $this->tokenPostWithHttpInfo($request); + $this->tokenPostWithHttpInfo($request, $contentType); } /** @@ -972,16 +1086,16 @@ public function tokenPost($request) * * OAuth Token * - * @param map[string,string] $request (required) + * @param object $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function tokenPostWithHttpInfo($request) + public function tokenPostWithHttpInfo($request, string $contentType = self::contentTypes['tokenPost'][0]) { - $returnType = ''; - $request = $this->tokenPostRequest($request); + $request = $this->tokenPostRequest($request, $contentType); try { $options = $this->createHttpClientOption(); @@ -990,9 +1104,16 @@ public function tokenPostWithHttpInfo($request) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1003,11 +1124,11 @@ public function tokenPostWithHttpInfo($request) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1025,14 +1146,15 @@ public function tokenPostWithHttpInfo($request) * * OAuth Token * - * @param map[string,string] $request (required) + * @param object $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function tokenPostAsync($request) + public function tokenPostAsync($request, string $contentType = self::contentTypes['tokenPost'][0]) { - return $this->tokenPostAsyncWithHttpInfo($request) + return $this->tokenPostAsyncWithHttpInfo($request, $contentType) ->then( function ($response) { return $response[0]; @@ -1045,15 +1167,16 @@ function ($response) { * * OAuth Token * - * @param map[string,string] $request (required) + * @param object $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function tokenPostAsyncWithHttpInfo($request) + public function tokenPostAsyncWithHttpInfo($request, string $contentType = self::contentTypes['tokenPost'][0]) { $returnType = ''; - $request = $this->tokenPostRequest($request); + $request = $this->tokenPostRequest($request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1072,7 +1195,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1081,13 +1204,15 @@ function ($exception) { /** * Create request for operation 'tokenPost' * - * @param map[string,string] $request (required) + * @param object $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function tokenPostRequest($request) + public function tokenPostRequest($request, string $contentType = self::contentTypes['tokenPost'][0]) { + // verify the required parameter 'request' is set if ($request === null || (is_array($request) && count($request) === 0)) { throw new \InvalidArgumentException( @@ -1095,6 +1220,7 @@ protected function tokenPostRequest($request) ); } + $resourcePath = '/oauth/token'; $formParams = []; $queryParams = []; @@ -1102,59 +1228,42 @@ protected function tokenPostRequest($request) $httpBody = ''; $multipart = false; + // header params if ($request !== null) { $headerParams['request'] = ObjectSerializer::toHeaderValue($request); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1175,10 +1284,11 @@ protected function tokenPostRequest($request) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/BrandApi.php b/src/lib/Api/BrandApi.php index a98d4ad..3138cde 100644 --- a/src/lib/Api/BrandApi.php +++ b/src/lib/Api/BrandApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'brandGet' => [ + 'application/json', + ], + 'brandGetWhiteLabels' => [ + 'application/json', + ], + 'brandReportGet' => [ + 'application/json', + ], + 'businessTemplatesGetBusinessTemplates' => [ + 'application/json', + ], + 'cancelBusinessCancel' => [ + '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 + 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; } /** @@ -93,20 +143,21 @@ public function getConfig() * Active Employees Report * * @param int $brand_id brand_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param string $request_email_addresses request_email_addresses (optional) + * @param bool $request_include_inactive_businesses request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBrandActiveEmployeeReportGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuActiveEmployeesModel[] + * @return \OpenAPI\Client\Model\AuActiveEmployeesModel[] */ - public function auBrandActiveEmployeeReportGet($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auBrandActiveEmployeeReportGet($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auBrandActiveEmployeeReportGet'][0]) { - list($response) = $this->auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -116,21 +167,21 @@ public function auBrandActiveEmployeeReportGet($brand_id, $request_email_address * Active Employees Report * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBrandActiveEmployeeReportGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuActiveEmployeesModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuActiveEmployeesModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auBrandActiveEmployeeReportGet'][0]) { - $returnType = '\Swagger\Client\Model\AuActiveEmployeesModel[]'; - $request = $this->auBrandActiveEmployeeReportGetRequest($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auBrandActiveEmployeeReportGetRequest($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -139,9 +190,16 @@ public function auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -152,19 +210,37 @@ public function auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuActiveEmployeesModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuActiveEmployeesModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuActiveEmployeesModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuActiveEmployeesModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -181,7 +257,7 @@ public function auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_e case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuActiveEmployeesModel[]', + '\OpenAPI\Client\Model\AuActiveEmployeesModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -197,19 +273,20 @@ public function auBrandActiveEmployeeReportGetWithHttpInfo($brand_id, $request_e * Active Employees Report * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBrandActiveEmployeeReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBrandActiveEmployeeReportGetAsync($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auBrandActiveEmployeeReportGetAsync($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auBrandActiveEmployeeReportGet'][0]) { - return $this->auBrandActiveEmployeeReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auBrandActiveEmployeeReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -223,30 +300,30 @@ function ($response) { * Active Employees Report * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBrandActiveEmployeeReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBrandActiveEmployeeReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auBrandActiveEmployeeReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auBrandActiveEmployeeReportGet'][0]) { - $returnType = '\Swagger\Client\Model\AuActiveEmployeesModel[]'; - $request = $this->auBrandActiveEmployeeReportGetRequest($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuActiveEmployeesModel[]'; + $request = $this->auBrandActiveEmployeeReportGetRequest($brand_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -269,7 +346,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -279,18 +356,20 @@ function ($exception) { * Create request for operation 'auBrandActiveEmployeeReportGet' * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBrandActiveEmployeeReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBrandActiveEmployeeReportGetRequest($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auBrandActiveEmployeeReportGetRequest($brand_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auBrandActiveEmployeeReportGet'][0]) { + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -298,6 +377,13 @@ protected function auBrandActiveEmployeeReportGetRequest($brand_id, $request_ema ); } + + + + + + + $resourcePath = '/api/v2/brand/{brandId}/reports/activeemployees'; $formParams = []; $queryParams = []; @@ -306,29 +392,60 @@ protected function auBrandActiveEmployeeReportGetRequest($brand_id, $request_ema $multipart = false; // query params - if ($request_email_addresses !== null) { - $queryParams['request.emailAddresses'] = ObjectSerializer::toQueryValue($request_email_addresses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_email_addresses, + 'request.emailAddresses', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_include_inactive_businesses !== null) { - $queryParams['request.includeInactiveBusinesses'] = ObjectSerializer::toQueryValue($request_include_inactive_businesses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_inactive_businesses, + 'request.includeInactiveBusinesses', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($brand_id !== null) { @@ -339,53 +456,35 @@ protected function auBrandActiveEmployeeReportGetRequest($brand_id, $request_ema ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -406,10 +505,11 @@ protected function auBrandActiveEmployeeReportGetRequest($brand_id, $request_ema $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -421,14 +521,15 @@ protected function auBrandActiveEmployeeReportGetRequest($brand_id, $request_ema * Get Brand Label by ID * * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BrandModel + * @return \OpenAPI\Client\Model\BrandModel */ - public function brandGet($id) + public function brandGet($id, string $contentType = self::contentTypes['brandGet'][0]) { - list($response) = $this->brandGetWithHttpInfo($id); + list($response) = $this->brandGetWithHttpInfo($id, $contentType); return $response; } @@ -438,15 +539,15 @@ public function brandGet($id) * Get Brand Label by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BrandModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BrandModel, HTTP status code, HTTP response headers (array of strings) */ - public function brandGetWithHttpInfo($id) + public function brandGetWithHttpInfo($id, string $contentType = self::contentTypes['brandGet'][0]) { - $returnType = '\Swagger\Client\Model\BrandModel'; - $request = $this->brandGetRequest($id); + $request = $this->brandGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -455,9 +556,16 @@ public function brandGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -468,19 +576,37 @@ public function brandGetWithHttpInfo($id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BrandModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BrandModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BrandModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BrandModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -497,7 +623,7 @@ public function brandGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BrandModel', + '\OpenAPI\Client\Model\BrandModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -513,13 +639,14 @@ public function brandGetWithHttpInfo($id) * Get Brand Label by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function brandGetAsync($id) + public function brandGetAsync($id, string $contentType = self::contentTypes['brandGet'][0]) { - return $this->brandGetAsyncWithHttpInfo($id) + return $this->brandGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -533,24 +660,24 @@ function ($response) { * Get Brand Label by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function brandGetAsyncWithHttpInfo($id) + public function brandGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['brandGet'][0]) { - $returnType = '\Swagger\Client\Model\BrandModel'; - $request = $this->brandGetRequest($id); + $returnType = '\OpenAPI\Client\Model\BrandModel'; + $request = $this->brandGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -573,7 +700,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -583,12 +710,14 @@ function ($exception) { * Create request for operation 'brandGet' * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function brandGetRequest($id) + public function brandGetRequest($id, string $contentType = self::contentTypes['brandGet'][0]) { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( @@ -596,6 +725,7 @@ protected function brandGetRequest($id) ); } + $resourcePath = '/api/v2/brand/{id}'; $formParams = []; $queryParams = []; @@ -604,6 +734,7 @@ protected function brandGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -613,53 +744,35 @@ protected function brandGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -680,10 +793,11 @@ protected function brandGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -694,14 +808,15 @@ protected function brandGetRequest($id) * * List Brand Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGetWhiteLabels'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BrandModel[] + * @return \OpenAPI\Client\Model\BrandModel[] */ - public function brandGetWhiteLabels() + public function brandGetWhiteLabels(string $contentType = self::contentTypes['brandGetWhiteLabels'][0]) { - list($response) = $this->brandGetWhiteLabelsWithHttpInfo(); + list($response) = $this->brandGetWhiteLabelsWithHttpInfo($contentType); return $response; } @@ -710,15 +825,15 @@ public function brandGetWhiteLabels() * * List Brand Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGetWhiteLabels'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BrandModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BrandModel[], HTTP status code, HTTP response headers (array of strings) */ - public function brandGetWhiteLabelsWithHttpInfo() + public function brandGetWhiteLabelsWithHttpInfo(string $contentType = self::contentTypes['brandGetWhiteLabels'][0]) { - $returnType = '\Swagger\Client\Model\BrandModel[]'; - $request = $this->brandGetWhiteLabelsRequest(); + $request = $this->brandGetWhiteLabelsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -727,9 +842,16 @@ public function brandGetWhiteLabelsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -740,19 +862,37 @@ public function brandGetWhiteLabelsWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BrandModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BrandModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BrandModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BrandModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -769,7 +909,7 @@ public function brandGetWhiteLabelsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BrandModel[]', + '\OpenAPI\Client\Model\BrandModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -784,13 +924,14 @@ public function brandGetWhiteLabelsWithHttpInfo() * * List Brand Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGetWhiteLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function brandGetWhiteLabelsAsync() + public function brandGetWhiteLabelsAsync(string $contentType = self::contentTypes['brandGetWhiteLabels'][0]) { - return $this->brandGetWhiteLabelsAsyncWithHttpInfo() + return $this->brandGetWhiteLabelsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -803,24 +944,24 @@ function ($response) { * * List Brand Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGetWhiteLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function brandGetWhiteLabelsAsyncWithHttpInfo() + public function brandGetWhiteLabelsAsyncWithHttpInfo(string $contentType = self::contentTypes['brandGetWhiteLabels'][0]) { - $returnType = '\Swagger\Client\Model\BrandModel[]'; - $request = $this->brandGetWhiteLabelsRequest(); + $returnType = '\OpenAPI\Client\Model\BrandModel[]'; + $request = $this->brandGetWhiteLabelsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -843,7 +984,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -852,13 +993,15 @@ function ($exception) { /** * Create request for operation 'brandGetWhiteLabels' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandGetWhiteLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function brandGetWhiteLabelsRequest() + public function brandGetWhiteLabelsRequest(string $contentType = self::contentTypes['brandGetWhiteLabels'][0]) { + $resourcePath = '/api/v2/brand'; $formParams = []; $queryParams = []; @@ -868,53 +1011,36 @@ protected function brandGetWhiteLabelsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -935,10 +1061,11 @@ protected function brandGetWhiteLabelsRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -950,19 +1077,20 @@ protected function brandGetWhiteLabelsRequest() * Signup Report * * @param int $brand_id brand_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param string $request_email_addresses request_email_addresses (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandReportGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SignupModel[] + * @return \OpenAPI\Client\Model\SignupModel[] */ - public function brandReportGet($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function brandReportGet($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['brandReportGet'][0]) { - list($response) = $this->brandReportGetWithHttpInfo($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->brandReportGetWithHttpInfo($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -972,20 +1100,20 @@ public function brandReportGet($brand_id, $request_email_addresses = null, $requ * Signup Report * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandReportGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SignupModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SignupModel[], HTTP status code, HTTP response headers (array of strings) */ - public function brandReportGetWithHttpInfo($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function brandReportGetWithHttpInfo($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['brandReportGet'][0]) { - $returnType = '\Swagger\Client\Model\SignupModel[]'; - $request = $this->brandReportGetRequest($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->brandReportGetRequest($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -994,9 +1122,16 @@ public function brandReportGetWithHttpInfo($brand_id, $request_email_addresses = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1007,19 +1142,37 @@ public function brandReportGetWithHttpInfo($brand_id, $request_email_addresses = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SignupModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SignupModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SignupModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SignupModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1036,7 +1189,7 @@ public function brandReportGetWithHttpInfo($brand_id, $request_email_addresses = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SignupModel[]', + '\OpenAPI\Client\Model\SignupModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1052,18 +1205,19 @@ public function brandReportGetWithHttpInfo($brand_id, $request_email_addresses = * Signup Report * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function brandReportGetAsync($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function brandReportGetAsync($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['brandReportGet'][0]) { - return $this->brandReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->brandReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1077,29 +1231,29 @@ function ($response) { * Signup Report * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function brandReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function brandReportGetAsyncWithHttpInfo($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['brandReportGet'][0]) { - $returnType = '\Swagger\Client\Model\SignupModel[]'; - $request = $this->brandReportGetRequest($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\SignupModel[]'; + $request = $this->brandReportGetRequest($brand_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1122,7 +1276,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1132,17 +1286,19 @@ function ($exception) { * Create request for operation 'brandReportGet' * * @param int $brand_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['brandReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function brandReportGetRequest($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function brandReportGetRequest($brand_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['brandReportGet'][0]) { + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -1150,6 +1306,12 @@ protected function brandReportGetRequest($brand_id, $request_email_addresses = n ); } + + + + + + $resourcePath = '/api/v2/brand/{brandId}/reports/signups'; $formParams = []; $queryParams = []; @@ -1158,25 +1320,51 @@ protected function brandReportGetRequest($brand_id, $request_email_addresses = n $multipart = false; // query params - if ($request_email_addresses !== null) { - $queryParams['request.emailAddresses'] = ObjectSerializer::toQueryValue($request_email_addresses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_email_addresses, + 'request.emailAddresses', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($brand_id !== null) { @@ -1187,53 +1375,35 @@ protected function brandReportGetRequest($brand_id, $request_email_addresses = n ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1254,10 +1424,11 @@ protected function brandReportGetRequest($brand_id, $request_email_addresses = n $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1269,14 +1440,15 @@ protected function brandReportGetRequest($brand_id, $request_email_addresses = n * List Business Templates * * @param string $brand_id brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTemplatesGetBusinessTemplates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessTemplateModel[] + * @return \OpenAPI\Client\Model\BusinessTemplateModel[] */ - public function businessTemplatesGetBusinessTemplates($brand_id) + public function businessTemplatesGetBusinessTemplates($brand_id, string $contentType = self::contentTypes['businessTemplatesGetBusinessTemplates'][0]) { - list($response) = $this->businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id); + list($response) = $this->businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id, $contentType); return $response; } @@ -1286,15 +1458,15 @@ public function businessTemplatesGetBusinessTemplates($brand_id) * List Business Templates * * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTemplatesGetBusinessTemplates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessTemplateModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessTemplateModel[], HTTP status code, HTTP response headers (array of strings) */ - public function businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id) + public function businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id, string $contentType = self::contentTypes['businessTemplatesGetBusinessTemplates'][0]) { - $returnType = '\Swagger\Client\Model\BusinessTemplateModel[]'; - $request = $this->businessTemplatesGetBusinessTemplatesRequest($brand_id); + $request = $this->businessTemplatesGetBusinessTemplatesRequest($brand_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1303,9 +1475,16 @@ public function businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1316,19 +1495,37 @@ public function businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessTemplateModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessTemplateModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessTemplateModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessTemplateModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1345,7 +1542,7 @@ public function businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessTemplateModel[]', + '\OpenAPI\Client\Model\BusinessTemplateModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1361,13 +1558,14 @@ public function businessTemplatesGetBusinessTemplatesWithHttpInfo($brand_id) * List Business Templates * * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTemplatesGetBusinessTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessTemplatesGetBusinessTemplatesAsync($brand_id) + public function businessTemplatesGetBusinessTemplatesAsync($brand_id, string $contentType = self::contentTypes['businessTemplatesGetBusinessTemplates'][0]) { - return $this->businessTemplatesGetBusinessTemplatesAsyncWithHttpInfo($brand_id) + return $this->businessTemplatesGetBusinessTemplatesAsyncWithHttpInfo($brand_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1381,24 +1579,24 @@ function ($response) { * List Business Templates * * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTemplatesGetBusinessTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessTemplatesGetBusinessTemplatesAsyncWithHttpInfo($brand_id) + public function businessTemplatesGetBusinessTemplatesAsyncWithHttpInfo($brand_id, string $contentType = self::contentTypes['businessTemplatesGetBusinessTemplates'][0]) { - $returnType = '\Swagger\Client\Model\BusinessTemplateModel[]'; - $request = $this->businessTemplatesGetBusinessTemplatesRequest($brand_id); + $returnType = '\OpenAPI\Client\Model\BusinessTemplateModel[]'; + $request = $this->businessTemplatesGetBusinessTemplatesRequest($brand_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1421,7 +1619,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1431,12 +1629,14 @@ function ($exception) { * Create request for operation 'businessTemplatesGetBusinessTemplates' * * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTemplatesGetBusinessTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessTemplatesGetBusinessTemplatesRequest($brand_id) + public function businessTemplatesGetBusinessTemplatesRequest($brand_id, string $contentType = self::contentTypes['businessTemplatesGetBusinessTemplates'][0]) { + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -1444,6 +1644,7 @@ protected function businessTemplatesGetBusinessTemplatesRequest($brand_id) ); } + $resourcePath = '/api/v2/brand/{brandId}/business-templates'; $formParams = []; $queryParams = []; @@ -1452,6 +1653,7 @@ protected function businessTemplatesGetBusinessTemplatesRequest($brand_id) $multipart = false; + // path params if ($brand_id !== null) { $resourcePath = str_replace( @@ -1461,53 +1663,35 @@ protected function businessTemplatesGetBusinessTemplatesRequest($brand_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1528,10 +1712,11 @@ protected function businessTemplatesGetBusinessTemplatesRequest($brand_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1544,14 +1729,15 @@ protected function businessTemplatesGetBusinessTemplatesRequest($brand_id) * * @param int $business_id business_id (required) * @param string $brand_id brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelBusinessCancel'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function cancelBusinessCancel($business_id, $brand_id) + public function cancelBusinessCancel($business_id, $brand_id, string $contentType = self::contentTypes['cancelBusinessCancel'][0]) { - $this->cancelBusinessCancelWithHttpInfo($business_id, $brand_id); + $this->cancelBusinessCancelWithHttpInfo($business_id, $brand_id, $contentType); } /** @@ -1561,15 +1747,15 @@ public function cancelBusinessCancel($business_id, $brand_id) * * @param int $business_id (required) * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelBusinessCancel'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function cancelBusinessCancelWithHttpInfo($business_id, $brand_id) + public function cancelBusinessCancelWithHttpInfo($business_id, $brand_id, string $contentType = self::contentTypes['cancelBusinessCancel'][0]) { - $returnType = ''; - $request = $this->cancelBusinessCancelRequest($business_id, $brand_id); + $request = $this->cancelBusinessCancelRequest($business_id, $brand_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1578,9 +1764,16 @@ public function cancelBusinessCancelWithHttpInfo($business_id, $brand_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1591,11 +1784,11 @@ public function cancelBusinessCancelWithHttpInfo($business_id, $brand_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1615,13 +1808,14 @@ public function cancelBusinessCancelWithHttpInfo($business_id, $brand_id) * * @param int $business_id (required) * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelBusinessCancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelBusinessCancelAsync($business_id, $brand_id) + public function cancelBusinessCancelAsync($business_id, $brand_id, string $contentType = self::contentTypes['cancelBusinessCancel'][0]) { - return $this->cancelBusinessCancelAsyncWithHttpInfo($business_id, $brand_id) + return $this->cancelBusinessCancelAsyncWithHttpInfo($business_id, $brand_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1636,14 +1830,15 @@ function ($response) { * * @param int $business_id (required) * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelBusinessCancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelBusinessCancelAsyncWithHttpInfo($business_id, $brand_id) + public function cancelBusinessCancelAsyncWithHttpInfo($business_id, $brand_id, string $contentType = self::contentTypes['cancelBusinessCancel'][0]) { $returnType = ''; - $request = $this->cancelBusinessCancelRequest($business_id, $brand_id); + $request = $this->cancelBusinessCancelRequest($business_id, $brand_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1662,7 +1857,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1673,18 +1868,21 @@ function ($exception) { * * @param int $business_id (required) * @param string $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelBusinessCancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function cancelBusinessCancelRequest($business_id, $brand_id) + public function cancelBusinessCancelRequest($business_id, $brand_id, string $contentType = self::contentTypes['cancelBusinessCancel'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling cancelBusinessCancel' ); } + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -1692,6 +1890,7 @@ protected function cancelBusinessCancelRequest($business_id, $brand_id) ); } + $resourcePath = '/api/v2/brand/{brandId}/business/{businessId}/cancel'; $formParams = []; $queryParams = []; @@ -1700,6 +1899,7 @@ protected function cancelBusinessCancelRequest($business_id, $brand_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1717,53 +1917,35 @@ protected function cancelBusinessCancelRequest($business_id, $brand_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1784,10 +1966,11 @@ protected function cancelBusinessCancelRequest($business_id, $brand_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/BusinessApi.php b/src/lib/Api/BusinessApi.php index 611a704..66ae5c4 100644 --- a/src/lib/Api/BusinessApi.php +++ b/src/lib/Api/BusinessApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'aTOPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'actionItemsDismiss' => [ + 'application/json', + ], + 'actionItemsGet' => [ + 'application/json', + ], + 'auBusinessCopyBusinessSettingsFromTemplate' => [ + 'application/json', + ], + 'auBusinessGetBusiness' => [ + 'application/json', + ], + 'auBusinessGetBusinessByExternalId' => [ + 'application/json', + ], + 'auBusinessGetBusinesses' => [ + 'application/json', + ], + 'auBusinessPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auBusinessTimesheetSettingsGet' => [ + 'application/json', + ], + 'auBusinessTimesheetSettingsPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeePortalSettingsGet' => [ + 'application/json', + ], + 'auEmployeePortalSettingsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPaySlipGet' => [ + 'application/json', + ], + 'auPaySlipPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auStpRegistrationGet' => [ + 'application/json', + ], + 'auStpRegistrationPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auSubscriptionGetCurrentBillingPlan' => [ + 'application/json', + ], + 'auSubscriptionListBillingPlans' => [ + 'application/json', + ], + 'auSubscriptionSetBillingPlan' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'businessAccessDelete' => [ + 'application/json', + ], + 'businessAccessGet' => [ + 'application/json', + ], + 'businessAccessGetAll' => [ + 'application/json', + ], + 'businessAccessPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'businessAccessPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'businessChangeTaxYearChangeFinancialYear' => [ + 'application/json', + ], + 'businessTagsGet' => [ + 'application/json', + ], + 'documentContent' => [ + 'application/json', + ], + 'documentDelete' => [ + 'application/json', + ], + 'documentGet' => [ + 'application/json', + ], + 'documentGetApiV2BusinessByBusinessIdDocumentById' => [ + 'application/json', + ], + 'documentPost' => [ + 'application/json', + ], + 'documentPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'entitlementsGetEntitlements' => [ + 'application/json', + ], + 'roundingRulesGetRoundingRules' => [ + 'application/json', + ], + 'roundingRulesSetRoundingRules' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -93,14 +277,15 @@ public function getConfig() * Get ATO Details * * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAtoSupplierModel + * @return \OpenAPI\Client\Model\BusinessAtoSupplierModel */ - public function aTOGet($business_id) + public function aTOGet($business_id, string $contentType = self::contentTypes['aTOGet'][0]) { - list($response) = $this->aTOGetWithHttpInfo($business_id); + list($response) = $this->aTOGetWithHttpInfo($business_id, $contentType); return $response; } @@ -110,15 +295,15 @@ public function aTOGet($business_id) * Get ATO Details * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAtoSupplierModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAtoSupplierModel, HTTP status code, HTTP response headers (array of strings) */ - public function aTOGetWithHttpInfo($business_id) + public function aTOGetWithHttpInfo($business_id, string $contentType = self::contentTypes['aTOGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAtoSupplierModel'; - $request = $this->aTOGetRequest($business_id); + $request = $this->aTOGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,9 +312,16 @@ public function aTOGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -140,19 +332,37 @@ public function aTOGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAtoSupplierModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAtoSupplierModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAtoSupplierModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAtoSupplierModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -169,7 +379,7 @@ public function aTOGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAtoSupplierModel', + '\OpenAPI\Client\Model\BusinessAtoSupplierModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -185,13 +395,14 @@ public function aTOGetWithHttpInfo($business_id) * Get ATO Details * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function aTOGetAsync($business_id) + public function aTOGetAsync($business_id, string $contentType = self::contentTypes['aTOGet'][0]) { - return $this->aTOGetAsyncWithHttpInfo($business_id) + return $this->aTOGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -205,24 +416,24 @@ function ($response) { * Get ATO Details * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function aTOGetAsyncWithHttpInfo($business_id) + public function aTOGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['aTOGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAtoSupplierModel'; - $request = $this->aTOGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\BusinessAtoSupplierModel'; + $request = $this->aTOGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -245,7 +456,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -255,12 +466,14 @@ function ($exception) { * Create request for operation 'aTOGet' * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function aTOGetRequest($business_id) + public function aTOGetRequest($business_id, string $contentType = self::contentTypes['aTOGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -268,6 +481,7 @@ protected function aTOGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/ato'; $formParams = []; $queryParams = []; @@ -276,6 +490,7 @@ protected function aTOGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -285,53 +500,35 @@ protected function aTOGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -352,10 +549,11 @@ protected function aTOGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -366,16 +564,17 @@ protected function aTOGetRequest($business_id) * * Set ATO Details * - * @param \Swagger\Client\Model\BusinessAtoSupplierModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\BusinessAtoSupplierModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAtoSupplierModel + * @return \OpenAPI\Client\Model\BusinessAtoSupplierModel */ - public function aTOPost($model, $business_id) + public function aTOPost($business_id, $model, string $contentType = self::contentTypes['aTOPost'][0]) { - list($response) = $this->aTOPostWithHttpInfo($model, $business_id); + list($response) = $this->aTOPostWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -384,17 +583,17 @@ public function aTOPost($model, $business_id) * * Set ATO Details * - * @param \Swagger\Client\Model\BusinessAtoSupplierModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAtoSupplierModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAtoSupplierModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAtoSupplierModel, HTTP status code, HTTP response headers (array of strings) */ - public function aTOPostWithHttpInfo($model, $business_id) + public function aTOPostWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['aTOPost'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAtoSupplierModel'; - $request = $this->aTOPostRequest($model, $business_id); + $request = $this->aTOPostRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -403,9 +602,16 @@ public function aTOPostWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -416,19 +622,37 @@ public function aTOPostWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAtoSupplierModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAtoSupplierModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAtoSupplierModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAtoSupplierModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -445,7 +669,7 @@ public function aTOPostWithHttpInfo($model, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAtoSupplierModel', + '\OpenAPI\Client\Model\BusinessAtoSupplierModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -460,15 +684,16 @@ public function aTOPostWithHttpInfo($model, $business_id) * * Set ATO Details * - * @param \Swagger\Client\Model\BusinessAtoSupplierModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAtoSupplierModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function aTOPostAsync($model, $business_id) + public function aTOPostAsync($business_id, $model, string $contentType = self::contentTypes['aTOPost'][0]) { - return $this->aTOPostAsyncWithHttpInfo($model, $business_id) + return $this->aTOPostAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -481,26 +706,26 @@ function ($response) { * * Set ATO Details * - * @param \Swagger\Client\Model\BusinessAtoSupplierModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAtoSupplierModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function aTOPostAsyncWithHttpInfo($model, $business_id) + public function aTOPostAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['aTOPost'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAtoSupplierModel'; - $request = $this->aTOPostRequest($model, $business_id); + $returnType = '\OpenAPI\Client\Model\BusinessAtoSupplierModel'; + $request = $this->aTOPostRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -523,7 +748,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -532,20 +757,16 @@ function ($exception) { /** * Create request for operation 'aTOPost' * - * @param \Swagger\Client\Model\BusinessAtoSupplierModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BusinessAtoSupplierModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['aTOPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function aTOPostRequest($model, $business_id) + public function aTOPostRequest($business_id, $model, string $contentType = self::contentTypes['aTOPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling aTOPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -553,6 +774,14 @@ protected function aTOPostRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling aTOPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/ato'; $formParams = []; $queryParams = []; @@ -561,6 +790,7 @@ protected function aTOPostRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -570,56 +800,42 @@ protected function aTOPostRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -640,10 +856,11 @@ protected function aTOPostRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -656,14 +873,15 @@ protected function aTOPostRequest($model, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsDismiss'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function actionItemsDismiss($id, $business_id) + public function actionItemsDismiss($id, $business_id, string $contentType = self::contentTypes['actionItemsDismiss'][0]) { - $this->actionItemsDismissWithHttpInfo($id, $business_id); + $this->actionItemsDismissWithHttpInfo($id, $business_id, $contentType); } /** @@ -673,15 +891,15 @@ public function actionItemsDismiss($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsDismiss'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function actionItemsDismissWithHttpInfo($id, $business_id) + public function actionItemsDismissWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['actionItemsDismiss'][0]) { - $returnType = ''; - $request = $this->actionItemsDismissRequest($id, $business_id); + $request = $this->actionItemsDismissRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -690,9 +908,16 @@ public function actionItemsDismissWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -703,11 +928,11 @@ public function actionItemsDismissWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -727,13 +952,14 @@ public function actionItemsDismissWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsDismiss'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function actionItemsDismissAsync($id, $business_id) + public function actionItemsDismissAsync($id, $business_id, string $contentType = self::contentTypes['actionItemsDismiss'][0]) { - return $this->actionItemsDismissAsyncWithHttpInfo($id, $business_id) + return $this->actionItemsDismissAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -748,14 +974,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsDismiss'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function actionItemsDismissAsyncWithHttpInfo($id, $business_id) + public function actionItemsDismissAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['actionItemsDismiss'][0]) { $returnType = ''; - $request = $this->actionItemsDismissRequest($id, $business_id); + $request = $this->actionItemsDismissRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -774,7 +1001,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -785,18 +1012,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsDismiss'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function actionItemsDismissRequest($id, $business_id) + public function actionItemsDismissRequest($id, $business_id, string $contentType = self::contentTypes['actionItemsDismiss'][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 actionItemsDismiss' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -804,6 +1034,7 @@ protected function actionItemsDismissRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/actionitems/businessnotifications/{id}/dismiss'; $formParams = []; $queryParams = []; @@ -812,6 +1043,7 @@ protected function actionItemsDismissRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -829,53 +1061,35 @@ protected function actionItemsDismissRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -896,10 +1110,11 @@ protected function actionItemsDismissRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -911,14 +1126,15 @@ protected function actionItemsDismissRequest($id, $business_id) * List Business Notifications * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAction[] + * @return \OpenAPI\Client\Model\BusinessAction[] */ - public function actionItemsGet($business_id) + public function actionItemsGet($business_id, string $contentType = self::contentTypes['actionItemsGet'][0]) { - list($response) = $this->actionItemsGetWithHttpInfo($business_id); + list($response) = $this->actionItemsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -928,15 +1144,15 @@ public function actionItemsGet($business_id) * List Business Notifications * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAction[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAction[], HTTP status code, HTTP response headers (array of strings) */ - public function actionItemsGetWithHttpInfo($business_id) + public function actionItemsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['actionItemsGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAction[]'; - $request = $this->actionItemsGetRequest($business_id); + $request = $this->actionItemsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -945,9 +1161,16 @@ public function actionItemsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -958,19 +1181,37 @@ public function actionItemsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAction[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAction[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAction[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAction[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -987,7 +1228,7 @@ public function actionItemsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAction[]', + '\OpenAPI\Client\Model\BusinessAction[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1003,13 +1244,14 @@ public function actionItemsGetWithHttpInfo($business_id) * List Business Notifications * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function actionItemsGetAsync($business_id) + public function actionItemsGetAsync($business_id, string $contentType = self::contentTypes['actionItemsGet'][0]) { - return $this->actionItemsGetAsyncWithHttpInfo($business_id) + return $this->actionItemsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1023,24 +1265,24 @@ function ($response) { * List Business Notifications * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function actionItemsGetAsyncWithHttpInfo($business_id) + public function actionItemsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['actionItemsGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAction[]'; - $request = $this->actionItemsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\BusinessAction[]'; + $request = $this->actionItemsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1063,7 +1305,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1073,12 +1315,14 @@ function ($exception) { * Create request for operation 'actionItemsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['actionItemsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function actionItemsGetRequest($business_id) + public function actionItemsGetRequest($business_id, string $contentType = self::contentTypes['actionItemsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1086,6 +1330,7 @@ protected function actionItemsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/actionitems/businessnotifications'; $formParams = []; $queryParams = []; @@ -1094,6 +1339,7 @@ protected function actionItemsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1103,53 +1349,35 @@ protected function actionItemsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1170,10 +1398,11 @@ protected function actionItemsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1186,14 +1415,15 @@ protected function actionItemsGetRequest($business_id) * * @param int $business_id business_id (required) * @param int $business_template_id business_template_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auBusinessCopyBusinessSettingsFromTemplate($business_id, $business_template_id) + public function auBusinessCopyBusinessSettingsFromTemplate($business_id, $business_template_id, string $contentType = self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'][0]) { - $this->auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business_id, $business_template_id); + $this->auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business_id, $business_template_id, $contentType); } /** @@ -1203,15 +1433,15 @@ public function auBusinessCopyBusinessSettingsFromTemplate($business_id, $busine * * @param int $business_id (required) * @param int $business_template_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business_id, $business_template_id) + public function auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business_id, $business_template_id, string $contentType = self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'][0]) { - $returnType = ''; - $request = $this->auBusinessCopyBusinessSettingsFromTemplateRequest($business_id, $business_template_id); + $request = $this->auBusinessCopyBusinessSettingsFromTemplateRequest($business_id, $business_template_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1220,9 +1450,16 @@ public function auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1233,11 +1470,11 @@ public function auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1257,13 +1494,14 @@ public function auBusinessCopyBusinessSettingsFromTemplateWithHttpInfo($business * * @param int $business_id (required) * @param int $business_template_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessCopyBusinessSettingsFromTemplateAsync($business_id, $business_template_id) + public function auBusinessCopyBusinessSettingsFromTemplateAsync($business_id, $business_template_id, string $contentType = self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'][0]) { - return $this->auBusinessCopyBusinessSettingsFromTemplateAsyncWithHttpInfo($business_id, $business_template_id) + return $this->auBusinessCopyBusinessSettingsFromTemplateAsyncWithHttpInfo($business_id, $business_template_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1278,14 +1516,15 @@ function ($response) { * * @param int $business_id (required) * @param int $business_template_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessCopyBusinessSettingsFromTemplateAsyncWithHttpInfo($business_id, $business_template_id) + public function auBusinessCopyBusinessSettingsFromTemplateAsyncWithHttpInfo($business_id, $business_template_id, string $contentType = self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'][0]) { $returnType = ''; - $request = $this->auBusinessCopyBusinessSettingsFromTemplateRequest($business_id, $business_template_id); + $request = $this->auBusinessCopyBusinessSettingsFromTemplateRequest($business_id, $business_template_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1304,7 +1543,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1315,18 +1554,21 @@ function ($exception) { * * @param int $business_id (required) * @param int $business_template_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessCopyBusinessSettingsFromTemplateRequest($business_id, $business_template_id) + public function auBusinessCopyBusinessSettingsFromTemplateRequest($business_id, $business_template_id, string $contentType = self::contentTypes['auBusinessCopyBusinessSettingsFromTemplate'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auBusinessCopyBusinessSettingsFromTemplate' ); } + // verify the required parameter 'business_template_id' is set if ($business_template_id === null || (is_array($business_template_id) && count($business_template_id) === 0)) { throw new \InvalidArgumentException( @@ -1334,6 +1576,7 @@ protected function auBusinessCopyBusinessSettingsFromTemplateRequest($business_i ); } + $resourcePath = '/api/v2/business/{businessId}/{businessTemplateId}'; $formParams = []; $queryParams = []; @@ -1342,6 +1585,7 @@ protected function auBusinessCopyBusinessSettingsFromTemplateRequest($business_i $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1359,53 +1603,35 @@ protected function auBusinessCopyBusinessSettingsFromTemplateRequest($business_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1426,10 +1652,11 @@ protected function auBusinessCopyBusinessSettingsFromTemplateRequest($business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1441,14 +1668,15 @@ protected function auBusinessCopyBusinessSettingsFromTemplateRequest($business_i * Get Business Details * * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusiness'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBusinessExportModel + * @return \OpenAPI\Client\Model\AuBusinessExportModel */ - public function auBusinessGetBusiness($business_id) + public function auBusinessGetBusiness($business_id, string $contentType = self::contentTypes['auBusinessGetBusiness'][0]) { - list($response) = $this->auBusinessGetBusinessWithHttpInfo($business_id); + list($response) = $this->auBusinessGetBusinessWithHttpInfo($business_id, $contentType); return $response; } @@ -1458,15 +1686,15 @@ public function auBusinessGetBusiness($business_id) * Get Business Details * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusiness'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBusinessExportModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBusinessExportModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessGetBusinessWithHttpInfo($business_id) + public function auBusinessGetBusinessWithHttpInfo($business_id, string $contentType = self::contentTypes['auBusinessGetBusiness'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel'; - $request = $this->auBusinessGetBusinessRequest($business_id); + $request = $this->auBusinessGetBusinessRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1475,9 +1703,16 @@ public function auBusinessGetBusinessWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1488,19 +1723,37 @@ public function auBusinessGetBusinessWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBusinessExportModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBusinessExportModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBusinessExportModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1517,7 +1770,7 @@ public function auBusinessGetBusinessWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBusinessExportModel', + '\OpenAPI\Client\Model\AuBusinessExportModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1533,13 +1786,14 @@ public function auBusinessGetBusinessWithHttpInfo($business_id) * Get Business Details * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusiness'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessGetBusinessAsync($business_id) + public function auBusinessGetBusinessAsync($business_id, string $contentType = self::contentTypes['auBusinessGetBusiness'][0]) { - return $this->auBusinessGetBusinessAsyncWithHttpInfo($business_id) + return $this->auBusinessGetBusinessAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1553,24 +1807,24 @@ function ($response) { * Get Business Details * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusiness'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessGetBusinessAsyncWithHttpInfo($business_id) + public function auBusinessGetBusinessAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auBusinessGetBusiness'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel'; - $request = $this->auBusinessGetBusinessRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel'; + $request = $this->auBusinessGetBusinessRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1593,7 +1847,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1603,12 +1857,14 @@ function ($exception) { * Create request for operation 'auBusinessGetBusiness' * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusiness'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessGetBusinessRequest($business_id) + public function auBusinessGetBusinessRequest($business_id, string $contentType = self::contentTypes['auBusinessGetBusiness'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1616,6 +1872,7 @@ protected function auBusinessGetBusinessRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}'; $formParams = []; $queryParams = []; @@ -1624,6 +1881,7 @@ protected function auBusinessGetBusinessRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1633,53 +1891,35 @@ protected function auBusinessGetBusinessRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1700,10 +1940,11 @@ protected function auBusinessGetBusinessRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1715,14 +1956,15 @@ protected function auBusinessGetBusinessRequest($business_id) * Get Business Details by External ID * * @param string $external_id external_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinessByExternalId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBusinessExportModel + * @return \OpenAPI\Client\Model\AuBusinessExportModel */ - public function auBusinessGetBusinessByExternalId($external_id) + public function auBusinessGetBusinessByExternalId($external_id, string $contentType = self::contentTypes['auBusinessGetBusinessByExternalId'][0]) { - list($response) = $this->auBusinessGetBusinessByExternalIdWithHttpInfo($external_id); + list($response) = $this->auBusinessGetBusinessByExternalIdWithHttpInfo($external_id, $contentType); return $response; } @@ -1732,15 +1974,15 @@ public function auBusinessGetBusinessByExternalId($external_id) * Get Business Details by External ID * * @param string $external_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinessByExternalId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBusinessExportModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBusinessExportModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessGetBusinessByExternalIdWithHttpInfo($external_id) + public function auBusinessGetBusinessByExternalIdWithHttpInfo($external_id, string $contentType = self::contentTypes['auBusinessGetBusinessByExternalId'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel'; - $request = $this->auBusinessGetBusinessByExternalIdRequest($external_id); + $request = $this->auBusinessGetBusinessByExternalIdRequest($external_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1749,9 +1991,16 @@ public function auBusinessGetBusinessByExternalIdWithHttpInfo($external_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1762,19 +2011,37 @@ public function auBusinessGetBusinessByExternalIdWithHttpInfo($external_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBusinessExportModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBusinessExportModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBusinessExportModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1791,7 +2058,7 @@ public function auBusinessGetBusinessByExternalIdWithHttpInfo($external_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBusinessExportModel', + '\OpenAPI\Client\Model\AuBusinessExportModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1807,13 +2074,14 @@ public function auBusinessGetBusinessByExternalIdWithHttpInfo($external_id) * Get Business Details by External ID * * @param string $external_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinessByExternalId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessGetBusinessByExternalIdAsync($external_id) + public function auBusinessGetBusinessByExternalIdAsync($external_id, string $contentType = self::contentTypes['auBusinessGetBusinessByExternalId'][0]) { - return $this->auBusinessGetBusinessByExternalIdAsyncWithHttpInfo($external_id) + return $this->auBusinessGetBusinessByExternalIdAsyncWithHttpInfo($external_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1827,24 +2095,24 @@ function ($response) { * Get Business Details by External ID * * @param string $external_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinessByExternalId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessGetBusinessByExternalIdAsyncWithHttpInfo($external_id) + public function auBusinessGetBusinessByExternalIdAsyncWithHttpInfo($external_id, string $contentType = self::contentTypes['auBusinessGetBusinessByExternalId'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel'; - $request = $this->auBusinessGetBusinessByExternalIdRequest($external_id); + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel'; + $request = $this->auBusinessGetBusinessByExternalIdRequest($external_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1867,7 +2135,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1877,12 +2145,14 @@ function ($exception) { * Create request for operation 'auBusinessGetBusinessByExternalId' * * @param string $external_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinessByExternalId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessGetBusinessByExternalIdRequest($external_id) + public function auBusinessGetBusinessByExternalIdRequest($external_id, string $contentType = self::contentTypes['auBusinessGetBusinessByExternalId'][0]) { + // verify the required parameter 'external_id' is set if ($external_id === null || (is_array($external_id) && count($external_id) === 0)) { throw new \InvalidArgumentException( @@ -1890,6 +2160,7 @@ protected function auBusinessGetBusinessByExternalIdRequest($external_id) ); } + $resourcePath = '/api/v2/business/externalid'; $formParams = []; $queryParams = []; @@ -1898,58 +2169,46 @@ protected function auBusinessGetBusinessByExternalIdRequest($external_id) $multipart = false; // query params - if ($external_id !== null) { - $queryParams['externalId'] = ObjectSerializer::toQueryValue($external_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_id, + 'externalId', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1970,10 +2229,11 @@ protected function auBusinessGetBusinessByExternalIdRequest($external_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1988,14 +2248,16 @@ protected function auBusinessGetBusinessByExternalIdRequest($external_id) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param mixed $query query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinesses'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBusinessExportModel[] + * @return \OpenAPI\Client\Model\AuBusinessExportModel[] */ - public function auBusinessGetBusinesses($filter = null, $orderby = null, $top = null, $skip = null) + public function auBusinessGetBusinesses($filter = null, $orderby = null, $top = null, $skip = null, $query = null, string $contentType = self::contentTypes['auBusinessGetBusinesses'][0]) { - list($response) = $this->auBusinessGetBusinessesWithHttpInfo($filter, $orderby, $top, $skip); + list($response) = $this->auBusinessGetBusinessesWithHttpInfo($filter, $orderby, $top, $skip, $query, $contentType); return $response; } @@ -2008,15 +2270,16 @@ public function auBusinessGetBusinesses($filter = null, $orderby = null, $top = * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param mixed $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinesses'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBusinessExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBusinessExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessGetBusinessesWithHttpInfo($filter = null, $orderby = null, $top = null, $skip = null) + public function auBusinessGetBusinessesWithHttpInfo($filter = null, $orderby = null, $top = null, $skip = null, $query = null, string $contentType = self::contentTypes['auBusinessGetBusinesses'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel[]'; - $request = $this->auBusinessGetBusinessesRequest($filter, $orderby, $top, $skip); + $request = $this->auBusinessGetBusinessesRequest($filter, $orderby, $top, $skip, $query, $contentType); try { $options = $this->createHttpClientOption(); @@ -2025,9 +2288,16 @@ public function auBusinessGetBusinessesWithHttpInfo($filter = null, $orderby = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2038,19 +2308,37 @@ public function auBusinessGetBusinessesWithHttpInfo($filter = null, $orderby = n sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBusinessExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBusinessExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBusinessExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2067,7 +2355,7 @@ public function auBusinessGetBusinessesWithHttpInfo($filter = null, $orderby = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBusinessExportModel[]', + '\OpenAPI\Client\Model\AuBusinessExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2086,13 +2374,15 @@ public function auBusinessGetBusinessesWithHttpInfo($filter = null, $orderby = n * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param mixed $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinesses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessGetBusinessesAsync($filter = null, $orderby = null, $top = null, $skip = null) + public function auBusinessGetBusinessesAsync($filter = null, $orderby = null, $top = null, $skip = null, $query = null, string $contentType = self::contentTypes['auBusinessGetBusinesses'][0]) { - return $this->auBusinessGetBusinessesAsyncWithHttpInfo($filter, $orderby, $top, $skip) + return $this->auBusinessGetBusinessesAsyncWithHttpInfo($filter, $orderby, $top, $skip, $query, $contentType) ->then( function ($response) { return $response[0]; @@ -2109,24 +2399,25 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param mixed $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinesses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessGetBusinessesAsyncWithHttpInfo($filter = null, $orderby = null, $top = null, $skip = null) + public function auBusinessGetBusinessesAsyncWithHttpInfo($filter = null, $orderby = null, $top = null, $skip = null, $query = null, string $contentType = self::contentTypes['auBusinessGetBusinesses'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel[]'; - $request = $this->auBusinessGetBusinessesRequest($filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel[]'; + $request = $this->auBusinessGetBusinessesRequest($filter, $orderby, $top, $skip, $query, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2149,7 +2440,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2162,13 +2453,21 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param mixed $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessGetBusinesses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessGetBusinessesRequest($filter = null, $orderby = null, $top = null, $skip = null) + public function auBusinessGetBusinessesRequest($filter = null, $orderby = null, $top = null, $skip = null, $query = null, string $contentType = self::contentTypes['auBusinessGetBusinesses'][0]) { + + + + + + $resourcePath = '/api/v2/business'; $formParams = []; $queryParams = []; @@ -2177,70 +2476,77 @@ protected function auBusinessGetBusinessesRequest($filter = null, $orderby = nul $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2261,10 +2567,11 @@ protected function auBusinessGetBusinessesRequest($filter = null, $orderby = nul $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2275,16 +2582,17 @@ protected function auBusinessGetBusinessesRequest($filter = null, $orderby = nul * * Create New Business * - * @param \Swagger\Client\Model\AuBusinessExportModel $model model (required) + * @param \OpenAPI\Client\Model\AuBusinessExportModel $model model (required) * @param bool $setup_default_data setup_default_data (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBusinessExportModel + * @return \OpenAPI\Client\Model\AuBusinessExportModel */ - public function auBusinessPost($model, $setup_default_data = 'true') + public function auBusinessPost($model, $setup_default_data = true, string $contentType = self::contentTypes['auBusinessPost'][0]) { - list($response) = $this->auBusinessPostWithHttpInfo($model, $setup_default_data); + list($response) = $this->auBusinessPostWithHttpInfo($model, $setup_default_data, $contentType); return $response; } @@ -2293,17 +2601,17 @@ public function auBusinessPost($model, $setup_default_data = 'true') * * Create New Business * - * @param \Swagger\Client\Model\AuBusinessExportModel $model (required) + * @param \OpenAPI\Client\Model\AuBusinessExportModel $model (required) * @param bool $setup_default_data (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBusinessExportModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBusinessExportModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessPostWithHttpInfo($model, $setup_default_data = 'true') + public function auBusinessPostWithHttpInfo($model, $setup_default_data = true, string $contentType = self::contentTypes['auBusinessPost'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel'; - $request = $this->auBusinessPostRequest($model, $setup_default_data); + $request = $this->auBusinessPostRequest($model, $setup_default_data, $contentType); try { $options = $this->createHttpClientOption(); @@ -2312,9 +2620,16 @@ public function auBusinessPostWithHttpInfo($model, $setup_default_data = 'true') } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2325,21 +2640,39 @@ public function auBusinessPostWithHttpInfo($model, $setup_default_data = 'true') sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBusinessExportModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBusinessExportModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBusinessExportModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); } } @@ -2354,7 +2687,7 @@ public function auBusinessPostWithHttpInfo($model, $setup_default_data = 'true') case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBusinessExportModel', + '\OpenAPI\Client\Model\AuBusinessExportModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2369,15 +2702,16 @@ public function auBusinessPostWithHttpInfo($model, $setup_default_data = 'true') * * Create New Business * - * @param \Swagger\Client\Model\AuBusinessExportModel $model (required) + * @param \OpenAPI\Client\Model\AuBusinessExportModel $model (required) * @param bool $setup_default_data (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessPostAsync($model, $setup_default_data = 'true') + public function auBusinessPostAsync($model, $setup_default_data = true, string $contentType = self::contentTypes['auBusinessPost'][0]) { - return $this->auBusinessPostAsyncWithHttpInfo($model, $setup_default_data) + return $this->auBusinessPostAsyncWithHttpInfo($model, $setup_default_data, $contentType) ->then( function ($response) { return $response[0]; @@ -2390,26 +2724,26 @@ function ($response) { * * Create New Business * - * @param \Swagger\Client\Model\AuBusinessExportModel $model (required) + * @param \OpenAPI\Client\Model\AuBusinessExportModel $model (required) * @param bool $setup_default_data (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessPostAsyncWithHttpInfo($model, $setup_default_data = 'true') + public function auBusinessPostAsyncWithHttpInfo($model, $setup_default_data = true, string $contentType = self::contentTypes['auBusinessPost'][0]) { - $returnType = '\Swagger\Client\Model\AuBusinessExportModel'; - $request = $this->auBusinessPostRequest($model, $setup_default_data); + $returnType = '\OpenAPI\Client\Model\AuBusinessExportModel'; + $request = $this->auBusinessPostRequest($model, $setup_default_data, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2432,7 +2766,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2441,14 +2775,16 @@ function ($exception) { /** * Create request for operation 'auBusinessPost' * - * @param \Swagger\Client\Model\AuBusinessExportModel $model (required) + * @param \OpenAPI\Client\Model\AuBusinessExportModel $model (required) * @param bool $setup_default_data (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessPostRequest($model, $setup_default_data = 'true') + public function auBusinessPostRequest($model, $setup_default_data = true, string $contentType = self::contentTypes['auBusinessPost'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -2456,6 +2792,8 @@ protected function auBusinessPostRequest($model, $setup_default_data = 'true') ); } + + $resourcePath = '/api/v2/business'; $formParams = []; $queryParams = []; @@ -2464,61 +2802,53 @@ protected function auBusinessPostRequest($model, $setup_default_data = 'true') $multipart = false; // query params - if ($setup_default_data !== null) { - $queryParams['setupDefaultData'] = ObjectSerializer::toQueryValue($setup_default_data); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $setup_default_data, + 'setupDefaultData', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2539,10 +2869,11 @@ protected function auBusinessPostRequest($model, $setup_default_data = 'true') $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2554,14 +2885,15 @@ protected function auBusinessPostRequest($model, $setup_default_data = 'true') * Get the timesheet settings for the business * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auBusinessTimesheetSettingsGet($business_id) + public function auBusinessTimesheetSettingsGet($business_id, string $contentType = self::contentTypes['auBusinessTimesheetSettingsGet'][0]) { - $this->auBusinessTimesheetSettingsGetWithHttpInfo($business_id); + $this->auBusinessTimesheetSettingsGetWithHttpInfo($business_id, $contentType); } /** @@ -2570,15 +2902,15 @@ public function auBusinessTimesheetSettingsGet($business_id) * Get the timesheet settings for the business * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessTimesheetSettingsGetWithHttpInfo($business_id) + public function auBusinessTimesheetSettingsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auBusinessTimesheetSettingsGet'][0]) { - $returnType = ''; - $request = $this->auBusinessTimesheetSettingsGetRequest($business_id); + $request = $this->auBusinessTimesheetSettingsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2587,9 +2919,16 @@ public function auBusinessTimesheetSettingsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2600,11 +2939,11 @@ public function auBusinessTimesheetSettingsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2623,13 +2962,14 @@ public function auBusinessTimesheetSettingsGetWithHttpInfo($business_id) * Get the timesheet settings for the business * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessTimesheetSettingsGetAsync($business_id) + public function auBusinessTimesheetSettingsGetAsync($business_id, string $contentType = self::contentTypes['auBusinessTimesheetSettingsGet'][0]) { - return $this->auBusinessTimesheetSettingsGetAsyncWithHttpInfo($business_id) + return $this->auBusinessTimesheetSettingsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2643,14 +2983,15 @@ function ($response) { * Get the timesheet settings for the business * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessTimesheetSettingsGetAsyncWithHttpInfo($business_id) + public function auBusinessTimesheetSettingsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auBusinessTimesheetSettingsGet'][0]) { $returnType = ''; - $request = $this->auBusinessTimesheetSettingsGetRequest($business_id); + $request = $this->auBusinessTimesheetSettingsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2669,7 +3010,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2679,12 +3020,14 @@ function ($exception) { * Create request for operation 'auBusinessTimesheetSettingsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessTimesheetSettingsGetRequest($business_id) + public function auBusinessTimesheetSettingsGetRequest($business_id, string $contentType = self::contentTypes['auBusinessTimesheetSettingsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2692,6 +3035,7 @@ protected function auBusinessTimesheetSettingsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/timesheetsettings'; $formParams = []; $queryParams = []; @@ -2700,6 +3044,7 @@ protected function auBusinessTimesheetSettingsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2709,53 +3054,35 @@ protected function auBusinessTimesheetSettingsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2776,10 +3103,11 @@ protected function auBusinessTimesheetSettingsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2790,16 +3118,17 @@ protected function auBusinessTimesheetSettingsGetRequest($business_id) * * Update the timesheet settings for the business * - * @param \Swagger\Client\Model\AuBusinessTimesheetSettingsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuBusinessTimesheetSettingsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auBusinessTimesheetSettingsPut($model, $business_id) + public function auBusinessTimesheetSettingsPut($business_id, $model, string $contentType = self::contentTypes['auBusinessTimesheetSettingsPut'][0]) { - $this->auBusinessTimesheetSettingsPutWithHttpInfo($model, $business_id); + $this->auBusinessTimesheetSettingsPutWithHttpInfo($business_id, $model, $contentType); } /** @@ -2807,17 +3136,17 @@ public function auBusinessTimesheetSettingsPut($model, $business_id) * * Update the timesheet settings for the business * - * @param \Swagger\Client\Model\AuBusinessTimesheetSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuBusinessTimesheetSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessTimesheetSettingsPutWithHttpInfo($model, $business_id) + public function auBusinessTimesheetSettingsPutWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auBusinessTimesheetSettingsPut'][0]) { - $returnType = ''; - $request = $this->auBusinessTimesheetSettingsPutRequest($model, $business_id); + $request = $this->auBusinessTimesheetSettingsPutRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2826,9 +3155,16 @@ public function auBusinessTimesheetSettingsPutWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2839,11 +3175,11 @@ public function auBusinessTimesheetSettingsPutWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2861,15 +3197,16 @@ public function auBusinessTimesheetSettingsPutWithHttpInfo($model, $business_id) * * Update the timesheet settings for the business * - * @param \Swagger\Client\Model\AuBusinessTimesheetSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuBusinessTimesheetSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessTimesheetSettingsPutAsync($model, $business_id) + public function auBusinessTimesheetSettingsPutAsync($business_id, $model, string $contentType = self::contentTypes['auBusinessTimesheetSettingsPut'][0]) { - return $this->auBusinessTimesheetSettingsPutAsyncWithHttpInfo($model, $business_id) + return $this->auBusinessTimesheetSettingsPutAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2882,16 +3219,17 @@ function ($response) { * * Update the timesheet settings for the business * - * @param \Swagger\Client\Model\AuBusinessTimesheetSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuBusinessTimesheetSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessTimesheetSettingsPutAsyncWithHttpInfo($model, $business_id) + public function auBusinessTimesheetSettingsPutAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auBusinessTimesheetSettingsPut'][0]) { $returnType = ''; - $request = $this->auBusinessTimesheetSettingsPutRequest($model, $business_id); + $request = $this->auBusinessTimesheetSettingsPutRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2910,7 +3248,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2919,20 +3257,16 @@ function ($exception) { /** * Create request for operation 'auBusinessTimesheetSettingsPut' * - * @param \Swagger\Client\Model\AuBusinessTimesheetSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuBusinessTimesheetSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessTimesheetSettingsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessTimesheetSettingsPutRequest($model, $business_id) + public function auBusinessTimesheetSettingsPutRequest($business_id, $model, string $contentType = self::contentTypes['auBusinessTimesheetSettingsPut'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auBusinessTimesheetSettingsPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2940,6 +3274,14 @@ protected function auBusinessTimesheetSettingsPutRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auBusinessTimesheetSettingsPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/timesheetsettings'; $formParams = []; $queryParams = []; @@ -2948,6 +3290,7 @@ protected function auBusinessTimesheetSettingsPutRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2957,56 +3300,42 @@ protected function auBusinessTimesheetSettingsPutRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3027,10 +3356,11 @@ protected function auBusinessTimesheetSettingsPutRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3042,14 +3372,15 @@ protected function auBusinessTimesheetSettingsPutRequest($model, $business_id) * Get Employee Portal Settings * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeePortalSettingsModel + * @return \OpenAPI\Client\Model\AuEmployeePortalSettingsModel */ - public function auEmployeePortalSettingsGet($business_id) + public function auEmployeePortalSettingsGet($business_id, string $contentType = self::contentTypes['auEmployeePortalSettingsGet'][0]) { - list($response) = $this->auEmployeePortalSettingsGetWithHttpInfo($business_id); + list($response) = $this->auEmployeePortalSettingsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -3059,15 +3390,15 @@ public function auEmployeePortalSettingsGet($business_id) * Get Employee Portal Settings * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeePortalSettingsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeePortalSettingsModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeePortalSettingsGetWithHttpInfo($business_id) + public function auEmployeePortalSettingsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auEmployeePortalSettingsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeePortalSettingsModel'; - $request = $this->auEmployeePortalSettingsGetRequest($business_id); + $request = $this->auEmployeePortalSettingsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3076,9 +3407,16 @@ public function auEmployeePortalSettingsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3089,19 +3427,37 @@ public function auEmployeePortalSettingsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeePortalSettingsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeePortalSettingsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3118,7 +3474,7 @@ public function auEmployeePortalSettingsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeePortalSettingsModel', + '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3134,13 +3490,14 @@ public function auEmployeePortalSettingsGetWithHttpInfo($business_id) * Get Employee Portal Settings * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePortalSettingsGetAsync($business_id) + public function auEmployeePortalSettingsGetAsync($business_id, string $contentType = self::contentTypes['auEmployeePortalSettingsGet'][0]) { - return $this->auEmployeePortalSettingsGetAsyncWithHttpInfo($business_id) + return $this->auEmployeePortalSettingsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3154,24 +3511,24 @@ function ($response) { * Get Employee Portal Settings * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePortalSettingsGetAsyncWithHttpInfo($business_id) + public function auEmployeePortalSettingsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auEmployeePortalSettingsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeePortalSettingsModel'; - $request = $this->auEmployeePortalSettingsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel'; + $request = $this->auEmployeePortalSettingsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3194,7 +3551,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3204,12 +3561,14 @@ function ($exception) { * Create request for operation 'auEmployeePortalSettingsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeePortalSettingsGetRequest($business_id) + public function auEmployeePortalSettingsGetRequest($business_id, string $contentType = self::contentTypes['auEmployeePortalSettingsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3217,6 +3576,7 @@ protected function auEmployeePortalSettingsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employeeportalsettings'; $formParams = []; $queryParams = []; @@ -3225,6 +3585,7 @@ protected function auEmployeePortalSettingsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3234,53 +3595,35 @@ protected function auEmployeePortalSettingsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3301,10 +3644,11 @@ protected function auEmployeePortalSettingsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3315,16 +3659,17 @@ protected function auEmployeePortalSettingsGetRequest($business_id) * * Update Employee Portal Settings * - * @param \Swagger\Client\Model\AuEmployeePortalSettingsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeePortalSettingsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeePortalSettingsModel + * @return \OpenAPI\Client\Model\AuEmployeePortalSettingsModel */ - public function auEmployeePortalSettingsPost($model, $business_id) + public function auEmployeePortalSettingsPost($business_id, $model, string $contentType = self::contentTypes['auEmployeePortalSettingsPost'][0]) { - list($response) = $this->auEmployeePortalSettingsPostWithHttpInfo($model, $business_id); + list($response) = $this->auEmployeePortalSettingsPostWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -3333,17 +3678,17 @@ public function auEmployeePortalSettingsPost($model, $business_id) * * Update Employee Portal Settings * - * @param \Swagger\Client\Model\AuEmployeePortalSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeePortalSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeePortalSettingsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeePortalSettingsModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeePortalSettingsPostWithHttpInfo($model, $business_id) + public function auEmployeePortalSettingsPostWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auEmployeePortalSettingsPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeePortalSettingsModel'; - $request = $this->auEmployeePortalSettingsPostRequest($model, $business_id); + $request = $this->auEmployeePortalSettingsPostRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3352,9 +3697,16 @@ public function auEmployeePortalSettingsPostWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3365,19 +3717,37 @@ public function auEmployeePortalSettingsPostWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeePortalSettingsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeePortalSettingsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3394,7 +3764,7 @@ public function auEmployeePortalSettingsPostWithHttpInfo($model, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeePortalSettingsModel', + '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3409,15 +3779,16 @@ public function auEmployeePortalSettingsPostWithHttpInfo($model, $business_id) * * Update Employee Portal Settings * - * @param \Swagger\Client\Model\AuEmployeePortalSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeePortalSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePortalSettingsPostAsync($model, $business_id) + public function auEmployeePortalSettingsPostAsync($business_id, $model, string $contentType = self::contentTypes['auEmployeePortalSettingsPost'][0]) { - return $this->auEmployeePortalSettingsPostAsyncWithHttpInfo($model, $business_id) + return $this->auEmployeePortalSettingsPostAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3430,26 +3801,26 @@ function ($response) { * * Update Employee Portal Settings * - * @param \Swagger\Client\Model\AuEmployeePortalSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeePortalSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePortalSettingsPostAsyncWithHttpInfo($model, $business_id) + public function auEmployeePortalSettingsPostAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auEmployeePortalSettingsPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeePortalSettingsModel'; - $request = $this->auEmployeePortalSettingsPostRequest($model, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeePortalSettingsModel'; + $request = $this->auEmployeePortalSettingsPostRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3472,7 +3843,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3481,20 +3852,16 @@ function ($exception) { /** * Create request for operation 'auEmployeePortalSettingsPost' * - * @param \Swagger\Client\Model\AuEmployeePortalSettingsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeePortalSettingsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePortalSettingsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeePortalSettingsPostRequest($model, $business_id) + public function auEmployeePortalSettingsPostRequest($business_id, $model, string $contentType = self::contentTypes['auEmployeePortalSettingsPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeePortalSettingsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3502,6 +3869,14 @@ protected function auEmployeePortalSettingsPostRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeePortalSettingsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employeeportalsettings'; $formParams = []; $queryParams = []; @@ -3510,6 +3885,7 @@ protected function auEmployeePortalSettingsPostRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3519,56 +3895,42 @@ protected function auEmployeePortalSettingsPostRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3589,10 +3951,11 @@ protected function auEmployeePortalSettingsPostRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3604,14 +3967,15 @@ protected function auEmployeePortalSettingsPostRequest($model, $business_id) * Get payslip configuration * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEditBusinessPaySlipApiModel + * @return \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel */ - public function auPaySlipGet($business_id) + public function auPaySlipGet($business_id, string $contentType = self::contentTypes['auPaySlipGet'][0]) { - list($response) = $this->auPaySlipGetWithHttpInfo($business_id); + list($response) = $this->auPaySlipGetWithHttpInfo($business_id, $contentType); return $response; } @@ -3621,15 +3985,15 @@ public function auPaySlipGet($business_id) * Get payslip configuration * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEditBusinessPaySlipApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPaySlipGetWithHttpInfo($business_id) + public function auPaySlipGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auPaySlipGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEditBusinessPaySlipApiModel'; - $request = $this->auPaySlipGetRequest($business_id); + $request = $this->auPaySlipGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3638,9 +4002,16 @@ public function auPaySlipGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3651,19 +4022,37 @@ public function auPaySlipGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3680,7 +4069,7 @@ public function auPaySlipGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEditBusinessPaySlipApiModel', + '\OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3696,13 +4085,14 @@ public function auPaySlipGetWithHttpInfo($business_id) * Get payslip configuration * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySlipGetAsync($business_id) + public function auPaySlipGetAsync($business_id, string $contentType = self::contentTypes['auPaySlipGet'][0]) { - return $this->auPaySlipGetAsyncWithHttpInfo($business_id) + return $this->auPaySlipGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3716,24 +4106,24 @@ function ($response) { * Get payslip configuration * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySlipGetAsyncWithHttpInfo($business_id) + public function auPaySlipGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auPaySlipGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEditBusinessPaySlipApiModel'; - $request = $this->auPaySlipGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel'; + $request = $this->auPaySlipGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3756,7 +4146,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3766,12 +4156,14 @@ function ($exception) { * Create request for operation 'auPaySlipGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaySlipGetRequest($business_id) + public function auPaySlipGetRequest($business_id, string $contentType = self::contentTypes['auPaySlipGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3779,6 +4171,7 @@ protected function auPaySlipGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payslip'; $formParams = []; $queryParams = []; @@ -3787,6 +4180,7 @@ protected function auPaySlipGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3796,53 +4190,35 @@ protected function auPaySlipGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3863,10 +4239,11 @@ protected function auPaySlipGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3877,16 +4254,17 @@ protected function auPaySlipGetRequest($business_id) * * Create payslip configuration * - * @param \Swagger\Client\Model\AuEditBusinessPaySlipApiModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPaySlipPost($model, $business_id) + public function auPaySlipPost($business_id, $model, string $contentType = self::contentTypes['auPaySlipPost'][0]) { - $this->auPaySlipPostWithHttpInfo($model, $business_id); + $this->auPaySlipPostWithHttpInfo($business_id, $model, $contentType); } /** @@ -3894,17 +4272,17 @@ public function auPaySlipPost($model, $business_id) * * Create payslip configuration * - * @param \Swagger\Client\Model\AuEditBusinessPaySlipApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPaySlipPostWithHttpInfo($model, $business_id) + public function auPaySlipPostWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auPaySlipPost'][0]) { - $returnType = ''; - $request = $this->auPaySlipPostRequest($model, $business_id); + $request = $this->auPaySlipPostRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3913,9 +4291,16 @@ public function auPaySlipPostWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3926,11 +4311,11 @@ public function auPaySlipPostWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3948,15 +4333,16 @@ public function auPaySlipPostWithHttpInfo($model, $business_id) * * Create payslip configuration * - * @param \Swagger\Client\Model\AuEditBusinessPaySlipApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySlipPostAsync($model, $business_id) + public function auPaySlipPostAsync($business_id, $model, string $contentType = self::contentTypes['auPaySlipPost'][0]) { - return $this->auPaySlipPostAsyncWithHttpInfo($model, $business_id) + return $this->auPaySlipPostAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3969,16 +4355,17 @@ function ($response) { * * Create payslip configuration * - * @param \Swagger\Client\Model\AuEditBusinessPaySlipApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySlipPostAsyncWithHttpInfo($model, $business_id) + public function auPaySlipPostAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auPaySlipPost'][0]) { $returnType = ''; - $request = $this->auPaySlipPostRequest($model, $business_id); + $request = $this->auPaySlipPostRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3997,7 +4384,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4006,20 +4393,16 @@ function ($exception) { /** * Create request for operation 'auPaySlipPost' * - * @param \Swagger\Client\Model\AuEditBusinessPaySlipApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEditBusinessPaySlipApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySlipPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaySlipPostRequest($model, $business_id) + public function auPaySlipPostRequest($business_id, $model, string $contentType = self::contentTypes['auPaySlipPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auPaySlipPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4027,6 +4410,14 @@ protected function auPaySlipPostRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auPaySlipPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payslip'; $formParams = []; $queryParams = []; @@ -4035,6 +4426,7 @@ protected function auPaySlipPostRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4044,56 +4436,42 @@ protected function auPaySlipPostRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4114,10 +4492,11 @@ protected function auPaySlipPostRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4129,14 +4508,15 @@ protected function auPaySlipPostRequest($model, $business_id) * Get STP Registration Details * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuStpRegistrationModel + * @return \OpenAPI\Client\Model\AuStpRegistrationModel */ - public function auStpRegistrationGet($business_id) + public function auStpRegistrationGet($business_id, string $contentType = self::contentTypes['auStpRegistrationGet'][0]) { - list($response) = $this->auStpRegistrationGetWithHttpInfo($business_id); + list($response) = $this->auStpRegistrationGetWithHttpInfo($business_id, $contentType); return $response; } @@ -4146,15 +4526,15 @@ public function auStpRegistrationGet($business_id) * Get STP Registration Details * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuStpRegistrationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuStpRegistrationModel, HTTP status code, HTTP response headers (array of strings) */ - public function auStpRegistrationGetWithHttpInfo($business_id) + public function auStpRegistrationGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auStpRegistrationGet'][0]) { - $returnType = '\Swagger\Client\Model\AuStpRegistrationModel'; - $request = $this->auStpRegistrationGetRequest($business_id); + $request = $this->auStpRegistrationGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4163,9 +4543,16 @@ public function auStpRegistrationGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4176,19 +4563,37 @@ public function auStpRegistrationGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuStpRegistrationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuStpRegistrationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuStpRegistrationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuStpRegistrationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4205,7 +4610,7 @@ public function auStpRegistrationGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuStpRegistrationModel', + '\OpenAPI\Client\Model\AuStpRegistrationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4221,13 +4626,14 @@ public function auStpRegistrationGetWithHttpInfo($business_id) * Get STP Registration Details * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auStpRegistrationGetAsync($business_id) + public function auStpRegistrationGetAsync($business_id, string $contentType = self::contentTypes['auStpRegistrationGet'][0]) { - return $this->auStpRegistrationGetAsyncWithHttpInfo($business_id) + return $this->auStpRegistrationGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4241,24 +4647,24 @@ function ($response) { * Get STP Registration Details * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auStpRegistrationGetAsyncWithHttpInfo($business_id) + public function auStpRegistrationGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auStpRegistrationGet'][0]) { - $returnType = '\Swagger\Client\Model\AuStpRegistrationModel'; - $request = $this->auStpRegistrationGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuStpRegistrationModel'; + $request = $this->auStpRegistrationGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4281,7 +4687,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4291,12 +4697,14 @@ function ($exception) { * Create request for operation 'auStpRegistrationGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auStpRegistrationGetRequest($business_id) + public function auStpRegistrationGetRequest($business_id, string $contentType = self::contentTypes['auStpRegistrationGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4304,6 +4712,7 @@ protected function auStpRegistrationGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/stpregister'; $formParams = []; $queryParams = []; @@ -4312,6 +4721,7 @@ protected function auStpRegistrationGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4321,53 +4731,35 @@ protected function auStpRegistrationGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4388,10 +4780,11 @@ protected function auStpRegistrationGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4402,16 +4795,17 @@ protected function auStpRegistrationGetRequest($business_id) * * Apply STP Registration Details * - * @param \Swagger\Client\Model\AuStpRegistrationModel $stp_registration_model stp_registration_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuStpRegistrationModel $stp_registration_model stp_registration_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuStpRegistrationModel + * @return \OpenAPI\Client\Model\AuStpRegistrationModel */ - public function auStpRegistrationPost($stp_registration_model, $business_id) + public function auStpRegistrationPost($business_id, $stp_registration_model, string $contentType = self::contentTypes['auStpRegistrationPost'][0]) { - list($response) = $this->auStpRegistrationPostWithHttpInfo($stp_registration_model, $business_id); + list($response) = $this->auStpRegistrationPostWithHttpInfo($business_id, $stp_registration_model, $contentType); return $response; } @@ -4420,17 +4814,17 @@ public function auStpRegistrationPost($stp_registration_model, $business_id) * * Apply STP Registration Details * - * @param \Swagger\Client\Model\AuStpRegistrationModel $stp_registration_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuStpRegistrationModel $stp_registration_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuStpRegistrationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuStpRegistrationModel, HTTP status code, HTTP response headers (array of strings) */ - public function auStpRegistrationPostWithHttpInfo($stp_registration_model, $business_id) + public function auStpRegistrationPostWithHttpInfo($business_id, $stp_registration_model, string $contentType = self::contentTypes['auStpRegistrationPost'][0]) { - $returnType = '\Swagger\Client\Model\AuStpRegistrationModel'; - $request = $this->auStpRegistrationPostRequest($stp_registration_model, $business_id); + $request = $this->auStpRegistrationPostRequest($business_id, $stp_registration_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -4439,9 +4833,16 @@ public function auStpRegistrationPostWithHttpInfo($stp_registration_model, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4452,19 +4853,37 @@ public function auStpRegistrationPostWithHttpInfo($stp_registration_model, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuStpRegistrationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuStpRegistrationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuStpRegistrationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuStpRegistrationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4481,7 +4900,7 @@ public function auStpRegistrationPostWithHttpInfo($stp_registration_model, $busi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuStpRegistrationModel', + '\OpenAPI\Client\Model\AuStpRegistrationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4496,15 +4915,16 @@ public function auStpRegistrationPostWithHttpInfo($stp_registration_model, $busi * * Apply STP Registration Details * - * @param \Swagger\Client\Model\AuStpRegistrationModel $stp_registration_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuStpRegistrationModel $stp_registration_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auStpRegistrationPostAsync($stp_registration_model, $business_id) + public function auStpRegistrationPostAsync($business_id, $stp_registration_model, string $contentType = self::contentTypes['auStpRegistrationPost'][0]) { - return $this->auStpRegistrationPostAsyncWithHttpInfo($stp_registration_model, $business_id) + return $this->auStpRegistrationPostAsyncWithHttpInfo($business_id, $stp_registration_model, $contentType) ->then( function ($response) { return $response[0]; @@ -4517,26 +4937,26 @@ function ($response) { * * Apply STP Registration Details * - * @param \Swagger\Client\Model\AuStpRegistrationModel $stp_registration_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuStpRegistrationModel $stp_registration_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auStpRegistrationPostAsyncWithHttpInfo($stp_registration_model, $business_id) + public function auStpRegistrationPostAsyncWithHttpInfo($business_id, $stp_registration_model, string $contentType = self::contentTypes['auStpRegistrationPost'][0]) { - $returnType = '\Swagger\Client\Model\AuStpRegistrationModel'; - $request = $this->auStpRegistrationPostRequest($stp_registration_model, $business_id); + $returnType = '\OpenAPI\Client\Model\AuStpRegistrationModel'; + $request = $this->auStpRegistrationPostRequest($business_id, $stp_registration_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4559,7 +4979,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4568,20 +4988,16 @@ function ($exception) { /** * Create request for operation 'auStpRegistrationPost' * - * @param \Swagger\Client\Model\AuStpRegistrationModel $stp_registration_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuStpRegistrationModel $stp_registration_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auStpRegistrationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auStpRegistrationPostRequest($stp_registration_model, $business_id) + public function auStpRegistrationPostRequest($business_id, $stp_registration_model, string $contentType = self::contentTypes['auStpRegistrationPost'][0]) { - // verify the required parameter 'stp_registration_model' is set - if ($stp_registration_model === null || (is_array($stp_registration_model) && count($stp_registration_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $stp_registration_model when calling auStpRegistrationPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4589,6 +5005,14 @@ protected function auStpRegistrationPostRequest($stp_registration_model, $busine ); } + // verify the required parameter 'stp_registration_model' is set + if ($stp_registration_model === null || (is_array($stp_registration_model) && count($stp_registration_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $stp_registration_model when calling auStpRegistrationPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/stpregister'; $formParams = []; $queryParams = []; @@ -4597,6 +5021,7 @@ protected function auStpRegistrationPostRequest($stp_registration_model, $busine $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4606,56 +5031,42 @@ protected function auStpRegistrationPostRequest($stp_registration_model, $busine ); } - // body params - $_tempBody = null; - if (isset($stp_registration_model)) { - $_tempBody = $stp_registration_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($stp_registration_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($stp_registration_model)); + } else { + $httpBody = $stp_registration_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4676,10 +5087,11 @@ protected function auStpRegistrationPostRequest($stp_registration_model, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4691,14 +5103,15 @@ protected function auStpRegistrationPostRequest($stp_registration_model, $busine * Get Business Billing PLan * * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionGetCurrentBillingPlan'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBillingPlanResponseModel + * @return \OpenAPI\Client\Model\AuBillingPlanResponseModel */ - public function auSubscriptionGetCurrentBillingPlan($business_id) + public function auSubscriptionGetCurrentBillingPlan($business_id, string $contentType = self::contentTypes['auSubscriptionGetCurrentBillingPlan'][0]) { - list($response) = $this->auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id); + list($response) = $this->auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id, $contentType); return $response; } @@ -4708,15 +5121,15 @@ public function auSubscriptionGetCurrentBillingPlan($business_id) * Get Business Billing PLan * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionGetCurrentBillingPlan'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBillingPlanResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBillingPlanResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id) + public function auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id, string $contentType = self::contentTypes['auSubscriptionGetCurrentBillingPlan'][0]) { - $returnType = '\Swagger\Client\Model\AuBillingPlanResponseModel'; - $request = $this->auSubscriptionGetCurrentBillingPlanRequest($business_id); + $request = $this->auSubscriptionGetCurrentBillingPlanRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4725,9 +5138,16 @@ public function auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4738,19 +5158,37 @@ public function auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBillingPlanResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBillingPlanResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBillingPlanResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBillingPlanResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4767,7 +5205,7 @@ public function auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBillingPlanResponseModel', + '\OpenAPI\Client\Model\AuBillingPlanResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4783,13 +5221,14 @@ public function auSubscriptionGetCurrentBillingPlanWithHttpInfo($business_id) * Get Business Billing PLan * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionGetCurrentBillingPlan'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSubscriptionGetCurrentBillingPlanAsync($business_id) + public function auSubscriptionGetCurrentBillingPlanAsync($business_id, string $contentType = self::contentTypes['auSubscriptionGetCurrentBillingPlan'][0]) { - return $this->auSubscriptionGetCurrentBillingPlanAsyncWithHttpInfo($business_id) + return $this->auSubscriptionGetCurrentBillingPlanAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4803,24 +5242,24 @@ function ($response) { * Get Business Billing PLan * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionGetCurrentBillingPlan'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSubscriptionGetCurrentBillingPlanAsyncWithHttpInfo($business_id) + public function auSubscriptionGetCurrentBillingPlanAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auSubscriptionGetCurrentBillingPlan'][0]) { - $returnType = '\Swagger\Client\Model\AuBillingPlanResponseModel'; - $request = $this->auSubscriptionGetCurrentBillingPlanRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuBillingPlanResponseModel'; + $request = $this->auSubscriptionGetCurrentBillingPlanRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4843,7 +5282,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4853,12 +5292,14 @@ function ($exception) { * Create request for operation 'auSubscriptionGetCurrentBillingPlan' * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionGetCurrentBillingPlan'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSubscriptionGetCurrentBillingPlanRequest($business_id) + public function auSubscriptionGetCurrentBillingPlanRequest($business_id, string $contentType = self::contentTypes['auSubscriptionGetCurrentBillingPlan'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4866,6 +5307,7 @@ protected function auSubscriptionGetCurrentBillingPlanRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/subscription/currentbillingplan'; $formParams = []; $queryParams = []; @@ -4874,6 +5316,7 @@ protected function auSubscriptionGetCurrentBillingPlanRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4883,53 +5326,35 @@ protected function auSubscriptionGetCurrentBillingPlanRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4950,10 +5375,11 @@ protected function auSubscriptionGetCurrentBillingPlanRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4965,14 +5391,15 @@ protected function auSubscriptionGetCurrentBillingPlanRequest($business_id) * List Billing Plans * * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionListBillingPlans'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBillingPlanResponseModel[] + * @return \OpenAPI\Client\Model\AuBillingPlanResponseModel[] */ - public function auSubscriptionListBillingPlans($business_id) + public function auSubscriptionListBillingPlans($business_id, string $contentType = self::contentTypes['auSubscriptionListBillingPlans'][0]) { - list($response) = $this->auSubscriptionListBillingPlansWithHttpInfo($business_id); + list($response) = $this->auSubscriptionListBillingPlansWithHttpInfo($business_id, $contentType); return $response; } @@ -4982,15 +5409,15 @@ public function auSubscriptionListBillingPlans($business_id) * List Billing Plans * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionListBillingPlans'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBillingPlanResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBillingPlanResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auSubscriptionListBillingPlansWithHttpInfo($business_id) + public function auSubscriptionListBillingPlansWithHttpInfo($business_id, string $contentType = self::contentTypes['auSubscriptionListBillingPlans'][0]) { - $returnType = '\Swagger\Client\Model\AuBillingPlanResponseModel[]'; - $request = $this->auSubscriptionListBillingPlansRequest($business_id); + $request = $this->auSubscriptionListBillingPlansRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4999,9 +5426,16 @@ public function auSubscriptionListBillingPlansWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5012,19 +5446,37 @@ public function auSubscriptionListBillingPlansWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBillingPlanResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBillingPlanResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBillingPlanResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBillingPlanResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5041,7 +5493,7 @@ public function auSubscriptionListBillingPlansWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBillingPlanResponseModel[]', + '\OpenAPI\Client\Model\AuBillingPlanResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5057,13 +5509,14 @@ public function auSubscriptionListBillingPlansWithHttpInfo($business_id) * List Billing Plans * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionListBillingPlans'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSubscriptionListBillingPlansAsync($business_id) + public function auSubscriptionListBillingPlansAsync($business_id, string $contentType = self::contentTypes['auSubscriptionListBillingPlans'][0]) { - return $this->auSubscriptionListBillingPlansAsyncWithHttpInfo($business_id) + return $this->auSubscriptionListBillingPlansAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5077,24 +5530,24 @@ function ($response) { * List Billing Plans * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionListBillingPlans'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSubscriptionListBillingPlansAsyncWithHttpInfo($business_id) + public function auSubscriptionListBillingPlansAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auSubscriptionListBillingPlans'][0]) { - $returnType = '\Swagger\Client\Model\AuBillingPlanResponseModel[]'; - $request = $this->auSubscriptionListBillingPlansRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuBillingPlanResponseModel[]'; + $request = $this->auSubscriptionListBillingPlansRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5117,7 +5570,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5127,12 +5580,14 @@ function ($exception) { * Create request for operation 'auSubscriptionListBillingPlans' * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionListBillingPlans'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSubscriptionListBillingPlansRequest($business_id) + public function auSubscriptionListBillingPlansRequest($business_id, string $contentType = self::contentTypes['auSubscriptionListBillingPlans'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5140,6 +5595,7 @@ protected function auSubscriptionListBillingPlansRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/subscription/billingplans'; $formParams = []; $queryParams = []; @@ -5148,6 +5604,7 @@ protected function auSubscriptionListBillingPlansRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -5157,53 +5614,35 @@ protected function auSubscriptionListBillingPlansRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5224,10 +5663,11 @@ protected function auSubscriptionListBillingPlansRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5239,15 +5679,16 @@ protected function auSubscriptionListBillingPlansRequest($business_id) * Set Business Billing Plan * * @param int $business_id business_id (required) - * @param \Swagger\Client\Model\SetBillingPlanRequestModel $model model (required) + * @param \OpenAPI\Client\Model\SetBillingPlanRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionSetBillingPlan'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auSubscriptionSetBillingPlan($business_id, $model) + public function auSubscriptionSetBillingPlan($business_id, $model, string $contentType = self::contentTypes['auSubscriptionSetBillingPlan'][0]) { - $this->auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model); + $this->auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model, $contentType); } /** @@ -5256,16 +5697,16 @@ public function auSubscriptionSetBillingPlan($business_id, $model) * Set Business Billing Plan * * @param int $business_id (required) - * @param \Swagger\Client\Model\SetBillingPlanRequestModel $model (required) + * @param \OpenAPI\Client\Model\SetBillingPlanRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionSetBillingPlan'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model) + public function auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auSubscriptionSetBillingPlan'][0]) { - $returnType = ''; - $request = $this->auSubscriptionSetBillingPlanRequest($business_id, $model); + $request = $this->auSubscriptionSetBillingPlanRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -5274,9 +5715,16 @@ public function auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5287,11 +5735,11 @@ public function auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5310,14 +5758,15 @@ public function auSubscriptionSetBillingPlanWithHttpInfo($business_id, $model) * Set Business Billing Plan * * @param int $business_id (required) - * @param \Swagger\Client\Model\SetBillingPlanRequestModel $model (required) + * @param \OpenAPI\Client\Model\SetBillingPlanRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionSetBillingPlan'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSubscriptionSetBillingPlanAsync($business_id, $model) + public function auSubscriptionSetBillingPlanAsync($business_id, $model, string $contentType = self::contentTypes['auSubscriptionSetBillingPlan'][0]) { - return $this->auSubscriptionSetBillingPlanAsyncWithHttpInfo($business_id, $model) + return $this->auSubscriptionSetBillingPlanAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -5331,15 +5780,16 @@ function ($response) { * Set Business Billing Plan * * @param int $business_id (required) - * @param \Swagger\Client\Model\SetBillingPlanRequestModel $model (required) + * @param \OpenAPI\Client\Model\SetBillingPlanRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionSetBillingPlan'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSubscriptionSetBillingPlanAsyncWithHttpInfo($business_id, $model) + public function auSubscriptionSetBillingPlanAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auSubscriptionSetBillingPlan'][0]) { $returnType = ''; - $request = $this->auSubscriptionSetBillingPlanRequest($business_id, $model); + $request = $this->auSubscriptionSetBillingPlanRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5358,7 +5808,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5368,19 +5818,22 @@ function ($exception) { * Create request for operation 'auSubscriptionSetBillingPlan' * * @param int $business_id (required) - * @param \Swagger\Client\Model\SetBillingPlanRequestModel $model (required) + * @param \OpenAPI\Client\Model\SetBillingPlanRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSubscriptionSetBillingPlan'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSubscriptionSetBillingPlanRequest($business_id, $model) + public function auSubscriptionSetBillingPlanRequest($business_id, $model, string $contentType = self::contentTypes['auSubscriptionSetBillingPlan'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auSubscriptionSetBillingPlan' ); } + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -5388,6 +5841,7 @@ protected function auSubscriptionSetBillingPlanRequest($business_id, $model) ); } + $resourcePath = '/api/v2/business/{businessId}/subscription/setbillingplan'; $formParams = []; $queryParams = []; @@ -5396,6 +5850,7 @@ protected function auSubscriptionSetBillingPlanRequest($business_id, $model) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -5405,56 +5860,42 @@ protected function auSubscriptionSetBillingPlanRequest($business_id, $model) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5475,10 +5916,11 @@ protected function auSubscriptionSetBillingPlanRequest($business_id, $model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5491,14 +5933,15 @@ protected function auSubscriptionSetBillingPlanRequest($business_id, $model) * * @param string $email email (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function businessAccessDelete($email, $business_id) + public function businessAccessDelete($email, $business_id, string $contentType = self::contentTypes['businessAccessDelete'][0]) { - $this->businessAccessDeleteWithHttpInfo($email, $business_id); + $this->businessAccessDeleteWithHttpInfo($email, $business_id, $contentType); } /** @@ -5508,15 +5951,15 @@ public function businessAccessDelete($email, $business_id) * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function businessAccessDeleteWithHttpInfo($email, $business_id) + public function businessAccessDeleteWithHttpInfo($email, $business_id, string $contentType = self::contentTypes['businessAccessDelete'][0]) { - $returnType = ''; - $request = $this->businessAccessDeleteRequest($email, $business_id); + $request = $this->businessAccessDeleteRequest($email, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5525,9 +5968,16 @@ public function businessAccessDeleteWithHttpInfo($email, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5538,11 +5988,11 @@ public function businessAccessDeleteWithHttpInfo($email, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5562,13 +6012,14 @@ public function businessAccessDeleteWithHttpInfo($email, $business_id) * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessDeleteAsync($email, $business_id) + public function businessAccessDeleteAsync($email, $business_id, string $contentType = self::contentTypes['businessAccessDelete'][0]) { - return $this->businessAccessDeleteAsyncWithHttpInfo($email, $business_id) + return $this->businessAccessDeleteAsyncWithHttpInfo($email, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5583,14 +6034,15 @@ function ($response) { * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessDeleteAsyncWithHttpInfo($email, $business_id) + public function businessAccessDeleteAsyncWithHttpInfo($email, $business_id, string $contentType = self::contentTypes['businessAccessDelete'][0]) { $returnType = ''; - $request = $this->businessAccessDeleteRequest($email, $business_id); + $request = $this->businessAccessDeleteRequest($email, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5609,7 +6061,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5620,18 +6072,21 @@ function ($exception) { * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessAccessDeleteRequest($email, $business_id) + public function businessAccessDeleteRequest($email, $business_id, string $contentType = self::contentTypes['businessAccessDelete'][0]) { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email when calling businessAccessDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5639,6 +6094,7 @@ protected function businessAccessDeleteRequest($email, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/access'; $formParams = []; $queryParams = []; @@ -5647,9 +6103,15 @@ protected function businessAccessDeleteRequest($email, $business_id) $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -5660,53 +6122,35 @@ protected function businessAccessDeleteRequest($email, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5727,10 +6171,11 @@ protected function businessAccessDeleteRequest($email, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5743,14 +6188,15 @@ protected function businessAccessDeleteRequest($email, $business_id) * * @param string $email email (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAccessModel + * @return \OpenAPI\Client\Model\BusinessAccessModel */ - public function businessAccessGet($email, $business_id) + public function businessAccessGet($email, $business_id, string $contentType = self::contentTypes['businessAccessGet'][0]) { - list($response) = $this->businessAccessGetWithHttpInfo($email, $business_id); + list($response) = $this->businessAccessGetWithHttpInfo($email, $business_id, $contentType); return $response; } @@ -5761,15 +6207,15 @@ public function businessAccessGet($email, $business_id) * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAccessModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAccessModel, HTTP status code, HTTP response headers (array of strings) */ - public function businessAccessGetWithHttpInfo($email, $business_id) + public function businessAccessGetWithHttpInfo($email, $business_id, string $contentType = self::contentTypes['businessAccessGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAccessModel'; - $request = $this->businessAccessGetRequest($email, $business_id); + $request = $this->businessAccessGetRequest($email, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5778,9 +6224,16 @@ public function businessAccessGetWithHttpInfo($email, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5791,19 +6244,37 @@ public function businessAccessGetWithHttpInfo($email, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAccessModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAccessModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAccessModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAccessModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5820,7 +6291,7 @@ public function businessAccessGetWithHttpInfo($email, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAccessModel', + '\OpenAPI\Client\Model\BusinessAccessModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5837,13 +6308,14 @@ public function businessAccessGetWithHttpInfo($email, $business_id) * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessGetAsync($email, $business_id) + public function businessAccessGetAsync($email, $business_id, string $contentType = self::contentTypes['businessAccessGet'][0]) { - return $this->businessAccessGetAsyncWithHttpInfo($email, $business_id) + return $this->businessAccessGetAsyncWithHttpInfo($email, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5858,24 +6330,24 @@ function ($response) { * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessGetAsyncWithHttpInfo($email, $business_id) + public function businessAccessGetAsyncWithHttpInfo($email, $business_id, string $contentType = self::contentTypes['businessAccessGet'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAccessModel'; - $request = $this->businessAccessGetRequest($email, $business_id); + $returnType = '\OpenAPI\Client\Model\BusinessAccessModel'; + $request = $this->businessAccessGetRequest($email, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5898,7 +6370,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5909,18 +6381,21 @@ function ($exception) { * * @param string $email (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessAccessGetRequest($email, $business_id) + public function businessAccessGetRequest($email, $business_id, string $contentType = self::contentTypes['businessAccessGet'][0]) { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email when calling businessAccessGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5928,6 +6403,7 @@ protected function businessAccessGetRequest($email, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/access/user'; $formParams = []; $queryParams = []; @@ -5936,9 +6412,15 @@ protected function businessAccessGetRequest($email, $business_id) $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -5949,53 +6431,35 @@ protected function businessAccessGetRequest($email, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6016,10 +6480,11 @@ protected function businessAccessGetRequest($email, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6035,14 +6500,15 @@ protected function businessAccessGetRequest($email, $business_id) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BusinessAccessModel[] + * @return \OpenAPI\Client\Model\BusinessAccessModel[] */ - public function businessAccessGetAll($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function businessAccessGetAll($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['businessAccessGetAll'][0]) { - list($response) = $this->businessAccessGetAllWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->businessAccessGetAllWithHttpInfo($business_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -6056,15 +6522,15 @@ public function businessAccessGetAll($business_id, $filter = null, $orderby = nu * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BusinessAccessModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BusinessAccessModel[], HTTP status code, HTTP response headers (array of strings) */ - public function businessAccessGetAllWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function businessAccessGetAllWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['businessAccessGetAll'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAccessModel[]'; - $request = $this->businessAccessGetAllRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->businessAccessGetAllRequest($business_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -6073,9 +6539,16 @@ public function businessAccessGetAllWithHttpInfo($business_id, $filter = null, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6086,19 +6559,37 @@ public function businessAccessGetAllWithHttpInfo($business_id, $filter = null, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BusinessAccessModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BusinessAccessModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BusinessAccessModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BusinessAccessModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6115,7 +6606,7 @@ public function businessAccessGetAllWithHttpInfo($business_id, $filter = null, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BusinessAccessModel[]', + '\OpenAPI\Client\Model\BusinessAccessModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6135,13 +6626,14 @@ public function businessAccessGetAllWithHttpInfo($business_id, $filter = null, $ * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessGetAllAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function businessAccessGetAllAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['businessAccessGetAll'][0]) { - return $this->businessAccessGetAllAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->businessAccessGetAllAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -6159,24 +6651,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessGetAllAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function businessAccessGetAllAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['businessAccessGetAll'][0]) { - $returnType = '\Swagger\Client\Model\BusinessAccessModel[]'; - $request = $this->businessAccessGetAllRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\BusinessAccessModel[]'; + $request = $this->businessAccessGetAllRequest($business_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6199,7 +6691,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6213,12 +6705,14 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessAccessGetAllRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function businessAccessGetAllRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['businessAccessGetAll'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6226,6 +6720,11 @@ protected function businessAccessGetAllRequest($business_id, $filter = null, $or ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/access'; $formParams = []; $queryParams = []; @@ -6234,21 +6733,42 @@ protected function businessAccessGetAllRequest($business_id, $filter = null, $or $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6259,53 +6779,35 @@ protected function businessAccessGetAllRequest($business_id, $filter = null, $or ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6326,10 +6828,11 @@ protected function businessAccessGetAllRequest($business_id, $filter = null, $or $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6340,16 +6843,17 @@ protected function businessAccessGetAllRequest($business_id, $filter = null, $or * * Assign Business Access * - * @param \Swagger\Client\Model\CreateBusinessAccessModel $view_model view_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\CreateBusinessAccessModel $view_model view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function businessAccessPost($view_model, $business_id) + public function businessAccessPost($business_id, $view_model, string $contentType = self::contentTypes['businessAccessPost'][0]) { - $this->businessAccessPostWithHttpInfo($view_model, $business_id); + $this->businessAccessPostWithHttpInfo($business_id, $view_model, $contentType); } /** @@ -6357,17 +6861,17 @@ public function businessAccessPost($view_model, $business_id) * * Assign Business Access * - * @param \Swagger\Client\Model\CreateBusinessAccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CreateBusinessAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function businessAccessPostWithHttpInfo($view_model, $business_id) + public function businessAccessPostWithHttpInfo($business_id, $view_model, string $contentType = self::contentTypes['businessAccessPost'][0]) { - $returnType = ''; - $request = $this->businessAccessPostRequest($view_model, $business_id); + $request = $this->businessAccessPostRequest($business_id, $view_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6376,9 +6880,16 @@ public function businessAccessPostWithHttpInfo($view_model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6389,11 +6900,11 @@ public function businessAccessPostWithHttpInfo($view_model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6411,15 +6922,16 @@ public function businessAccessPostWithHttpInfo($view_model, $business_id) * * Assign Business Access * - * @param \Swagger\Client\Model\CreateBusinessAccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CreateBusinessAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessPostAsync($view_model, $business_id) + public function businessAccessPostAsync($business_id, $view_model, string $contentType = self::contentTypes['businessAccessPost'][0]) { - return $this->businessAccessPostAsyncWithHttpInfo($view_model, $business_id) + return $this->businessAccessPostAsyncWithHttpInfo($business_id, $view_model, $contentType) ->then( function ($response) { return $response[0]; @@ -6432,16 +6944,17 @@ function ($response) { * * Assign Business Access * - * @param \Swagger\Client\Model\CreateBusinessAccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CreateBusinessAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessPostAsyncWithHttpInfo($view_model, $business_id) + public function businessAccessPostAsyncWithHttpInfo($business_id, $view_model, string $contentType = self::contentTypes['businessAccessPost'][0]) { $returnType = ''; - $request = $this->businessAccessPostRequest($view_model, $business_id); + $request = $this->businessAccessPostRequest($business_id, $view_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6460,7 +6973,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6469,20 +6982,16 @@ function ($exception) { /** * Create request for operation 'businessAccessPost' * - * @param \Swagger\Client\Model\CreateBusinessAccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CreateBusinessAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessAccessPostRequest($view_model, $business_id) + public function businessAccessPostRequest($business_id, $view_model, string $contentType = self::contentTypes['businessAccessPost'][0]) { - // verify the required parameter 'view_model' is set - if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $view_model when calling businessAccessPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6490,6 +6999,14 @@ protected function businessAccessPostRequest($view_model, $business_id) ); } + // verify the required parameter 'view_model' is set + if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $view_model when calling businessAccessPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/access'; $formParams = []; $queryParams = []; @@ -6498,6 +7015,7 @@ protected function businessAccessPostRequest($view_model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6507,56 +7025,42 @@ protected function businessAccessPostRequest($view_model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($view_model)) { - $_tempBody = $view_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($view_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($view_model)); + } else { + $httpBody = $view_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6577,10 +7081,11 @@ protected function businessAccessPostRequest($view_model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6592,16 +7097,17 @@ protected function businessAccessPostRequest($view_model, $business_id) * Update details of an associated user * * @param string $email email (required) - * @param \Swagger\Client\Model\AccessModel $view_model view_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function businessAccessPut($email, $view_model, $business_id) + public function businessAccessPut($email, $business_id, $view_model, string $contentType = self::contentTypes['businessAccessPut'][0]) { - $this->businessAccessPutWithHttpInfo($email, $view_model, $business_id); + $this->businessAccessPutWithHttpInfo($email, $business_id, $view_model, $contentType); } /** @@ -6610,17 +7116,17 @@ public function businessAccessPut($email, $view_model, $business_id) * Update details of an associated user * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function businessAccessPutWithHttpInfo($email, $view_model, $business_id) + public function businessAccessPutWithHttpInfo($email, $business_id, $view_model, string $contentType = self::contentTypes['businessAccessPut'][0]) { - $returnType = ''; - $request = $this->businessAccessPutRequest($email, $view_model, $business_id); + $request = $this->businessAccessPutRequest($email, $business_id, $view_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6629,9 +7135,16 @@ public function businessAccessPutWithHttpInfo($email, $view_model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6642,11 +7155,11 @@ public function businessAccessPutWithHttpInfo($email, $view_model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6665,15 +7178,16 @@ public function businessAccessPutWithHttpInfo($email, $view_model, $business_id) * Update details of an associated user * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessPutAsync($email, $view_model, $business_id) + public function businessAccessPutAsync($email, $business_id, $view_model, string $contentType = self::contentTypes['businessAccessPut'][0]) { - return $this->businessAccessPutAsyncWithHttpInfo($email, $view_model, $business_id) + return $this->businessAccessPutAsyncWithHttpInfo($email, $business_id, $view_model, $contentType) ->then( function ($response) { return $response[0]; @@ -6687,16 +7201,17 @@ function ($response) { * Update details of an associated user * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessAccessPutAsyncWithHttpInfo($email, $view_model, $business_id) + public function businessAccessPutAsyncWithHttpInfo($email, $business_id, $view_model, string $contentType = self::contentTypes['businessAccessPut'][0]) { $returnType = ''; - $request = $this->businessAccessPutRequest($email, $view_model, $business_id); + $request = $this->businessAccessPutRequest($email, $business_id, $view_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6715,7 +7230,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6725,26 +7240,23 @@ function ($exception) { * Create request for operation 'businessAccessPut' * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessAccessPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessAccessPutRequest($email, $view_model, $business_id) + public function businessAccessPutRequest($email, $business_id, $view_model, string $contentType = self::contentTypes['businessAccessPut'][0]) { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email when calling businessAccessPut' ); } - // verify the required parameter 'view_model' is set - if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $view_model when calling businessAccessPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6752,6 +7264,14 @@ protected function businessAccessPutRequest($email, $view_model, $business_id) ); } + // verify the required parameter 'view_model' is set + if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $view_model when calling businessAccessPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/access'; $formParams = []; $queryParams = []; @@ -6760,9 +7280,15 @@ protected function businessAccessPutRequest($email, $view_model, $business_id) $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6773,56 +7299,42 @@ protected function businessAccessPutRequest($email, $view_model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($view_model)) { - $_tempBody = $view_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($view_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($view_model)); + } else { + $httpBody = $view_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6843,10 +7355,11 @@ protected function businessAccessPutRequest($email, $view_model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6859,14 +7372,15 @@ protected function businessAccessPutRequest($email, $view_model, $business_id) * * @param int $year year (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessChangeTaxYearChangeFinancialYear'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function businessChangeTaxYearChangeFinancialYear($year, $business_id) + public function businessChangeTaxYearChangeFinancialYear($year, $business_id, string $contentType = self::contentTypes['businessChangeTaxYearChangeFinancialYear'][0]) { - $this->businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $business_id); + $this->businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $business_id, $contentType); } /** @@ -6876,15 +7390,15 @@ public function businessChangeTaxYearChangeFinancialYear($year, $business_id) * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessChangeTaxYearChangeFinancialYear'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $business_id) + public function businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $business_id, string $contentType = self::contentTypes['businessChangeTaxYearChangeFinancialYear'][0]) { - $returnType = ''; - $request = $this->businessChangeTaxYearChangeFinancialYearRequest($year, $business_id); + $request = $this->businessChangeTaxYearChangeFinancialYearRequest($year, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6893,9 +7407,16 @@ public function businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6906,11 +7427,11 @@ public function businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6930,13 +7451,14 @@ public function businessChangeTaxYearChangeFinancialYearWithHttpInfo($year, $bus * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessChangeTaxYearChangeFinancialYear'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessChangeTaxYearChangeFinancialYearAsync($year, $business_id) + public function businessChangeTaxYearChangeFinancialYearAsync($year, $business_id, string $contentType = self::contentTypes['businessChangeTaxYearChangeFinancialYear'][0]) { - return $this->businessChangeTaxYearChangeFinancialYearAsyncWithHttpInfo($year, $business_id) + return $this->businessChangeTaxYearChangeFinancialYearAsyncWithHttpInfo($year, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6951,14 +7473,15 @@ function ($response) { * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessChangeTaxYearChangeFinancialYear'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessChangeTaxYearChangeFinancialYearAsyncWithHttpInfo($year, $business_id) + public function businessChangeTaxYearChangeFinancialYearAsyncWithHttpInfo($year, $business_id, string $contentType = self::contentTypes['businessChangeTaxYearChangeFinancialYear'][0]) { $returnType = ''; - $request = $this->businessChangeTaxYearChangeFinancialYearRequest($year, $business_id); + $request = $this->businessChangeTaxYearChangeFinancialYearRequest($year, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6977,7 +7500,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6988,18 +7511,21 @@ function ($exception) { * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessChangeTaxYearChangeFinancialYear'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessChangeTaxYearChangeFinancialYearRequest($year, $business_id) + public function businessChangeTaxYearChangeFinancialYearRequest($year, $business_id, string $contentType = self::contentTypes['businessChangeTaxYearChangeFinancialYear'][0]) { + // verify the required parameter 'year' is set if ($year === null || (is_array($year) && count($year) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $year when calling businessChangeTaxYearChangeFinancialYear' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7007,6 +7533,7 @@ protected function businessChangeTaxYearChangeFinancialYearRequest($year, $busin ); } + $resourcePath = '/api/v2/business/{businessId}/initialfinancialyear'; $formParams = []; $queryParams = []; @@ -7015,9 +7542,15 @@ protected function businessChangeTaxYearChangeFinancialYearRequest($year, $busin $multipart = false; // query params - if ($year !== null) { - $queryParams['year'] = ObjectSerializer::toQueryValue($year); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $year, + 'year', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -7028,53 +7561,35 @@ protected function businessChangeTaxYearChangeFinancialYearRequest($year, $busin ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7095,10 +7610,11 @@ protected function businessChangeTaxYearChangeFinancialYearRequest($year, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7110,14 +7626,15 @@ protected function businessChangeTaxYearChangeFinancialYearRequest($year, $busin * List the Business tags * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTagsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TagViewModel[] + * @return \OpenAPI\Client\Model\TagViewModel[] */ - public function businessTagsGet($business_id) + public function businessTagsGet($business_id, string $contentType = self::contentTypes['businessTagsGet'][0]) { - list($response) = $this->businessTagsGetWithHttpInfo($business_id); + list($response) = $this->businessTagsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -7127,15 +7644,15 @@ public function businessTagsGet($business_id) * List the Business tags * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTagsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TagViewModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TagViewModel[], HTTP status code, HTTP response headers (array of strings) */ - public function businessTagsGetWithHttpInfo($business_id) + public function businessTagsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['businessTagsGet'][0]) { - $returnType = '\Swagger\Client\Model\TagViewModel[]'; - $request = $this->businessTagsGetRequest($business_id); + $request = $this->businessTagsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7144,9 +7661,16 @@ public function businessTagsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7157,19 +7681,37 @@ public function businessTagsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TagViewModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TagViewModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TagViewModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TagViewModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7186,7 +7728,7 @@ public function businessTagsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TagViewModel[]', + '\OpenAPI\Client\Model\TagViewModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7202,13 +7744,14 @@ public function businessTagsGetWithHttpInfo($business_id) * List the Business tags * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTagsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessTagsGetAsync($business_id) + public function businessTagsGetAsync($business_id, string $contentType = self::contentTypes['businessTagsGet'][0]) { - return $this->businessTagsGetAsyncWithHttpInfo($business_id) + return $this->businessTagsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7222,24 +7765,24 @@ function ($response) { * List the Business tags * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTagsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function businessTagsGetAsyncWithHttpInfo($business_id) + public function businessTagsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['businessTagsGet'][0]) { - $returnType = '\Swagger\Client\Model\TagViewModel[]'; - $request = $this->businessTagsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\TagViewModel[]'; + $request = $this->businessTagsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7262,7 +7805,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7272,12 +7815,14 @@ function ($exception) { * Create request for operation 'businessTagsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['businessTagsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function businessTagsGetRequest($business_id) + public function businessTagsGetRequest($business_id, string $contentType = self::contentTypes['businessTagsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7285,6 +7830,7 @@ protected function businessTagsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/tags'; $formParams = []; $queryParams = []; @@ -7293,6 +7839,7 @@ protected function businessTagsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7302,53 +7849,35 @@ protected function businessTagsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7369,10 +7898,11 @@ protected function businessTagsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7385,14 +7915,15 @@ protected function businessTagsGetRequest($business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentContent'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentFile + * @return \OpenAPI\Client\Model\DocumentFile */ - public function documentContent($id, $business_id) + public function documentContent($id, $business_id, string $contentType = self::contentTypes['documentContent'][0]) { - list($response) = $this->documentContentWithHttpInfo($id, $business_id); + list($response) = $this->documentContentWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -7403,15 +7934,15 @@ public function documentContent($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentContent'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) */ - public function documentContentWithHttpInfo($id, $business_id) + public function documentContentWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['documentContent'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->documentContentRequest($id, $business_id); + $request = $this->documentContentRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7420,9 +7951,16 @@ public function documentContentWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7433,19 +7971,37 @@ public function documentContentWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentFile' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentFile' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentFile', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentFile'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7462,7 +8018,7 @@ public function documentContentWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentFile', + '\OpenAPI\Client\Model\DocumentFile', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7479,13 +8035,14 @@ public function documentContentWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentContentAsync($id, $business_id) + public function documentContentAsync($id, $business_id, string $contentType = self::contentTypes['documentContent'][0]) { - return $this->documentContentAsyncWithHttpInfo($id, $business_id) + return $this->documentContentAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7500,24 +8057,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentContentAsyncWithHttpInfo($id, $business_id) + public function documentContentAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['documentContent'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->documentContentRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\DocumentFile'; + $request = $this->documentContentRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7540,7 +8097,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7551,18 +8108,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function documentContentRequest($id, $business_id) + public function documentContentRequest($id, $business_id, string $contentType = self::contentTypes['documentContent'][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 documentContent' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7570,6 +8130,7 @@ protected function documentContentRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/document/{id}/content'; $formParams = []; $queryParams = []; @@ -7578,6 +8139,7 @@ protected function documentContentRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -7595,53 +8157,35 @@ protected function documentContentRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7662,10 +8206,11 @@ protected function documentContentRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7678,14 +8223,15 @@ protected function documentContentRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function documentDelete($id, $business_id) + public function documentDelete($id, $business_id, string $contentType = self::contentTypes['documentDelete'][0]) { - $this->documentDeleteWithHttpInfo($id, $business_id); + $this->documentDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -7695,15 +8241,15 @@ public function documentDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function documentDeleteWithHttpInfo($id, $business_id) + public function documentDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['documentDelete'][0]) { - $returnType = ''; - $request = $this->documentDeleteRequest($id, $business_id); + $request = $this->documentDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7712,9 +8258,16 @@ public function documentDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7725,11 +8278,11 @@ public function documentDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -7749,13 +8302,14 @@ public function documentDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentDeleteAsync($id, $business_id) + public function documentDeleteAsync($id, $business_id, string $contentType = self::contentTypes['documentDelete'][0]) { - return $this->documentDeleteAsyncWithHttpInfo($id, $business_id) + return $this->documentDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7770,14 +8324,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentDeleteAsyncWithHttpInfo($id, $business_id) + public function documentDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['documentDelete'][0]) { $returnType = ''; - $request = $this->documentDeleteRequest($id, $business_id); + $request = $this->documentDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7796,7 +8351,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7807,18 +8362,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function documentDeleteRequest($id, $business_id) + public function documentDeleteRequest($id, $business_id, string $contentType = self::contentTypes['documentDelete'][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 documentDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7826,6 +8384,7 @@ protected function documentDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/document/{id}'; $formParams = []; $queryParams = []; @@ -7834,6 +8393,7 @@ protected function documentDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -7851,53 +8411,35 @@ protected function documentDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7918,10 +8460,11 @@ protected function documentDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7933,14 +8476,15 @@ protected function documentDeleteRequest($id, $business_id) * List Business Document Details * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentModel[] + * @return \OpenAPI\Client\Model\DocumentModel[] */ - public function documentGet($business_id) + public function documentGet($business_id, string $contentType = self::contentTypes['documentGet'][0]) { - list($response) = $this->documentGetWithHttpInfo($business_id); + list($response) = $this->documentGetWithHttpInfo($business_id, $contentType); return $response; } @@ -7950,15 +8494,15 @@ public function documentGet($business_id) * List Business Document Details * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function documentGetWithHttpInfo($business_id) + public function documentGetWithHttpInfo($business_id, string $contentType = self::contentTypes['documentGet'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel[]'; - $request = $this->documentGetRequest($business_id); + $request = $this->documentGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7967,9 +8511,16 @@ public function documentGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7980,19 +8531,37 @@ public function documentGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8009,7 +8578,7 @@ public function documentGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentModel[]', + '\OpenAPI\Client\Model\DocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8025,13 +8594,14 @@ public function documentGetWithHttpInfo($business_id) * List Business Document Details * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentGetAsync($business_id) + public function documentGetAsync($business_id, string $contentType = self::contentTypes['documentGet'][0]) { - return $this->documentGetAsyncWithHttpInfo($business_id) + return $this->documentGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8045,24 +8615,24 @@ function ($response) { * List Business Document Details * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentGetAsyncWithHttpInfo($business_id) + public function documentGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['documentGet'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel[]'; - $request = $this->documentGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\DocumentModel[]'; + $request = $this->documentGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8085,7 +8655,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8095,12 +8665,14 @@ function ($exception) { * Create request for operation 'documentGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function documentGetRequest($business_id) + public function documentGetRequest($business_id, string $contentType = self::contentTypes['documentGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8108,6 +8680,7 @@ protected function documentGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/document'; $formParams = []; $queryParams = []; @@ -8116,6 +8689,7 @@ protected function documentGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -8125,53 +8699,35 @@ protected function documentGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8192,10 +8748,11 @@ protected function documentGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8208,14 +8765,15 @@ protected function documentGetRequest($business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentModel + * @return \OpenAPI\Client\Model\DocumentModel */ - public function documentGetApiV2BusinessByBusinessIdDocumentById($id, $business_id) + public function documentGetApiV2BusinessByBusinessIdDocumentById($id, $business_id, string $contentType = self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'][0]) { - list($response) = $this->documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id, $business_id); + list($response) = $this->documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -8226,15 +8784,15 @@ public function documentGetApiV2BusinessByBusinessIdDocumentById($id, $business_ * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id, $business_id) + public function documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel'; - $request = $this->documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $business_id); + $request = $this->documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8243,9 +8801,16 @@ public function documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8256,19 +8821,37 @@ public function documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8285,7 +8868,7 @@ public function documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentModel', + '\OpenAPI\Client\Model\DocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8302,13 +8885,14 @@ public function documentGetApiV2BusinessByBusinessIdDocumentByIdWithHttpInfo($id * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentGetApiV2BusinessByBusinessIdDocumentByIdAsync($id, $business_id) + public function documentGetApiV2BusinessByBusinessIdDocumentByIdAsync($id, $business_id, string $contentType = self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'][0]) { - return $this->documentGetApiV2BusinessByBusinessIdDocumentByIdAsyncWithHttpInfo($id, $business_id) + return $this->documentGetApiV2BusinessByBusinessIdDocumentByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8323,24 +8907,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentGetApiV2BusinessByBusinessIdDocumentByIdAsyncWithHttpInfo($id, $business_id) + public function documentGetApiV2BusinessByBusinessIdDocumentByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel'; - $request = $this->documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\DocumentModel'; + $request = $this->documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8363,7 +8947,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8374,18 +8958,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $business_id) + public function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $business_id, string $contentType = self::contentTypes['documentGetApiV2BusinessByBusinessIdDocumentById'][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 documentGetApiV2BusinessByBusinessIdDocumentById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8393,6 +8980,7 @@ protected function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, ); } + $resourcePath = '/api/v2/business/{businessId}/document/{id}'; $formParams = []; $queryParams = []; @@ -8401,6 +8989,7 @@ protected function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -8418,53 +9007,35 @@ protected function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8485,10 +9056,11 @@ protected function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8501,14 +9073,15 @@ protected function documentGetApiV2BusinessByBusinessIdDocumentByIdRequest($id, * * @param string $business_id business_id (required) * @param bool $visible_to_all visible_to_all (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentModel[] + * @return \OpenAPI\Client\Model\DocumentModel[] */ - public function documentPost($business_id, $visible_to_all = 'false') + public function documentPost($business_id, $visible_to_all = false, string $contentType = self::contentTypes['documentPost'][0]) { - list($response) = $this->documentPostWithHttpInfo($business_id, $visible_to_all); + list($response) = $this->documentPostWithHttpInfo($business_id, $visible_to_all, $contentType); return $response; } @@ -8519,15 +9092,15 @@ public function documentPost($business_id, $visible_to_all = 'false') * * @param string $business_id (required) * @param bool $visible_to_all (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function documentPostWithHttpInfo($business_id, $visible_to_all = 'false') + public function documentPostWithHttpInfo($business_id, $visible_to_all = false, string $contentType = self::contentTypes['documentPost'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel[]'; - $request = $this->documentPostRequest($business_id, $visible_to_all); + $request = $this->documentPostRequest($business_id, $visible_to_all, $contentType); try { $options = $this->createHttpClientOption(); @@ -8536,9 +9109,16 @@ public function documentPostWithHttpInfo($business_id, $visible_to_all = 'false' } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8549,19 +9129,37 @@ public function documentPostWithHttpInfo($business_id, $visible_to_all = 'false' sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8578,7 +9176,7 @@ public function documentPostWithHttpInfo($business_id, $visible_to_all = 'false' case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentModel[]', + '\OpenAPI\Client\Model\DocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8595,13 +9193,14 @@ public function documentPostWithHttpInfo($business_id, $visible_to_all = 'false' * * @param string $business_id (required) * @param bool $visible_to_all (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentPostAsync($business_id, $visible_to_all = 'false') + public function documentPostAsync($business_id, $visible_to_all = false, string $contentType = self::contentTypes['documentPost'][0]) { - return $this->documentPostAsyncWithHttpInfo($business_id, $visible_to_all) + return $this->documentPostAsyncWithHttpInfo($business_id, $visible_to_all, $contentType) ->then( function ($response) { return $response[0]; @@ -8616,24 +9215,24 @@ function ($response) { * * @param string $business_id (required) * @param bool $visible_to_all (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentPostAsyncWithHttpInfo($business_id, $visible_to_all = 'false') + public function documentPostAsyncWithHttpInfo($business_id, $visible_to_all = false, string $contentType = self::contentTypes['documentPost'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel[]'; - $request = $this->documentPostRequest($business_id, $visible_to_all); + $returnType = '\OpenAPI\Client\Model\DocumentModel[]'; + $request = $this->documentPostRequest($business_id, $visible_to_all, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8656,7 +9255,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8667,12 +9266,14 @@ function ($exception) { * * @param string $business_id (required) * @param bool $visible_to_all (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function documentPostRequest($business_id, $visible_to_all = 'false') + public function documentPostRequest($business_id, $visible_to_all = false, string $contentType = self::contentTypes['documentPost'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8680,6 +9281,8 @@ protected function documentPostRequest($business_id, $visible_to_all = 'false') ); } + + $resourcePath = '/api/v2/business/{businessId}/document'; $formParams = []; $queryParams = []; @@ -8688,9 +9291,15 @@ protected function documentPostRequest($business_id, $visible_to_all = 'false') $multipart = false; // query params - if ($visible_to_all !== null) { - $queryParams['visibleToAll'] = ObjectSerializer::toQueryValue($visible_to_all); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $visible_to_all, + 'visibleToAll', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -8701,53 +9310,35 @@ protected function documentPostRequest($business_id, $visible_to_all = 'false') ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8768,10 +9359,11 @@ protected function documentPostRequest($business_id, $visible_to_all = 'false') $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8783,16 +9375,17 @@ protected function documentPostRequest($business_id, $visible_to_all = 'false') * Update Business Document Permissions * * @param int $id id (required) - * @param \Swagger\Client\Model\UpdateDocumentPermissionsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\UpdateDocumentPermissionsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentModel + * @return \OpenAPI\Client\Model\DocumentModel */ - public function documentPut($id, $model, $business_id) + public function documentPut($id, $business_id, $model, string $contentType = self::contentTypes['documentPut'][0]) { - list($response) = $this->documentPutWithHttpInfo($id, $model, $business_id); + list($response) = $this->documentPutWithHttpInfo($id, $business_id, $model, $contentType); return $response; } @@ -8802,17 +9395,17 @@ public function documentPut($id, $model, $business_id) * Update Business Document Permissions * * @param int $id (required) - * @param \Swagger\Client\Model\UpdateDocumentPermissionsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UpdateDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function documentPutWithHttpInfo($id, $model, $business_id) + public function documentPutWithHttpInfo($id, $business_id, $model, string $contentType = self::contentTypes['documentPut'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel'; - $request = $this->documentPutRequest($id, $model, $business_id); + $request = $this->documentPutRequest($id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -8821,9 +9414,16 @@ public function documentPutWithHttpInfo($id, $model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8834,19 +9434,37 @@ public function documentPutWithHttpInfo($id, $model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8863,7 +9481,7 @@ public function documentPutWithHttpInfo($id, $model, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentModel', + '\OpenAPI\Client\Model\DocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8879,15 +9497,16 @@ public function documentPutWithHttpInfo($id, $model, $business_id) * Update Business Document Permissions * * @param int $id (required) - * @param \Swagger\Client\Model\UpdateDocumentPermissionsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UpdateDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentPutAsync($id, $model, $business_id) + public function documentPutAsync($id, $business_id, $model, string $contentType = self::contentTypes['documentPut'][0]) { - return $this->documentPutAsyncWithHttpInfo($id, $model, $business_id) + return $this->documentPutAsyncWithHttpInfo($id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -8901,26 +9520,26 @@ function ($response) { * Update Business Document Permissions * * @param int $id (required) - * @param \Swagger\Client\Model\UpdateDocumentPermissionsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UpdateDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function documentPutAsyncWithHttpInfo($id, $model, $business_id) + public function documentPutAsyncWithHttpInfo($id, $business_id, $model, string $contentType = self::contentTypes['documentPut'][0]) { - $returnType = '\Swagger\Client\Model\DocumentModel'; - $request = $this->documentPutRequest($id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\DocumentModel'; + $request = $this->documentPutRequest($id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8943,7 +9562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8953,26 +9572,23 @@ function ($exception) { * Create request for operation 'documentPut' * * @param int $id (required) - * @param \Swagger\Client\Model\UpdateDocumentPermissionsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UpdateDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function documentPutRequest($id, $model, $business_id) + public function documentPutRequest($id, $business_id, $model, string $contentType = self::contentTypes['documentPut'][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 documentPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling documentPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8980,6 +9596,14 @@ protected function documentPutRequest($id, $model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling documentPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/document/{id}'; $formParams = []; $queryParams = []; @@ -8988,6 +9612,7 @@ protected function documentPutRequest($id, $model, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -9005,56 +9630,42 @@ protected function documentPutRequest($id, $model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9075,10 +9686,11 @@ protected function documentPutRequest($id, $model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9090,14 +9702,15 @@ protected function documentPutRequest($id, $model, $business_id) * List Entitlements * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['entitlementsGetEntitlements'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EntitlementsModel + * @return \OpenAPI\Client\Model\EntitlementsModel */ - public function entitlementsGetEntitlements($business_id) + public function entitlementsGetEntitlements($business_id, string $contentType = self::contentTypes['entitlementsGetEntitlements'][0]) { - list($response) = $this->entitlementsGetEntitlementsWithHttpInfo($business_id); + list($response) = $this->entitlementsGetEntitlementsWithHttpInfo($business_id, $contentType); return $response; } @@ -9107,15 +9720,15 @@ public function entitlementsGetEntitlements($business_id) * List Entitlements * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['entitlementsGetEntitlements'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EntitlementsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EntitlementsModel, HTTP status code, HTTP response headers (array of strings) */ - public function entitlementsGetEntitlementsWithHttpInfo($business_id) + public function entitlementsGetEntitlementsWithHttpInfo($business_id, string $contentType = self::contentTypes['entitlementsGetEntitlements'][0]) { - $returnType = '\Swagger\Client\Model\EntitlementsModel'; - $request = $this->entitlementsGetEntitlementsRequest($business_id); + $request = $this->entitlementsGetEntitlementsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -9124,9 +9737,16 @@ public function entitlementsGetEntitlementsWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9137,19 +9757,37 @@ public function entitlementsGetEntitlementsWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EntitlementsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EntitlementsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EntitlementsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EntitlementsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9166,7 +9804,7 @@ public function entitlementsGetEntitlementsWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EntitlementsModel', + '\OpenAPI\Client\Model\EntitlementsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9182,13 +9820,14 @@ public function entitlementsGetEntitlementsWithHttpInfo($business_id) * List Entitlements * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['entitlementsGetEntitlements'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function entitlementsGetEntitlementsAsync($business_id) + public function entitlementsGetEntitlementsAsync($business_id, string $contentType = self::contentTypes['entitlementsGetEntitlements'][0]) { - return $this->entitlementsGetEntitlementsAsyncWithHttpInfo($business_id) + return $this->entitlementsGetEntitlementsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -9202,24 +9841,24 @@ function ($response) { * List Entitlements * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['entitlementsGetEntitlements'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function entitlementsGetEntitlementsAsyncWithHttpInfo($business_id) + public function entitlementsGetEntitlementsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['entitlementsGetEntitlements'][0]) { - $returnType = '\Swagger\Client\Model\EntitlementsModel'; - $request = $this->entitlementsGetEntitlementsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\EntitlementsModel'; + $request = $this->entitlementsGetEntitlementsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9242,7 +9881,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9252,12 +9891,14 @@ function ($exception) { * Create request for operation 'entitlementsGetEntitlements' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['entitlementsGetEntitlements'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function entitlementsGetEntitlementsRequest($business_id) + public function entitlementsGetEntitlementsRequest($business_id, string $contentType = self::contentTypes['entitlementsGetEntitlements'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9265,6 +9906,7 @@ protected function entitlementsGetEntitlementsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/entitlements'; $formParams = []; $queryParams = []; @@ -9273,6 +9915,7 @@ protected function entitlementsGetEntitlementsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -9282,53 +9925,35 @@ protected function entitlementsGetEntitlementsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9349,10 +9974,11 @@ protected function entitlementsGetEntitlementsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9364,14 +9990,15 @@ protected function entitlementsGetEntitlementsRequest($business_id) * Get Rounding Rules * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesGetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimesheetRoundingRulesModel + * @return \OpenAPI\Client\Model\TimesheetRoundingRulesModel */ - public function roundingRulesGetRoundingRules($business_id) + public function roundingRulesGetRoundingRules($business_id, string $contentType = self::contentTypes['roundingRulesGetRoundingRules'][0]) { - list($response) = $this->roundingRulesGetRoundingRulesWithHttpInfo($business_id); + list($response) = $this->roundingRulesGetRoundingRulesWithHttpInfo($business_id, $contentType); return $response; } @@ -9381,15 +10008,15 @@ public function roundingRulesGetRoundingRules($business_id) * Get Rounding Rules * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesGetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimesheetRoundingRulesModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimesheetRoundingRulesModel, HTTP status code, HTTP response headers (array of strings) */ - public function roundingRulesGetRoundingRulesWithHttpInfo($business_id) + public function roundingRulesGetRoundingRulesWithHttpInfo($business_id, string $contentType = self::contentTypes['roundingRulesGetRoundingRules'][0]) { - $returnType = '\Swagger\Client\Model\TimesheetRoundingRulesModel'; - $request = $this->roundingRulesGetRoundingRulesRequest($business_id); + $request = $this->roundingRulesGetRoundingRulesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -9398,9 +10025,16 @@ public function roundingRulesGetRoundingRulesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9411,19 +10045,37 @@ public function roundingRulesGetRoundingRulesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimesheetRoundingRulesModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimesheetRoundingRulesModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimesheetRoundingRulesModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimesheetRoundingRulesModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9440,7 +10092,7 @@ public function roundingRulesGetRoundingRulesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimesheetRoundingRulesModel', + '\OpenAPI\Client\Model\TimesheetRoundingRulesModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9456,13 +10108,14 @@ public function roundingRulesGetRoundingRulesWithHttpInfo($business_id) * Get Rounding Rules * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesGetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function roundingRulesGetRoundingRulesAsync($business_id) + public function roundingRulesGetRoundingRulesAsync($business_id, string $contentType = self::contentTypes['roundingRulesGetRoundingRules'][0]) { - return $this->roundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id) + return $this->roundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -9476,24 +10129,24 @@ function ($response) { * Get Rounding Rules * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesGetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function roundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id) + public function roundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['roundingRulesGetRoundingRules'][0]) { - $returnType = '\Swagger\Client\Model\TimesheetRoundingRulesModel'; - $request = $this->roundingRulesGetRoundingRulesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\TimesheetRoundingRulesModel'; + $request = $this->roundingRulesGetRoundingRulesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9516,7 +10169,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9526,12 +10179,14 @@ function ($exception) { * Create request for operation 'roundingRulesGetRoundingRules' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesGetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function roundingRulesGetRoundingRulesRequest($business_id) + public function roundingRulesGetRoundingRulesRequest($business_id, string $contentType = self::contentTypes['roundingRulesGetRoundingRules'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9539,6 +10194,7 @@ protected function roundingRulesGetRoundingRulesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/roundingrules'; $formParams = []; $queryParams = []; @@ -9547,6 +10203,7 @@ protected function roundingRulesGetRoundingRulesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -9556,53 +10213,35 @@ protected function roundingRulesGetRoundingRulesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9623,10 +10262,11 @@ protected function roundingRulesGetRoundingRulesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9637,16 +10277,17 @@ protected function roundingRulesGetRoundingRulesRequest($business_id) * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules rounding_rules (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesSetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function roundingRulesSetRoundingRules($rounding_rules, $business_id) + public function roundingRulesSetRoundingRules($business_id, $rounding_rules, string $contentType = self::contentTypes['roundingRulesSetRoundingRules'][0]) { - $this->roundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $business_id); + $this->roundingRulesSetRoundingRulesWithHttpInfo($business_id, $rounding_rules, $contentType); } /** @@ -9654,17 +10295,17 @@ public function roundingRulesSetRoundingRules($rounding_rules, $business_id) * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesSetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function roundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $business_id) + public function roundingRulesSetRoundingRulesWithHttpInfo($business_id, $rounding_rules, string $contentType = self::contentTypes['roundingRulesSetRoundingRules'][0]) { - $returnType = ''; - $request = $this->roundingRulesSetRoundingRulesRequest($rounding_rules, $business_id); + $request = $this->roundingRulesSetRoundingRulesRequest($business_id, $rounding_rules, $contentType); try { $options = $this->createHttpClientOption(); @@ -9673,9 +10314,16 @@ public function roundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9686,11 +10334,11 @@ public function roundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -9708,15 +10356,16 @@ public function roundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $busi * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesSetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function roundingRulesSetRoundingRulesAsync($rounding_rules, $business_id) + public function roundingRulesSetRoundingRulesAsync($business_id, $rounding_rules, string $contentType = self::contentTypes['roundingRulesSetRoundingRules'][0]) { - return $this->roundingRulesSetRoundingRulesAsyncWithHttpInfo($rounding_rules, $business_id) + return $this->roundingRulesSetRoundingRulesAsyncWithHttpInfo($business_id, $rounding_rules, $contentType) ->then( function ($response) { return $response[0]; @@ -9729,16 +10378,17 @@ function ($response) { * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesSetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function roundingRulesSetRoundingRulesAsyncWithHttpInfo($rounding_rules, $business_id) + public function roundingRulesSetRoundingRulesAsyncWithHttpInfo($business_id, $rounding_rules, string $contentType = self::contentTypes['roundingRulesSetRoundingRules'][0]) { $returnType = ''; - $request = $this->roundingRulesSetRoundingRulesRequest($rounding_rules, $business_id); + $request = $this->roundingRulesSetRoundingRulesRequest($business_id, $rounding_rules, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9757,7 +10407,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9766,20 +10416,16 @@ function ($exception) { /** * Create request for operation 'roundingRulesSetRoundingRules' * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['roundingRulesSetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function roundingRulesSetRoundingRulesRequest($rounding_rules, $business_id) + public function roundingRulesSetRoundingRulesRequest($business_id, $rounding_rules, string $contentType = self::contentTypes['roundingRulesSetRoundingRules'][0]) { - // verify the required parameter 'rounding_rules' is set - if ($rounding_rules === null || (is_array($rounding_rules) && count($rounding_rules) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $rounding_rules when calling roundingRulesSetRoundingRules' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9787,6 +10433,14 @@ protected function roundingRulesSetRoundingRulesRequest($rounding_rules, $busine ); } + // verify the required parameter 'rounding_rules' is set + if ($rounding_rules === null || (is_array($rounding_rules) && count($rounding_rules) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rounding_rules when calling roundingRulesSetRoundingRules' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/roundingrules'; $formParams = []; $queryParams = []; @@ -9795,6 +10449,7 @@ protected function roundingRulesSetRoundingRulesRequest($rounding_rules, $busine $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -9804,56 +10459,42 @@ protected function roundingRulesSetRoundingRulesRequest($rounding_rules, $busine ); } - // body params - $_tempBody = null; - if (isset($rounding_rules)) { - $_tempBody = $rounding_rules; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($rounding_rules)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rounding_rules)); + } else { + $httpBody = $rounding_rules; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9874,10 +10515,11 @@ protected function roundingRulesSetRoundingRulesRequest($rounding_rules, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/ChartOfAccountsApi.php b/src/lib/Api/ChartOfAccountsApi.php index 9ab7cda..212eb35 100644 --- a/src/lib/Api/ChartOfAccountsApi.php +++ b/src/lib/Api/ChartOfAccountsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'accountsGet' => [ + 'application/json', + ], + 'accountsGetAccountTypes' => [ + 'application/json', + ], + 'accountsGetApiV2BusinessByBusinessIdAccountsById' => [ + 'application/json', + ], + 'accountsGetJournalService' => [ + 'application/json', + ], + 'accountsGetJournalServices' => [ + 'application/json', + ], + 'accountsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'accountsPostBulk' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'accountsPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'accountsPutJournalService' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auChartOfAccountsDelete' => [ + 'application/json', + ], + 'auChartOfAccountsGet' => [ + 'application/json', + ], + 'auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' => [ + 'application/json', + ], + 'auChartOfAccountsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +195,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function accountsDelete($id, $business_id) + public function accountsDelete($id, $business_id, string $contentType = self::contentTypes['accountsDelete'][0]) { - $this->accountsDeleteWithHttpInfo($id, $business_id); + $this->accountsDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +213,15 @@ public function accountsDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function accountsDeleteWithHttpInfo($id, $business_id) + public function accountsDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['accountsDelete'][0]) { - $returnType = ''; - $request = $this->accountsDeleteRequest($id, $business_id); + $request = $this->accountsDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +230,16 @@ public function accountsDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +250,11 @@ public function accountsDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +274,14 @@ public function accountsDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsDeleteAsync($id, $business_id) + public function accountsDeleteAsync($id, $business_id, string $contentType = self::contentTypes['accountsDelete'][0]) { - return $this->accountsDeleteAsyncWithHttpInfo($id, $business_id) + return $this->accountsDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +296,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsDeleteAsyncWithHttpInfo($id, $business_id) + public function accountsDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['accountsDelete'][0]) { $returnType = ''; - $request = $this->accountsDeleteRequest($id, $business_id); + $request = $this->accountsDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +323,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +334,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsDeleteRequest($id, $business_id) + public function accountsDeleteRequest($id, $business_id, string $contentType = self::contentTypes['accountsDelete'][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 accountsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +356,7 @@ protected function accountsDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/accounts/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +365,7 @@ protected function accountsDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +383,35 @@ protected function accountsDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +432,11 @@ protected function accountsDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -349,14 +448,15 @@ protected function accountsDeleteRequest($id, $business_id) * Get Journal Accounts * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalAccountModel[] + * @return \OpenAPI\Client\Model\JournalAccountModel[] */ - public function accountsGet($business_id) + public function accountsGet($business_id, string $contentType = self::contentTypes['accountsGet'][0]) { - list($response) = $this->accountsGetWithHttpInfo($business_id); + list($response) = $this->accountsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -366,15 +466,15 @@ public function accountsGet($business_id) * Get Journal Accounts * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalAccountModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalAccountModel[], HTTP status code, HTTP response headers (array of strings) */ - public function accountsGetWithHttpInfo($business_id) + public function accountsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGet'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel[]'; - $request = $this->accountsGetRequest($business_id); + $request = $this->accountsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -383,9 +483,16 @@ public function accountsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -396,19 +503,37 @@ public function accountsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalAccountModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalAccountModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalAccountModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalAccountModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -425,7 +550,7 @@ public function accountsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalAccountModel[]', + '\OpenAPI\Client\Model\JournalAccountModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -441,13 +566,14 @@ public function accountsGetWithHttpInfo($business_id) * Get Journal Accounts * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetAsync($business_id) + public function accountsGetAsync($business_id, string $contentType = self::contentTypes['accountsGet'][0]) { - return $this->accountsGetAsyncWithHttpInfo($business_id) + return $this->accountsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -461,24 +587,24 @@ function ($response) { * Get Journal Accounts * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetAsyncWithHttpInfo($business_id) + public function accountsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGet'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel[]'; - $request = $this->accountsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\JournalAccountModel[]'; + $request = $this->accountsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -501,7 +627,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -511,12 +637,14 @@ function ($exception) { * Create request for operation 'accountsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsGetRequest($business_id) + public function accountsGetRequest($business_id, string $contentType = self::contentTypes['accountsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -524,6 +652,7 @@ protected function accountsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/accounts'; $formParams = []; $queryParams = []; @@ -532,6 +661,7 @@ protected function accountsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -541,53 +671,35 @@ protected function accountsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -608,10 +720,11 @@ protected function accountsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -623,14 +736,15 @@ protected function accountsGetRequest($business_id) * Get Journal Account Types * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetAccountTypes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string[] */ - public function accountsGetAccountTypes($business_id) + public function accountsGetAccountTypes($business_id, string $contentType = self::contentTypes['accountsGetAccountTypes'][0]) { - list($response) = $this->accountsGetAccountTypesWithHttpInfo($business_id); + list($response) = $this->accountsGetAccountTypesWithHttpInfo($business_id, $contentType); return $response; } @@ -640,15 +754,15 @@ public function accountsGetAccountTypes($business_id) * Get Journal Account Types * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetAccountTypes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string[], HTTP status code, HTTP response headers (array of strings) */ - public function accountsGetAccountTypesWithHttpInfo($business_id) + public function accountsGetAccountTypesWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGetAccountTypes'][0]) { - $returnType = 'string[]'; - $request = $this->accountsGetAccountTypesRequest($business_id); + $request = $this->accountsGetAccountTypesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -657,9 +771,16 @@ public function accountsGetAccountTypesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -670,19 +791,37 @@ public function accountsGetAccountTypesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $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 = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -715,13 +854,14 @@ public function accountsGetAccountTypesWithHttpInfo($business_id) * Get Journal Account Types * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetAccountTypes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetAccountTypesAsync($business_id) + public function accountsGetAccountTypesAsync($business_id, string $contentType = self::contentTypes['accountsGetAccountTypes'][0]) { - return $this->accountsGetAccountTypesAsyncWithHttpInfo($business_id) + return $this->accountsGetAccountTypesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -735,24 +875,24 @@ function ($response) { * Get Journal Account Types * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetAccountTypes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetAccountTypesAsyncWithHttpInfo($business_id) + public function accountsGetAccountTypesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGetAccountTypes'][0]) { $returnType = 'string[]'; - $request = $this->accountsGetAccountTypesRequest($business_id); + $request = $this->accountsGetAccountTypesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -775,7 +915,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -785,12 +925,14 @@ function ($exception) { * Create request for operation 'accountsGetAccountTypes' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetAccountTypes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsGetAccountTypesRequest($business_id) + public function accountsGetAccountTypesRequest($business_id, string $contentType = self::contentTypes['accountsGetAccountTypes'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -798,6 +940,7 @@ protected function accountsGetAccountTypesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/accounts/types'; $formParams = []; $queryParams = []; @@ -806,6 +949,7 @@ protected function accountsGetAccountTypesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -815,53 +959,35 @@ protected function accountsGetAccountTypesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -882,10 +1008,11 @@ protected function accountsGetAccountTypesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -898,14 +1025,15 @@ protected function accountsGetAccountTypesRequest($business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalAccountModel + * @return \OpenAPI\Client\Model\JournalAccountModel */ - public function accountsGetApiV2BusinessByBusinessIdAccountsById($id, $business_id) + public function accountsGetApiV2BusinessByBusinessIdAccountsById($id, $business_id, string $contentType = self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'][0]) { - list($response) = $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id, $business_id); + list($response) = $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -916,15 +1044,15 @@ public function accountsGetApiV2BusinessByBusinessIdAccountsById($id, $business_ * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalAccountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalAccountModel, HTTP status code, HTTP response headers (array of strings) */ - public function accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id, $business_id) + public function accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel'; - $request = $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $business_id); + $request = $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -933,9 +1061,16 @@ public function accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -946,19 +1081,37 @@ public function accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalAccountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalAccountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalAccountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalAccountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -975,7 +1128,7 @@ public function accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalAccountModel', + '\OpenAPI\Client\Model\JournalAccountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -992,13 +1145,14 @@ public function accountsGetApiV2BusinessByBusinessIdAccountsByIdWithHttpInfo($id * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetApiV2BusinessByBusinessIdAccountsByIdAsync($id, $business_id) + public function accountsGetApiV2BusinessByBusinessIdAccountsByIdAsync($id, $business_id, string $contentType = self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'][0]) { - return $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdAsyncWithHttpInfo($id, $business_id) + return $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1013,24 +1167,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetApiV2BusinessByBusinessIdAccountsByIdAsyncWithHttpInfo($id, $business_id) + public function accountsGetApiV2BusinessByBusinessIdAccountsByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel'; - $request = $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\JournalAccountModel'; + $request = $this->accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1053,7 +1207,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1064,18 +1218,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $business_id) + public function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $business_id, string $contentType = self::contentTypes['accountsGetApiV2BusinessByBusinessIdAccountsById'][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 accountsGetApiV2BusinessByBusinessIdAccountsById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1083,6 +1240,7 @@ protected function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, ); } + $resourcePath = '/api/v2/business/{businessId}/accounts/{id}'; $formParams = []; $queryParams = []; @@ -1091,6 +1249,7 @@ protected function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1108,53 +1267,35 @@ protected function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1175,10 +1316,11 @@ protected function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1190,14 +1332,15 @@ protected function accountsGetApiV2BusinessByBusinessIdAccountsByIdRequest($id, * Get Journal Service provider * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalServiceProviderModel + * @return \OpenAPI\Client\Model\JournalServiceProviderModel */ - public function accountsGetJournalService($business_id) + public function accountsGetJournalService($business_id, string $contentType = self::contentTypes['accountsGetJournalService'][0]) { - list($response) = $this->accountsGetJournalServiceWithHttpInfo($business_id); + list($response) = $this->accountsGetJournalServiceWithHttpInfo($business_id, $contentType); return $response; } @@ -1207,15 +1350,15 @@ public function accountsGetJournalService($business_id) * Get Journal Service provider * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalServiceProviderModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalServiceProviderModel, HTTP status code, HTTP response headers (array of strings) */ - public function accountsGetJournalServiceWithHttpInfo($business_id) + public function accountsGetJournalServiceWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGetJournalService'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceProviderModel'; - $request = $this->accountsGetJournalServiceRequest($business_id); + $request = $this->accountsGetJournalServiceRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1224,9 +1367,16 @@ public function accountsGetJournalServiceWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1237,19 +1387,37 @@ public function accountsGetJournalServiceWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalServiceProviderModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalServiceProviderModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalServiceProviderModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalServiceProviderModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1266,7 +1434,7 @@ public function accountsGetJournalServiceWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalServiceProviderModel', + '\OpenAPI\Client\Model\JournalServiceProviderModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1282,13 +1450,14 @@ public function accountsGetJournalServiceWithHttpInfo($business_id) * Get Journal Service provider * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetJournalServiceAsync($business_id) + public function accountsGetJournalServiceAsync($business_id, string $contentType = self::contentTypes['accountsGetJournalService'][0]) { - return $this->accountsGetJournalServiceAsyncWithHttpInfo($business_id) + return $this->accountsGetJournalServiceAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1302,24 +1471,24 @@ function ($response) { * Get Journal Service provider * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetJournalServiceAsyncWithHttpInfo($business_id) + public function accountsGetJournalServiceAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGetJournalService'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceProviderModel'; - $request = $this->accountsGetJournalServiceRequest($business_id); + $returnType = '\OpenAPI\Client\Model\JournalServiceProviderModel'; + $request = $this->accountsGetJournalServiceRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1342,7 +1511,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1352,12 +1521,14 @@ function ($exception) { * Create request for operation 'accountsGetJournalService' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsGetJournalServiceRequest($business_id) + public function accountsGetJournalServiceRequest($business_id, string $contentType = self::contentTypes['accountsGetJournalService'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1365,6 +1536,7 @@ protected function accountsGetJournalServiceRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/accounts/journalservice'; $formParams = []; $queryParams = []; @@ -1373,6 +1545,7 @@ protected function accountsGetJournalServiceRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1382,53 +1555,35 @@ protected function accountsGetJournalServiceRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1449,10 +1604,11 @@ protected function accountsGetJournalServiceRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1464,14 +1620,15 @@ protected function accountsGetJournalServiceRequest($business_id) * Get Journal Service providers * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalServices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string[] */ - public function accountsGetJournalServices($business_id) + public function accountsGetJournalServices($business_id, string $contentType = self::contentTypes['accountsGetJournalServices'][0]) { - list($response) = $this->accountsGetJournalServicesWithHttpInfo($business_id); + list($response) = $this->accountsGetJournalServicesWithHttpInfo($business_id, $contentType); return $response; } @@ -1481,15 +1638,15 @@ public function accountsGetJournalServices($business_id) * Get Journal Service providers * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalServices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string[], HTTP status code, HTTP response headers (array of strings) */ - public function accountsGetJournalServicesWithHttpInfo($business_id) + public function accountsGetJournalServicesWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGetJournalServices'][0]) { - $returnType = 'string[]'; - $request = $this->accountsGetJournalServicesRequest($business_id); + $request = $this->accountsGetJournalServicesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1498,9 +1655,16 @@ public function accountsGetJournalServicesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1511,19 +1675,37 @@ public function accountsGetJournalServicesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $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 = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1556,13 +1738,14 @@ public function accountsGetJournalServicesWithHttpInfo($business_id) * Get Journal Service providers * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalServices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetJournalServicesAsync($business_id) + public function accountsGetJournalServicesAsync($business_id, string $contentType = self::contentTypes['accountsGetJournalServices'][0]) { - return $this->accountsGetJournalServicesAsyncWithHttpInfo($business_id) + return $this->accountsGetJournalServicesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1576,24 +1759,24 @@ function ($response) { * Get Journal Service providers * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalServices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsGetJournalServicesAsyncWithHttpInfo($business_id) + public function accountsGetJournalServicesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['accountsGetJournalServices'][0]) { $returnType = 'string[]'; - $request = $this->accountsGetJournalServicesRequest($business_id); + $request = $this->accountsGetJournalServicesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1616,7 +1799,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1626,12 +1809,14 @@ function ($exception) { * Create request for operation 'accountsGetJournalServices' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsGetJournalServices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsGetJournalServicesRequest($business_id) + public function accountsGetJournalServicesRequest($business_id, string $contentType = self::contentTypes['accountsGetJournalServices'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1639,6 +1824,7 @@ protected function accountsGetJournalServicesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/accounts/journalservices'; $formParams = []; $queryParams = []; @@ -1647,6 +1833,7 @@ protected function accountsGetJournalServicesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1656,53 +1843,35 @@ protected function accountsGetJournalServicesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1723,10 +1892,11 @@ protected function accountsGetJournalServicesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1737,16 +1907,17 @@ protected function accountsGetJournalServicesRequest($business_id) * * Create a new Journal Account * - * @param \Swagger\Client\Model\JournalAccountModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalAccountModel + * @return \OpenAPI\Client\Model\JournalAccountModel */ - public function accountsPost($request, $business_id) + public function accountsPost($business_id, $request, string $contentType = self::contentTypes['accountsPost'][0]) { - list($response) = $this->accountsPostWithHttpInfo($request, $business_id); + list($response) = $this->accountsPostWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -1755,17 +1926,17 @@ public function accountsPost($request, $business_id) * * Create a new Journal Account * - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalAccountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalAccountModel, HTTP status code, HTTP response headers (array of strings) */ - public function accountsPostWithHttpInfo($request, $business_id) + public function accountsPostWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['accountsPost'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel'; - $request = $this->accountsPostRequest($request, $business_id); + $request = $this->accountsPostRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -1774,9 +1945,16 @@ public function accountsPostWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1787,19 +1965,37 @@ public function accountsPostWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalAccountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalAccountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalAccountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalAccountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1816,7 +2012,7 @@ public function accountsPostWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalAccountModel', + '\OpenAPI\Client\Model\JournalAccountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1831,15 +2027,16 @@ public function accountsPostWithHttpInfo($request, $business_id) * * Create a new Journal Account * - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPostAsync($request, $business_id) + public function accountsPostAsync($business_id, $request, string $contentType = self::contentTypes['accountsPost'][0]) { - return $this->accountsPostAsyncWithHttpInfo($request, $business_id) + return $this->accountsPostAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -1852,26 +2049,26 @@ function ($response) { * * Create a new Journal Account * - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPostAsyncWithHttpInfo($request, $business_id) + public function accountsPostAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['accountsPost'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel'; - $request = $this->accountsPostRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\JournalAccountModel'; + $request = $this->accountsPostRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1894,7 +2091,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1903,20 +2100,16 @@ function ($exception) { /** * Create request for operation 'accountsPost' * - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsPostRequest($request, $business_id) + public function accountsPostRequest($business_id, $request, string $contentType = self::contentTypes['accountsPost'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling accountsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1924,6 +2117,14 @@ protected function accountsPostRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling accountsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/accounts'; $formParams = []; $queryParams = []; @@ -1932,6 +2133,7 @@ protected function accountsPostRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1941,56 +2143,42 @@ protected function accountsPostRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2011,10 +2199,11 @@ protected function accountsPostRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2025,16 +2214,17 @@ protected function accountsPostRequest($request, $business_id) * * Bulk insert Journal Accounts * - * @param \Swagger\Client\Model\JournalAccountModel[] $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel[] $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPostBulk'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalAccountBulkCreateModel + * @return \OpenAPI\Client\Model\JournalAccountBulkCreateModel */ - public function accountsPostBulk($request, $business_id) + public function accountsPostBulk($business_id, $request, string $contentType = self::contentTypes['accountsPostBulk'][0]) { - list($response) = $this->accountsPostBulkWithHttpInfo($request, $business_id); + list($response) = $this->accountsPostBulkWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -2043,17 +2233,17 @@ public function accountsPostBulk($request, $business_id) * * Bulk insert Journal Accounts * - * @param \Swagger\Client\Model\JournalAccountModel[] $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel[] $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPostBulk'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalAccountBulkCreateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalAccountBulkCreateModel, HTTP status code, HTTP response headers (array of strings) */ - public function accountsPostBulkWithHttpInfo($request, $business_id) + public function accountsPostBulkWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['accountsPostBulk'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountBulkCreateModel'; - $request = $this->accountsPostBulkRequest($request, $business_id); + $request = $this->accountsPostBulkRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2062,9 +2252,16 @@ public function accountsPostBulkWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2075,19 +2272,37 @@ public function accountsPostBulkWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalAccountBulkCreateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalAccountBulkCreateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalAccountBulkCreateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalAccountBulkCreateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2104,7 +2319,7 @@ public function accountsPostBulkWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalAccountBulkCreateModel', + '\OpenAPI\Client\Model\JournalAccountBulkCreateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2119,15 +2334,16 @@ public function accountsPostBulkWithHttpInfo($request, $business_id) * * Bulk insert Journal Accounts * - * @param \Swagger\Client\Model\JournalAccountModel[] $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel[] $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPostBulk'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPostBulkAsync($request, $business_id) + public function accountsPostBulkAsync($business_id, $request, string $contentType = self::contentTypes['accountsPostBulk'][0]) { - return $this->accountsPostBulkAsyncWithHttpInfo($request, $business_id) + return $this->accountsPostBulkAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2140,26 +2356,26 @@ function ($response) { * * Bulk insert Journal Accounts * - * @param \Swagger\Client\Model\JournalAccountModel[] $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel[] $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPostBulk'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPostBulkAsyncWithHttpInfo($request, $business_id) + public function accountsPostBulkAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['accountsPostBulk'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountBulkCreateModel'; - $request = $this->accountsPostBulkRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\JournalAccountBulkCreateModel'; + $request = $this->accountsPostBulkRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2182,7 +2398,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2191,20 +2407,16 @@ function ($exception) { /** * Create request for operation 'accountsPostBulk' * - * @param \Swagger\Client\Model\JournalAccountModel[] $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel[] $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPostBulk'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsPostBulkRequest($request, $business_id) + public function accountsPostBulkRequest($business_id, $request, string $contentType = self::contentTypes['accountsPostBulk'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling accountsPostBulk' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2212,6 +2424,14 @@ protected function accountsPostBulkRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling accountsPostBulk' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/accounts/bulk'; $formParams = []; $queryParams = []; @@ -2220,6 +2440,7 @@ protected function accountsPostBulkRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2229,56 +2450,42 @@ protected function accountsPostBulkRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2299,10 +2506,11 @@ protected function accountsPostBulkRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2314,16 +2522,17 @@ protected function accountsPostBulkRequest($request, $business_id) * Update an existing Journal Account * * @param int $id id (required) - * @param \Swagger\Client\Model\JournalAccountModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalAccountModel + * @return \OpenAPI\Client\Model\JournalAccountModel */ - public function accountsPut($id, $request, $business_id) + public function accountsPut($id, $business_id, $request, string $contentType = self::contentTypes['accountsPut'][0]) { - list($response) = $this->accountsPutWithHttpInfo($id, $request, $business_id); + list($response) = $this->accountsPutWithHttpInfo($id, $business_id, $request, $contentType); return $response; } @@ -2333,17 +2542,17 @@ public function accountsPut($id, $request, $business_id) * Update an existing Journal Account * * @param int $id (required) - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalAccountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalAccountModel, HTTP status code, HTTP response headers (array of strings) */ - public function accountsPutWithHttpInfo($id, $request, $business_id) + public function accountsPutWithHttpInfo($id, $business_id, $request, string $contentType = self::contentTypes['accountsPut'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel'; - $request = $this->accountsPutRequest($id, $request, $business_id); + $request = $this->accountsPutRequest($id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2352,9 +2561,16 @@ public function accountsPutWithHttpInfo($id, $request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2365,19 +2581,37 @@ public function accountsPutWithHttpInfo($id, $request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalAccountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalAccountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalAccountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalAccountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2394,7 +2628,7 @@ public function accountsPutWithHttpInfo($id, $request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalAccountModel', + '\OpenAPI\Client\Model\JournalAccountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2410,15 +2644,16 @@ public function accountsPutWithHttpInfo($id, $request, $business_id) * Update an existing Journal Account * * @param int $id (required) - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPutAsync($id, $request, $business_id) + public function accountsPutAsync($id, $business_id, $request, string $contentType = self::contentTypes['accountsPut'][0]) { - return $this->accountsPutAsyncWithHttpInfo($id, $request, $business_id) + return $this->accountsPutAsyncWithHttpInfo($id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2432,26 +2667,26 @@ function ($response) { * Update an existing Journal Account * * @param int $id (required) - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPutAsyncWithHttpInfo($id, $request, $business_id) + public function accountsPutAsyncWithHttpInfo($id, $business_id, $request, string $contentType = self::contentTypes['accountsPut'][0]) { - $returnType = '\Swagger\Client\Model\JournalAccountModel'; - $request = $this->accountsPutRequest($id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\JournalAccountModel'; + $request = $this->accountsPutRequest($id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2474,7 +2709,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2484,26 +2719,23 @@ function ($exception) { * Create request for operation 'accountsPut' * * @param int $id (required) - * @param \Swagger\Client\Model\JournalAccountModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalAccountModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsPutRequest($id, $request, $business_id) + public function accountsPutRequest($id, $business_id, $request, string $contentType = self::contentTypes['accountsPut'][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 accountsPut' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling accountsPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2511,6 +2743,14 @@ protected function accountsPutRequest($id, $request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling accountsPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/accounts/{id}'; $formParams = []; $queryParams = []; @@ -2519,6 +2759,7 @@ protected function accountsPutRequest($id, $request, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2536,56 +2777,42 @@ protected function accountsPutRequest($id, $request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2606,10 +2833,11 @@ protected function accountsPutRequest($id, $request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2620,16 +2848,17 @@ protected function accountsPutRequest($id, $request, $business_id) * * Update Journal Service provider * - * @param \Swagger\Client\Model\JournalServiceProviderModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\JournalServiceProviderModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPutJournalService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalServiceProviderModel + * @return \OpenAPI\Client\Model\JournalServiceProviderModel */ - public function accountsPutJournalService($model, $business_id) + public function accountsPutJournalService($business_id, $model, string $contentType = self::contentTypes['accountsPutJournalService'][0]) { - list($response) = $this->accountsPutJournalServiceWithHttpInfo($model, $business_id); + list($response) = $this->accountsPutJournalServiceWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -2638,17 +2867,17 @@ public function accountsPutJournalService($model, $business_id) * * Update Journal Service provider * - * @param \Swagger\Client\Model\JournalServiceProviderModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalServiceProviderModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPutJournalService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalServiceProviderModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalServiceProviderModel, HTTP status code, HTTP response headers (array of strings) */ - public function accountsPutJournalServiceWithHttpInfo($model, $business_id) + public function accountsPutJournalServiceWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['accountsPutJournalService'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceProviderModel'; - $request = $this->accountsPutJournalServiceRequest($model, $business_id); + $request = $this->accountsPutJournalServiceRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2657,9 +2886,16 @@ public function accountsPutJournalServiceWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2670,19 +2906,37 @@ public function accountsPutJournalServiceWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalServiceProviderModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalServiceProviderModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalServiceProviderModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalServiceProviderModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2699,7 +2953,7 @@ public function accountsPutJournalServiceWithHttpInfo($model, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalServiceProviderModel', + '\OpenAPI\Client\Model\JournalServiceProviderModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2714,15 +2968,16 @@ public function accountsPutJournalServiceWithHttpInfo($model, $business_id) * * Update Journal Service provider * - * @param \Swagger\Client\Model\JournalServiceProviderModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalServiceProviderModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPutJournalService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPutJournalServiceAsync($model, $business_id) + public function accountsPutJournalServiceAsync($business_id, $model, string $contentType = self::contentTypes['accountsPutJournalService'][0]) { - return $this->accountsPutJournalServiceAsyncWithHttpInfo($model, $business_id) + return $this->accountsPutJournalServiceAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2735,26 +2990,26 @@ function ($response) { * * Update Journal Service provider * - * @param \Swagger\Client\Model\JournalServiceProviderModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalServiceProviderModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPutJournalService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function accountsPutJournalServiceAsyncWithHttpInfo($model, $business_id) + public function accountsPutJournalServiceAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['accountsPutJournalService'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceProviderModel'; - $request = $this->accountsPutJournalServiceRequest($model, $business_id); + $returnType = '\OpenAPI\Client\Model\JournalServiceProviderModel'; + $request = $this->accountsPutJournalServiceRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2777,7 +3032,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2786,20 +3041,16 @@ function ($exception) { /** * Create request for operation 'accountsPutJournalService' * - * @param \Swagger\Client\Model\JournalServiceProviderModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\JournalServiceProviderModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsPutJournalService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function accountsPutJournalServiceRequest($model, $business_id) + public function accountsPutJournalServiceRequest($business_id, $model, string $contentType = self::contentTypes['accountsPutJournalService'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling accountsPutJournalService' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2807,6 +3058,14 @@ protected function accountsPutJournalServiceRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling accountsPutJournalService' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/accounts/journalservice'; $formParams = []; $queryParams = []; @@ -2815,6 +3074,7 @@ protected function accountsPutJournalServiceRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2824,56 +3084,42 @@ protected function accountsPutJournalServiceRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2894,10 +3140,11 @@ protected function accountsPutJournalServiceRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2910,14 +3157,15 @@ protected function accountsPutJournalServiceRequest($model, $business_id) * * @param int $location_id location_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auChartOfAccountsDelete($location_id, $business_id) + public function auChartOfAccountsDelete($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsDelete'][0]) { - $this->auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id); + $this->auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id, $contentType); } /** @@ -2927,15 +3175,15 @@ public function auChartOfAccountsDelete($location_id, $business_id) * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id) + public function auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsDelete'][0]) { - $returnType = ''; - $request = $this->auChartOfAccountsDeleteRequest($location_id, $business_id); + $request = $this->auChartOfAccountsDeleteRequest($location_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2944,9 +3192,16 @@ public function auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2957,11 +3212,11 @@ public function auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2981,13 +3236,14 @@ public function auChartOfAccountsDeleteWithHttpInfo($location_id, $business_id) * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsDeleteAsync($location_id, $business_id) + public function auChartOfAccountsDeleteAsync($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsDelete'][0]) { - return $this->auChartOfAccountsDeleteAsyncWithHttpInfo($location_id, $business_id) + return $this->auChartOfAccountsDeleteAsyncWithHttpInfo($location_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3002,14 +3258,15 @@ function ($response) { * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsDeleteAsyncWithHttpInfo($location_id, $business_id) + public function auChartOfAccountsDeleteAsyncWithHttpInfo($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsDelete'][0]) { $returnType = ''; - $request = $this->auChartOfAccountsDeleteRequest($location_id, $business_id); + $request = $this->auChartOfAccountsDeleteRequest($location_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3028,7 +3285,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3039,18 +3296,21 @@ function ($exception) { * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auChartOfAccountsDeleteRequest($location_id, $business_id) + public function auChartOfAccountsDeleteRequest($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsDelete'][0]) { + // verify the required parameter 'location_id' is set if ($location_id === null || (is_array($location_id) && count($location_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $location_id when calling auChartOfAccountsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3058,6 +3318,7 @@ protected function auChartOfAccountsDeleteRequest($location_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/chartofaccounts/location/{locationId}'; $formParams = []; $queryParams = []; @@ -3066,6 +3327,7 @@ protected function auChartOfAccountsDeleteRequest($location_id, $business_id) $multipart = false; + // path params if ($location_id !== null) { $resourcePath = str_replace( @@ -3083,53 +3345,35 @@ protected function auChartOfAccountsDeleteRequest($location_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3150,10 +3394,11 @@ protected function auChartOfAccountsDeleteRequest($location_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3165,14 +3410,15 @@ protected function auChartOfAccountsDeleteRequest($location_id, $business_id) * Get Chart of Accounts * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuChartOfAccountsModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsModel */ - public function auChartOfAccountsGet($business_id) + public function auChartOfAccountsGet($business_id, string $contentType = self::contentTypes['auChartOfAccountsGet'][0]) { - list($response) = $this->auChartOfAccountsGetWithHttpInfo($business_id); + list($response) = $this->auChartOfAccountsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -3182,15 +3428,15 @@ public function auChartOfAccountsGet($business_id) * Get Chart of Accounts * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuChartOfAccountsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuChartOfAccountsModel, HTTP status code, HTTP response headers (array of strings) */ - public function auChartOfAccountsGetWithHttpInfo($business_id) + public function auChartOfAccountsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auChartOfAccountsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsModel'; - $request = $this->auChartOfAccountsGetRequest($business_id); + $request = $this->auChartOfAccountsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3199,9 +3445,16 @@ public function auChartOfAccountsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3212,19 +3465,37 @@ public function auChartOfAccountsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuChartOfAccountsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuChartOfAccountsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuChartOfAccountsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3241,7 +3512,7 @@ public function auChartOfAccountsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuChartOfAccountsModel', + '\OpenAPI\Client\Model\AuChartOfAccountsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3257,13 +3528,14 @@ public function auChartOfAccountsGetWithHttpInfo($business_id) * Get Chart of Accounts * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsGetAsync($business_id) + public function auChartOfAccountsGetAsync($business_id, string $contentType = self::contentTypes['auChartOfAccountsGet'][0]) { - return $this->auChartOfAccountsGetAsyncWithHttpInfo($business_id) + return $this->auChartOfAccountsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3277,24 +3549,24 @@ function ($response) { * Get Chart of Accounts * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsGetAsyncWithHttpInfo($business_id) + public function auChartOfAccountsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auChartOfAccountsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsModel'; - $request = $this->auChartOfAccountsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsModel'; + $request = $this->auChartOfAccountsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3317,7 +3589,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3327,12 +3599,14 @@ function ($exception) { * Create request for operation 'auChartOfAccountsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auChartOfAccountsGetRequest($business_id) + public function auChartOfAccountsGetRequest($business_id, string $contentType = self::contentTypes['auChartOfAccountsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3340,6 +3614,7 @@ protected function auChartOfAccountsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/chartofaccounts'; $formParams = []; $queryParams = []; @@ -3348,6 +3623,7 @@ protected function auChartOfAccountsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3357,53 +3633,35 @@ protected function auChartOfAccountsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3424,10 +3682,11 @@ protected function auChartOfAccountsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3440,14 +3699,15 @@ protected function auChartOfAccountsGetRequest($business_id) * * @param int $location_id location_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel */ - public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId($location_id, $business_id) + public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - list($response) = $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $business_id); + list($response) = $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $business_id, $contentType); return $response; } @@ -3458,15 +3718,15 @@ public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLoca * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel, HTTP status code, HTTP response headers (array of strings) */ - public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $business_id) + public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel'; - $request = $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id); + $request = $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3475,9 +3735,16 @@ public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLoca } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3488,19 +3755,37 @@ public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLoca sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3517,7 +3802,7 @@ public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLoca case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel', + '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3534,13 +3819,14 @@ public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLoca * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsync($location_id, $business_id) + public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsync($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - return $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $business_id) + return $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3555,24 +3841,24 @@ function ($response) { * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $business_id) + public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel'; - $request = $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel'; + $request = $this->auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3595,7 +3881,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3606,18 +3892,21 @@ function ($exception) { * * @param int $location_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id) + public function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id, string $contentType = self::contentTypes['auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { + // verify the required parameter 'location_id' is set if ($location_id === null || (is_array($location_id) && count($location_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $location_id when calling auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3625,6 +3914,7 @@ protected function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsL ); } + $resourcePath = '/api/v2/business/{businessId}/chartofaccounts/location/{locationId}'; $formParams = []; $queryParams = []; @@ -3633,6 +3923,7 @@ protected function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsL $multipart = false; + // path params if ($location_id !== null) { $resourcePath = str_replace( @@ -3650,53 +3941,35 @@ protected function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsL ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3717,10 +3990,11 @@ protected function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsL $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3731,16 +4005,17 @@ protected function auChartOfAccountsGetApiV2BusinessByBusinessIdChartofaccountsL * * Update Chart of Accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts chart_of_accounts (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuChartOfAccountsModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsModel */ - public function auChartOfAccountsPost($chart_of_accounts, $business_id) + public function auChartOfAccountsPost($business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPost'][0]) { - list($response) = $this->auChartOfAccountsPostWithHttpInfo($chart_of_accounts, $business_id); + list($response) = $this->auChartOfAccountsPostWithHttpInfo($business_id, $chart_of_accounts, $contentType); return $response; } @@ -3749,17 +4024,17 @@ public function auChartOfAccountsPost($chart_of_accounts, $business_id) * * Update Chart of Accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuChartOfAccountsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuChartOfAccountsModel, HTTP status code, HTTP response headers (array of strings) */ - public function auChartOfAccountsPostWithHttpInfo($chart_of_accounts, $business_id) + public function auChartOfAccountsPostWithHttpInfo($business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPost'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsModel'; - $request = $this->auChartOfAccountsPostRequest($chart_of_accounts, $business_id); + $request = $this->auChartOfAccountsPostRequest($business_id, $chart_of_accounts, $contentType); try { $options = $this->createHttpClientOption(); @@ -3768,9 +4043,16 @@ public function auChartOfAccountsPostWithHttpInfo($chart_of_accounts, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3781,19 +4063,37 @@ public function auChartOfAccountsPostWithHttpInfo($chart_of_accounts, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuChartOfAccountsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuChartOfAccountsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuChartOfAccountsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3810,7 +4110,7 @@ public function auChartOfAccountsPostWithHttpInfo($chart_of_accounts, $business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuChartOfAccountsModel', + '\OpenAPI\Client\Model\AuChartOfAccountsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3825,15 +4125,16 @@ public function auChartOfAccountsPostWithHttpInfo($chart_of_accounts, $business_ * * Update Chart of Accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsPostAsync($chart_of_accounts, $business_id) + public function auChartOfAccountsPostAsync($business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPost'][0]) { - return $this->auChartOfAccountsPostAsyncWithHttpInfo($chart_of_accounts, $business_id) + return $this->auChartOfAccountsPostAsyncWithHttpInfo($business_id, $chart_of_accounts, $contentType) ->then( function ($response) { return $response[0]; @@ -3846,26 +4147,26 @@ function ($response) { * * Update Chart of Accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsPostAsyncWithHttpInfo($chart_of_accounts, $business_id) + public function auChartOfAccountsPostAsyncWithHttpInfo($business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPost'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsModel'; - $request = $this->auChartOfAccountsPostRequest($chart_of_accounts, $business_id); + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsModel'; + $request = $this->auChartOfAccountsPostRequest($business_id, $chart_of_accounts, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3888,7 +4189,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3897,20 +4198,16 @@ function ($exception) { /** * Create request for operation 'auChartOfAccountsPost' * - * @param \Swagger\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auChartOfAccountsPostRequest($chart_of_accounts, $business_id) + public function auChartOfAccountsPostRequest($business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPost'][0]) { - // verify the required parameter 'chart_of_accounts' is set - if ($chart_of_accounts === null || (is_array($chart_of_accounts) && count($chart_of_accounts) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $chart_of_accounts when calling auChartOfAccountsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3918,6 +4215,14 @@ protected function auChartOfAccountsPostRequest($chart_of_accounts, $business_id ); } + // verify the required parameter 'chart_of_accounts' is set + if ($chart_of_accounts === null || (is_array($chart_of_accounts) && count($chart_of_accounts) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $chart_of_accounts when calling auChartOfAccountsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/chartofaccounts'; $formParams = []; $queryParams = []; @@ -3926,6 +4231,7 @@ protected function auChartOfAccountsPostRequest($chart_of_accounts, $business_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3935,56 +4241,42 @@ protected function auChartOfAccountsPostRequest($chart_of_accounts, $business_id ); } - // body params - $_tempBody = null; - if (isset($chart_of_accounts)) { - $_tempBody = $chart_of_accounts; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($chart_of_accounts)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($chart_of_accounts)); + } else { + $httpBody = $chart_of_accounts; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4005,10 +4297,11 @@ protected function auChartOfAccountsPostRequest($chart_of_accounts, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4020,16 +4313,17 @@ protected function auChartOfAccountsPostRequest($chart_of_accounts, $business_id * Update Location Specific Chart of Accounts * * @param int $location_id location_id (required) - * @param \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts chart_of_accounts (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel */ - public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId($location_id, $chart_of_accounts, $business_id) + public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId($location_id, $business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - list($response) = $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $chart_of_accounts, $business_id); + list($response) = $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $business_id, $chart_of_accounts, $contentType); return $response; } @@ -4039,17 +4333,17 @@ public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLoc * Update Location Specific Chart of Accounts * * @param int $location_id (required) - * @param \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel, HTTP status code, HTTP response headers (array of strings) */ - public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $chart_of_accounts, $business_id) + public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdWithHttpInfo($location_id, $business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel'; - $request = $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $chart_of_accounts, $business_id); + $request = $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id, $chart_of_accounts, $contentType); try { $options = $this->createHttpClientOption(); @@ -4058,9 +4352,16 @@ public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLoc } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4071,19 +4372,37 @@ public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLoc sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4100,7 +4419,7 @@ public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLoc case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel', + '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4116,15 +4435,16 @@ public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLoc * Update Location Specific Chart of Accounts * * @param int $location_id (required) - * @param \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsync($location_id, $chart_of_accounts, $business_id) + public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsync($location_id, $business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - return $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $chart_of_accounts, $business_id) + return $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $business_id, $chart_of_accounts, $contentType) ->then( function ($response) { return $response[0]; @@ -4138,26 +4458,26 @@ function ($response) { * Update Location Specific Chart of Accounts * * @param int $location_id (required) - * @param \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $chart_of_accounts, $business_id) + public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdAsyncWithHttpInfo($location_id, $business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { - $returnType = '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel'; - $request = $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $chart_of_accounts, $business_id); + $returnType = '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel'; + $request = $this->auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id, $chart_of_accounts, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4180,7 +4500,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4190,26 +4510,23 @@ function ($exception) { * Create request for operation 'auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' * * @param int $location_id (required) - * @param \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel $chart_of_accounts (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $chart_of_accounts, $business_id) + public function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationIdRequest($location_id, $business_id, $chart_of_accounts, string $contentType = self::contentTypes['auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId'][0]) { + // verify the required parameter 'location_id' is set if ($location_id === null || (is_array($location_id) && count($location_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $location_id when calling auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' ); } - // verify the required parameter 'chart_of_accounts' is set - if ($chart_of_accounts === null || (is_array($chart_of_accounts) && count($chart_of_accounts) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $chart_of_accounts when calling auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4217,6 +4534,14 @@ protected function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccounts ); } + // verify the required parameter 'chart_of_accounts' is set + if ($chart_of_accounts === null || (is_array($chart_of_accounts) && count($chart_of_accounts) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $chart_of_accounts when calling auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccountsLocationByLocationId' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/chartofaccounts/location/{locationId}'; $formParams = []; $queryParams = []; @@ -4225,6 +4550,7 @@ protected function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccounts $multipart = false; + // path params if ($location_id !== null) { $resourcePath = str_replace( @@ -4242,56 +4568,42 @@ protected function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccounts ); } - // body params - $_tempBody = null; - if (isset($chart_of_accounts)) { - $_tempBody = $chart_of_accounts; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($chart_of_accounts)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($chart_of_accounts)); + } else { + $httpBody = $chart_of_accounts; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4312,10 +4624,11 @@ protected function auChartOfAccountsPostApiV2BusinessByBusinessIdChartofaccounts $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/DeductionCategoriesApi.php b/src/lib/Api/DeductionCategoriesApi.php index 908407e..99dbefd 100644 --- a/src/lib/Api/DeductionCategoriesApi.php +++ b/src/lib/Api/DeductionCategoriesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auDeductionCategoryGet' => [ + 'application/json', + ], + 'auDeductionCategoryGetDeductionCategories' => [ + 'application/json', + ], + 'auDeductionCategoryPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auDeductionCategoryPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auDeductionCategoryDelete($id, $business_id) + public function auDeductionCategoryDelete($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryDelete'][0]) { - $this->auDeductionCategoryDeleteWithHttpInfo($id, $business_id); + $this->auDeductionCategoryDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auDeductionCategoryDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auDeductionCategoryDeleteWithHttpInfo($id, $business_id) + public function auDeductionCategoryDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryDelete'][0]) { - $returnType = ''; - $request = $this->auDeductionCategoryDeleteRequest($id, $business_id); + $request = $this->auDeductionCategoryDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auDeductionCategoryDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auDeductionCategoryDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auDeductionCategoryDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryDeleteAsync($id, $business_id) + public function auDeductionCategoryDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryDelete'][0]) { - return $this->auDeductionCategoryDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auDeductionCategoryDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryDeleteAsyncWithHttpInfo($id, $business_id) + public function auDeductionCategoryDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryDelete'][0]) { $returnType = ''; - $request = $this->auDeductionCategoryDeleteRequest($id, $business_id); + $request = $this->auDeductionCategoryDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auDeductionCategoryDeleteRequest($id, $business_id) + public function auDeductionCategoryDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryDelete'][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 auDeductionCategoryDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auDeductionCategoryDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/deductioncategory/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auDeductionCategoryDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auDeductionCategoryDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auDeductionCategoryDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auDeductionCategoryDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDeductionCategoryModel + * @return \OpenAPI\Client\Model\AuDeductionCategoryModel */ - public function auDeductionCategoryGet($id, $business_id) + public function auDeductionCategoryGet($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryGet'][0]) { - list($response) = $this->auDeductionCategoryGetWithHttpInfo($id, $business_id); + list($response) = $this->auDeductionCategoryGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auDeductionCategoryGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDeductionCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDeductionCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auDeductionCategoryGetWithHttpInfo($id, $business_id) + public function auDeductionCategoryGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel'; - $request = $this->auDeductionCategoryGetRequest($id, $business_id); + $request = $this->auDeductionCategoryGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auDeductionCategoryGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auDeductionCategoryGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDeductionCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auDeductionCategoryGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDeductionCategoryModel', + '\OpenAPI\Client\Model\AuDeductionCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auDeductionCategoryGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryGetAsync($id, $business_id) + public function auDeductionCategoryGetAsync($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryGet'][0]) { - return $this->auDeductionCategoryGetAsyncWithHttpInfo($id, $business_id) + return $this->auDeductionCategoryGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryGetAsyncWithHttpInfo($id, $business_id) + public function auDeductionCategoryGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel'; - $request = $this->auDeductionCategoryGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel'; + $request = $this->auDeductionCategoryGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auDeductionCategoryGetRequest($id, $business_id) + public function auDeductionCategoryGetRequest($id, $business_id, string $contentType = self::contentTypes['auDeductionCategoryGet'][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 auDeductionCategoryGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auDeductionCategoryGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/deductioncategory/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auDeductionCategoryGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auDeductionCategoryGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auDeductionCategoryGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auDeductionCategoryGetRequest($id, $business_id) * List Deduction Categories * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGetDeductionCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDeductionCategoryModel[] + * @return \OpenAPI\Client\Model\AuDeductionCategoryModel[] */ - public function auDeductionCategoryGetDeductionCategories($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auDeductionCategoryGetDeductionCategories($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auDeductionCategoryGetDeductionCategories'][0]) { - list($response) = $this->auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auDeductionCategoryGetDeductionCategories($business_id, $filter * List Deduction Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGetDeductionCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDeductionCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDeductionCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auDeductionCategoryGetDeductionCategories'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel[]'; - $request = $this->auDeductionCategoryGetDeductionCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auDeductionCategoryGetDeductionCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDeductionCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDeductionCategoryModel[]', + '\OpenAPI\Client\Model\AuDeductionCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auDeductionCategoryGetDeductionCategoriesWithHttpInfo($business_ * List Deduction Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGetDeductionCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryGetDeductionCategoriesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auDeductionCategoryGetDeductionCategoriesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auDeductionCategoryGetDeductionCategories'][0]) { - return $this->auDeductionCategoryGetDeductionCategoriesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auDeductionCategoryGetDeductionCategoriesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Deduction Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGetDeductionCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryGetDeductionCategoriesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auDeductionCategoryGetDeductionCategoriesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auDeductionCategoryGetDeductionCategories'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel[]'; - $request = $this->auDeductionCategoryGetDeductionCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel[]'; + $request = $this->auDeductionCategoryGetDeductionCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auDeductionCategoryGetDeductionCategories' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryGetDeductionCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auDeductionCategoryGetDeductionCategoriesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auDeductionCategoryGetDeductionCategoriesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auDeductionCategoryGetDeductionCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auDeductionCategoryGetDeductionCategoriesRequest($business_id ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/deductioncategory'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auDeductionCategoryGetDeductionCategoriesRequest($business_id $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auDeductionCategoryGetDeductionCategoriesRequest($business_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auDeductionCategoryGetDeductionCategoriesRequest($business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auDeductionCategoryGetDeductionCategoriesRequest($business_id * * Create Deduction Category * - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category deduction_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDeductionCategoryModel + * @return \OpenAPI\Client\Model\AuDeductionCategoryModel */ - public function auDeductionCategoryPost($deduction_category, $business_id) + public function auDeductionCategoryPost($business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPost'][0]) { - list($response) = $this->auDeductionCategoryPostWithHttpInfo($deduction_category, $business_id); + list($response) = $this->auDeductionCategoryPostWithHttpInfo($business_id, $deduction_category, $contentType); return $response; } @@ -969,17 +1086,17 @@ public function auDeductionCategoryPost($deduction_category, $business_id) * * Create Deduction Category * - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDeductionCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDeductionCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auDeductionCategoryPostWithHttpInfo($deduction_category, $business_id) + public function auDeductionCategoryPostWithHttpInfo($business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel'; - $request = $this->auDeductionCategoryPostRequest($deduction_category, $business_id); + $request = $this->auDeductionCategoryPostRequest($business_id, $deduction_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1105,16 @@ public function auDeductionCategoryPostWithHttpInfo($deduction_category, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1125,37 @@ public function auDeductionCategoryPostWithHttpInfo($deduction_category, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDeductionCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1172,7 @@ public function auDeductionCategoryPostWithHttpInfo($deduction_category, $busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDeductionCategoryModel', + '\OpenAPI\Client\Model\AuDeductionCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1187,16 @@ public function auDeductionCategoryPostWithHttpInfo($deduction_category, $busine * * Create Deduction Category * - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryPostAsync($deduction_category, $business_id) + public function auDeductionCategoryPostAsync($business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPost'][0]) { - return $this->auDeductionCategoryPostAsyncWithHttpInfo($deduction_category, $business_id) + return $this->auDeductionCategoryPostAsyncWithHttpInfo($business_id, $deduction_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1209,26 @@ function ($response) { * * Create Deduction Category * - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryPostAsyncWithHttpInfo($deduction_category, $business_id) + public function auDeductionCategoryPostAsyncWithHttpInfo($business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel'; - $request = $this->auDeductionCategoryPostRequest($deduction_category, $business_id); + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel'; + $request = $this->auDeductionCategoryPostRequest($business_id, $deduction_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1260,16 @@ function ($exception) { /** * Create request for operation 'auDeductionCategoryPost' * - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auDeductionCategoryPostRequest($deduction_category, $business_id) + public function auDeductionCategoryPostRequest($business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPost'][0]) { - // verify the required parameter 'deduction_category' is set - if ($deduction_category === null || (is_array($deduction_category) && count($deduction_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $deduction_category when calling auDeductionCategoryPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1277,14 @@ protected function auDeductionCategoryPostRequest($deduction_category, $business ); } + // verify the required parameter 'deduction_category' is set + if ($deduction_category === null || (is_array($deduction_category) && count($deduction_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $deduction_category when calling auDeductionCategoryPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/deductioncategory'; $formParams = []; $queryParams = []; @@ -1146,6 +1293,7 @@ protected function auDeductionCategoryPostRequest($deduction_category, $business $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1303,42 @@ protected function auDeductionCategoryPostRequest($deduction_category, $business ); } - // body params - $_tempBody = null; - if (isset($deduction_category)) { - $_tempBody = $deduction_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($deduction_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($deduction_category)); + } else { + $httpBody = $deduction_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1359,11 @@ protected function auDeductionCategoryPostRequest($deduction_category, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1375,17 @@ protected function auDeductionCategoryPostRequest($deduction_category, $business * Update Deduction Category * * @param int $id id (required) - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category deduction_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDeductionCategoryModel + * @return \OpenAPI\Client\Model\AuDeductionCategoryModel */ - public function auDeductionCategoryPut($id, $deduction_category, $business_id) + public function auDeductionCategoryPut($id, $business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPut'][0]) { - list($response) = $this->auDeductionCategoryPutWithHttpInfo($id, $deduction_category, $business_id); + list($response) = $this->auDeductionCategoryPutWithHttpInfo($id, $business_id, $deduction_category, $contentType); return $response; } @@ -1259,17 +1395,17 @@ public function auDeductionCategoryPut($id, $deduction_category, $business_id) * Update Deduction Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDeductionCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDeductionCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auDeductionCategoryPutWithHttpInfo($id, $deduction_category, $business_id) + public function auDeductionCategoryPutWithHttpInfo($id, $business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPut'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel'; - $request = $this->auDeductionCategoryPutRequest($id, $deduction_category, $business_id); + $request = $this->auDeductionCategoryPutRequest($id, $business_id, $deduction_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1414,16 @@ public function auDeductionCategoryPutWithHttpInfo($id, $deduction_category, $bu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1434,37 @@ public function auDeductionCategoryPutWithHttpInfo($id, $deduction_category, $bu sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDeductionCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDeductionCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1481,7 @@ public function auDeductionCategoryPutWithHttpInfo($id, $deduction_category, $bu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDeductionCategoryModel', + '\OpenAPI\Client\Model\AuDeductionCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1497,16 @@ public function auDeductionCategoryPutWithHttpInfo($id, $deduction_category, $bu * Update Deduction Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryPutAsync($id, $deduction_category, $business_id) + public function auDeductionCategoryPutAsync($id, $business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPut'][0]) { - return $this->auDeductionCategoryPutAsyncWithHttpInfo($id, $deduction_category, $business_id) + return $this->auDeductionCategoryPutAsyncWithHttpInfo($id, $business_id, $deduction_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1520,26 @@ function ($response) { * Update Deduction Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auDeductionCategoryPutAsyncWithHttpInfo($id, $deduction_category, $business_id) + public function auDeductionCategoryPutAsyncWithHttpInfo($id, $business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPut'][0]) { - $returnType = '\Swagger\Client\Model\AuDeductionCategoryModel'; - $request = $this->auDeductionCategoryPutRequest($id, $deduction_category, $business_id); + $returnType = '\OpenAPI\Client\Model\AuDeductionCategoryModel'; + $request = $this->auDeductionCategoryPutRequest($id, $business_id, $deduction_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1572,23 @@ function ($exception) { * Create request for operation 'auDeductionCategoryPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuDeductionCategoryModel $deduction_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuDeductionCategoryModel $deduction_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auDeductionCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auDeductionCategoryPutRequest($id, $deduction_category, $business_id) + public function auDeductionCategoryPutRequest($id, $business_id, $deduction_category, string $contentType = self::contentTypes['auDeductionCategoryPut'][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 auDeductionCategoryPut' ); } - // verify the required parameter 'deduction_category' is set - if ($deduction_category === null || (is_array($deduction_category) && count($deduction_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $deduction_category when calling auDeductionCategoryPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1596,14 @@ protected function auDeductionCategoryPutRequest($id, $deduction_category, $busi ); } + // verify the required parameter 'deduction_category' is set + if ($deduction_category === null || (is_array($deduction_category) && count($deduction_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $deduction_category when calling auDeductionCategoryPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/deductioncategory/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1612,7 @@ protected function auDeductionCategoryPutRequest($id, $deduction_category, $busi $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1630,42 @@ protected function auDeductionCategoryPutRequest($id, $deduction_category, $busi ); } - // body params - $_tempBody = null; - if (isset($deduction_category)) { - $_tempBody = $deduction_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($deduction_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($deduction_category)); + } else { + $httpBody = $deduction_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1686,11 @@ protected function auDeductionCategoryPutRequest($id, $deduction_category, $busi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeAccessApi.php b/src/lib/Api/EmployeeAccessApi.php index 1d78b49..044251e 100644 --- a/src/lib/Api/EmployeeAccessApi.php +++ b/src/lib/Api/EmployeeAccessApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeAccessDeleteEmployeeAccess' => [ + 'application/json', + ], + 'employeeAccessGetAll' => [ + 'application/json', + ], + 'employeeAccessListEmployeeAccess' => [ + 'application/json', + ], + 'employeeAccessUpdateUserAccess' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -92,17 +147,18 @@ public function getConfig() * * Grant Employee Access * - * @param \Swagger\Client\Model\CreateEmployeeAccessModel $view_model view_model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeAccessModel $view_model view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessAddEmployeeAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeAccessAddEmployeeAccess($view_model, $business_id, $employee_id) + public function employeeAccessAddEmployeeAccess($business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessAddEmployeeAccess'][0]) { - $this->employeeAccessAddEmployeeAccessWithHttpInfo($view_model, $business_id, $employee_id); + $this->employeeAccessAddEmployeeAccessWithHttpInfo($business_id, $employee_id, $view_model, $contentType); } /** @@ -110,18 +166,18 @@ public function employeeAccessAddEmployeeAccess($view_model, $business_id, $empl * * Grant Employee Access * - * @param \Swagger\Client\Model\CreateEmployeeAccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessAddEmployeeAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeAccessAddEmployeeAccessWithHttpInfo($view_model, $business_id, $employee_id) + public function employeeAccessAddEmployeeAccessWithHttpInfo($business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessAddEmployeeAccess'][0]) { - $returnType = ''; - $request = $this->employeeAccessAddEmployeeAccessRequest($view_model, $business_id, $employee_id); + $request = $this->employeeAccessAddEmployeeAccessRequest($business_id, $employee_id, $view_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +186,16 @@ public function employeeAccessAddEmployeeAccessWithHttpInfo($view_model, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +206,11 @@ public function employeeAccessAddEmployeeAccessWithHttpInfo($view_model, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,16 +228,17 @@ public function employeeAccessAddEmployeeAccessWithHttpInfo($view_model, $busine * * Grant Employee Access * - * @param \Swagger\Client\Model\CreateEmployeeAccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessAddEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessAddEmployeeAccessAsync($view_model, $business_id, $employee_id) + public function employeeAccessAddEmployeeAccessAsync($business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessAddEmployeeAccess'][0]) { - return $this->employeeAccessAddEmployeeAccessAsyncWithHttpInfo($view_model, $business_id, $employee_id) + return $this->employeeAccessAddEmployeeAccessAsyncWithHttpInfo($business_id, $employee_id, $view_model, $contentType) ->then( function ($response) { return $response[0]; @@ -187,17 +251,18 @@ function ($response) { * * Grant Employee Access * - * @param \Swagger\Client\Model\CreateEmployeeAccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessAddEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessAddEmployeeAccessAsyncWithHttpInfo($view_model, $business_id, $employee_id) + public function employeeAccessAddEmployeeAccessAsyncWithHttpInfo($business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessAddEmployeeAccess'][0]) { $returnType = ''; - $request = $this->employeeAccessAddEmployeeAccessRequest($view_model, $business_id, $employee_id); + $request = $this->employeeAccessAddEmployeeAccessRequest($business_id, $employee_id, $view_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +281,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -225,27 +290,24 @@ function ($exception) { /** * Create request for operation 'employeeAccessAddEmployeeAccess' * - * @param \Swagger\Client\Model\CreateEmployeeAccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeAccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessAddEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeAccessAddEmployeeAccessRequest($view_model, $business_id, $employee_id) + public function employeeAccessAddEmployeeAccessRequest($business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessAddEmployeeAccess'][0]) { - // verify the required parameter 'view_model' is set - if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $view_model when calling employeeAccessAddEmployeeAccess' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeAccessAddEmployeeAccess' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +315,14 @@ protected function employeeAccessAddEmployeeAccessRequest($view_model, $business ); } + // verify the required parameter 'view_model' is set + if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $view_model when calling employeeAccessAddEmployeeAccess' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/access'; $formParams = []; $queryParams = []; @@ -261,6 +331,7 @@ protected function employeeAccessAddEmployeeAccessRequest($view_model, $business $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -278,56 +349,42 @@ protected function employeeAccessAddEmployeeAccessRequest($view_model, $business ); } - // body params - $_tempBody = null; - if (isset($view_model)) { - $_tempBody = $view_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($view_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($view_model)); + } else { + $httpBody = $view_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -348,10 +405,11 @@ protected function employeeAccessAddEmployeeAccessRequest($view_model, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -365,14 +423,15 @@ protected function employeeAccessAddEmployeeAccessRequest($view_model, $business * @param string $email email (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessDeleteEmployeeAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeAccessDeleteEmployeeAccess($email, $business_id, $employee_id) + public function employeeAccessDeleteEmployeeAccess($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessDeleteEmployeeAccess'][0]) { - $this->employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business_id, $employee_id); + $this->employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business_id, $employee_id, $contentType); } /** @@ -383,15 +442,15 @@ public function employeeAccessDeleteEmployeeAccess($email, $business_id, $employ * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessDeleteEmployeeAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business_id, $employee_id) + public function employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessDeleteEmployeeAccess'][0]) { - $returnType = ''; - $request = $this->employeeAccessDeleteEmployeeAccessRequest($email, $business_id, $employee_id); + $request = $this->employeeAccessDeleteEmployeeAccessRequest($email, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -400,9 +459,16 @@ public function employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -413,11 +479,11 @@ public function employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -438,13 +504,14 @@ public function employeeAccessDeleteEmployeeAccessWithHttpInfo($email, $business * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessDeleteEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessDeleteEmployeeAccessAsync($email, $business_id, $employee_id) + public function employeeAccessDeleteEmployeeAccessAsync($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessDeleteEmployeeAccess'][0]) { - return $this->employeeAccessDeleteEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id) + return $this->employeeAccessDeleteEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -460,14 +527,15 @@ function ($response) { * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessDeleteEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessDeleteEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id) + public function employeeAccessDeleteEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessDeleteEmployeeAccess'][0]) { $returnType = ''; - $request = $this->employeeAccessDeleteEmployeeAccessRequest($email, $business_id, $employee_id); + $request = $this->employeeAccessDeleteEmployeeAccessRequest($email, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -486,7 +554,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -498,24 +566,28 @@ function ($exception) { * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessDeleteEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeAccessDeleteEmployeeAccessRequest($email, $business_id, $employee_id) + public function employeeAccessDeleteEmployeeAccessRequest($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessDeleteEmployeeAccess'][0]) { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email when calling employeeAccessDeleteEmployeeAccess' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeAccessDeleteEmployeeAccess' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -523,6 +595,7 @@ protected function employeeAccessDeleteEmployeeAccessRequest($email, $business_i ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/access'; $formParams = []; $queryParams = []; @@ -531,9 +604,15 @@ protected function employeeAccessDeleteEmployeeAccessRequest($email, $business_i $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -552,53 +631,35 @@ protected function employeeAccessDeleteEmployeeAccessRequest($email, $business_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -619,10 +680,11 @@ protected function employeeAccessDeleteEmployeeAccessRequest($email, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -639,14 +701,15 @@ protected function employeeAccessDeleteEmployeeAccessRequest($email, $business_i * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeAccessModel[] + * @return \OpenAPI\Client\Model\EmployeeAccessModel[] */ - public function employeeAccessGetAll($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeAccessGetAll($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeAccessGetAll'][0]) { - list($response) = $this->employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -661,15 +724,15 @@ public function employeeAccessGetAll($business_id, $employee_id, $filter = null, * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeAccessModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeAccessModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeAccessGetAll'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeAccessModel[]'; - $request = $this->employeeAccessGetAllRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->employeeAccessGetAllRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -678,9 +741,16 @@ public function employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $fi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -691,19 +761,37 @@ public function employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $fi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeAccessModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeAccessModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeAccessModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeAccessModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -720,7 +808,7 @@ public function employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $fi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeAccessModel[]', + '\OpenAPI\Client\Model\EmployeeAccessModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -741,13 +829,14 @@ public function employeeAccessGetAllWithHttpInfo($business_id, $employee_id, $fi * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessGetAllAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeAccessGetAllAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeAccessGetAll'][0]) { - return $this->employeeAccessGetAllAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->employeeAccessGetAllAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,24 +855,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessGetAllAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeAccessGetAllAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeAccessGetAll'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeAccessModel[]'; - $request = $this->employeeAccessGetAllRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\EmployeeAccessModel[]'; + $request = $this->employeeAccessGetAllRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -806,7 +895,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -821,18 +910,21 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeAccessGetAllRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeAccessGetAllRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeAccessGetAll'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeAccessGetAll' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -840,6 +932,11 @@ protected function employeeAccessGetAllRequest($business_id, $employee_id, $filt ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/access'; $formParams = []; $queryParams = []; @@ -848,21 +945,42 @@ protected function employeeAccessGetAllRequest($business_id, $employee_id, $filt $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -881,53 +999,35 @@ protected function employeeAccessGetAllRequest($business_id, $employee_id, $filt ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -948,10 +1048,11 @@ protected function employeeAccessGetAllRequest($business_id, $employee_id, $filt $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -965,14 +1066,15 @@ protected function employeeAccessGetAllRequest($business_id, $employee_id, $filt * @param string $email email (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessListEmployeeAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeAccessModel + * @return \OpenAPI\Client\Model\EmployeeAccessModel */ - public function employeeAccessListEmployeeAccess($email, $business_id, $employee_id) + public function employeeAccessListEmployeeAccess($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessListEmployeeAccess'][0]) { - list($response) = $this->employeeAccessListEmployeeAccessWithHttpInfo($email, $business_id, $employee_id); + list($response) = $this->employeeAccessListEmployeeAccessWithHttpInfo($email, $business_id, $employee_id, $contentType); return $response; } @@ -984,15 +1086,15 @@ public function employeeAccessListEmployeeAccess($email, $business_id, $employee * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessListEmployeeAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeAccessModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeAccessModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeAccessListEmployeeAccessWithHttpInfo($email, $business_id, $employee_id) + public function employeeAccessListEmployeeAccessWithHttpInfo($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessListEmployeeAccess'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeAccessModel'; - $request = $this->employeeAccessListEmployeeAccessRequest($email, $business_id, $employee_id); + $request = $this->employeeAccessListEmployeeAccessRequest($email, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1001,9 +1103,16 @@ public function employeeAccessListEmployeeAccessWithHttpInfo($email, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1014,19 +1123,37 @@ public function employeeAccessListEmployeeAccessWithHttpInfo($email, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeAccessModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeAccessModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeAccessModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeAccessModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1043,7 +1170,7 @@ public function employeeAccessListEmployeeAccessWithHttpInfo($email, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeAccessModel', + '\OpenAPI\Client\Model\EmployeeAccessModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1061,13 +1188,14 @@ public function employeeAccessListEmployeeAccessWithHttpInfo($email, $business_i * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessListEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessListEmployeeAccessAsync($email, $business_id, $employee_id) + public function employeeAccessListEmployeeAccessAsync($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessListEmployeeAccess'][0]) { - return $this->employeeAccessListEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id) + return $this->employeeAccessListEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1083,24 +1211,24 @@ function ($response) { * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessListEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessListEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id) + public function employeeAccessListEmployeeAccessAsyncWithHttpInfo($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessListEmployeeAccess'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeAccessModel'; - $request = $this->employeeAccessListEmployeeAccessRequest($email, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeAccessModel'; + $request = $this->employeeAccessListEmployeeAccessRequest($email, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1123,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1135,24 +1263,28 @@ function ($exception) { * @param string $email (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessListEmployeeAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeAccessListEmployeeAccessRequest($email, $business_id, $employee_id) + public function employeeAccessListEmployeeAccessRequest($email, $business_id, $employee_id, string $contentType = self::contentTypes['employeeAccessListEmployeeAccess'][0]) { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email when calling employeeAccessListEmployeeAccess' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeAccessListEmployeeAccess' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1160,6 +1292,7 @@ protected function employeeAccessListEmployeeAccessRequest($email, $business_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/access/email'; $formParams = []; $queryParams = []; @@ -1168,9 +1301,15 @@ protected function employeeAccessListEmployeeAccessRequest($email, $business_id, $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1189,53 +1328,35 @@ protected function employeeAccessListEmployeeAccessRequest($email, $business_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1256,10 +1377,11 @@ protected function employeeAccessListEmployeeAccessRequest($email, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1271,17 +1393,18 @@ protected function employeeAccessListEmployeeAccessRequest($email, $business_id, * Update Employee Access Record * * @param string $email email (required) - * @param \Swagger\Client\Model\AccessModel $view_model view_model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessUpdateUserAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeAccessUpdateUserAccess($email, $view_model, $business_id, $employee_id) + public function employeeAccessUpdateUserAccess($email, $business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessUpdateUserAccess'][0]) { - $this->employeeAccessUpdateUserAccessWithHttpInfo($email, $view_model, $business_id, $employee_id); + $this->employeeAccessUpdateUserAccessWithHttpInfo($email, $business_id, $employee_id, $view_model, $contentType); } /** @@ -1290,18 +1413,18 @@ public function employeeAccessUpdateUserAccess($email, $view_model, $business_id * Update Employee Access Record * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessUpdateUserAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeAccessUpdateUserAccessWithHttpInfo($email, $view_model, $business_id, $employee_id) + public function employeeAccessUpdateUserAccessWithHttpInfo($email, $business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessUpdateUserAccess'][0]) { - $returnType = ''; - $request = $this->employeeAccessUpdateUserAccessRequest($email, $view_model, $business_id, $employee_id); + $request = $this->employeeAccessUpdateUserAccessRequest($email, $business_id, $employee_id, $view_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1310,9 +1433,16 @@ public function employeeAccessUpdateUserAccessWithHttpInfo($email, $view_model, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1323,11 +1453,11 @@ public function employeeAccessUpdateUserAccessWithHttpInfo($email, $view_model, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1346,16 +1476,17 @@ public function employeeAccessUpdateUserAccessWithHttpInfo($email, $view_model, * Update Employee Access Record * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessUpdateUserAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessUpdateUserAccessAsync($email, $view_model, $business_id, $employee_id) + public function employeeAccessUpdateUserAccessAsync($email, $business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessUpdateUserAccess'][0]) { - return $this->employeeAccessUpdateUserAccessAsyncWithHttpInfo($email, $view_model, $business_id, $employee_id) + return $this->employeeAccessUpdateUserAccessAsyncWithHttpInfo($email, $business_id, $employee_id, $view_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1369,17 +1500,18 @@ function ($response) { * Update Employee Access Record * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessUpdateUserAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeAccessUpdateUserAccessAsyncWithHttpInfo($email, $view_model, $business_id, $employee_id) + public function employeeAccessUpdateUserAccessAsyncWithHttpInfo($email, $business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessUpdateUserAccess'][0]) { $returnType = ''; - $request = $this->employeeAccessUpdateUserAccessRequest($email, $view_model, $business_id, $employee_id); + $request = $this->employeeAccessUpdateUserAccessRequest($email, $business_id, $employee_id, $view_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1398,7 +1530,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1408,33 +1540,31 @@ function ($exception) { * Create request for operation 'employeeAccessUpdateUserAccess' * * @param string $email (required) - * @param \Swagger\Client\Model\AccessModel $view_model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AccessModel $view_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeAccessUpdateUserAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeAccessUpdateUserAccessRequest($email, $view_model, $business_id, $employee_id) + public function employeeAccessUpdateUserAccessRequest($email, $business_id, $employee_id, $view_model, string $contentType = self::contentTypes['employeeAccessUpdateUserAccess'][0]) { + // verify the required parameter 'email' is set if ($email === null || (is_array($email) && count($email) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email when calling employeeAccessUpdateUserAccess' ); } - // verify the required parameter 'view_model' is set - if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $view_model when calling employeeAccessUpdateUserAccess' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeAccessUpdateUserAccess' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1442,6 +1572,14 @@ protected function employeeAccessUpdateUserAccessRequest($email, $view_model, $b ); } + // verify the required parameter 'view_model' is set + if ($view_model === null || (is_array($view_model) && count($view_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $view_model when calling employeeAccessUpdateUserAccess' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/access'; $formParams = []; $queryParams = []; @@ -1450,9 +1588,15 @@ protected function employeeAccessUpdateUserAccessRequest($email, $view_model, $b $multipart = false; // query params - if ($email !== null) { - $queryParams['email'] = ObjectSerializer::toQueryValue($email); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1471,56 +1615,42 @@ protected function employeeAccessUpdateUserAccessRequest($email, $view_model, $b ); } - // body params - $_tempBody = null; - if (isset($view_model)) { - $_tempBody = $view_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($view_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($view_model)); + } else { + $httpBody = $view_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1541,10 +1671,11 @@ protected function employeeAccessUpdateUserAccessRequest($email, $view_model, $b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeApi.php b/src/lib/Api/EmployeeApi.php index 1628e98..75f1ce5 100644 --- a/src/lib/Api/EmployeeApi.php +++ b/src/lib/Api/EmployeeApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeGetByExternalReferenceId' => [ + 'application/json', + ], + 'auEmployeeGetEmployeeByExternalId' => [ + 'application/json', + ], + 'auEmployeeGetEmployeeById' => [ + 'application/json', + ], + 'auEmployeeGetEmployees' => [ + 'application/json', + ], + 'auEmployeePayRatesGet' => [ + 'application/json', + ], + 'auEmployeePostEmployee' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeePutEmployee' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeeShiftConditionGet' => [ + 'application/json', + ], + 'auEmployeeSyncEmployeeToQBO' => [ + 'application/json', + ], + 'auEmployeeWorkTypeGet' => [ + 'application/json', + ], + 'auOpeningBalancesGet' => [ + 'application/json', + ], + 'auOpeningBalancesPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeActivatePostActivate' => [ + 'application/json', + ], + 'employeeDetailsGetEmployee' => [ + 'application/json', + ], + 'employeeDetailsGetEmployees' => [ + 'application/json', + ], + 'employeeKioskAccessPostGrantKioskAccess' => [ + 'application/json', + ], + 'employeeKioskAccessPostRevokeKioskAccess' => [ + 'application/json', + ], + 'employeeProfileImageDelete' => [ + 'application/json', + ], + 'employeeProfileImageGet' => [ + 'application/json', + ], + 'employeeProfileImagePost' => [ + 'application/json', + ], + 'employeeStandardHoursGet' => [ + 'application/json', + ], + 'employeeStandardHoursPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'leaveBalancesGetLeaveBalances' => [ + 'application/json', + ], + 'notesGet' => [ + 'application/json', + ], + 'notesPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +224,15 @@ public function getConfig() * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeDeleteEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeDeleteEmployee($employee_id, $business_id) + public function auEmployeeDeleteEmployee($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeDeleteEmployee'][0]) { - $this->auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id); + $this->auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id, $contentType); } /** @@ -111,15 +242,15 @@ public function auEmployeeDeleteEmployee($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeDeleteEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id) + public function auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeDeleteEmployee'][0]) { - $returnType = ''; - $request = $this->auEmployeeDeleteEmployeeRequest($employee_id, $business_id); + $request = $this->auEmployeeDeleteEmployeeRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +259,16 @@ public function auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +279,11 @@ public function auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +303,14 @@ public function auEmployeeDeleteEmployeeWithHttpInfo($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeDeleteEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeDeleteEmployeeAsync($employee_id, $business_id) + public function auEmployeeDeleteEmployeeAsync($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeDeleteEmployee'][0]) { - return $this->auEmployeeDeleteEmployeeAsyncWithHttpInfo($employee_id, $business_id) + return $this->auEmployeeDeleteEmployeeAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +325,15 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeDeleteEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeDeleteEmployeeAsyncWithHttpInfo($employee_id, $business_id) + public function auEmployeeDeleteEmployeeAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeDeleteEmployee'][0]) { $returnType = ''; - $request = $this->auEmployeeDeleteEmployeeRequest($employee_id, $business_id); + $request = $this->auEmployeeDeleteEmployeeRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +352,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +363,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeDeleteEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeDeleteEmployeeRequest($employee_id, $business_id) + public function auEmployeeDeleteEmployeeRequest($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeDeleteEmployee'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEmployeeDeleteEmployee' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +385,7 @@ protected function auEmployeeDeleteEmployeeRequest($employee_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}'; $formParams = []; $queryParams = []; @@ -250,6 +394,7 @@ protected function auEmployeeDeleteEmployeeRequest($employee_id, $business_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -267,53 +412,35 @@ protected function auEmployeeDeleteEmployeeRequest($employee_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +461,11 @@ protected function auEmployeeDeleteEmployeeRequest($employee_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -351,14 +479,15 @@ protected function auEmployeeDeleteEmployeeRequest($employee_id, $business_id) * @param string $external_reference_id external_reference_id (required) * @param string $source source (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetByExternalReferenceId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuUnstructuredEmployeeModel + * @return \OpenAPI\Client\Model\AuUnstructuredEmployeeModel */ - public function auEmployeeGetByExternalReferenceId($external_reference_id, $source, $business_id) + public function auEmployeeGetByExternalReferenceId($external_reference_id, $source, $business_id, string $contentType = self::contentTypes['auEmployeeGetByExternalReferenceId'][0]) { - list($response) = $this->auEmployeeGetByExternalReferenceIdWithHttpInfo($external_reference_id, $source, $business_id); + list($response) = $this->auEmployeeGetByExternalReferenceIdWithHttpInfo($external_reference_id, $source, $business_id, $contentType); return $response; } @@ -370,15 +499,15 @@ public function auEmployeeGetByExternalReferenceId($external_reference_id, $sour * @param string $external_reference_id (required) * @param string $source (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetByExternalReferenceId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGetByExternalReferenceIdWithHttpInfo($external_reference_id, $source, $business_id) + public function auEmployeeGetByExternalReferenceIdWithHttpInfo($external_reference_id, $source, $business_id, string $contentType = self::contentTypes['auEmployeeGetByExternalReferenceId'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEmployeeGetByExternalReferenceIdRequest($external_reference_id, $source, $business_id); + $request = $this->auEmployeeGetByExternalReferenceIdRequest($external_reference_id, $source, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -387,9 +516,16 @@ public function auEmployeeGetByExternalReferenceIdWithHttpInfo($external_referen } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -400,19 +536,37 @@ public function auEmployeeGetByExternalReferenceIdWithHttpInfo($external_referen sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -429,7 +583,7 @@ public function auEmployeeGetByExternalReferenceIdWithHttpInfo($external_referen case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuUnstructuredEmployeeModel', + '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -447,13 +601,14 @@ public function auEmployeeGetByExternalReferenceIdWithHttpInfo($external_referen * @param string $external_reference_id (required) * @param string $source (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetByExternalReferenceId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetByExternalReferenceIdAsync($external_reference_id, $source, $business_id) + public function auEmployeeGetByExternalReferenceIdAsync($external_reference_id, $source, $business_id, string $contentType = self::contentTypes['auEmployeeGetByExternalReferenceId'][0]) { - return $this->auEmployeeGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $source, $business_id) + return $this->auEmployeeGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $source, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -469,24 +624,24 @@ function ($response) { * @param string $external_reference_id (required) * @param string $source (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetByExternalReferenceId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $source, $business_id) + public function auEmployeeGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $source, $business_id, string $contentType = self::contentTypes['auEmployeeGetByExternalReferenceId'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEmployeeGetByExternalReferenceIdRequest($external_reference_id, $source, $business_id); + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; + $request = $this->auEmployeeGetByExternalReferenceIdRequest($external_reference_id, $source, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -509,7 +664,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -521,24 +676,28 @@ function ($exception) { * @param string $external_reference_id (required) * @param string $source (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetByExternalReferenceId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGetByExternalReferenceIdRequest($external_reference_id, $source, $business_id) + public function auEmployeeGetByExternalReferenceIdRequest($external_reference_id, $source, $business_id, string $contentType = self::contentTypes['auEmployeeGetByExternalReferenceId'][0]) { + // verify the required parameter 'external_reference_id' is set if ($external_reference_id === null || (is_array($external_reference_id) && count($external_reference_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $external_reference_id when calling auEmployeeGetByExternalReferenceId' ); } + // verify the required parameter 'source' is set if ($source === null || (is_array($source) && count($source) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $source when calling auEmployeeGetByExternalReferenceId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -546,6 +705,7 @@ protected function auEmployeeGetByExternalReferenceIdRequest($external_reference ); } + $resourcePath = '/api/v2/business/{businessId}/employee/unstructured/externalreferenceid/{externalReferenceId}/{source}'; $formParams = []; $queryParams = []; @@ -554,6 +714,7 @@ protected function auEmployeeGetByExternalReferenceIdRequest($external_reference $multipart = false; + // path params if ($external_reference_id !== null) { $resourcePath = str_replace( @@ -579,53 +740,35 @@ protected function auEmployeeGetByExternalReferenceIdRequest($external_reference ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -646,10 +789,11 @@ protected function auEmployeeGetByExternalReferenceIdRequest($external_reference $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -662,14 +806,15 @@ protected function auEmployeeGetByExternalReferenceIdRequest($external_reference * * @param string $external_id external_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeByExternalId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuUnstructuredEmployeeModel + * @return \OpenAPI\Client\Model\AuUnstructuredEmployeeModel */ - public function auEmployeeGetEmployeeByExternalId($external_id, $business_id) + public function auEmployeeGetEmployeeByExternalId($external_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeByExternalId'][0]) { - list($response) = $this->auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $business_id); + list($response) = $this->auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $business_id, $contentType); return $response; } @@ -680,15 +825,15 @@ public function auEmployeeGetEmployeeByExternalId($external_id, $business_id) * * @param string $external_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeByExternalId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $business_id) + public function auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeByExternalId'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEmployeeGetEmployeeByExternalIdRequest($external_id, $business_id); + $request = $this->auEmployeeGetEmployeeByExternalIdRequest($external_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -697,9 +842,16 @@ public function auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -710,19 +862,37 @@ public function auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -739,7 +909,7 @@ public function auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $bus case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuUnstructuredEmployeeModel', + '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -756,13 +926,14 @@ public function auEmployeeGetEmployeeByExternalIdWithHttpInfo($external_id, $bus * * @param string $external_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeByExternalId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetEmployeeByExternalIdAsync($external_id, $business_id) + public function auEmployeeGetEmployeeByExternalIdAsync($external_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeByExternalId'][0]) { - return $this->auEmployeeGetEmployeeByExternalIdAsyncWithHttpInfo($external_id, $business_id) + return $this->auEmployeeGetEmployeeByExternalIdAsyncWithHttpInfo($external_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -777,24 +948,24 @@ function ($response) { * * @param string $external_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeByExternalId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetEmployeeByExternalIdAsyncWithHttpInfo($external_id, $business_id) + public function auEmployeeGetEmployeeByExternalIdAsyncWithHttpInfo($external_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeByExternalId'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEmployeeGetEmployeeByExternalIdRequest($external_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; + $request = $this->auEmployeeGetEmployeeByExternalIdRequest($external_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -817,7 +988,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -828,18 +999,21 @@ function ($exception) { * * @param string $external_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeByExternalId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGetEmployeeByExternalIdRequest($external_id, $business_id) + public function auEmployeeGetEmployeeByExternalIdRequest($external_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeByExternalId'][0]) { + // verify the required parameter 'external_id' is set if ($external_id === null || (is_array($external_id) && count($external_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $external_id when calling auEmployeeGetEmployeeByExternalId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -847,6 +1021,7 @@ protected function auEmployeeGetEmployeeByExternalIdRequest($external_id, $busin ); } + $resourcePath = '/api/v2/business/{businessId}/employee/unstructured/externalid/{externalId}'; $formParams = []; $queryParams = []; @@ -855,6 +1030,7 @@ protected function auEmployeeGetEmployeeByExternalIdRequest($external_id, $busin $multipart = false; + // path params if ($external_id !== null) { $resourcePath = str_replace( @@ -872,53 +1048,35 @@ protected function auEmployeeGetEmployeeByExternalIdRequest($external_id, $busin ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -939,10 +1097,11 @@ protected function auEmployeeGetEmployeeByExternalIdRequest($external_id, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -955,14 +1114,15 @@ protected function auEmployeeGetEmployeeByExternalIdRequest($external_id, $busin * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuUnstructuredEmployeeModel + * @return \OpenAPI\Client\Model\AuUnstructuredEmployeeModel */ - public function auEmployeeGetEmployeeById($employee_id, $business_id) + public function auEmployeeGetEmployeeById($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeById'][0]) { - list($response) = $this->auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id); + list($response) = $this->auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id, $contentType); return $response; } @@ -973,15 +1133,15 @@ public function auEmployeeGetEmployeeById($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id) + public function auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeById'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEmployeeGetEmployeeByIdRequest($employee_id, $business_id); + $request = $this->auEmployeeGetEmployeeByIdRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -990,9 +1150,16 @@ public function auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1003,19 +1170,37 @@ public function auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1032,7 +1217,7 @@ public function auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuUnstructuredEmployeeModel', + '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1049,13 +1234,14 @@ public function auEmployeeGetEmployeeByIdWithHttpInfo($employee_id, $business_id * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetEmployeeByIdAsync($employee_id, $business_id) + public function auEmployeeGetEmployeeByIdAsync($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeById'][0]) { - return $this->auEmployeeGetEmployeeByIdAsyncWithHttpInfo($employee_id, $business_id) + return $this->auEmployeeGetEmployeeByIdAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1070,24 +1256,24 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetEmployeeByIdAsyncWithHttpInfo($employee_id, $business_id) + public function auEmployeeGetEmployeeByIdAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeById'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEmployeeGetEmployeeByIdRequest($employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; + $request = $this->auEmployeeGetEmployeeByIdRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1110,7 +1296,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1121,18 +1307,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployeeById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id) + public function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeGetEmployeeById'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEmployeeGetEmployeeById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1140,6 +1329,7 @@ protected function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/unstructured/{employeeId}'; $formParams = []; $queryParams = []; @@ -1148,6 +1338,7 @@ protected function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1165,53 +1356,35 @@ protected function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1232,10 +1405,11 @@ protected function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1247,21 +1421,22 @@ protected function auEmployeeGetEmployeeByIdRequest($employee_id, $business_id) * List Employees * * @param string $business_id business_id (required) - * @param int $filter_pay_schedule_id (optional) - * @param int $filter_location_id (optional) + * @param mixed $options options (optional) + * @param int $filter_pay_schedule_id filter_pay_schedule_id (optional) + * @param int $filter_location_id filter_location_id (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) - * @param object $options options (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuUnstructuredEmployeeModel[] + * @return \OpenAPI\Client\Model\AuUnstructuredEmployeeModel[] */ - public function auEmployeeGetEmployees($business_id, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, $options = null) + public function auEmployeeGetEmployees($business_id, $options = null, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGetEmployees'][0]) { - list($response) = $this->auEmployeeGetEmployeesWithHttpInfo($business_id, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $options); + list($response) = $this->auEmployeeGetEmployeesWithHttpInfo($business_id, $options, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -1271,22 +1446,22 @@ public function auEmployeeGetEmployees($business_id, $filter_pay_schedule_id = n * List Employees * * @param string $business_id (required) - * @param int $filter_pay_schedule_id (optional) - * @param int $filter_location_id (optional) + * @param mixed $options (optional) + * @param int $filter_pay_schedule_id (optional) + * @param int $filter_location_id (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) - * @param object $options (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuUnstructuredEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuUnstructuredEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGetEmployeesWithHttpInfo($business_id, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, $options = null) + public function auEmployeeGetEmployeesWithHttpInfo($business_id, $options = null, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel[]'; - $request = $this->auEmployeeGetEmployeesRequest($business_id, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $options); + $request = $this->auEmployeeGetEmployeesRequest($business_id, $options, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -1295,9 +1470,16 @@ public function auEmployeeGetEmployeesWithHttpInfo($business_id, $filter_pay_sch } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1308,19 +1490,37 @@ public function auEmployeeGetEmployeesWithHttpInfo($business_id, $filter_pay_sch sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1337,7 +1537,7 @@ public function auEmployeeGetEmployeesWithHttpInfo($business_id, $filter_pay_sch case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuUnstructuredEmployeeModel[]', + '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1353,20 +1553,21 @@ public function auEmployeeGetEmployeesWithHttpInfo($business_id, $filter_pay_sch * List Employees * * @param string $business_id (required) - * @param int $filter_pay_schedule_id (optional) - * @param int $filter_location_id (optional) + * @param mixed $options (optional) + * @param int $filter_pay_schedule_id (optional) + * @param int $filter_location_id (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) - * @param object $options (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetEmployeesAsync($business_id, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, $options = null) + public function auEmployeeGetEmployeesAsync($business_id, $options = null, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGetEmployees'][0]) { - return $this->auEmployeeGetEmployeesAsyncWithHttpInfo($business_id, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $options) + return $this->auEmployeeGetEmployeesAsyncWithHttpInfo($business_id, $options, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -1380,31 +1581,31 @@ function ($response) { * List Employees * * @param string $business_id (required) - * @param int $filter_pay_schedule_id (optional) - * @param int $filter_location_id (optional) + * @param mixed $options (optional) + * @param int $filter_pay_schedule_id (optional) + * @param int $filter_location_id (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) - * @param object $options (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGetEmployeesAsyncWithHttpInfo($business_id, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, $options = null) + public function auEmployeeGetEmployeesAsyncWithHttpInfo($business_id, $options = null, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel[]'; - $request = $this->auEmployeeGetEmployeesRequest($business_id, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $options); + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel[]'; + $request = $this->auEmployeeGetEmployeesRequest($business_id, $options, $filter_pay_schedule_id, $filter_location_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1427,7 +1628,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1437,19 +1638,21 @@ function ($exception) { * Create request for operation 'auEmployeeGetEmployees' * * @param string $business_id (required) - * @param int $filter_pay_schedule_id (optional) - * @param int $filter_location_id (optional) + * @param mixed $options (optional) + * @param int $filter_pay_schedule_id (optional) + * @param int $filter_location_id (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) - * @param object $options (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGetEmployeesRequest($business_id, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, $options = null) + public function auEmployeeGetEmployeesRequest($business_id, $options = null, $filter_pay_schedule_id = null, $filter_location_id = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGetEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1457,6 +1660,14 @@ protected function auEmployeeGetEmployeesRequest($business_id, $filter_pay_sched ); } + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/unstructured'; $formParams = []; $queryParams = []; @@ -1465,29 +1676,60 @@ protected function auEmployeeGetEmployeesRequest($business_id, $filter_pay_sched $multipart = false; // query params - if ($filter_pay_schedule_id !== null) { - $queryParams['filter.payScheduleId'] = ObjectSerializer::toQueryValue($filter_pay_schedule_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_pay_schedule_id, + 'filter.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // header params if ($options !== null) { $headerParams['options'] = ObjectSerializer::toHeaderValue($options); @@ -1502,53 +1744,35 @@ protected function auEmployeeGetEmployeesRequest($business_id, $filter_pay_sched ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1569,10 +1793,11 @@ protected function auEmployeeGetEmployeesRequest($business_id, $filter_pay_sched $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1585,14 +1810,15 @@ protected function auEmployeeGetEmployeesRequest($business_id, $filter_pay_sched * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePayRatesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeePayRateModel[] + * @return \OpenAPI\Client\Model\AuEmployeePayRateModel[] */ - public function auEmployeePayRatesGet($business_id, $employee_id) + public function auEmployeePayRatesGet($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeePayRatesGet'][0]) { - list($response) = $this->auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id); + list($response) = $this->auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -1603,15 +1829,15 @@ public function auEmployeePayRatesGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePayRatesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeePayRateModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeePayRateModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id) + public function auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeePayRatesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeePayRateModel[]'; - $request = $this->auEmployeePayRatesGetRequest($business_id, $employee_id); + $request = $this->auEmployeePayRatesGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1620,9 +1846,16 @@ public function auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1633,19 +1866,37 @@ public function auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeePayRateModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeePayRateModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeePayRateModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeePayRateModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1662,7 +1913,7 @@ public function auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeePayRateModel[]', + '\OpenAPI\Client\Model\AuEmployeePayRateModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1679,13 +1930,14 @@ public function auEmployeePayRatesGetWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePayRatesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePayRatesGetAsync($business_id, $employee_id) + public function auEmployeePayRatesGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeePayRatesGet'][0]) { - return $this->auEmployeePayRatesGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->auEmployeePayRatesGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1700,24 +1952,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePayRatesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePayRatesGetAsyncWithHttpInfo($business_id, $employee_id) + public function auEmployeePayRatesGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeePayRatesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeePayRateModel[]'; - $request = $this->auEmployeePayRatesGetRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeePayRateModel[]'; + $request = $this->auEmployeePayRatesGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1740,7 +1992,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1751,18 +2003,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePayRatesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeePayRatesGetRequest($business_id, $employee_id) + public function auEmployeePayRatesGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeePayRatesGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeePayRatesGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1770,6 +2025,7 @@ protected function auEmployeePayRatesGetRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payrate'; $formParams = []; $queryParams = []; @@ -1778,6 +2034,7 @@ protected function auEmployeePayRatesGetRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1795,53 +2052,35 @@ protected function auEmployeePayRatesGetRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1862,10 +2101,11 @@ protected function auEmployeePayRatesGetRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1876,17 +2116,18 @@ protected function auEmployeePayRatesGetRequest($business_id, $employee_id) * * Create or Update Employee * - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model model (required) * @param string $business_id business_id (required) - * @param string $match_type match_type (optional, default to 1) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model model (required) + * @param string $match_type match_type (optional, default to '1') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePostEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeUpdateResponseModel + * @return \OpenAPI\Client\Model\EmployeeUpdateResponseModel */ - public function auEmployeePostEmployee($model, $business_id, $match_type = '1') + public function auEmployeePostEmployee($business_id, $model, $match_type = '1', string $contentType = self::contentTypes['auEmployeePostEmployee'][0]) { - list($response) = $this->auEmployeePostEmployeeWithHttpInfo($model, $business_id, $match_type); + list($response) = $this->auEmployeePostEmployeeWithHttpInfo($business_id, $model, $match_type, $contentType); return $response; } @@ -1895,18 +2136,18 @@ public function auEmployeePostEmployee($model, $business_id, $match_type = '1') * * Create or Update Employee * - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) - * @param string $match_type (optional, default to 1) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $match_type (optional, default to '1') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePostEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeUpdateResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeUpdateResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeePostEmployeeWithHttpInfo($model, $business_id, $match_type = '1') + public function auEmployeePostEmployeeWithHttpInfo($business_id, $model, $match_type = '1', string $contentType = self::contentTypes['auEmployeePostEmployee'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeUpdateResponseModel'; - $request = $this->auEmployeePostEmployeeRequest($model, $business_id, $match_type); + $request = $this->auEmployeePostEmployeeRequest($business_id, $model, $match_type, $contentType); try { $options = $this->createHttpClientOption(); @@ -1915,9 +2156,16 @@ public function auEmployeePostEmployeeWithHttpInfo($model, $business_id, $match_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1928,19 +2176,37 @@ public function auEmployeePostEmployeeWithHttpInfo($model, $business_id, $match_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeUpdateResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeUpdateResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeUpdateResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeUpdateResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1957,7 +2223,7 @@ public function auEmployeePostEmployeeWithHttpInfo($model, $business_id, $match_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeUpdateResponseModel', + '\OpenAPI\Client\Model\EmployeeUpdateResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1972,16 +2238,17 @@ public function auEmployeePostEmployeeWithHttpInfo($model, $business_id, $match_ * * Create or Update Employee * - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) - * @param string $match_type (optional, default to 1) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $match_type (optional, default to '1') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePostEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePostEmployeeAsync($model, $business_id, $match_type = '1') + public function auEmployeePostEmployeeAsync($business_id, $model, $match_type = '1', string $contentType = self::contentTypes['auEmployeePostEmployee'][0]) { - return $this->auEmployeePostEmployeeAsyncWithHttpInfo($model, $business_id, $match_type) + return $this->auEmployeePostEmployeeAsyncWithHttpInfo($business_id, $model, $match_type, $contentType) ->then( function ($response) { return $response[0]; @@ -1994,27 +2261,27 @@ function ($response) { * * Create or Update Employee * - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) - * @param string $match_type (optional, default to 1) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $match_type (optional, default to '1') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePostEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePostEmployeeAsyncWithHttpInfo($model, $business_id, $match_type = '1') + public function auEmployeePostEmployeeAsyncWithHttpInfo($business_id, $model, $match_type = '1', string $contentType = self::contentTypes['auEmployeePostEmployee'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeUpdateResponseModel'; - $request = $this->auEmployeePostEmployeeRequest($model, $business_id, $match_type); + $returnType = '\OpenAPI\Client\Model\EmployeeUpdateResponseModel'; + $request = $this->auEmployeePostEmployeeRequest($business_id, $model, $match_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2037,7 +2304,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2046,21 +2313,17 @@ function ($exception) { /** * Create request for operation 'auEmployeePostEmployee' * - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) - * @param string $match_type (optional, default to 1) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $match_type (optional, default to '1') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePostEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeePostEmployeeRequest($model, $business_id, $match_type = '1') + public function auEmployeePostEmployeeRequest($business_id, $model, $match_type = '1', string $contentType = self::contentTypes['auEmployeePostEmployee'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeePostEmployee' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2068,6 +2331,15 @@ protected function auEmployeePostEmployeeRequest($model, $business_id, $match_ty ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeePostEmployee' + ); + } + + + $resourcePath = '/api/v2/business/{businessId}/employee/unstructured'; $formParams = []; $queryParams = []; @@ -2076,9 +2348,15 @@ protected function auEmployeePostEmployeeRequest($model, $business_id, $match_ty $multipart = false; // query params - if ($match_type !== null) { - $queryParams['matchType'] = ObjectSerializer::toQueryValue($match_type); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $match_type, + 'matchType', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -2089,56 +2367,42 @@ protected function auEmployeePostEmployeeRequest($model, $business_id, $match_ty ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2159,10 +2423,11 @@ protected function auEmployeePostEmployeeRequest($model, $business_id, $match_ty $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2174,16 +2439,17 @@ protected function auEmployeePostEmployeeRequest($model, $business_id, $match_ty * Update Employee * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePutEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeUpdateResponseModel + * @return \OpenAPI\Client\Model\EmployeeUpdateResponseModel */ - public function auEmployeePutEmployee($employee_id, $model, $business_id) + public function auEmployeePutEmployee($employee_id, $business_id, $model, string $contentType = self::contentTypes['auEmployeePutEmployee'][0]) { - list($response) = $this->auEmployeePutEmployeeWithHttpInfo($employee_id, $model, $business_id); + list($response) = $this->auEmployeePutEmployeeWithHttpInfo($employee_id, $business_id, $model, $contentType); return $response; } @@ -2193,17 +2459,17 @@ public function auEmployeePutEmployee($employee_id, $model, $business_id) * Update Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePutEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeUpdateResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeUpdateResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeePutEmployeeWithHttpInfo($employee_id, $model, $business_id) + public function auEmployeePutEmployeeWithHttpInfo($employee_id, $business_id, $model, string $contentType = self::contentTypes['auEmployeePutEmployee'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeUpdateResponseModel'; - $request = $this->auEmployeePutEmployeeRequest($employee_id, $model, $business_id); + $request = $this->auEmployeePutEmployeeRequest($employee_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2212,9 +2478,16 @@ public function auEmployeePutEmployeeWithHttpInfo($employee_id, $model, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2225,19 +2498,37 @@ public function auEmployeePutEmployeeWithHttpInfo($employee_id, $model, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeUpdateResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeUpdateResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeUpdateResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeUpdateResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2254,7 +2545,7 @@ public function auEmployeePutEmployeeWithHttpInfo($employee_id, $model, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeUpdateResponseModel', + '\OpenAPI\Client\Model\EmployeeUpdateResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2270,15 +2561,16 @@ public function auEmployeePutEmployeeWithHttpInfo($employee_id, $model, $busines * Update Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePutEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePutEmployeeAsync($employee_id, $model, $business_id) + public function auEmployeePutEmployeeAsync($employee_id, $business_id, $model, string $contentType = self::contentTypes['auEmployeePutEmployee'][0]) { - return $this->auEmployeePutEmployeeAsyncWithHttpInfo($employee_id, $model, $business_id) + return $this->auEmployeePutEmployeeAsyncWithHttpInfo($employee_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2292,26 +2584,26 @@ function ($response) { * Update Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePutEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeePutEmployeeAsyncWithHttpInfo($employee_id, $model, $business_id) + public function auEmployeePutEmployeeAsyncWithHttpInfo($employee_id, $business_id, $model, string $contentType = self::contentTypes['auEmployeePutEmployee'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeUpdateResponseModel'; - $request = $this->auEmployeePutEmployeeRequest($employee_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\EmployeeUpdateResponseModel'; + $request = $this->auEmployeePutEmployeeRequest($employee_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2334,7 +2626,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2344,26 +2636,23 @@ function ($exception) { * Create request for operation 'auEmployeePutEmployee' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuUnstructuredEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuUnstructuredEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeePutEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeePutEmployeeRequest($employee_id, $model, $business_id) + public function auEmployeePutEmployeeRequest($employee_id, $business_id, $model, string $contentType = self::contentTypes['auEmployeePutEmployee'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEmployeePutEmployee' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeePutEmployee' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2371,6 +2660,14 @@ protected function auEmployeePutEmployeeRequest($employee_id, $model, $business_ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeePutEmployee' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/unstructured/{employeeId}'; $formParams = []; $queryParams = []; @@ -2379,6 +2676,7 @@ protected function auEmployeePutEmployeeRequest($employee_id, $model, $business_ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -2396,56 +2694,42 @@ protected function auEmployeePutEmployeeRequest($employee_id, $model, $business_ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2466,10 +2750,11 @@ protected function auEmployeePutEmployeeRequest($employee_id, $model, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2486,14 +2771,15 @@ protected function auEmployeePutEmployeeRequest($employee_id, $model, $business_ * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeShiftConditionGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuWorkTypeModel[] */ - public function auEmployeeShiftConditionGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeShiftConditionGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeShiftConditionGet'][0]) { - list($response) = $this->auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -2508,15 +2794,15 @@ public function auEmployeeShiftConditionGet($business_id, $employee_id, $filter * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeShiftConditionGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeShiftConditionGet'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEmployeeShiftConditionGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->auEmployeeShiftConditionGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -2525,9 +2811,16 @@ public function auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2538,19 +2831,37 @@ public function auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2567,7 +2878,7 @@ public function auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel[]', + '\OpenAPI\Client\Model\AuWorkTypeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2588,13 +2899,14 @@ public function auEmployeeShiftConditionGetWithHttpInfo($business_id, $employee_ * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeShiftConditionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeShiftConditionGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeShiftConditionGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeShiftConditionGet'][0]) { - return $this->auEmployeeShiftConditionGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->auEmployeeShiftConditionGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -2613,24 +2925,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeShiftConditionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeShiftConditionGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeShiftConditionGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeShiftConditionGet'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEmployeeShiftConditionGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; + $request = $this->auEmployeeShiftConditionGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2653,7 +2965,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2668,18 +2980,21 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeShiftConditionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeShiftConditionGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeShiftConditionGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeShiftConditionGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeShiftConditionGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2687,6 +3002,11 @@ protected function auEmployeeShiftConditionGetRequest($business_id, $employee_id ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/shiftcondition'; $formParams = []; $queryParams = []; @@ -2695,21 +3015,42 @@ protected function auEmployeeShiftConditionGetRequest($business_id, $employee_id $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -2728,53 +3069,35 @@ protected function auEmployeeShiftConditionGetRequest($business_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2795,10 +3118,11 @@ protected function auEmployeeShiftConditionGetRequest($business_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2811,14 +3135,15 @@ protected function auEmployeeShiftConditionGetRequest($business_id, $employee_id * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSyncEmployeeToQBO'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeSyncEmployeeToQBO($employee_id, $business_id) + public function auEmployeeSyncEmployeeToQBO($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeSyncEmployeeToQBO'][0]) { - $this->auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_id); + $this->auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_id, $contentType); } /** @@ -2828,15 +3153,15 @@ public function auEmployeeSyncEmployeeToQBO($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSyncEmployeeToQBO'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_id) + public function auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeSyncEmployeeToQBO'][0]) { - $returnType = ''; - $request = $this->auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id); + $request = $this->auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2845,9 +3170,16 @@ public function auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2858,11 +3190,11 @@ public function auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2882,13 +3214,14 @@ public function auEmployeeSyncEmployeeToQBOWithHttpInfo($employee_id, $business_ * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSyncEmployeeToQBO'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSyncEmployeeToQBOAsync($employee_id, $business_id) + public function auEmployeeSyncEmployeeToQBOAsync($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeSyncEmployeeToQBO'][0]) { - return $this->auEmployeeSyncEmployeeToQBOAsyncWithHttpInfo($employee_id, $business_id) + return $this->auEmployeeSyncEmployeeToQBOAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2903,14 +3236,15 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSyncEmployeeToQBO'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSyncEmployeeToQBOAsyncWithHttpInfo($employee_id, $business_id) + public function auEmployeeSyncEmployeeToQBOAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeSyncEmployeeToQBO'][0]) { $returnType = ''; - $request = $this->auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id); + $request = $this->auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2929,7 +3263,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2940,18 +3274,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSyncEmployeeToQBO'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id) + public function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id, string $contentType = self::contentTypes['auEmployeeSyncEmployeeToQBO'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEmployeeSyncEmployeeToQBO' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2959,6 +3296,7 @@ protected function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/synctoqbo'; $formParams = []; $queryParams = []; @@ -2967,6 +3305,7 @@ protected function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -2984,53 +3323,35 @@ protected function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3051,10 +3372,11 @@ protected function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3071,14 +3393,15 @@ protected function auEmployeeSyncEmployeeToQBORequest($employee_id, $business_id * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeWorkTypeGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuWorkTypeModel[] */ - public function auEmployeeWorkTypeGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeWorkTypeGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeWorkTypeGet'][0]) { - list($response) = $this->auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -3093,15 +3416,15 @@ public function auEmployeeWorkTypeGet($business_id, $employee_id, $filter = null * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeWorkTypeGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeWorkTypeGet'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEmployeeWorkTypeGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->auEmployeeWorkTypeGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -3110,9 +3433,16 @@ public function auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $f } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3123,19 +3453,37 @@ public function auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $f sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3152,7 +3500,7 @@ public function auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $f case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel[]', + '\OpenAPI\Client\Model\AuWorkTypeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3173,13 +3521,14 @@ public function auEmployeeWorkTypeGetWithHttpInfo($business_id, $employee_id, $f * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeWorkTypeGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeWorkTypeGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeWorkTypeGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeWorkTypeGet'][0]) { - return $this->auEmployeeWorkTypeGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->auEmployeeWorkTypeGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -3198,24 +3547,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeWorkTypeGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeWorkTypeGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeWorkTypeGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeWorkTypeGet'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEmployeeWorkTypeGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; + $request = $this->auEmployeeWorkTypeGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3238,7 +3587,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3253,18 +3602,21 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeWorkTypeGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeWorkTypeGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeWorkTypeGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3272,6 +3624,11 @@ protected function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $fil ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/worktype'; $formParams = []; $queryParams = []; @@ -3280,21 +3637,42 @@ protected function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $fil $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -3313,53 +3691,35 @@ protected function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $fil ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3380,10 +3740,11 @@ protected function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $fil $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3396,14 +3757,15 @@ protected function auEmployeeWorkTypeGetRequest($business_id, $employee_id, $fil * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuOpeningBalancesModel + * @return \OpenAPI\Client\Model\AuOpeningBalancesModel */ - public function auOpeningBalancesGet($business_id, $employee_id) + public function auOpeningBalancesGet($business_id, $employee_id, string $contentType = self::contentTypes['auOpeningBalancesGet'][0]) { - list($response) = $this->auOpeningBalancesGetWithHttpInfo($business_id, $employee_id); + list($response) = $this->auOpeningBalancesGetWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -3414,15 +3776,15 @@ public function auOpeningBalancesGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuOpeningBalancesModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuOpeningBalancesModel, HTTP status code, HTTP response headers (array of strings) */ - public function auOpeningBalancesGetWithHttpInfo($business_id, $employee_id) + public function auOpeningBalancesGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auOpeningBalancesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuOpeningBalancesModel'; - $request = $this->auOpeningBalancesGetRequest($business_id, $employee_id); + $request = $this->auOpeningBalancesGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3431,9 +3793,16 @@ public function auOpeningBalancesGetWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3444,19 +3813,37 @@ public function auOpeningBalancesGetWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuOpeningBalancesModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuOpeningBalancesModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuOpeningBalancesModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuOpeningBalancesModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3473,7 +3860,7 @@ public function auOpeningBalancesGetWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuOpeningBalancesModel', + '\OpenAPI\Client\Model\AuOpeningBalancesModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3490,13 +3877,14 @@ public function auOpeningBalancesGetWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auOpeningBalancesGetAsync($business_id, $employee_id) + public function auOpeningBalancesGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['auOpeningBalancesGet'][0]) { - return $this->auOpeningBalancesGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->auOpeningBalancesGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3511,24 +3899,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auOpeningBalancesGetAsyncWithHttpInfo($business_id, $employee_id) + public function auOpeningBalancesGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auOpeningBalancesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuOpeningBalancesModel'; - $request = $this->auOpeningBalancesGetRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuOpeningBalancesModel'; + $request = $this->auOpeningBalancesGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3551,7 +3939,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3562,18 +3950,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auOpeningBalancesGetRequest($business_id, $employee_id) + public function auOpeningBalancesGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['auOpeningBalancesGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auOpeningBalancesGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3581,6 +3972,7 @@ protected function auOpeningBalancesGetRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/openingbalances'; $formParams = []; $queryParams = []; @@ -3589,6 +3981,7 @@ protected function auOpeningBalancesGetRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3606,53 +3999,35 @@ protected function auOpeningBalancesGetRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3673,10 +4048,11 @@ protected function auOpeningBalancesGetRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3687,17 +4063,18 @@ protected function auOpeningBalancesGetRequest($business_id, $employee_id) * * Set Opening Balances * - * @param \Swagger\Client\Model\AuOpeningBalancesModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuOpeningBalancesModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auOpeningBalancesPost($model, $business_id, $employee_id) + public function auOpeningBalancesPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['auOpeningBalancesPost'][0]) { - $this->auOpeningBalancesPostWithHttpInfo($model, $business_id, $employee_id); + $this->auOpeningBalancesPostWithHttpInfo($business_id, $employee_id, $model, $contentType); } /** @@ -3705,18 +4082,18 @@ public function auOpeningBalancesPost($model, $business_id, $employee_id) * * Set Opening Balances * - * @param \Swagger\Client\Model\AuOpeningBalancesModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuOpeningBalancesModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auOpeningBalancesPostWithHttpInfo($model, $business_id, $employee_id) + public function auOpeningBalancesPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auOpeningBalancesPost'][0]) { - $returnType = ''; - $request = $this->auOpeningBalancesPostRequest($model, $business_id, $employee_id); + $request = $this->auOpeningBalancesPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3725,9 +4102,16 @@ public function auOpeningBalancesPostWithHttpInfo($model, $business_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3738,11 +4122,11 @@ public function auOpeningBalancesPostWithHttpInfo($model, $business_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3760,16 +4144,17 @@ public function auOpeningBalancesPostWithHttpInfo($model, $business_id, $employe * * Set Opening Balances * - * @param \Swagger\Client\Model\AuOpeningBalancesModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuOpeningBalancesModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auOpeningBalancesPostAsync($model, $business_id, $employee_id) + public function auOpeningBalancesPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['auOpeningBalancesPost'][0]) { - return $this->auOpeningBalancesPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->auOpeningBalancesPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3782,17 +4167,18 @@ function ($response) { * * Set Opening Balances * - * @param \Swagger\Client\Model\AuOpeningBalancesModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuOpeningBalancesModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auOpeningBalancesPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function auOpeningBalancesPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auOpeningBalancesPost'][0]) { $returnType = ''; - $request = $this->auOpeningBalancesPostRequest($model, $business_id, $employee_id); + $request = $this->auOpeningBalancesPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3811,7 +4197,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3820,27 +4206,24 @@ function ($exception) { /** * Create request for operation 'auOpeningBalancesPost' * - * @param \Swagger\Client\Model\AuOpeningBalancesModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuOpeningBalancesModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auOpeningBalancesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auOpeningBalancesPostRequest($model, $business_id, $employee_id) + public function auOpeningBalancesPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['auOpeningBalancesPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auOpeningBalancesPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auOpeningBalancesPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3848,6 +4231,14 @@ protected function auOpeningBalancesPostRequest($model, $business_id, $employee_ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auOpeningBalancesPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/openingbalances'; $formParams = []; $queryParams = []; @@ -3856,6 +4247,7 @@ protected function auOpeningBalancesPostRequest($model, $business_id, $employee_ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3873,56 +4265,42 @@ protected function auOpeningBalancesPostRequest($model, $business_id, $employee_ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3943,10 +4321,11 @@ protected function auOpeningBalancesPostRequest($model, $business_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3959,14 +4338,15 @@ protected function auOpeningBalancesPostRequest($model, $business_id, $employee_ * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeActivatePostActivate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeActivatePostActivate($employee_id, $business_id) + public function employeeActivatePostActivate($employee_id, $business_id, string $contentType = self::contentTypes['employeeActivatePostActivate'][0]) { - $this->employeeActivatePostActivateWithHttpInfo($employee_id, $business_id); + $this->employeeActivatePostActivateWithHttpInfo($employee_id, $business_id, $contentType); } /** @@ -3976,15 +4356,15 @@ public function employeeActivatePostActivate($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeActivatePostActivate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeActivatePostActivateWithHttpInfo($employee_id, $business_id) + public function employeeActivatePostActivateWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeActivatePostActivate'][0]) { - $returnType = ''; - $request = $this->employeeActivatePostActivateRequest($employee_id, $business_id); + $request = $this->employeeActivatePostActivateRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3993,9 +4373,16 @@ public function employeeActivatePostActivateWithHttpInfo($employee_id, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4006,11 +4393,11 @@ public function employeeActivatePostActivateWithHttpInfo($employee_id, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -4030,13 +4417,14 @@ public function employeeActivatePostActivateWithHttpInfo($employee_id, $business * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeActivatePostActivate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeActivatePostActivateAsync($employee_id, $business_id) + public function employeeActivatePostActivateAsync($employee_id, $business_id, string $contentType = self::contentTypes['employeeActivatePostActivate'][0]) { - return $this->employeeActivatePostActivateAsyncWithHttpInfo($employee_id, $business_id) + return $this->employeeActivatePostActivateAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4051,14 +4439,15 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeActivatePostActivate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeActivatePostActivateAsyncWithHttpInfo($employee_id, $business_id) + public function employeeActivatePostActivateAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeActivatePostActivate'][0]) { $returnType = ''; - $request = $this->employeeActivatePostActivateRequest($employee_id, $business_id); + $request = $this->employeeActivatePostActivateRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4077,7 +4466,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4088,18 +4477,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeActivatePostActivate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeActivatePostActivateRequest($employee_id, $business_id) + public function employeeActivatePostActivateRequest($employee_id, $business_id, string $contentType = self::contentTypes['employeeActivatePostActivate'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling employeeActivatePostActivate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4107,6 +4499,7 @@ protected function employeeActivatePostActivateRequest($employee_id, $business_i ); } + $resourcePath = '/api/v2/business/{businessId}/employee/activate/{employeeId}'; $formParams = []; $queryParams = []; @@ -4115,6 +4508,7 @@ protected function employeeActivatePostActivateRequest($employee_id, $business_i $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4132,53 +4526,35 @@ protected function employeeActivatePostActivateRequest($employee_id, $business_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4199,10 +4575,11 @@ protected function employeeActivatePostActivateRequest($employee_id, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4215,14 +4592,15 @@ protected function employeeActivatePostActivateRequest($employee_id, $business_i * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDetailsModel + * @return \OpenAPI\Client\Model\EmployeeDetailsModel */ - public function employeeDetailsGetEmployee($employee_id, $business_id) + public function employeeDetailsGetEmployee($employee_id, $business_id, string $contentType = self::contentTypes['employeeDetailsGetEmployee'][0]) { - list($response) = $this->employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_id); + list($response) = $this->employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_id, $contentType); return $response; } @@ -4233,15 +4611,15 @@ public function employeeDetailsGetEmployee($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDetailsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDetailsModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_id) + public function employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeDetailsGetEmployee'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsModel'; - $request = $this->employeeDetailsGetEmployeeRequest($employee_id, $business_id); + $request = $this->employeeDetailsGetEmployeeRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4250,9 +4628,16 @@ public function employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4263,19 +4648,37 @@ public function employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDetailsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDetailsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDetailsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4292,7 +4695,7 @@ public function employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDetailsModel', + '\OpenAPI\Client\Model\EmployeeDetailsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4309,13 +4712,14 @@ public function employeeDetailsGetEmployeeWithHttpInfo($employee_id, $business_i * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDetailsGetEmployeeAsync($employee_id, $business_id) + public function employeeDetailsGetEmployeeAsync($employee_id, $business_id, string $contentType = self::contentTypes['employeeDetailsGetEmployee'][0]) { - return $this->employeeDetailsGetEmployeeAsyncWithHttpInfo($employee_id, $business_id) + return $this->employeeDetailsGetEmployeeAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4330,24 +4734,24 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDetailsGetEmployeeAsyncWithHttpInfo($employee_id, $business_id) + public function employeeDetailsGetEmployeeAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeDetailsGetEmployee'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsModel'; - $request = $this->employeeDetailsGetEmployeeRequest($employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsModel'; + $request = $this->employeeDetailsGetEmployeeRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4370,7 +4774,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4381,18 +4785,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDetailsGetEmployeeRequest($employee_id, $business_id) + public function employeeDetailsGetEmployeeRequest($employee_id, $business_id, string $contentType = self::contentTypes['employeeDetailsGetEmployee'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling employeeDetailsGetEmployee' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4400,6 +4807,7 @@ protected function employeeDetailsGetEmployeeRequest($employee_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/details'; $formParams = []; $queryParams = []; @@ -4408,6 +4816,7 @@ protected function employeeDetailsGetEmployeeRequest($employee_id, $business_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4425,53 +4834,35 @@ protected function employeeDetailsGetEmployeeRequest($employee_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4492,10 +4883,11 @@ protected function employeeDetailsGetEmployeeRequest($employee_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4507,18 +4899,20 @@ protected function employeeDetailsGetEmployeeRequest($employee_id, $business_id) * List basic details for employees * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDetailsModel[] + * @return \OpenAPI\Client\Model\EmployeeDetailsModel[] */ - public function employeeDetailsGetEmployees($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeDetailsGetEmployees($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeDetailsGetEmployees'][0]) { - list($response) = $this->employeeDetailsGetEmployeesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->employeeDetailsGetEmployeesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -4528,19 +4922,20 @@ public function employeeDetailsGetEmployees($business_id, $filter = null, $order * List basic details for employees * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDetailsModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDetailsModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeDetailsGetEmployeesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeDetailsGetEmployeesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeDetailsGetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsModel[]'; - $request = $this->employeeDetailsGetEmployeesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->employeeDetailsGetEmployeesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -4549,9 +4944,16 @@ public function employeeDetailsGetEmployeesWithHttpInfo($business_id, $filter = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4562,19 +4964,37 @@ public function employeeDetailsGetEmployeesWithHttpInfo($business_id, $filter = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDetailsModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDetailsModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDetailsModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4591,7 +5011,7 @@ public function employeeDetailsGetEmployeesWithHttpInfo($business_id, $filter = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDetailsModel[]', + '\OpenAPI\Client\Model\EmployeeDetailsModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4607,17 +5027,19 @@ public function employeeDetailsGetEmployeesWithHttpInfo($business_id, $filter = * List basic details for employees * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDetailsGetEmployeesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeDetailsGetEmployeesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeDetailsGetEmployees'][0]) { - return $this->employeeDetailsGetEmployeesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->employeeDetailsGetEmployeesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -4631,28 +5053,29 @@ function ($response) { * List basic details for employees * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDetailsGetEmployeesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeDetailsGetEmployeesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeDetailsGetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsModel[]'; - $request = $this->employeeDetailsGetEmployeesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsModel[]'; + $request = $this->employeeDetailsGetEmployeesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4675,7 +5098,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4685,16 +5108,19 @@ function ($exception) { * Create request for operation 'employeeDetailsGetEmployees' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDetailsGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDetailsGetEmployeesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeDetailsGetEmployeesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeDetailsGetEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4702,6 +5128,12 @@ protected function employeeDetailsGetEmployeesRequest($business_id, $filter = nu ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/details'; $formParams = []; $queryParams = []; @@ -4710,20 +5142,45 @@ protected function employeeDetailsGetEmployeesRequest($business_id, $filter = nu $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -4735,53 +5192,35 @@ protected function employeeDetailsGetEmployeesRequest($business_id, $filter = nu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4802,10 +5241,11 @@ protected function employeeDetailsGetEmployeesRequest($business_id, $filter = nu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4818,14 +5258,15 @@ protected function employeeDetailsGetEmployeesRequest($business_id, $filter = nu * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostGrantKioskAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeKioskAccessPostGrantKioskAccess($employee_id, $business_id) + public function employeeKioskAccessPostGrantKioskAccess($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostGrantKioskAccess'][0]) { - $this->employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id, $business_id); + $this->employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id, $business_id, $contentType); } /** @@ -4835,15 +5276,15 @@ public function employeeKioskAccessPostGrantKioskAccess($employee_id, $business_ * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostGrantKioskAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id, $business_id) + public function employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostGrantKioskAccess'][0]) { - $returnType = ''; - $request = $this->employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $business_id); + $request = $this->employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4852,9 +5293,16 @@ public function employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4865,11 +5313,11 @@ public function employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -4889,13 +5337,14 @@ public function employeeKioskAccessPostGrantKioskAccessWithHttpInfo($employee_id * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostGrantKioskAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeKioskAccessPostGrantKioskAccessAsync($employee_id, $business_id) + public function employeeKioskAccessPostGrantKioskAccessAsync($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostGrantKioskAccess'][0]) { - return $this->employeeKioskAccessPostGrantKioskAccessAsyncWithHttpInfo($employee_id, $business_id) + return $this->employeeKioskAccessPostGrantKioskAccessAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4910,14 +5359,15 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostGrantKioskAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeKioskAccessPostGrantKioskAccessAsyncWithHttpInfo($employee_id, $business_id) + public function employeeKioskAccessPostGrantKioskAccessAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostGrantKioskAccess'][0]) { $returnType = ''; - $request = $this->employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $business_id); + $request = $this->employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4936,7 +5386,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4947,18 +5397,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostGrantKioskAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $business_id) + public function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostGrantKioskAccess'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling employeeKioskAccessPostGrantKioskAccess' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4966,6 +5419,7 @@ protected function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/grantkioskaccess/{employeeId}'; $formParams = []; $queryParams = []; @@ -4974,6 +5428,7 @@ protected function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4991,53 +5446,35 @@ protected function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5058,10 +5495,11 @@ protected function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5074,14 +5512,15 @@ protected function employeeKioskAccessPostGrantKioskAccessRequest($employee_id, * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeKioskAccessPostRevokeKioskAccess($employee_id, $business_id) + public function employeeKioskAccessPostRevokeKioskAccess($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'][0]) { - $this->employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_id, $business_id); + $this->employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_id, $business_id, $contentType); } /** @@ -5091,15 +5530,15 @@ public function employeeKioskAccessPostRevokeKioskAccess($employee_id, $business * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_id, $business_id) + public function employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'][0]) { - $returnType = ''; - $request = $this->employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $business_id); + $request = $this->employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5108,9 +5547,16 @@ public function employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + (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 ); } @@ -5121,11 +5567,11 @@ public function employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5145,13 +5591,14 @@ public function employeeKioskAccessPostRevokeKioskAccessWithHttpInfo($employee_i * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeKioskAccessPostRevokeKioskAccessAsync($employee_id, $business_id) + public function employeeKioskAccessPostRevokeKioskAccessAsync($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'][0]) { - return $this->employeeKioskAccessPostRevokeKioskAccessAsyncWithHttpInfo($employee_id, $business_id) + return $this->employeeKioskAccessPostRevokeKioskAccessAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5166,14 +5613,15 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeKioskAccessPostRevokeKioskAccessAsyncWithHttpInfo($employee_id, $business_id) + public function employeeKioskAccessPostRevokeKioskAccessAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'][0]) { $returnType = ''; - $request = $this->employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $business_id); + $request = $this->employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5192,7 +5640,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5203,18 +5651,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $business_id) + public function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $business_id, string $contentType = self::contentTypes['employeeKioskAccessPostRevokeKioskAccess'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling employeeKioskAccessPostRevokeKioskAccess' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5222,6 +5673,7 @@ protected function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/revokekioskaccess/{employeeId}'; $formParams = []; $queryParams = []; @@ -5230,6 +5682,7 @@ protected function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -5247,53 +5700,35 @@ protected function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5314,10 +5749,11 @@ protected function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5330,14 +5766,15 @@ protected function employeeKioskAccessPostRevokeKioskAccessRequest($employee_id, * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeProfileImageDelete($business_id, $employee_id) + public function employeeProfileImageDelete($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageDelete'][0]) { - $this->employeeProfileImageDeleteWithHttpInfo($business_id, $employee_id); + $this->employeeProfileImageDeleteWithHttpInfo($business_id, $employee_id, $contentType); } /** @@ -5347,15 +5784,15 @@ public function employeeProfileImageDelete($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeProfileImageDeleteWithHttpInfo($business_id, $employee_id) + public function employeeProfileImageDeleteWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageDelete'][0]) { - $returnType = ''; - $request = $this->employeeProfileImageDeleteRequest($business_id, $employee_id); + $request = $this->employeeProfileImageDeleteRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5364,9 +5801,16 @@ public function employeeProfileImageDeleteWithHttpInfo($business_id, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5377,11 +5821,11 @@ public function employeeProfileImageDeleteWithHttpInfo($business_id, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5401,13 +5845,14 @@ public function employeeProfileImageDeleteWithHttpInfo($business_id, $employee_i * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeProfileImageDeleteAsync($business_id, $employee_id) + public function employeeProfileImageDeleteAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageDelete'][0]) { - return $this->employeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5422,14 +5867,15 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id) + public function employeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageDelete'][0]) { $returnType = ''; - $request = $this->employeeProfileImageDeleteRequest($business_id, $employee_id); + $request = $this->employeeProfileImageDeleteRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5448,7 +5894,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5459,18 +5905,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeProfileImageDeleteRequest($business_id, $employee_id) + public function employeeProfileImageDeleteRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageDelete'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeProfileImageDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5478,6 +5927,7 @@ protected function employeeProfileImageDeleteRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/image'; $formParams = []; $queryParams = []; @@ -5486,6 +5936,7 @@ protected function employeeProfileImageDeleteRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -5503,53 +5954,35 @@ protected function employeeProfileImageDeleteRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5570,10 +6003,11 @@ protected function employeeProfileImageDeleteRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5586,14 +6020,15 @@ protected function employeeProfileImageDeleteRequest($business_id, $employee_id) * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeProfileImageGet($business_id, $employee_id) + public function employeeProfileImageGet($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageGet'][0]) { - $this->employeeProfileImageGetWithHttpInfo($business_id, $employee_id); + $this->employeeProfileImageGetWithHttpInfo($business_id, $employee_id, $contentType); } /** @@ -5603,15 +6038,15 @@ public function employeeProfileImageGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeProfileImageGetWithHttpInfo($business_id, $employee_id) + public function employeeProfileImageGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageGet'][0]) { - $returnType = ''; - $request = $this->employeeProfileImageGetRequest($business_id, $employee_id); + $request = $this->employeeProfileImageGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5620,9 +6055,16 @@ public function employeeProfileImageGetWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5633,11 +6075,11 @@ public function employeeProfileImageGetWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5657,13 +6099,14 @@ public function employeeProfileImageGetWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeProfileImageGetAsync($business_id, $employee_id) + public function employeeProfileImageGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageGet'][0]) { - return $this->employeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5678,14 +6121,15 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id) + public function employeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageGet'][0]) { $returnType = ''; - $request = $this->employeeProfileImageGetRequest($business_id, $employee_id); + $request = $this->employeeProfileImageGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5704,7 +6148,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5715,18 +6159,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImageGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeProfileImageGetRequest($business_id, $employee_id) + public function employeeProfileImageGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImageGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeProfileImageGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5734,6 +6181,7 @@ protected function employeeProfileImageGetRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/image'; $formParams = []; $queryParams = []; @@ -5742,6 +6190,7 @@ protected function employeeProfileImageGetRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -5759,53 +6208,35 @@ protected function employeeProfileImageGetRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5826,10 +6257,11 @@ protected function employeeProfileImageGetRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5842,14 +6274,15 @@ protected function employeeProfileImageGetRequest($business_id, $employee_id) * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImagePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ProfileImageMetadata + * @return \OpenAPI\Client\Model\ProfileImageMetadata */ - public function employeeProfileImagePost($business_id, $employee_id) + public function employeeProfileImagePost($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImagePost'][0]) { - list($response) = $this->employeeProfileImagePostWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeProfileImagePostWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -5860,15 +6293,15 @@ public function employeeProfileImagePost($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImagePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ProfileImageMetadata, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ProfileImageMetadata, HTTP status code, HTTP response headers (array of strings) */ - public function employeeProfileImagePostWithHttpInfo($business_id, $employee_id) + public function employeeProfileImagePostWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImagePost'][0]) { - $returnType = '\Swagger\Client\Model\ProfileImageMetadata'; - $request = $this->employeeProfileImagePostRequest($business_id, $employee_id); + $request = $this->employeeProfileImagePostRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5877,9 +6310,16 @@ public function employeeProfileImagePostWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5890,19 +6330,37 @@ public function employeeProfileImagePostWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ProfileImageMetadata' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProfileImageMetadata' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProfileImageMetadata', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProfileImageMetadata'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5919,7 +6377,7 @@ public function employeeProfileImagePostWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ProfileImageMetadata', + '\OpenAPI\Client\Model\ProfileImageMetadata', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5936,13 +6394,14 @@ public function employeeProfileImagePostWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeProfileImagePostAsync($business_id, $employee_id) + public function employeeProfileImagePostAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImagePost'][0]) { - return $this->employeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5957,24 +6416,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id) + public function employeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImagePost'][0]) { - $returnType = '\Swagger\Client\Model\ProfileImageMetadata'; - $request = $this->employeeProfileImagePostRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ProfileImageMetadata'; + $request = $this->employeeProfileImagePostRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5997,7 +6456,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6008,18 +6467,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeProfileImagePostRequest($business_id, $employee_id) + public function employeeProfileImagePostRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeProfileImagePost'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeProfileImagePost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6027,6 +6489,7 @@ protected function employeeProfileImagePostRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/image'; $formParams = []; $queryParams = []; @@ -6035,6 +6498,7 @@ protected function employeeProfileImagePostRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6052,53 +6516,35 @@ protected function employeeProfileImagePostRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6119,10 +6565,11 @@ protected function employeeProfileImagePostRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6135,14 +6582,15 @@ protected function employeeProfileImagePostRequest($business_id, $employee_id) * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\StandardHoursModel + * @return \OpenAPI\Client\Model\StandardHoursModel */ - public function employeeStandardHoursGet($business_id, $employee_id) + public function employeeStandardHoursGet($business_id, $employee_id, string $contentType = self::contentTypes['employeeStandardHoursGet'][0]) { - list($response) = $this->employeeStandardHoursGetWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeStandardHoursGetWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -6153,15 +6601,15 @@ public function employeeStandardHoursGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\StandardHoursModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\StandardHoursModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeStandardHoursGetWithHttpInfo($business_id, $employee_id) + public function employeeStandardHoursGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeStandardHoursGet'][0]) { - $returnType = '\Swagger\Client\Model\StandardHoursModel'; - $request = $this->employeeStandardHoursGetRequest($business_id, $employee_id); + $request = $this->employeeStandardHoursGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6170,9 +6618,16 @@ public function employeeStandardHoursGetWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6183,19 +6638,37 @@ public function employeeStandardHoursGetWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\StandardHoursModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\StandardHoursModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\StandardHoursModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\StandardHoursModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6212,7 +6685,7 @@ public function employeeStandardHoursGetWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\StandardHoursModel', + '\OpenAPI\Client\Model\StandardHoursModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6229,13 +6702,14 @@ public function employeeStandardHoursGetWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeStandardHoursGetAsync($business_id, $employee_id) + public function employeeStandardHoursGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeStandardHoursGet'][0]) { - return $this->employeeStandardHoursGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeStandardHoursGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6250,24 +6724,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeStandardHoursGetAsyncWithHttpInfo($business_id, $employee_id) + public function employeeStandardHoursGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeStandardHoursGet'][0]) { - $returnType = '\Swagger\Client\Model\StandardHoursModel'; - $request = $this->employeeStandardHoursGetRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\StandardHoursModel'; + $request = $this->employeeStandardHoursGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6290,7 +6764,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6301,18 +6775,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeStandardHoursGetRequest($business_id, $employee_id) + public function employeeStandardHoursGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeStandardHoursGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeStandardHoursGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6320,6 +6797,7 @@ protected function employeeStandardHoursGetRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/standardhours'; $formParams = []; $queryParams = []; @@ -6328,6 +6806,7 @@ protected function employeeStandardHoursGetRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6345,53 +6824,35 @@ protected function employeeStandardHoursGetRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6412,10 +6873,11 @@ protected function employeeStandardHoursGetRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6426,17 +6888,18 @@ protected function employeeStandardHoursGetRequest($business_id, $employee_id) * * Set standard hours for employee * - * @param \Swagger\Client\Model\StandardHoursModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\StandardHoursModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\StandardHoursModel + * @return \OpenAPI\Client\Model\StandardHoursModel */ - public function employeeStandardHoursPut($model, $business_id, $employee_id) + public function employeeStandardHoursPut($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeStandardHoursPut'][0]) { - list($response) = $this->employeeStandardHoursPutWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeeStandardHoursPutWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -6445,18 +6908,18 @@ public function employeeStandardHoursPut($model, $business_id, $employee_id) * * Set standard hours for employee * - * @param \Swagger\Client\Model\StandardHoursModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\StandardHoursModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\StandardHoursModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\StandardHoursModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeStandardHoursPutWithHttpInfo($model, $business_id, $employee_id) + public function employeeStandardHoursPutWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeStandardHoursPut'][0]) { - $returnType = '\Swagger\Client\Model\StandardHoursModel'; - $request = $this->employeeStandardHoursPutRequest($model, $business_id, $employee_id); + $request = $this->employeeStandardHoursPutRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6465,9 +6928,16 @@ public function employeeStandardHoursPutWithHttpInfo($model, $business_id, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6478,19 +6948,37 @@ public function employeeStandardHoursPutWithHttpInfo($model, $business_id, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\StandardHoursModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\StandardHoursModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\StandardHoursModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\StandardHoursModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6507,7 +6995,7 @@ public function employeeStandardHoursPutWithHttpInfo($model, $business_id, $empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\StandardHoursModel', + '\OpenAPI\Client\Model\StandardHoursModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6522,16 +7010,17 @@ public function employeeStandardHoursPutWithHttpInfo($model, $business_id, $empl * * Set standard hours for employee * - * @param \Swagger\Client\Model\StandardHoursModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\StandardHoursModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeStandardHoursPutAsync($model, $business_id, $employee_id) + public function employeeStandardHoursPutAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeStandardHoursPut'][0]) { - return $this->employeeStandardHoursPutAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeeStandardHoursPutAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6544,27 +7033,27 @@ function ($response) { * * Set standard hours for employee * - * @param \Swagger\Client\Model\StandardHoursModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\StandardHoursModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeStandardHoursPutAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeeStandardHoursPutAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeStandardHoursPut'][0]) { - $returnType = '\Swagger\Client\Model\StandardHoursModel'; - $request = $this->employeeStandardHoursPutRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\StandardHoursModel'; + $request = $this->employeeStandardHoursPutRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6587,7 +7076,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6596,27 +7085,24 @@ function ($exception) { /** * Create request for operation 'employeeStandardHoursPut' * - * @param \Swagger\Client\Model\StandardHoursModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\StandardHoursModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeStandardHoursPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeStandardHoursPutRequest($model, $business_id, $employee_id) + public function employeeStandardHoursPutRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeStandardHoursPut'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeStandardHoursPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeStandardHoursPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6624,6 +7110,14 @@ protected function employeeStandardHoursPutRequest($model, $business_id, $employ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeStandardHoursPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/standardhours'; $formParams = []; $queryParams = []; @@ -6632,6 +7126,7 @@ protected function employeeStandardHoursPutRequest($model, $business_id, $employ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6649,56 +7144,42 @@ protected function employeeStandardHoursPutRequest($model, $business_id, $employ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6719,10 +7200,11 @@ protected function employeeStandardHoursPutRequest($model, $business_id, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6736,14 +7218,15 @@ protected function employeeStandardHoursPutRequest($model, $business_id, $employ * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) * @param \DateTime $as_at_date as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['leaveBalancesGetLeaveBalances'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LeaveBalanceModel[] + * @return \OpenAPI\Client\Model\LeaveBalanceModel[] */ - public function leaveBalancesGetLeaveBalances($business_id, $employee_id, $as_at_date = null) + public function leaveBalancesGetLeaveBalances($business_id, $employee_id, $as_at_date = null, string $contentType = self::contentTypes['leaveBalancesGetLeaveBalances'][0]) { - list($response) = $this->leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employee_id, $as_at_date); + list($response) = $this->leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employee_id, $as_at_date, $contentType); return $response; } @@ -6755,15 +7238,15 @@ public function leaveBalancesGetLeaveBalances($business_id, $employee_id, $as_at * @param string $business_id (required) * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['leaveBalancesGetLeaveBalances'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LeaveBalanceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LeaveBalanceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employee_id, $as_at_date = null) + public function leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employee_id, $as_at_date = null, string $contentType = self::contentTypes['leaveBalancesGetLeaveBalances'][0]) { - $returnType = '\Swagger\Client\Model\LeaveBalanceModel[]'; - $request = $this->leaveBalancesGetLeaveBalancesRequest($business_id, $employee_id, $as_at_date); + $request = $this->leaveBalancesGetLeaveBalancesRequest($business_id, $employee_id, $as_at_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -6772,9 +7255,16 @@ public function leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6785,19 +7275,37 @@ public function leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LeaveBalanceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LeaveBalanceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LeaveBalanceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LeaveBalanceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6814,7 +7322,7 @@ public function leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LeaveBalanceModel[]', + '\OpenAPI\Client\Model\LeaveBalanceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6832,13 +7340,14 @@ public function leaveBalancesGetLeaveBalancesWithHttpInfo($business_id, $employe * @param string $business_id (required) * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['leaveBalancesGetLeaveBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function leaveBalancesGetLeaveBalancesAsync($business_id, $employee_id, $as_at_date = null) + public function leaveBalancesGetLeaveBalancesAsync($business_id, $employee_id, $as_at_date = null, string $contentType = self::contentTypes['leaveBalancesGetLeaveBalances'][0]) { - return $this->leaveBalancesGetLeaveBalancesAsyncWithHttpInfo($business_id, $employee_id, $as_at_date) + return $this->leaveBalancesGetLeaveBalancesAsyncWithHttpInfo($business_id, $employee_id, $as_at_date, $contentType) ->then( function ($response) { return $response[0]; @@ -6854,24 +7363,24 @@ function ($response) { * @param string $business_id (required) * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['leaveBalancesGetLeaveBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function leaveBalancesGetLeaveBalancesAsyncWithHttpInfo($business_id, $employee_id, $as_at_date = null) + public function leaveBalancesGetLeaveBalancesAsyncWithHttpInfo($business_id, $employee_id, $as_at_date = null, string $contentType = self::contentTypes['leaveBalancesGetLeaveBalances'][0]) { - $returnType = '\Swagger\Client\Model\LeaveBalanceModel[]'; - $request = $this->leaveBalancesGetLeaveBalancesRequest($business_id, $employee_id, $as_at_date); + $returnType = '\OpenAPI\Client\Model\LeaveBalanceModel[]'; + $request = $this->leaveBalancesGetLeaveBalancesRequest($business_id, $employee_id, $as_at_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6894,7 +7403,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6906,18 +7415,21 @@ function ($exception) { * @param string $business_id (required) * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['leaveBalancesGetLeaveBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_id, $as_at_date = null) + public function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_id, $as_at_date = null, string $contentType = self::contentTypes['leaveBalancesGetLeaveBalances'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling leaveBalancesGetLeaveBalances' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6925,6 +7437,8 @@ protected function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_ ); } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leavebalances'; $formParams = []; $queryParams = []; @@ -6933,9 +7447,15 @@ protected function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_ $multipart = false; // query params - if ($as_at_date !== null) { - $queryParams['asAtDate'] = ObjectSerializer::toQueryValue($as_at_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $as_at_date, + 'asAtDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6954,53 +7474,35 @@ protected function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7021,10 +7523,11 @@ protected function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7037,14 +7540,15 @@ protected function leaveBalancesGetLeaveBalancesRequest($business_id, $employee_ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeNoteModel[] + * @return \OpenAPI\Client\Model\EmployeeNoteModel[] */ - public function notesGet($business_id, $employee_id) + public function notesGet($business_id, $employee_id, string $contentType = self::contentTypes['notesGet'][0]) { - list($response) = $this->notesGetWithHttpInfo($business_id, $employee_id); + list($response) = $this->notesGetWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -7055,15 +7559,15 @@ public function notesGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeNoteModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeNoteModel[], HTTP status code, HTTP response headers (array of strings) */ - public function notesGetWithHttpInfo($business_id, $employee_id) + public function notesGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['notesGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeNoteModel[]'; - $request = $this->notesGetRequest($business_id, $employee_id); + $request = $this->notesGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7072,9 +7576,16 @@ public function notesGetWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7085,19 +7596,37 @@ public function notesGetWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeNoteModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeNoteModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeNoteModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeNoteModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7114,7 +7643,7 @@ public function notesGetWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeNoteModel[]', + '\OpenAPI\Client\Model\EmployeeNoteModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7131,13 +7660,14 @@ public function notesGetWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function notesGetAsync($business_id, $employee_id) + public function notesGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['notesGet'][0]) { - return $this->notesGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->notesGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7152,24 +7682,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function notesGetAsyncWithHttpInfo($business_id, $employee_id) + public function notesGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['notesGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeNoteModel[]'; - $request = $this->notesGetRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeNoteModel[]'; + $request = $this->notesGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7192,7 +7722,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7203,18 +7733,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function notesGetRequest($business_id, $employee_id) + public function notesGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['notesGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling notesGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7222,6 +7755,7 @@ protected function notesGetRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/notes'; $formParams = []; $queryParams = []; @@ -7230,6 +7764,7 @@ protected function notesGetRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7247,53 +7782,35 @@ protected function notesGetRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7314,10 +7831,11 @@ protected function notesGetRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7328,17 +7846,18 @@ protected function notesGetRequest($business_id, $employee_id) * * Set Employee Notes * - * @param \Swagger\Client\Model\CreateEmployeeNoteModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeNoteModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function notesPost($model, $business_id, $employee_id) + public function notesPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['notesPost'][0]) { - $this->notesPostWithHttpInfo($model, $business_id, $employee_id); + $this->notesPostWithHttpInfo($business_id, $employee_id, $model, $contentType); } /** @@ -7346,18 +7865,18 @@ public function notesPost($model, $business_id, $employee_id) * * Set Employee Notes * - * @param \Swagger\Client\Model\CreateEmployeeNoteModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function notesPostWithHttpInfo($model, $business_id, $employee_id) + public function notesPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['notesPost'][0]) { - $returnType = ''; - $request = $this->notesPostRequest($model, $business_id, $employee_id); + $request = $this->notesPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -7366,9 +7885,16 @@ public function notesPostWithHttpInfo($model, $business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7379,11 +7905,11 @@ public function notesPostWithHttpInfo($model, $business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -7401,16 +7927,17 @@ public function notesPostWithHttpInfo($model, $business_id, $employee_id) * * Set Employee Notes * - * @param \Swagger\Client\Model\CreateEmployeeNoteModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function notesPostAsync($model, $business_id, $employee_id) + public function notesPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['notesPost'][0]) { - return $this->notesPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->notesPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -7423,17 +7950,18 @@ function ($response) { * * Set Employee Notes * - * @param \Swagger\Client\Model\CreateEmployeeNoteModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function notesPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function notesPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['notesPost'][0]) { $returnType = ''; - $request = $this->notesPostRequest($model, $business_id, $employee_id); + $request = $this->notesPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7452,7 +7980,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7461,27 +7989,24 @@ function ($exception) { /** * Create request for operation 'notesPost' * - * @param \Swagger\Client\Model\CreateEmployeeNoteModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\CreateEmployeeNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['notesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function notesPostRequest($model, $business_id, $employee_id) + public function notesPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['notesPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling notesPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling notesPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7489,6 +8014,14 @@ protected function notesPostRequest($model, $business_id, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling notesPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/notes'; $formParams = []; $queryParams = []; @@ -7497,6 +8030,7 @@ protected function notesPostRequest($model, $business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7514,56 +8048,42 @@ protected function notesPostRequest($model, $business_id, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7584,10 +8104,11 @@ protected function notesPostRequest($model, $business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeBankAccountApi.php b/src/lib/Api/EmployeeBankAccountApi.php index 9d32a88..a2b7f9a 100644 --- a/src/lib/Api/EmployeeBankAccountApi.php +++ b/src/lib/Api/EmployeeBankAccountApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auBankAccountGet' => [ + 'application/json', + ], + 'auBankAccountList' => [ + 'application/json', + ], + 'auBankAccountPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auBankAccountPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +150,15 @@ public function getConfig() * @param int $bank_account_id bank_account_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSaveBankAccountResponseModel + * @return \OpenAPI\Client\Model\AuSaveBankAccountResponseModel */ - public function auBankAccountDelete($bank_account_id, $business_id, $employee_id) + public function auBankAccountDelete($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountDelete'][0]) { - list($response) = $this->auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, $employee_id); + list($response) = $this->auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, $employee_id, $contentType); return $response; } @@ -114,15 +170,15 @@ public function auBankAccountDelete($bank_account_id, $business_id, $employee_id * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, $employee_id) + public function auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountDelete'][0]) { - $returnType = '\Swagger\Client\Model\AuSaveBankAccountResponseModel'; - $request = $this->auBankAccountDeleteRequest($bank_account_id, $business_id, $employee_id); + $request = $this->auBankAccountDeleteRequest($bank_account_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -131,9 +187,16 @@ public function auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -144,19 +207,37 @@ public function auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSaveBankAccountResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSaveBankAccountResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -173,7 +254,7 @@ public function auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSaveBankAccountResponseModel', + '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -191,13 +272,14 @@ public function auBankAccountDeleteWithHttpInfo($bank_account_id, $business_id, * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountDeleteAsync($bank_account_id, $business_id, $employee_id) + public function auBankAccountDeleteAsync($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountDelete'][0]) { - return $this->auBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id) + return $this->auBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -213,24 +295,24 @@ function ($response) { * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id) + public function auBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountDelete'][0]) { - $returnType = '\Swagger\Client\Model\AuSaveBankAccountResponseModel'; - $request = $this->auBankAccountDeleteRequest($bank_account_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel'; + $request = $this->auBankAccountDeleteRequest($bank_account_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +335,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -265,24 +347,28 @@ function ($exception) { * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBankAccountDeleteRequest($bank_account_id, $business_id, $employee_id) + public function auBankAccountDeleteRequest($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountDelete'][0]) { + // verify the required parameter 'bank_account_id' is set if ($bank_account_id === null || (is_array($bank_account_id) && count($bank_account_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $bank_account_id when calling auBankAccountDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auBankAccountDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -290,6 +376,7 @@ protected function auBankAccountDeleteRequest($bank_account_id, $business_id, $e ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/bankaccount/{bankAccountId}'; $formParams = []; $queryParams = []; @@ -298,6 +385,7 @@ protected function auBankAccountDeleteRequest($bank_account_id, $business_id, $e $multipart = false; + // path params if ($bank_account_id !== null) { $resourcePath = str_replace( @@ -323,53 +411,35 @@ protected function auBankAccountDeleteRequest($bank_account_id, $business_id, $e ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -390,10 +460,11 @@ protected function auBankAccountDeleteRequest($bank_account_id, $business_id, $e $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -407,14 +478,15 @@ protected function auBankAccountDeleteRequest($bank_account_id, $business_id, $e * @param int $bank_account_id bank_account_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBankAccountModel + * @return \OpenAPI\Client\Model\AuBankAccountModel */ - public function auBankAccountGet($bank_account_id, $business_id, $employee_id) + public function auBankAccountGet($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountGet'][0]) { - list($response) = $this->auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $employee_id); + list($response) = $this->auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $employee_id, $contentType); return $response; } @@ -426,15 +498,15 @@ public function auBankAccountGet($bank_account_id, $business_id, $employee_id) * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBankAccountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBankAccountModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $employee_id) + public function auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountGet'][0]) { - $returnType = '\Swagger\Client\Model\AuBankAccountModel'; - $request = $this->auBankAccountGetRequest($bank_account_id, $business_id, $employee_id); + $request = $this->auBankAccountGetRequest($bank_account_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -443,9 +515,16 @@ public function auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $em } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -456,19 +535,37 @@ public function auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $em sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBankAccountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBankAccountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBankAccountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBankAccountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -485,7 +582,7 @@ public function auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $em case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBankAccountModel', + '\OpenAPI\Client\Model\AuBankAccountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -503,13 +600,14 @@ public function auBankAccountGetWithHttpInfo($bank_account_id, $business_id, $em * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountGetAsync($bank_account_id, $business_id, $employee_id) + public function auBankAccountGetAsync($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountGet'][0]) { - return $this->auBankAccountGetAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id) + return $this->auBankAccountGetAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -525,24 +623,24 @@ function ($response) { * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountGetAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id) + public function auBankAccountGetAsyncWithHttpInfo($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountGet'][0]) { - $returnType = '\Swagger\Client\Model\AuBankAccountModel'; - $request = $this->auBankAccountGetRequest($bank_account_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuBankAccountModel'; + $request = $this->auBankAccountGetRequest($bank_account_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -565,7 +663,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -577,24 +675,28 @@ function ($exception) { * @param int $bank_account_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBankAccountGetRequest($bank_account_id, $business_id, $employee_id) + public function auBankAccountGetRequest($bank_account_id, $business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountGet'][0]) { + // verify the required parameter 'bank_account_id' is set if ($bank_account_id === null || (is_array($bank_account_id) && count($bank_account_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $bank_account_id when calling auBankAccountGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auBankAccountGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -602,6 +704,7 @@ protected function auBankAccountGetRequest($bank_account_id, $business_id, $empl ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/bankaccount/{bankAccountId}'; $formParams = []; $queryParams = []; @@ -610,6 +713,7 @@ protected function auBankAccountGetRequest($bank_account_id, $business_id, $empl $multipart = false; + // path params if ($bank_account_id !== null) { $resourcePath = str_replace( @@ -635,53 +739,35 @@ protected function auBankAccountGetRequest($bank_account_id, $business_id, $empl ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -702,10 +788,11 @@ protected function auBankAccountGetRequest($bank_account_id, $business_id, $empl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -718,14 +805,15 @@ protected function auBankAccountGetRequest($bank_account_id, $business_id, $empl * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBankAccountModel[] + * @return \OpenAPI\Client\Model\AuBankAccountModel[] */ - public function auBankAccountList($business_id, $employee_id) + public function auBankAccountList($business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountList'][0]) { - list($response) = $this->auBankAccountListWithHttpInfo($business_id, $employee_id); + list($response) = $this->auBankAccountListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -736,15 +824,15 @@ public function auBankAccountList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBankAccountModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBankAccountModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auBankAccountListWithHttpInfo($business_id, $employee_id) + public function auBankAccountListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountList'][0]) { - $returnType = '\Swagger\Client\Model\AuBankAccountModel[]'; - $request = $this->auBankAccountListRequest($business_id, $employee_id); + $request = $this->auBankAccountListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -753,9 +841,16 @@ public function auBankAccountListWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -766,19 +861,37 @@ public function auBankAccountListWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBankAccountModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBankAccountModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBankAccountModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBankAccountModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -795,7 +908,7 @@ public function auBankAccountListWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBankAccountModel[]', + '\OpenAPI\Client\Model\AuBankAccountModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -812,13 +925,14 @@ public function auBankAccountListWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountListAsync($business_id, $employee_id) + public function auBankAccountListAsync($business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountList'][0]) { - return $this->auBankAccountListAsyncWithHttpInfo($business_id, $employee_id) + return $this->auBankAccountListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -833,24 +947,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountListAsyncWithHttpInfo($business_id, $employee_id) + public function auBankAccountListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountList'][0]) { - $returnType = '\Swagger\Client\Model\AuBankAccountModel[]'; - $request = $this->auBankAccountListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuBankAccountModel[]'; + $request = $this->auBankAccountListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -873,7 +987,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -884,18 +998,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBankAccountListRequest($business_id, $employee_id) + public function auBankAccountListRequest($business_id, $employee_id, string $contentType = self::contentTypes['auBankAccountList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auBankAccountList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -903,6 +1020,7 @@ protected function auBankAccountListRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/bankaccount'; $formParams = []; $queryParams = []; @@ -911,6 +1029,7 @@ protected function auBankAccountListRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -928,53 +1047,35 @@ protected function auBankAccountListRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -995,10 +1096,11 @@ protected function auBankAccountListRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1009,17 +1111,18 @@ protected function auBankAccountListRequest($business_id, $employee_id) * * Create Bank Account * - * @param \Swagger\Client\Model\AuBankAccountModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSaveBankAccountResponseModel + * @return \OpenAPI\Client\Model\AuSaveBankAccountResponseModel */ - public function auBankAccountPost($model, $business_id, $employee_id) + public function auBankAccountPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPost'][0]) { - list($response) = $this->auBankAccountPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->auBankAccountPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -1028,18 +1131,18 @@ public function auBankAccountPost($model, $business_id, $employee_id) * * Create Bank Account * - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBankAccountPostWithHttpInfo($model, $business_id, $employee_id) + public function auBankAccountPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPost'][0]) { - $returnType = '\Swagger\Client\Model\AuSaveBankAccountResponseModel'; - $request = $this->auBankAccountPostRequest($model, $business_id, $employee_id); + $request = $this->auBankAccountPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1048,9 +1151,16 @@ public function auBankAccountPostWithHttpInfo($model, $business_id, $employee_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1061,19 +1171,37 @@ public function auBankAccountPostWithHttpInfo($model, $business_id, $employee_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSaveBankAccountResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSaveBankAccountResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1090,7 +1218,7 @@ public function auBankAccountPostWithHttpInfo($model, $business_id, $employee_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSaveBankAccountResponseModel', + '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1105,16 +1233,17 @@ public function auBankAccountPostWithHttpInfo($model, $business_id, $employee_id * * Create Bank Account * - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountPostAsync($model, $business_id, $employee_id) + public function auBankAccountPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPost'][0]) { - return $this->auBankAccountPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->auBankAccountPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1127,27 +1256,27 @@ function ($response) { * * Create Bank Account * - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function auBankAccountPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPost'][0]) { - $returnType = '\Swagger\Client\Model\AuSaveBankAccountResponseModel'; - $request = $this->auBankAccountPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel'; + $request = $this->auBankAccountPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1170,7 +1299,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1179,27 +1308,24 @@ function ($exception) { /** * Create request for operation 'auBankAccountPost' * - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBankAccountPostRequest($model, $business_id, $employee_id) + public function auBankAccountPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auBankAccountPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auBankAccountPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1207,6 +1333,14 @@ protected function auBankAccountPostRequest($model, $business_id, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auBankAccountPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/bankaccount'; $formParams = []; $queryParams = []; @@ -1215,6 +1349,7 @@ protected function auBankAccountPostRequest($model, $business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1232,56 +1367,42 @@ protected function auBankAccountPostRequest($model, $business_id, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1302,10 +1423,11 @@ protected function auBankAccountPostRequest($model, $business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1317,17 +1439,18 @@ protected function auBankAccountPostRequest($model, $business_id, $employee_id) * Update Bank Account * * @param int $id id (required) - * @param \Swagger\Client\Model\AuBankAccountModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSaveBankAccountResponseModel + * @return \OpenAPI\Client\Model\AuSaveBankAccountResponseModel */ - public function auBankAccountPut($id, $model, $business_id, $employee_id) + public function auBankAccountPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPut'][0]) { - list($response) = $this->auBankAccountPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->auBankAccountPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -1337,18 +1460,18 @@ public function auBankAccountPut($id, $model, $business_id, $employee_id) * Update Bank Account * * @param int $id (required) - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auBankAccountPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function auBankAccountPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPut'][0]) { - $returnType = '\Swagger\Client\Model\AuSaveBankAccountResponseModel'; - $request = $this->auBankAccountPutRequest($id, $model, $business_id, $employee_id); + $request = $this->auBankAccountPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1357,9 +1480,16 @@ public function auBankAccountPutWithHttpInfo($id, $model, $business_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1370,19 +1500,37 @@ public function auBankAccountPutWithHttpInfo($id, $model, $business_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSaveBankAccountResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSaveBankAccountResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1399,7 +1547,7 @@ public function auBankAccountPutWithHttpInfo($id, $model, $business_id, $employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSaveBankAccountResponseModel', + '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1415,16 +1563,17 @@ public function auBankAccountPutWithHttpInfo($id, $model, $business_id, $employe * Update Bank Account * * @param int $id (required) - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountPutAsync($id, $model, $business_id, $employee_id) + public function auBankAccountPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPut'][0]) { - return $this->auBankAccountPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->auBankAccountPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1438,27 +1587,27 @@ function ($response) { * Update Bank Account * * @param int $id (required) - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBankAccountPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function auBankAccountPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPut'][0]) { - $returnType = '\Swagger\Client\Model\AuSaveBankAccountResponseModel'; - $request = $this->auBankAccountPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuSaveBankAccountResponseModel'; + $request = $this->auBankAccountPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1481,7 +1630,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1491,33 +1640,31 @@ function ($exception) { * Create request for operation 'auBankAccountPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuBankAccountModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBankAccountPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBankAccountPutRequest($id, $model, $business_id, $employee_id) + public function auBankAccountPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auBankAccountPut'][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 auBankAccountPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auBankAccountPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auBankAccountPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1525,6 +1672,14 @@ protected function auBankAccountPutRequest($id, $model, $business_id, $employee_ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auBankAccountPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/bankaccount/{id}'; $formParams = []; $queryParams = []; @@ -1533,6 +1688,7 @@ protected function auBankAccountPutRequest($id, $model, $business_id, $employee_ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1558,56 +1714,42 @@ protected function auBankAccountPutRequest($id, $model, $business_id, $employee_ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1628,10 +1770,11 @@ protected function auBankAccountPutRequest($id, $model, $business_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeDocumentApi.php b/src/lib/Api/EmployeeDocumentApi.php index a48bea6..1d3d0cd 100644 --- a/src/lib/Api/EmployeeDocumentApi.php +++ b/src/lib/Api/EmployeeDocumentApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'employeeDocumentDelete' => [ + 'application/json', + ], + 'employeeDocumentEmployeeExpenseLinkCreateLink' => [ + 'application/json', + ], + 'employeeDocumentEmployeeExpenseLinkDelete' => [ + 'application/json', + ], + 'employeeDocumentGet' => [ + 'application/json', + ], + 'employeeDocumentLeaveLinkCreateLink' => [ + 'application/json', + ], + 'employeeDocumentLeaveLinkRemoveLink' => [ + 'application/json', + ], + 'employeeDocumentList' => [ + 'application/json', + ], + 'employeeDocumentTimesheetLinkCreateLink' => [ + 'application/json', + ], + 'employeeDocumentTimesheetLinkRemoveLink' => [ + 'application/json', + ], + 'employeeDocumentUpdatePermissions' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeDocumentUpload' => [ + '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 + 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; } /** @@ -95,14 +167,15 @@ public function getConfig() * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentContent'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentFile + * @return \OpenAPI\Client\Model\DocumentFile */ - public function employeeDocumentContent($id, $business_id, $employee_id) + public function employeeDocumentContent($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentContent'][0]) { - list($response) = $this->employeeDocumentContentWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeDocumentContentWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -114,15 +187,15 @@ public function employeeDocumentContent($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentContent'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentContentWithHttpInfo($id, $business_id, $employee_id) + public function employeeDocumentContentWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentContent'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->employeeDocumentContentRequest($id, $business_id, $employee_id); + $request = $this->employeeDocumentContentRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -131,9 +204,16 @@ public function employeeDocumentContentWithHttpInfo($id, $business_id, $employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -144,19 +224,37 @@ public function employeeDocumentContentWithHttpInfo($id, $business_id, $employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentFile' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentFile' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentFile', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentFile'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -173,7 +271,7 @@ public function employeeDocumentContentWithHttpInfo($id, $business_id, $employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentFile', + '\OpenAPI\Client\Model\DocumentFile', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -191,13 +289,14 @@ public function employeeDocumentContentWithHttpInfo($id, $business_id, $employee * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentContentAsync($id, $business_id, $employee_id) + public function employeeDocumentContentAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentContent'][0]) { - return $this->employeeDocumentContentAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeDocumentContentAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -213,24 +312,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentContentAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeDocumentContentAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentContent'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->employeeDocumentContentRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\DocumentFile'; + $request = $this->employeeDocumentContentRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +352,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -265,24 +364,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentContentRequest($id, $business_id, $employee_id) + public function employeeDocumentContentRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentContent'][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 employeeDocumentContent' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentContent' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -290,6 +393,7 @@ protected function employeeDocumentContentRequest($id, $business_id, $employee_i ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{id}/content'; $formParams = []; $queryParams = []; @@ -298,6 +402,7 @@ protected function employeeDocumentContentRequest($id, $business_id, $employee_i $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -323,53 +428,35 @@ protected function employeeDocumentContentRequest($id, $business_id, $employee_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -390,10 +477,11 @@ protected function employeeDocumentContentRequest($id, $business_id, $employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -407,14 +495,15 @@ protected function employeeDocumentContentRequest($id, $business_id, $employee_i * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentDelete($id, $business_id, $employee_id) + public function employeeDocumentDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentDelete'][0]) { - $this->employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -425,15 +514,15 @@ public function employeeDocumentDelete($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentDelete'][0]) { - $returnType = ''; - $request = $this->employeeDocumentDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeDocumentDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -442,9 +531,16 @@ public function employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -455,11 +551,11 @@ public function employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -480,13 +576,14 @@ public function employeeDocumentDeleteWithHttpInfo($id, $business_id, $employee_ * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentDeleteAsync($id, $business_id, $employee_id) + public function employeeDocumentDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentDelete'][0]) { - return $this->employeeDocumentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeDocumentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -502,14 +599,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeDocumentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentDelete'][0]) { $returnType = ''; - $request = $this->employeeDocumentDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeDocumentDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -528,7 +626,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -540,24 +638,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentDeleteRequest($id, $business_id, $employee_id) + public function employeeDocumentDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentDelete'][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 employeeDocumentDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -565,6 +667,7 @@ protected function employeeDocumentDeleteRequest($id, $business_id, $employee_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{id}'; $formParams = []; $queryParams = []; @@ -573,6 +676,7 @@ protected function employeeDocumentDeleteRequest($id, $business_id, $employee_id $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -598,53 +702,35 @@ protected function employeeDocumentDeleteRequest($id, $business_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -665,10 +751,11 @@ protected function employeeDocumentDeleteRequest($id, $business_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -683,14 +770,15 @@ protected function employeeDocumentDeleteRequest($id, $business_id, $employee_id * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentEmployeeExpenseLinkCreateLink($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkCreateLink($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'][0]) { - $this->employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id); + $this->employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType); } /** @@ -702,15 +790,15 @@ public function employeeDocumentEmployeeExpenseLinkCreateLink($document_id, $id, * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'][0]) { - $returnType = ''; - $request = $this->employeeDocumentEmployeeExpenseLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentEmployeeExpenseLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -719,9 +807,16 @@ public function employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($docum } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -732,11 +827,11 @@ public function employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($docum sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -758,13 +853,14 @@ public function employeeDocumentEmployeeExpenseLinkCreateLinkWithHttpInfo($docum * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentEmployeeExpenseLinkCreateLinkAsync($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkCreateLinkAsync($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'][0]) { - return $this->employeeDocumentEmployeeExpenseLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + return $this->employeeDocumentEmployeeExpenseLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -781,14 +877,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentEmployeeExpenseLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'][0]) { $returnType = ''; - $request = $this->employeeDocumentEmployeeExpenseLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentEmployeeExpenseLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -807,7 +904,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,30 +917,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkCreateLink'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling employeeDocumentEmployeeExpenseLinkCreateLink' ); } + // 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 employeeDocumentEmployeeExpenseLinkCreateLink' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentEmployeeExpenseLinkCreateLink' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -851,6 +953,7 @@ protected function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($documen ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{documentId}/expense/{id}'; $formParams = []; $queryParams = []; @@ -859,6 +962,7 @@ protected function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($documen $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -892,53 +996,35 @@ protected function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($documen ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -959,10 +1045,11 @@ protected function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($documen $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -977,14 +1064,15 @@ protected function employeeDocumentEmployeeExpenseLinkCreateLinkRequest($documen * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentEmployeeExpenseLinkDelete($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkDelete($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'][0]) { - $this->employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_id, $id, $business_id, $employee_id); + $this->employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType); } /** @@ -996,15 +1084,15 @@ public function employeeDocumentEmployeeExpenseLinkDelete($document_id, $id, $bu * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'][0]) { - $returnType = ''; - $request = $this->employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1013,9 +1101,16 @@ public function employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1026,11 +1121,11 @@ public function employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1052,13 +1147,14 @@ public function employeeDocumentEmployeeExpenseLinkDeleteWithHttpInfo($document_ * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentEmployeeExpenseLinkDeleteAsync($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkDeleteAsync($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'][0]) { - return $this->employeeDocumentEmployeeExpenseLinkDeleteAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + return $this->employeeDocumentEmployeeExpenseLinkDeleteAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1075,14 +1171,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentEmployeeExpenseLinkDeleteAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkDeleteAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'][0]) { $returnType = ''; - $request = $this->employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1101,7 +1198,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1114,30 +1211,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id, $id, $business_id, $employee_id) + public function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentEmployeeExpenseLinkDelete'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling employeeDocumentEmployeeExpenseLinkDelete' ); } + // 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 employeeDocumentEmployeeExpenseLinkDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentEmployeeExpenseLinkDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1145,6 +1247,7 @@ protected function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{documentId}/expense/{id}'; $formParams = []; $queryParams = []; @@ -1153,6 +1256,7 @@ protected function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -1186,53 +1290,35 @@ protected function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1253,10 +1339,11 @@ protected function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1270,14 +1357,15 @@ protected function employeeDocumentEmployeeExpenseLinkDeleteRequest($document_id * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDocumentModel + * @return \OpenAPI\Client\Model\EmployeeDocumentModel */ - public function employeeDocumentGet($id, $business_id, $employee_id) + public function employeeDocumentGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentGet'][0]) { - list($response) = $this->employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -1289,15 +1377,15 @@ public function employeeDocumentGet($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id) + public function employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel'; - $request = $this->employeeDocumentGetRequest($id, $business_id, $employee_id); + $request = $this->employeeDocumentGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1306,9 +1394,16 @@ public function employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1319,19 +1414,37 @@ public function employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1348,7 +1461,7 @@ public function employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDocumentModel', + '\OpenAPI\Client\Model\EmployeeDocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1366,13 +1479,14 @@ public function employeeDocumentGetWithHttpInfo($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentGetAsync($id, $business_id, $employee_id) + public function employeeDocumentGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentGet'][0]) { - return $this->employeeDocumentGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeDocumentGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1388,24 +1502,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeDocumentGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel'; - $request = $this->employeeDocumentGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel'; + $request = $this->employeeDocumentGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1428,7 +1542,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1440,24 +1554,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentGetRequest($id, $business_id, $employee_id) + public function employeeDocumentGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentGet'][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 employeeDocumentGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1465,6 +1583,7 @@ protected function employeeDocumentGetRequest($id, $business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{id}'; $formParams = []; $queryParams = []; @@ -1473,6 +1592,7 @@ protected function employeeDocumentGetRequest($id, $business_id, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1498,53 +1618,35 @@ protected function employeeDocumentGetRequest($id, $business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1565,10 +1667,11 @@ protected function employeeDocumentGetRequest($id, $business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1583,14 +1686,15 @@ protected function employeeDocumentGetRequest($id, $business_id, $employee_id) * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkCreateLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentLeaveLinkCreateLink($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkCreateLink($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkCreateLink'][0]) { - $this->employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id); + $this->employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType); } /** @@ -1602,15 +1706,15 @@ public function employeeDocumentLeaveLinkCreateLink($document_id, $id, $business * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkCreateLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkCreateLink'][0]) { - $returnType = ''; - $request = $this->employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1619,9 +1723,16 @@ public function employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1632,11 +1743,11 @@ public function employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1658,13 +1769,14 @@ public function employeeDocumentLeaveLinkCreateLinkWithHttpInfo($document_id, $i * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentLeaveLinkCreateLinkAsync($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkCreateLinkAsync($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkCreateLink'][0]) { - return $this->employeeDocumentLeaveLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + return $this->employeeDocumentLeaveLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1681,14 +1793,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentLeaveLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkCreateLink'][0]) { $returnType = ''; - $request = $this->employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1707,7 +1820,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1720,30 +1833,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkCreateLink'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling employeeDocumentLeaveLinkCreateLink' ); } + // 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 employeeDocumentLeaveLinkCreateLink' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentLeaveLinkCreateLink' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1751,6 +1869,7 @@ protected function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{documentId}/leave/{id}'; $formParams = []; $queryParams = []; @@ -1759,6 +1878,7 @@ protected function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -1792,53 +1912,35 @@ protected function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1859,10 +1961,11 @@ protected function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1877,14 +1980,15 @@ protected function employeeDocumentLeaveLinkCreateLinkRequest($document_id, $id, * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkRemoveLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentLeaveLinkRemoveLink($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkRemoveLink($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkRemoveLink'][0]) { - $this->employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id); + $this->employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType); } /** @@ -1896,15 +2000,15 @@ public function employeeDocumentLeaveLinkRemoveLink($document_id, $id, $business * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkRemoveLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkRemoveLink'][0]) { - $returnType = ''; - $request = $this->employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1913,9 +2017,16 @@ public function employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1926,11 +2037,11 @@ public function employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1952,13 +2063,14 @@ public function employeeDocumentLeaveLinkRemoveLinkWithHttpInfo($document_id, $i * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkRemoveLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentLeaveLinkRemoveLinkAsync($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkRemoveLinkAsync($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkRemoveLink'][0]) { - return $this->employeeDocumentLeaveLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + return $this->employeeDocumentLeaveLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1975,14 +2087,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkRemoveLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentLeaveLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkRemoveLink'][0]) { $returnType = ''; - $request = $this->employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2001,7 +2114,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2014,30 +2127,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentLeaveLinkRemoveLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id) + public function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentLeaveLinkRemoveLink'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling employeeDocumentLeaveLinkRemoveLink' ); } + // 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 employeeDocumentLeaveLinkRemoveLink' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentLeaveLinkRemoveLink' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2045,6 +2163,7 @@ protected function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{documentId}/leave/{id}'; $formParams = []; $queryParams = []; @@ -2053,6 +2172,7 @@ protected function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -2086,53 +2206,35 @@ protected function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2153,10 +2255,11 @@ protected function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2169,14 +2272,15 @@ protected function employeeDocumentLeaveLinkRemoveLinkRequest($document_id, $id, * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDocumentModel[] + * @return \OpenAPI\Client\Model\EmployeeDocumentModel[] */ - public function employeeDocumentList($business_id, $employee_id) + public function employeeDocumentList($business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentList'][0]) { - list($response) = $this->employeeDocumentListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeDocumentListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -2187,15 +2291,15 @@ public function employeeDocumentList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentListWithHttpInfo($business_id, $employee_id) + public function employeeDocumentListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel[]'; - $request = $this->employeeDocumentListRequest($business_id, $employee_id); + $request = $this->employeeDocumentListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2204,9 +2308,16 @@ public function employeeDocumentListWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2217,19 +2328,37 @@ public function employeeDocumentListWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2246,7 +2375,7 @@ public function employeeDocumentListWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDocumentModel[]', + '\OpenAPI\Client\Model\EmployeeDocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2263,13 +2392,14 @@ public function employeeDocumentListWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentListAsync($business_id, $employee_id) + public function employeeDocumentListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentList'][0]) { - return $this->employeeDocumentListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeDocumentListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2284,24 +2414,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentListAsyncWithHttpInfo($business_id, $employee_id) + public function employeeDocumentListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel[]'; - $request = $this->employeeDocumentListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel[]'; + $request = $this->employeeDocumentListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2324,7 +2454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2335,18 +2465,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentListRequest($business_id, $employee_id) + public function employeeDocumentListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2354,6 +2487,7 @@ protected function employeeDocumentListRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document'; $formParams = []; $queryParams = []; @@ -2362,6 +2496,7 @@ protected function employeeDocumentListRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2379,53 +2514,35 @@ protected function employeeDocumentListRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2446,10 +2563,11 @@ protected function employeeDocumentListRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2464,14 +2582,15 @@ protected function employeeDocumentListRequest($business_id, $employee_id) * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkCreateLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentTimesheetLinkCreateLink($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkCreateLink($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkCreateLink'][0]) { - $this->employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id); + $this->employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType); } /** @@ -2483,15 +2602,15 @@ public function employeeDocumentTimesheetLinkCreateLink($document_id, $id, $busi * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkCreateLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkCreateLink'][0]) { - $returnType = ''; - $request = $this->employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2500,9 +2619,16 @@ public function employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2513,11 +2639,11 @@ public function employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2539,13 +2665,14 @@ public function employeeDocumentTimesheetLinkCreateLinkWithHttpInfo($document_id * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentTimesheetLinkCreateLinkAsync($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkCreateLinkAsync($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkCreateLink'][0]) { - return $this->employeeDocumentTimesheetLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + return $this->employeeDocumentTimesheetLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2562,14 +2689,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentTimesheetLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkCreateLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkCreateLink'][0]) { $returnType = ''; - $request = $this->employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2588,7 +2716,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2601,30 +2729,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkCreateLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkCreateLink'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling employeeDocumentTimesheetLinkCreateLink' ); } + // 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 employeeDocumentTimesheetLinkCreateLink' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentTimesheetLinkCreateLink' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2632,6 +2765,7 @@ protected function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{documentId}/timesheet/{id}'; $formParams = []; $queryParams = []; @@ -2640,6 +2774,7 @@ protected function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -2673,53 +2808,35 @@ protected function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2740,10 +2857,11 @@ protected function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2758,14 +2876,15 @@ protected function employeeDocumentTimesheetLinkCreateLinkRequest($document_id, * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeDocumentTimesheetLinkRemoveLink($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkRemoveLink($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'][0]) { - $this->employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id); + $this->employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType); } /** @@ -2777,15 +2896,15 @@ public function employeeDocumentTimesheetLinkRemoveLink($document_id, $id, $busi * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'][0]) { - $returnType = ''; - $request = $this->employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2794,9 +2913,16 @@ public function employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2807,11 +2933,11 @@ public function employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2833,13 +2959,14 @@ public function employeeDocumentTimesheetLinkRemoveLinkWithHttpInfo($document_id * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentTimesheetLinkRemoveLinkAsync($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkRemoveLinkAsync($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'][0]) { - return $this->employeeDocumentTimesheetLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + return $this->employeeDocumentTimesheetLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2856,14 +2983,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentTimesheetLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkRemoveLinkAsyncWithHttpInfo($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'][0]) { $returnType = ''; - $request = $this->employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id); + $request = $this->employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2882,7 +3010,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2895,30 +3023,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id) + public function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeDocumentTimesheetLinkRemoveLink'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling employeeDocumentTimesheetLinkRemoveLink' ); } + // 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 employeeDocumentTimesheetLinkRemoveLink' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentTimesheetLinkRemoveLink' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2926,6 +3059,7 @@ protected function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document/{documentId}/timesheet/{id}'; $formParams = []; $queryParams = []; @@ -2934,6 +3068,7 @@ protected function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -2967,53 +3102,35 @@ protected function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3034,10 +3151,11 @@ protected function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3048,17 +3166,18 @@ protected function employeeDocumentTimesheetLinkRemoveLinkRequest($document_id, * * Update Employee Document Permissions * - * @param \Swagger\Client\Model\UpdateEmployeeDocumentPermissionsModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\UpdateEmployeeDocumentPermissionsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpdatePermissions'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDocumentModel + * @return \OpenAPI\Client\Model\EmployeeDocumentModel */ - public function employeeDocumentUpdatePermissions($model, $business_id, $employee_id) + public function employeeDocumentUpdatePermissions($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeDocumentUpdatePermissions'][0]) { - list($response) = $this->employeeDocumentUpdatePermissionsWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeeDocumentUpdatePermissionsWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -3067,18 +3186,18 @@ public function employeeDocumentUpdatePermissions($model, $business_id, $employe * * Update Employee Document Permissions * - * @param \Swagger\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpdatePermissions'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentUpdatePermissionsWithHttpInfo($model, $business_id, $employee_id) + public function employeeDocumentUpdatePermissionsWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeDocumentUpdatePermissions'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel'; - $request = $this->employeeDocumentUpdatePermissionsRequest($model, $business_id, $employee_id); + $request = $this->employeeDocumentUpdatePermissionsRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3087,9 +3206,16 @@ public function employeeDocumentUpdatePermissionsWithHttpInfo($model, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3100,19 +3226,37 @@ public function employeeDocumentUpdatePermissionsWithHttpInfo($model, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3129,7 +3273,7 @@ public function employeeDocumentUpdatePermissionsWithHttpInfo($model, $business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDocumentModel', + '\OpenAPI\Client\Model\EmployeeDocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3144,16 +3288,17 @@ public function employeeDocumentUpdatePermissionsWithHttpInfo($model, $business_ * * Update Employee Document Permissions * - * @param \Swagger\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpdatePermissions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentUpdatePermissionsAsync($model, $business_id, $employee_id) + public function employeeDocumentUpdatePermissionsAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeDocumentUpdatePermissions'][0]) { - return $this->employeeDocumentUpdatePermissionsAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeeDocumentUpdatePermissionsAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3166,27 +3311,27 @@ function ($response) { * * Update Employee Document Permissions * - * @param \Swagger\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpdatePermissions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentUpdatePermissionsAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeeDocumentUpdatePermissionsAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeDocumentUpdatePermissions'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel'; - $request = $this->employeeDocumentUpdatePermissionsRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel'; + $request = $this->employeeDocumentUpdatePermissionsRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3209,7 +3354,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3218,27 +3363,24 @@ function ($exception) { /** * Create request for operation 'employeeDocumentUpdatePermissions' * - * @param \Swagger\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UpdateEmployeeDocumentPermissionsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpdatePermissions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentUpdatePermissionsRequest($model, $business_id, $employee_id) + public function employeeDocumentUpdatePermissionsRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeDocumentUpdatePermissions'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeDocumentUpdatePermissions' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentUpdatePermissions' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3246,6 +3388,14 @@ protected function employeeDocumentUpdatePermissionsRequest($model, $business_id ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeDocumentUpdatePermissions' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document'; $formParams = []; $queryParams = []; @@ -3254,6 +3404,7 @@ protected function employeeDocumentUpdatePermissionsRequest($model, $business_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3271,56 +3422,42 @@ protected function employeeDocumentUpdatePermissionsRequest($model, $business_id ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3341,10 +3478,11 @@ protected function employeeDocumentUpdatePermissionsRequest($model, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3358,14 +3496,15 @@ protected function employeeDocumentUpdatePermissionsRequest($model, $business_id * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) * @param bool $visible visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpload'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDocumentModel[] + * @return \OpenAPI\Client\Model\EmployeeDocumentModel[] */ - public function employeeDocumentUpload($business_id, $employee_id, $visible = 'false') + public function employeeDocumentUpload($business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeDocumentUpload'][0]) { - list($response) = $this->employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $visible); + list($response) = $this->employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $visible, $contentType); return $response; } @@ -3377,15 +3516,15 @@ public function employeeDocumentUpload($business_id, $employee_id, $visible = 'f * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpload'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $visible = 'false') + public function employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeDocumentUpload'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel[]'; - $request = $this->employeeDocumentUploadRequest($business_id, $employee_id, $visible); + $request = $this->employeeDocumentUploadRequest($business_id, $employee_id, $visible, $contentType); try { $options = $this->createHttpClientOption(); @@ -3394,9 +3533,16 @@ public function employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3407,19 +3553,37 @@ public function employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3436,7 +3600,7 @@ public function employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDocumentModel[]', + '\OpenAPI\Client\Model\EmployeeDocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3454,13 +3618,14 @@ public function employeeDocumentUploadWithHttpInfo($business_id, $employee_id, $ * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentUploadAsync($business_id, $employee_id, $visible = 'false') + public function employeeDocumentUploadAsync($business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeDocumentUpload'][0]) { - return $this->employeeDocumentUploadAsyncWithHttpInfo($business_id, $employee_id, $visible) + return $this->employeeDocumentUploadAsyncWithHttpInfo($business_id, $employee_id, $visible, $contentType) ->then( function ($response) { return $response[0]; @@ -3476,24 +3641,24 @@ function ($response) { * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeDocumentUploadAsyncWithHttpInfo($business_id, $employee_id, $visible = 'false') + public function employeeDocumentUploadAsyncWithHttpInfo($business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeDocumentUpload'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDocumentModel[]'; - $request = $this->employeeDocumentUploadRequest($business_id, $employee_id, $visible); + $returnType = '\OpenAPI\Client\Model\EmployeeDocumentModel[]'; + $request = $this->employeeDocumentUploadRequest($business_id, $employee_id, $visible, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3516,7 +3681,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3528,18 +3693,21 @@ function ($exception) { * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeDocumentUpload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeDocumentUploadRequest($business_id, $employee_id, $visible = 'false') + public function employeeDocumentUploadRequest($business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeDocumentUpload'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeDocumentUpload' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3547,6 +3715,8 @@ protected function employeeDocumentUploadRequest($business_id, $employee_id, $vi ); } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/document'; $formParams = []; $queryParams = []; @@ -3555,9 +3725,15 @@ protected function employeeDocumentUploadRequest($business_id, $employee_id, $vi $multipart = false; // query params - if ($visible !== null) { - $queryParams['visible'] = ObjectSerializer::toQueryValue($visible); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $visible, + 'visible', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -3576,53 +3752,35 @@ protected function employeeDocumentUploadRequest($business_id, $employee_id, $vi ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3643,10 +3801,11 @@ protected function employeeDocumentUploadRequest($business_id, $employee_id, $vi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeEarningsLineSplitApi.php b/src/lib/Api/EmployeeEarningsLineSplitApi.php index 0a2eca9..c95fa8b 100644 --- a/src/lib/Api/EmployeeEarningsLineSplitApi.php +++ b/src/lib/Api/EmployeeEarningsLineSplitApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'genericEarningsLineSplitGet' => [ + 'application/json', + ], + 'genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId' => [ + 'application/json', + ], + 'genericEarningsLineSplitPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericEarningsLineSplitPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +150,15 @@ public function getConfig() * @param int $location_id location_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericEarningsLineSplitDelete($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitDelete($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitDelete'][0]) { - $this->genericEarningsLineSplitDeleteWithHttpInfo($location_id, $business_id, $employee_id); + $this->genericEarningsLineSplitDeleteWithHttpInfo($location_id, $business_id, $employee_id, $contentType); } /** @@ -113,15 +169,15 @@ public function genericEarningsLineSplitDelete($location_id, $business_id, $empl * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericEarningsLineSplitDeleteWithHttpInfo($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitDeleteWithHttpInfo($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitDelete'][0]) { - $returnType = ''; - $request = $this->genericEarningsLineSplitDeleteRequest($location_id, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitDeleteRequest($location_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +186,16 @@ public function genericEarningsLineSplitDeleteWithHttpInfo($location_id, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +206,11 @@ public function genericEarningsLineSplitDeleteWithHttpInfo($location_id, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -168,13 +231,14 @@ public function genericEarningsLineSplitDeleteWithHttpInfo($location_id, $busine * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitDeleteAsync($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitDeleteAsync($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitDelete'][0]) { - return $this->genericEarningsLineSplitDeleteAsyncWithHttpInfo($location_id, $business_id, $employee_id) + return $this->genericEarningsLineSplitDeleteAsyncWithHttpInfo($location_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -190,14 +254,15 @@ function ($response) { * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitDeleteAsyncWithHttpInfo($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitDeleteAsyncWithHttpInfo($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitDelete'][0]) { $returnType = ''; - $request = $this->genericEarningsLineSplitDeleteRequest($location_id, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitDeleteRequest($location_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +281,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -228,24 +293,28 @@ function ($exception) { * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericEarningsLineSplitDeleteRequest($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitDeleteRequest($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitDelete'][0]) { + // verify the required parameter 'location_id' is set if ($location_id === null || (is_array($location_id) && count($location_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $location_id when calling genericEarningsLineSplitDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericEarningsLineSplitDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +322,7 @@ protected function genericEarningsLineSplitDeleteRequest($location_id, $business ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/{locationId}'; $formParams = []; $queryParams = []; @@ -261,6 +331,7 @@ protected function genericEarningsLineSplitDeleteRequest($location_id, $business $multipart = false; + // path params if ($location_id !== null) { $resourcePath = str_replace( @@ -286,53 +357,35 @@ protected function genericEarningsLineSplitDeleteRequest($location_id, $business ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -353,10 +406,11 @@ protected function genericEarningsLineSplitDeleteRequest($location_id, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -373,14 +427,15 @@ protected function genericEarningsLineSplitDeleteRequest($location_id, $business * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EarningsLineSplitApiModel[] + * @return \OpenAPI\Client\Model\EarningsLineSplitApiModel[] */ - public function genericEarningsLineSplitGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericEarningsLineSplitGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericEarningsLineSplitGet'][0]) { - list($response) = $this->genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -395,15 +450,15 @@ public function genericEarningsLineSplitGet($business_id, $employee_id, $filter * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EarningsLineSplitApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EarningsLineSplitApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericEarningsLineSplitGet'][0]) { - $returnType = '\Swagger\Client\Model\EarningsLineSplitApiModel[]'; - $request = $this->genericEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->genericEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -412,9 +467,16 @@ public function genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -425,19 +487,37 @@ public function genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EarningsLineSplitApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EarningsLineSplitApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EarningsLineSplitApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EarningsLineSplitApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -454,7 +534,7 @@ public function genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EarningsLineSplitApiModel[]', + '\OpenAPI\Client\Model\EarningsLineSplitApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -475,13 +555,14 @@ public function genericEarningsLineSplitGetWithHttpInfo($business_id, $employee_ * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericEarningsLineSplitGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericEarningsLineSplitGet'][0]) { - return $this->genericEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->genericEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -500,24 +581,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericEarningsLineSplitGet'][0]) { - $returnType = '\Swagger\Client\Model\EarningsLineSplitApiModel[]'; - $request = $this->genericEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\EarningsLineSplitApiModel[]'; + $request = $this->genericEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -540,7 +621,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -555,18 +636,21 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericEarningsLineSplitGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericEarningsLineSplitGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericEarningsLineSplitGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericEarningsLineSplitGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -574,6 +658,11 @@ protected function genericEarningsLineSplitGetRequest($business_id, $employee_id ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit'; $formParams = []; $queryParams = []; @@ -582,21 +671,42 @@ protected function genericEarningsLineSplitGetRequest($business_id, $employee_id $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -615,53 +725,35 @@ protected function genericEarningsLineSplitGetRequest($business_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -682,10 +774,11 @@ protected function genericEarningsLineSplitGetRequest($business_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -699,14 +792,15 @@ protected function genericEarningsLineSplitGetRequest($business_id, $employee_id * @param int $location_id location_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EarningsLineSplitApiModel + * @return \OpenAPI\Client\Model\EarningsLineSplitApiModel */ - public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'][0]) { - list($response) = $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdWithHttpInfo($location_id, $business_id, $employee_id); + list($response) = $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdWithHttpInfo($location_id, $business_id, $employee_id, $contentType); return $response; } @@ -718,15 +812,15 @@ public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEm * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EarningsLineSplitApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EarningsLineSplitApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdWithHttpInfo($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdWithHttpInfo($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'][0]) { - $returnType = '\Swagger\Client\Model\EarningsLineSplitApiModel'; - $request = $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdRequest($location_id, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdRequest($location_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -735,9 +829,16 @@ public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEm } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -748,19 +849,37 @@ public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEm sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EarningsLineSplitApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EarningsLineSplitApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EarningsLineSplitApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EarningsLineSplitApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -777,7 +896,7 @@ public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEm case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EarningsLineSplitApiModel', + '\OpenAPI\Client\Model\EarningsLineSplitApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -795,13 +914,14 @@ public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEm * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdAsync($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdAsync($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'][0]) { - return $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdAsyncWithHttpInfo($location_id, $business_id, $employee_id) + return $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdAsyncWithHttpInfo($location_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -817,24 +937,24 @@ function ($response) { * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdAsyncWithHttpInfo($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdAsyncWithHttpInfo($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'][0]) { - $returnType = '\Swagger\Client\Model\EarningsLineSplitApiModel'; - $request = $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdRequest($location_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EarningsLineSplitApiModel'; + $request = $this->genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdRequest($location_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -857,7 +977,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -869,24 +989,28 @@ function ($exception) { * @param int $location_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdRequest($location_id, $business_id, $employee_id) + public function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationIdRequest($location_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId'][0]) { + // verify the required parameter 'location_id' is set if ($location_id === null || (is_array($location_id) && count($location_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $location_id when calling genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdEarningslinesplitByLocationId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -894,6 +1018,7 @@ protected function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeB ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/{locationId}'; $formParams = []; $queryParams = []; @@ -902,6 +1027,7 @@ protected function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeB $multipart = false; + // path params if ($location_id !== null) { $resourcePath = str_replace( @@ -927,53 +1053,35 @@ protected function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeB ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -994,10 +1102,11 @@ protected function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeB $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1008,17 +1117,18 @@ protected function genericEarningsLineSplitGetApiV2BusinessByBusinessIdEmployeeB * * Create Earnings line split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split earnings_line_split (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericEarningsLineSplitPost($earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPost($business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPost'][0]) { - $this->genericEarningsLineSplitPostWithHttpInfo($earnings_line_split, $business_id, $employee_id); + $this->genericEarningsLineSplitPostWithHttpInfo($business_id, $employee_id, $earnings_line_split, $contentType); } /** @@ -1026,18 +1136,18 @@ public function genericEarningsLineSplitPost($earnings_line_split, $business_id, * * Create Earnings line split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericEarningsLineSplitPostWithHttpInfo($earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPostWithHttpInfo($business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPost'][0]) { - $returnType = ''; - $request = $this->genericEarningsLineSplitPostRequest($earnings_line_split, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitPostRequest($business_id, $employee_id, $earnings_line_split, $contentType); try { $options = $this->createHttpClientOption(); @@ -1046,9 +1156,16 @@ public function genericEarningsLineSplitPostWithHttpInfo($earnings_line_split, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1059,11 +1176,11 @@ public function genericEarningsLineSplitPostWithHttpInfo($earnings_line_split, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1081,16 +1198,17 @@ public function genericEarningsLineSplitPostWithHttpInfo($earnings_line_split, $ * * Create Earnings line split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitPostAsync($earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPostAsync($business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPost'][0]) { - return $this->genericEarningsLineSplitPostAsyncWithHttpInfo($earnings_line_split, $business_id, $employee_id) + return $this->genericEarningsLineSplitPostAsyncWithHttpInfo($business_id, $employee_id, $earnings_line_split, $contentType) ->then( function ($response) { return $response[0]; @@ -1103,17 +1221,18 @@ function ($response) { * * Create Earnings line split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitPostAsyncWithHttpInfo($earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPostAsyncWithHttpInfo($business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPost'][0]) { $returnType = ''; - $request = $this->genericEarningsLineSplitPostRequest($earnings_line_split, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitPostRequest($business_id, $employee_id, $earnings_line_split, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1132,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1141,27 +1260,24 @@ function ($exception) { /** * Create request for operation 'genericEarningsLineSplitPost' * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericEarningsLineSplitPostRequest($earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPostRequest($business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPost'][0]) { - // verify the required parameter 'earnings_line_split' is set - if ($earnings_line_split === null || (is_array($earnings_line_split) && count($earnings_line_split) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $earnings_line_split when calling genericEarningsLineSplitPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericEarningsLineSplitPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1169,6 +1285,14 @@ protected function genericEarningsLineSplitPostRequest($earnings_line_split, $bu ); } + // verify the required parameter 'earnings_line_split' is set + if ($earnings_line_split === null || (is_array($earnings_line_split) && count($earnings_line_split) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earnings_line_split when calling genericEarningsLineSplitPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit'; $formParams = []; $queryParams = []; @@ -1177,6 +1301,7 @@ protected function genericEarningsLineSplitPostRequest($earnings_line_split, $bu $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1194,56 +1319,42 @@ protected function genericEarningsLineSplitPostRequest($earnings_line_split, $bu ); } - // body params - $_tempBody = null; - if (isset($earnings_line_split)) { - $_tempBody = $earnings_line_split; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($earnings_line_split)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($earnings_line_split)); + } else { + $httpBody = $earnings_line_split; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1264,10 +1375,11 @@ protected function genericEarningsLineSplitPostRequest($earnings_line_split, $bu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1279,17 +1391,18 @@ protected function genericEarningsLineSplitPostRequest($earnings_line_split, $bu * Update Earnings line split * * @param int $location_id location_id (required) - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split earnings_line_split (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericEarningsLineSplitPut($location_id, $earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPut($location_id, $business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPut'][0]) { - $this->genericEarningsLineSplitPutWithHttpInfo($location_id, $earnings_line_split, $business_id, $employee_id); + $this->genericEarningsLineSplitPutWithHttpInfo($location_id, $business_id, $employee_id, $earnings_line_split, $contentType); } /** @@ -1298,18 +1411,18 @@ public function genericEarningsLineSplitPut($location_id, $earnings_line_split, * Update Earnings line split * * @param int $location_id (required) - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericEarningsLineSplitPutWithHttpInfo($location_id, $earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPutWithHttpInfo($location_id, $business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPut'][0]) { - $returnType = ''; - $request = $this->genericEarningsLineSplitPutRequest($location_id, $earnings_line_split, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitPutRequest($location_id, $business_id, $employee_id, $earnings_line_split, $contentType); try { $options = $this->createHttpClientOption(); @@ -1318,9 +1431,16 @@ public function genericEarningsLineSplitPutWithHttpInfo($location_id, $earnings_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1331,11 +1451,11 @@ public function genericEarningsLineSplitPutWithHttpInfo($location_id, $earnings_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1354,16 +1474,17 @@ public function genericEarningsLineSplitPutWithHttpInfo($location_id, $earnings_ * Update Earnings line split * * @param int $location_id (required) - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitPutAsync($location_id, $earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPutAsync($location_id, $business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPut'][0]) { - return $this->genericEarningsLineSplitPutAsyncWithHttpInfo($location_id, $earnings_line_split, $business_id, $employee_id) + return $this->genericEarningsLineSplitPutAsyncWithHttpInfo($location_id, $business_id, $employee_id, $earnings_line_split, $contentType) ->then( function ($response) { return $response[0]; @@ -1377,17 +1498,18 @@ function ($response) { * Update Earnings line split * * @param int $location_id (required) - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericEarningsLineSplitPutAsyncWithHttpInfo($location_id, $earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPutAsyncWithHttpInfo($location_id, $business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPut'][0]) { $returnType = ''; - $request = $this->genericEarningsLineSplitPutRequest($location_id, $earnings_line_split, $business_id, $employee_id); + $request = $this->genericEarningsLineSplitPutRequest($location_id, $business_id, $employee_id, $earnings_line_split, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1406,7 +1528,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1416,33 +1538,31 @@ function ($exception) { * Create request for operation 'genericEarningsLineSplitPut' * * @param int $location_id (required) - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $earnings_line_split (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericEarningsLineSplitPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericEarningsLineSplitPutRequest($location_id, $earnings_line_split, $business_id, $employee_id) + public function genericEarningsLineSplitPutRequest($location_id, $business_id, $employee_id, $earnings_line_split, string $contentType = self::contentTypes['genericEarningsLineSplitPut'][0]) { + // verify the required parameter 'location_id' is set if ($location_id === null || (is_array($location_id) && count($location_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $location_id when calling genericEarningsLineSplitPut' ); } - // verify the required parameter 'earnings_line_split' is set - if ($earnings_line_split === null || (is_array($earnings_line_split) && count($earnings_line_split) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $earnings_line_split when calling genericEarningsLineSplitPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericEarningsLineSplitPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1450,6 +1570,14 @@ protected function genericEarningsLineSplitPutRequest($location_id, $earnings_li ); } + // verify the required parameter 'earnings_line_split' is set + if ($earnings_line_split === null || (is_array($earnings_line_split) && count($earnings_line_split) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earnings_line_split when calling genericEarningsLineSplitPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/{locationId}'; $formParams = []; $queryParams = []; @@ -1458,6 +1586,7 @@ protected function genericEarningsLineSplitPutRequest($location_id, $earnings_li $multipart = false; + // path params if ($location_id !== null) { $resourcePath = str_replace( @@ -1483,56 +1612,42 @@ protected function genericEarningsLineSplitPutRequest($location_id, $earnings_li ); } - // body params - $_tempBody = null; - if (isset($earnings_line_split)) { - $_tempBody = $earnings_line_split; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($earnings_line_split)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($earnings_line_split)); + } else { + $httpBody = $earnings_line_split; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1553,10 +1668,11 @@ protected function genericEarningsLineSplitPutRequest($location_id, $earnings_li $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeExpenseCategoriesApi.php b/src/lib/Api/EmployeeExpenseCategoriesApi.php index 09aa72b..6f1a1a8 100644 --- a/src/lib/Api/EmployeeExpenseCategoriesApi.php +++ b/src/lib/Api/EmployeeExpenseCategoriesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'employeeExpenseCategoryGet' => [ + 'application/json', + ], + 'employeeExpenseCategoryGetEmployeeExpenseCategories' => [ + 'application/json', + ], + 'employeeExpenseCategoryPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeExpenseCategoryPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeExpenseCategoryTaxCodes' => [ + '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 + 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; } /** @@ -94,14 +152,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeExpenseCategoryDelete($id, $business_id) + public function employeeExpenseCategoryDelete($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryDelete'][0]) { - $this->employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id); + $this->employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +170,15 @@ public function employeeExpenseCategoryDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id) + public function employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryDelete'][0]) { - $returnType = ''; - $request = $this->employeeExpenseCategoryDeleteRequest($id, $business_id); + $request = $this->employeeExpenseCategoryDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +187,16 @@ public function employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +207,11 @@ public function employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +231,14 @@ public function employeeExpenseCategoryDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryDeleteAsync($id, $business_id) + public function employeeExpenseCategoryDeleteAsync($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryDelete'][0]) { - return $this->employeeExpenseCategoryDeleteAsyncWithHttpInfo($id, $business_id) + return $this->employeeExpenseCategoryDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +253,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryDeleteAsyncWithHttpInfo($id, $business_id) + public function employeeExpenseCategoryDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryDelete'][0]) { $returnType = ''; - $request = $this->employeeExpenseCategoryDeleteRequest($id, $business_id); + $request = $this->employeeExpenseCategoryDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +280,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +291,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeExpenseCategoryDeleteRequest($id, $business_id) + public function employeeExpenseCategoryDeleteRequest($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryDelete'][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 employeeExpenseCategoryDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +313,7 @@ protected function employeeExpenseCategoryDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employeeexpensecategory/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +322,7 @@ protected function employeeExpenseCategoryDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +340,35 @@ protected function employeeExpenseCategoryDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +389,11 @@ protected function employeeExpenseCategoryDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +406,15 @@ protected function employeeExpenseCategoryDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeExpenseCategoryModel + * @return \OpenAPI\Client\Model\EmployeeExpenseCategoryModel */ - public function employeeExpenseCategoryGet($id, $business_id) + public function employeeExpenseCategoryGet($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryGet'][0]) { - list($response) = $this->employeeExpenseCategoryGetWithHttpInfo($id, $business_id); + list($response) = $this->employeeExpenseCategoryGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +425,15 @@ public function employeeExpenseCategoryGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeExpenseCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeExpenseCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeExpenseCategoryGetWithHttpInfo($id, $business_id) + public function employeeExpenseCategoryGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpenseCategoryModel'; - $request = $this->employeeExpenseCategoryGetRequest($id, $business_id); + $request = $this->employeeExpenseCategoryGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +442,16 @@ public function employeeExpenseCategoryGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +462,37 @@ public function employeeExpenseCategoryGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeExpenseCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeExpenseCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +509,7 @@ public function employeeExpenseCategoryGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeExpenseCategoryModel', + '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +526,14 @@ public function employeeExpenseCategoryGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryGetAsync($id, $business_id) + public function employeeExpenseCategoryGetAsync($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryGet'][0]) { - return $this->employeeExpenseCategoryGetAsyncWithHttpInfo($id, $business_id) + return $this->employeeExpenseCategoryGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +548,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryGetAsyncWithHttpInfo($id, $business_id) + public function employeeExpenseCategoryGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpenseCategoryModel'; - $request = $this->employeeExpenseCategoryGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel'; + $request = $this->employeeExpenseCategoryGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +588,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +599,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeExpenseCategoryGetRequest($id, $business_id) + public function employeeExpenseCategoryGetRequest($id, $business_id, string $contentType = self::contentTypes['employeeExpenseCategoryGet'][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 employeeExpenseCategoryGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +621,7 @@ protected function employeeExpenseCategoryGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employeeexpensecategory/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +630,7 @@ protected function employeeExpenseCategoryGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +648,35 @@ protected function employeeExpenseCategoryGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +697,11 @@ protected function employeeExpenseCategoryGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +713,20 @@ protected function employeeExpenseCategoryGetRequest($id, $business_id) * List Employee Expense Categories * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeExpenseCategoryModel[] + * @return \OpenAPI\Client\Model\EmployeeExpenseCategoryModel[] */ - public function employeeExpenseCategoryGetEmployeeExpenseCategories($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeExpenseCategoryGetEmployeeExpenseCategories($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'][0]) { - list($response) = $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +736,20 @@ public function employeeExpenseCategoryGetEmployeeExpenseCategories($business_id * List Employee Expense Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeExpenseCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeExpenseCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpenseCategoryModel[]'; - $request = $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +758,16 @@ public function employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo( } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +778,37 @@ public function employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeExpenseCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeExpenseCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +825,7 @@ public function employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo( case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeExpenseCategoryModel[]', + '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +841,19 @@ public function employeeExpenseCategoryGetEmployeeExpenseCategoriesWithHttpInfo( * List Employee Expense Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryGetEmployeeExpenseCategoriesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeExpenseCategoryGetEmployeeExpenseCategoriesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'][0]) { - return $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +867,29 @@ function ($response) { * List Employee Expense Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryGetEmployeeExpenseCategoriesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeExpenseCategoryGetEmployeeExpenseCategoriesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpenseCategoryModel[]'; - $request = $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel[]'; + $request = $this->employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +912,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +922,19 @@ function ($exception) { * Create request for operation 'employeeExpenseCategoryGetEmployeeExpenseCategories' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employeeExpenseCategoryGetEmployeeExpenseCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +942,12 @@ protected function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($b ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employeeexpensecategory'; $formParams = []; $queryParams = []; @@ -845,20 +956,45 @@ protected function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($b $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1006,35 @@ protected function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($b ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1055,11 @@ protected function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1070,17 @@ protected function employeeExpenseCategoryGetEmployeeExpenseCategoriesRequest($b * * Create Employee Expense Category * - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category employee_expense_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeExpenseCategoryModel + * @return \OpenAPI\Client\Model\EmployeeExpenseCategoryModel */ - public function employeeExpenseCategoryPost($employee_expense_category, $business_id) + public function employeeExpenseCategoryPost($business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPost'][0]) { - list($response) = $this->employeeExpenseCategoryPostWithHttpInfo($employee_expense_category, $business_id); + list($response) = $this->employeeExpenseCategoryPostWithHttpInfo($business_id, $employee_expense_category, $contentType); return $response; } @@ -969,17 +1089,17 @@ public function employeeExpenseCategoryPost($employee_expense_category, $busines * * Create Employee Expense Category * - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeExpenseCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeExpenseCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeExpenseCategoryPostWithHttpInfo($employee_expense_category, $business_id) + public function employeeExpenseCategoryPostWithHttpInfo($business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpenseCategoryModel'; - $request = $this->employeeExpenseCategoryPostRequest($employee_expense_category, $business_id); + $request = $this->employeeExpenseCategoryPostRequest($business_id, $employee_expense_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1108,16 @@ public function employeeExpenseCategoryPostWithHttpInfo($employee_expense_catego } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1128,37 @@ public function employeeExpenseCategoryPostWithHttpInfo($employee_expense_catego sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeExpenseCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeExpenseCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1175,7 @@ public function employeeExpenseCategoryPostWithHttpInfo($employee_expense_catego case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeExpenseCategoryModel', + '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1190,16 @@ public function employeeExpenseCategoryPostWithHttpInfo($employee_expense_catego * * Create Employee Expense Category * - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryPostAsync($employee_expense_category, $business_id) + public function employeeExpenseCategoryPostAsync($business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPost'][0]) { - return $this->employeeExpenseCategoryPostAsyncWithHttpInfo($employee_expense_category, $business_id) + return $this->employeeExpenseCategoryPostAsyncWithHttpInfo($business_id, $employee_expense_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1212,26 @@ function ($response) { * * Create Employee Expense Category * - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryPostAsyncWithHttpInfo($employee_expense_category, $business_id) + public function employeeExpenseCategoryPostAsyncWithHttpInfo($business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpenseCategoryModel'; - $request = $this->employeeExpenseCategoryPostRequest($employee_expense_category, $business_id); + $returnType = '\OpenAPI\Client\Model\EmployeeExpenseCategoryModel'; + $request = $this->employeeExpenseCategoryPostRequest($business_id, $employee_expense_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1254,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1263,16 @@ function ($exception) { /** * Create request for operation 'employeeExpenseCategoryPost' * - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeExpenseCategoryPostRequest($employee_expense_category, $business_id) + public function employeeExpenseCategoryPostRequest($business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPost'][0]) { - // verify the required parameter 'employee_expense_category' is set - if ($employee_expense_category === null || (is_array($employee_expense_category) && count($employee_expense_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employee_expense_category when calling employeeExpenseCategoryPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1280,14 @@ protected function employeeExpenseCategoryPostRequest($employee_expense_category ); } + // verify the required parameter 'employee_expense_category' is set + if ($employee_expense_category === null || (is_array($employee_expense_category) && count($employee_expense_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employee_expense_category when calling employeeExpenseCategoryPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employeeexpensecategory'; $formParams = []; $queryParams = []; @@ -1146,6 +1296,7 @@ protected function employeeExpenseCategoryPostRequest($employee_expense_category $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1306,42 @@ protected function employeeExpenseCategoryPostRequest($employee_expense_category ); } - // body params - $_tempBody = null; - if (isset($employee_expense_category)) { - $_tempBody = $employee_expense_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employee_expense_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employee_expense_category)); + } else { + $httpBody = $employee_expense_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1362,11 @@ protected function employeeExpenseCategoryPostRequest($employee_expense_category $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1378,17 @@ protected function employeeExpenseCategoryPostRequest($employee_expense_category * Update Employee Expense Category * * @param int $id id (required) - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category employee_expense_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeExpenseCategoryPut($id, $employee_expense_category, $business_id) + public function employeeExpenseCategoryPut($id, $business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPut'][0]) { - $this->employeeExpenseCategoryPutWithHttpInfo($id, $employee_expense_category, $business_id); + $this->employeeExpenseCategoryPutWithHttpInfo($id, $business_id, $employee_expense_category, $contentType); } /** @@ -1258,17 +1397,17 @@ public function employeeExpenseCategoryPut($id, $employee_expense_category, $bus * Update Employee Expense Category * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeExpenseCategoryPutWithHttpInfo($id, $employee_expense_category, $business_id) + public function employeeExpenseCategoryPutWithHttpInfo($id, $business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPut'][0]) { - $returnType = ''; - $request = $this->employeeExpenseCategoryPutRequest($id, $employee_expense_category, $business_id); + $request = $this->employeeExpenseCategoryPutRequest($id, $business_id, $employee_expense_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -1277,9 +1416,16 @@ public function employeeExpenseCategoryPutWithHttpInfo($id, $employee_expense_ca } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1290,11 +1436,11 @@ public function employeeExpenseCategoryPutWithHttpInfo($id, $employee_expense_ca sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1313,15 +1459,16 @@ public function employeeExpenseCategoryPutWithHttpInfo($id, $employee_expense_ca * Update Employee Expense Category * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryPutAsync($id, $employee_expense_category, $business_id) + public function employeeExpenseCategoryPutAsync($id, $business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPut'][0]) { - return $this->employeeExpenseCategoryPutAsyncWithHttpInfo($id, $employee_expense_category, $business_id) + return $this->employeeExpenseCategoryPutAsyncWithHttpInfo($id, $business_id, $employee_expense_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1335,16 +1482,17 @@ function ($response) { * Update Employee Expense Category * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryPutAsyncWithHttpInfo($id, $employee_expense_category, $business_id) + public function employeeExpenseCategoryPutAsyncWithHttpInfo($id, $business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPut'][0]) { $returnType = ''; - $request = $this->employeeExpenseCategoryPutRequest($id, $employee_expense_category, $business_id); + $request = $this->employeeExpenseCategoryPutRequest($id, $business_id, $employee_expense_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1363,7 +1511,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1373,26 +1521,23 @@ function ($exception) { * Create request for operation 'employeeExpenseCategoryPut' * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeExpenseCategoryModel $employee_expense_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeExpenseCategoryPutRequest($id, $employee_expense_category, $business_id) + public function employeeExpenseCategoryPutRequest($id, $business_id, $employee_expense_category, string $contentType = self::contentTypes['employeeExpenseCategoryPut'][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 employeeExpenseCategoryPut' ); } - // verify the required parameter 'employee_expense_category' is set - if ($employee_expense_category === null || (is_array($employee_expense_category) && count($employee_expense_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employee_expense_category when calling employeeExpenseCategoryPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1400,6 +1545,14 @@ protected function employeeExpenseCategoryPutRequest($id, $employee_expense_cate ); } + // verify the required parameter 'employee_expense_category' is set + if ($employee_expense_category === null || (is_array($employee_expense_category) && count($employee_expense_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employee_expense_category when calling employeeExpenseCategoryPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employeeexpensecategory/{id}'; $formParams = []; $queryParams = []; @@ -1408,6 +1561,7 @@ protected function employeeExpenseCategoryPutRequest($id, $employee_expense_cate $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1425,56 +1579,42 @@ protected function employeeExpenseCategoryPutRequest($id, $employee_expense_cate ); } - // body params - $_tempBody = null; - if (isset($employee_expense_category)) { - $_tempBody = $employee_expense_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employee_expense_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employee_expense_category)); + } else { + $httpBody = $employee_expense_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1495,10 +1635,11 @@ protected function employeeExpenseCategoryPutRequest($id, $employee_expense_cate $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1510,14 +1651,15 @@ protected function employeeExpenseCategoryPutRequest($id, $employee_expense_cate * Get Tax Codes * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryTaxCodes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalServiceTaxCode[] + * @return \OpenAPI\Client\Model\JournalServiceTaxCode[] */ - public function employeeExpenseCategoryTaxCodes($business_id) + public function employeeExpenseCategoryTaxCodes($business_id, string $contentType = self::contentTypes['employeeExpenseCategoryTaxCodes'][0]) { - list($response) = $this->employeeExpenseCategoryTaxCodesWithHttpInfo($business_id); + list($response) = $this->employeeExpenseCategoryTaxCodesWithHttpInfo($business_id, $contentType); return $response; } @@ -1527,15 +1669,15 @@ public function employeeExpenseCategoryTaxCodes($business_id) * Get Tax Codes * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryTaxCodes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalServiceTaxCode[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalServiceTaxCode[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeExpenseCategoryTaxCodesWithHttpInfo($business_id) + public function employeeExpenseCategoryTaxCodesWithHttpInfo($business_id, string $contentType = self::contentTypes['employeeExpenseCategoryTaxCodes'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceTaxCode[]'; - $request = $this->employeeExpenseCategoryTaxCodesRequest($business_id); + $request = $this->employeeExpenseCategoryTaxCodesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1544,9 +1686,16 @@ public function employeeExpenseCategoryTaxCodesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1557,19 +1706,37 @@ public function employeeExpenseCategoryTaxCodesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalServiceTaxCode[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalServiceTaxCode[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalServiceTaxCode[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalServiceTaxCode[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1586,7 +1753,7 @@ public function employeeExpenseCategoryTaxCodesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalServiceTaxCode[]', + '\OpenAPI\Client\Model\JournalServiceTaxCode[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1602,13 +1769,14 @@ public function employeeExpenseCategoryTaxCodesWithHttpInfo($business_id) * Get Tax Codes * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryTaxCodesAsync($business_id) + public function employeeExpenseCategoryTaxCodesAsync($business_id, string $contentType = self::contentTypes['employeeExpenseCategoryTaxCodes'][0]) { - return $this->employeeExpenseCategoryTaxCodesAsyncWithHttpInfo($business_id) + return $this->employeeExpenseCategoryTaxCodesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1622,24 +1790,24 @@ function ($response) { * Get Tax Codes * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeExpenseCategoryTaxCodesAsyncWithHttpInfo($business_id) + public function employeeExpenseCategoryTaxCodesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['employeeExpenseCategoryTaxCodes'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceTaxCode[]'; - $request = $this->employeeExpenseCategoryTaxCodesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\JournalServiceTaxCode[]'; + $request = $this->employeeExpenseCategoryTaxCodesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1662,7 +1830,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1672,12 +1840,14 @@ function ($exception) { * Create request for operation 'employeeExpenseCategoryTaxCodes' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeExpenseCategoryTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeExpenseCategoryTaxCodesRequest($business_id) + public function employeeExpenseCategoryTaxCodesRequest($business_id, string $contentType = self::contentTypes['employeeExpenseCategoryTaxCodes'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1685,6 +1855,7 @@ protected function employeeExpenseCategoryTaxCodesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employeeexpensecategory/taxcodes'; $formParams = []; $queryParams = []; @@ -1693,6 +1864,7 @@ protected function employeeExpenseCategoryTaxCodesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1702,53 +1874,35 @@ protected function employeeExpenseCategoryTaxCodesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1769,10 +1923,11 @@ protected function employeeExpenseCategoryTaxCodesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeExpenseRequestApi.php b/src/lib/Api/EmployeeExpenseRequestApi.php index ab8357d..af52876 100644 --- a/src/lib/Api/EmployeeExpenseRequestApi.php +++ b/src/lib/Api/EmployeeExpenseRequestApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'expenseRequestDecline' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'expenseRequestDelete' => [ + 'application/json', + ], + 'expenseRequestGet' => [ + 'application/json', + ], + 'expenseRequestGetExpenseRequests' => [ + 'application/json', + ], + 'expenseRequestPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'expenseRequestPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'expenseRequestUploadAttachment' => [ + '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 + 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; } /** @@ -95,14 +163,15 @@ public function getConfig() * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function expenseRequestApprove($expense_request_id, $business_id, $employee_id) + public function expenseRequestApprove($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestApprove'][0]) { - $this->expenseRequestApproveWithHttpInfo($expense_request_id, $business_id, $employee_id); + $this->expenseRequestApproveWithHttpInfo($expense_request_id, $business_id, $employee_id, $contentType); } /** @@ -113,15 +182,15 @@ public function expenseRequestApprove($expense_request_id, $business_id, $employ * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestApproveWithHttpInfo($expense_request_id, $business_id, $employee_id) + public function expenseRequestApproveWithHttpInfo($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestApprove'][0]) { - $returnType = ''; - $request = $this->expenseRequestApproveRequest($expense_request_id, $business_id, $employee_id); + $request = $this->expenseRequestApproveRequest($expense_request_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +199,16 @@ public function expenseRequestApproveWithHttpInfo($expense_request_id, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +219,11 @@ public function expenseRequestApproveWithHttpInfo($expense_request_id, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -168,13 +244,14 @@ public function expenseRequestApproveWithHttpInfo($expense_request_id, $business * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestApproveAsync($expense_request_id, $business_id, $employee_id) + public function expenseRequestApproveAsync($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestApprove'][0]) { - return $this->expenseRequestApproveAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id) + return $this->expenseRequestApproveAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -190,14 +267,15 @@ function ($response) { * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestApproveAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id) + public function expenseRequestApproveAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestApprove'][0]) { $returnType = ''; - $request = $this->expenseRequestApproveRequest($expense_request_id, $business_id, $employee_id); + $request = $this->expenseRequestApproveRequest($expense_request_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +294,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -228,24 +306,28 @@ function ($exception) { * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestApproveRequest($expense_request_id, $business_id, $employee_id) + public function expenseRequestApproveRequest($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestApprove'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling expenseRequestApprove' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestApprove' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +335,7 @@ protected function expenseRequestApproveRequest($expense_request_id, $business_i ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest/{expenseRequestId}/approve'; $formParams = []; $queryParams = []; @@ -261,6 +344,7 @@ protected function expenseRequestApproveRequest($expense_request_id, $business_i $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -286,53 +370,35 @@ protected function expenseRequestApproveRequest($expense_request_id, $business_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -353,10 +419,11 @@ protected function expenseRequestApproveRequest($expense_request_id, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -368,17 +435,18 @@ protected function expenseRequestApproveRequest($expense_request_id, $business_i * Decline Expense Request * * @param int $expense_request_id expense_request_id (required) - * @param string $reason reason (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $reason reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function expenseRequestDecline($expense_request_id, $reason, $business_id, $employee_id) + public function expenseRequestDecline($expense_request_id, $business_id, $employee_id, $reason, string $contentType = self::contentTypes['expenseRequestDecline'][0]) { - $this->expenseRequestDeclineWithHttpInfo($expense_request_id, $reason, $business_id, $employee_id); + $this->expenseRequestDeclineWithHttpInfo($expense_request_id, $business_id, $employee_id, $reason, $contentType); } /** @@ -387,18 +455,18 @@ public function expenseRequestDecline($expense_request_id, $reason, $business_id * Decline Expense Request * * @param int $expense_request_id (required) - * @param string $reason (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestDeclineWithHttpInfo($expense_request_id, $reason, $business_id, $employee_id) + public function expenseRequestDeclineWithHttpInfo($expense_request_id, $business_id, $employee_id, $reason, string $contentType = self::contentTypes['expenseRequestDecline'][0]) { - $returnType = ''; - $request = $this->expenseRequestDeclineRequest($expense_request_id, $reason, $business_id, $employee_id); + $request = $this->expenseRequestDeclineRequest($expense_request_id, $business_id, $employee_id, $reason, $contentType); try { $options = $this->createHttpClientOption(); @@ -407,9 +475,16 @@ public function expenseRequestDeclineWithHttpInfo($expense_request_id, $reason, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -420,11 +495,11 @@ public function expenseRequestDeclineWithHttpInfo($expense_request_id, $reason, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -443,16 +518,17 @@ public function expenseRequestDeclineWithHttpInfo($expense_request_id, $reason, * Decline Expense Request * * @param int $expense_request_id (required) - * @param string $reason (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestDeclineAsync($expense_request_id, $reason, $business_id, $employee_id) + public function expenseRequestDeclineAsync($expense_request_id, $business_id, $employee_id, $reason, string $contentType = self::contentTypes['expenseRequestDecline'][0]) { - return $this->expenseRequestDeclineAsyncWithHttpInfo($expense_request_id, $reason, $business_id, $employee_id) + return $this->expenseRequestDeclineAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $reason, $contentType) ->then( function ($response) { return $response[0]; @@ -466,17 +542,18 @@ function ($response) { * Decline Expense Request * * @param int $expense_request_id (required) - * @param string $reason (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestDeclineAsyncWithHttpInfo($expense_request_id, $reason, $business_id, $employee_id) + public function expenseRequestDeclineAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $reason, string $contentType = self::contentTypes['expenseRequestDecline'][0]) { $returnType = ''; - $request = $this->expenseRequestDeclineRequest($expense_request_id, $reason, $business_id, $employee_id); + $request = $this->expenseRequestDeclineRequest($expense_request_id, $business_id, $employee_id, $reason, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -495,7 +572,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -505,33 +582,31 @@ function ($exception) { * Create request for operation 'expenseRequestDecline' * * @param int $expense_request_id (required) - * @param string $reason (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestDeclineRequest($expense_request_id, $reason, $business_id, $employee_id) + public function expenseRequestDeclineRequest($expense_request_id, $business_id, $employee_id, $reason, string $contentType = self::contentTypes['expenseRequestDecline'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling expenseRequestDecline' ); } - // verify the required parameter 'reason' is set - if ($reason === null || (is_array($reason) && count($reason) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $reason when calling expenseRequestDecline' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestDecline' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -539,6 +614,14 @@ protected function expenseRequestDeclineRequest($expense_request_id, $reason, $b ); } + // verify the required parameter 'reason' is set + if ($reason === null || (is_array($reason) && count($reason) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $reason when calling expenseRequestDecline' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest/{expenseRequestId}/decline'; $formParams = []; $queryParams = []; @@ -547,6 +630,7 @@ protected function expenseRequestDeclineRequest($expense_request_id, $reason, $b $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -572,56 +656,42 @@ protected function expenseRequestDeclineRequest($expense_request_id, $reason, $b ); } - // body params - $_tempBody = null; - if (isset($reason)) { - $_tempBody = $reason; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($reason)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($reason)); + } else { + $httpBody = $reason; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -642,10 +712,11 @@ protected function expenseRequestDeclineRequest($expense_request_id, $reason, $b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -659,14 +730,15 @@ protected function expenseRequestDeclineRequest($expense_request_id, $reason, $b * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function expenseRequestDelete($expense_request_id, $business_id, $employee_id) + public function expenseRequestDelete($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestDelete'][0]) { - $this->expenseRequestDeleteWithHttpInfo($expense_request_id, $business_id, $employee_id); + $this->expenseRequestDeleteWithHttpInfo($expense_request_id, $business_id, $employee_id, $contentType); } /** @@ -677,15 +749,15 @@ public function expenseRequestDelete($expense_request_id, $business_id, $employe * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestDeleteWithHttpInfo($expense_request_id, $business_id, $employee_id) + public function expenseRequestDeleteWithHttpInfo($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestDelete'][0]) { - $returnType = ''; - $request = $this->expenseRequestDeleteRequest($expense_request_id, $business_id, $employee_id); + $request = $this->expenseRequestDeleteRequest($expense_request_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -694,9 +766,16 @@ public function expenseRequestDeleteWithHttpInfo($expense_request_id, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -707,11 +786,11 @@ public function expenseRequestDeleteWithHttpInfo($expense_request_id, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -732,13 +811,14 @@ public function expenseRequestDeleteWithHttpInfo($expense_request_id, $business_ * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestDeleteAsync($expense_request_id, $business_id, $employee_id) + public function expenseRequestDeleteAsync($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestDelete'][0]) { - return $this->expenseRequestDeleteAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id) + return $this->expenseRequestDeleteAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -754,14 +834,15 @@ function ($response) { * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestDeleteAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id) + public function expenseRequestDeleteAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestDelete'][0]) { $returnType = ''; - $request = $this->expenseRequestDeleteRequest($expense_request_id, $business_id, $employee_id); + $request = $this->expenseRequestDeleteRequest($expense_request_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -780,7 +861,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -792,24 +873,28 @@ function ($exception) { * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestDeleteRequest($expense_request_id, $business_id, $employee_id) + public function expenseRequestDeleteRequest($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestDelete'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling expenseRequestDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -817,6 +902,7 @@ protected function expenseRequestDeleteRequest($expense_request_id, $business_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -825,6 +911,7 @@ protected function expenseRequestDeleteRequest($expense_request_id, $business_id $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -850,53 +937,35 @@ protected function expenseRequestDeleteRequest($expense_request_id, $business_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -917,10 +986,11 @@ protected function expenseRequestDeleteRequest($expense_request_id, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -934,14 +1004,15 @@ protected function expenseRequestDeleteRequest($expense_request_id, $business_id * @param int $employee_id employee_id (required) * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ExpenseRequestResponseModel + * @return \OpenAPI\Client\Model\ExpenseRequestResponseModel */ - public function expenseRequestGet($employee_id, $expense_request_id, $business_id) + public function expenseRequestGet($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['expenseRequestGet'][0]) { - list($response) = $this->expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, $business_id); + list($response) = $this->expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType); return $response; } @@ -953,15 +1024,15 @@ public function expenseRequestGet($employee_id, $expense_request_id, $business_i * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ExpenseRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ExpenseRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['expenseRequestGet'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseRequestResponseModel'; - $request = $this->expenseRequestGetRequest($employee_id, $expense_request_id, $business_id); + $request = $this->expenseRequestGetRequest($employee_id, $expense_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -970,9 +1041,16 @@ public function expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -983,19 +1061,37 @@ public function expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ExpenseRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExpenseRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExpenseRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExpenseRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1012,7 +1108,7 @@ public function expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ExpenseRequestResponseModel', + '\OpenAPI\Client\Model\ExpenseRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1030,13 +1126,14 @@ public function expenseRequestGetWithHttpInfo($employee_id, $expense_request_id, * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestGetAsync($employee_id, $expense_request_id, $business_id) + public function expenseRequestGetAsync($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['expenseRequestGet'][0]) { - return $this->expenseRequestGetAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + return $this->expenseRequestGetAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1052,24 +1149,24 @@ function ($response) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestGetAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function expenseRequestGetAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['expenseRequestGet'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseRequestResponseModel'; - $request = $this->expenseRequestGetRequest($employee_id, $expense_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ExpenseRequestResponseModel'; + $request = $this->expenseRequestGetRequest($employee_id, $expense_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1092,7 +1189,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1104,24 +1201,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestGetRequest($employee_id, $expense_request_id, $business_id) + public function expenseRequestGetRequest($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['expenseRequestGet'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling expenseRequestGet' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling expenseRequestGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1129,6 +1230,7 @@ protected function expenseRequestGetRequest($employee_id, $expense_request_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -1137,6 +1239,7 @@ protected function expenseRequestGetRequest($employee_id, $expense_request_id, $ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1162,53 +1265,35 @@ protected function expenseRequestGetRequest($employee_id, $expense_request_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1229,10 +1314,11 @@ protected function expenseRequestGetRequest($employee_id, $expense_request_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1245,18 +1331,20 @@ protected function expenseRequestGetRequest($employee_id, $expense_request_id, $ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGetExpenseRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ExpenseRequestResponseModel[] + * @return \OpenAPI\Client\Model\ExpenseRequestResponseModel[] */ - public function expenseRequestGetExpenseRequests($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function expenseRequestGetExpenseRequests($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['expenseRequestGetExpenseRequests'][0]) { - list($response) = $this->expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -1267,19 +1355,20 @@ public function expenseRequestGetExpenseRequests($business_id, $employee_id, $fi * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGetExpenseRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ExpenseRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ExpenseRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['expenseRequestGetExpenseRequests'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseRequestResponseModel[]'; - $request = $this->expenseRequestGetExpenseRequestsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->expenseRequestGetExpenseRequestsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -1288,9 +1377,16 @@ public function expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1301,19 +1397,37 @@ public function expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ExpenseRequestResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExpenseRequestResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExpenseRequestResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExpenseRequestResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1330,7 +1444,7 @@ public function expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ExpenseRequestResponseModel[]', + '\OpenAPI\Client\Model\ExpenseRequestResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1347,17 +1461,19 @@ public function expenseRequestGetExpenseRequestsWithHttpInfo($business_id, $empl * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGetExpenseRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestGetExpenseRequestsAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function expenseRequestGetExpenseRequestsAsync($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['expenseRequestGetExpenseRequests'][0]) { - return $this->expenseRequestGetExpenseRequestsAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->expenseRequestGetExpenseRequestsAsyncWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -1372,28 +1488,29 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGetExpenseRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestGetExpenseRequestsAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function expenseRequestGetExpenseRequestsAsyncWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['expenseRequestGetExpenseRequests'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseRequestResponseModel[]'; - $request = $this->expenseRequestGetExpenseRequestsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\ExpenseRequestResponseModel[]'; + $request = $this->expenseRequestGetExpenseRequestsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1416,7 +1533,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1427,22 +1544,26 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestGetExpenseRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestGetExpenseRequestsRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function expenseRequestGetExpenseRequestsRequest($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['expenseRequestGetExpenseRequests'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestGetExpenseRequests' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1450,6 +1571,12 @@ protected function expenseRequestGetExpenseRequestsRequest($business_id, $employ ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest'; $formParams = []; $queryParams = []; @@ -1458,20 +1585,45 @@ protected function expenseRequestGetExpenseRequestsRequest($business_id, $employ $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -1491,53 +1643,35 @@ protected function expenseRequestGetExpenseRequestsRequest($business_id, $employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1558,10 +1692,11 @@ protected function expenseRequestGetExpenseRequestsRequest($business_id, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1572,17 +1707,18 @@ protected function expenseRequestGetExpenseRequestsRequest($business_id, $employ * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function expenseRequestPost($model, $business_id, $employee_id) + public function expenseRequestPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPost'][0]) { - $this->expenseRequestPostWithHttpInfo($model, $business_id, $employee_id); + $this->expenseRequestPostWithHttpInfo($business_id, $employee_id, $model, $contentType); } /** @@ -1590,18 +1726,18 @@ public function expenseRequestPost($model, $business_id, $employee_id) * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestPostWithHttpInfo($model, $business_id, $employee_id) + public function expenseRequestPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPost'][0]) { - $returnType = ''; - $request = $this->expenseRequestPostRequest($model, $business_id, $employee_id); + $request = $this->expenseRequestPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1610,9 +1746,16 @@ public function expenseRequestPostWithHttpInfo($model, $business_id, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1623,11 +1766,11 @@ public function expenseRequestPostWithHttpInfo($model, $business_id, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1645,16 +1788,17 @@ public function expenseRequestPostWithHttpInfo($model, $business_id, $employee_i * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestPostAsync($model, $business_id, $employee_id) + public function expenseRequestPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPost'][0]) { - return $this->expenseRequestPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->expenseRequestPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1667,17 +1811,18 @@ function ($response) { * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function expenseRequestPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPost'][0]) { $returnType = ''; - $request = $this->expenseRequestPostRequest($model, $business_id, $employee_id); + $request = $this->expenseRequestPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1696,7 +1841,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1705,27 +1850,24 @@ function ($exception) { /** * Create request for operation 'expenseRequestPost' * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestPostRequest($model, $business_id, $employee_id) + public function expenseRequestPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling expenseRequestPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1733,6 +1875,14 @@ protected function expenseRequestPostRequest($model, $business_id, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling expenseRequestPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest'; $formParams = []; $queryParams = []; @@ -1741,6 +1891,7 @@ protected function expenseRequestPostRequest($model, $business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1758,56 +1909,42 @@ protected function expenseRequestPostRequest($model, $business_id, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1828,10 +1965,11 @@ protected function expenseRequestPostRequest($model, $business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1843,17 +1981,18 @@ protected function expenseRequestPostRequest($model, $business_id, $employee_id) * Update Expense Request * * @param int $expense_request_id expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function expenseRequestPut($expense_request_id, $model, $business_id, $employee_id) + public function expenseRequestPut($expense_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPut'][0]) { - $this->expenseRequestPutWithHttpInfo($expense_request_id, $model, $business_id, $employee_id); + $this->expenseRequestPutWithHttpInfo($expense_request_id, $business_id, $employee_id, $model, $contentType); } /** @@ -1862,18 +2001,18 @@ public function expenseRequestPut($expense_request_id, $model, $business_id, $em * Update Expense Request * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestPutWithHttpInfo($expense_request_id, $model, $business_id, $employee_id) + public function expenseRequestPutWithHttpInfo($expense_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPut'][0]) { - $returnType = ''; - $request = $this->expenseRequestPutRequest($expense_request_id, $model, $business_id, $employee_id); + $request = $this->expenseRequestPutRequest($expense_request_id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1882,9 +2021,16 @@ public function expenseRequestPutWithHttpInfo($expense_request_id, $model, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1895,11 +2041,11 @@ public function expenseRequestPutWithHttpInfo($expense_request_id, $model, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1918,16 +2064,17 @@ public function expenseRequestPutWithHttpInfo($expense_request_id, $model, $busi * Update Expense Request * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestPutAsync($expense_request_id, $model, $business_id, $employee_id) + public function expenseRequestPutAsync($expense_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPut'][0]) { - return $this->expenseRequestPutAsyncWithHttpInfo($expense_request_id, $model, $business_id, $employee_id) + return $this->expenseRequestPutAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1941,17 +2088,18 @@ function ($response) { * Update Expense Request * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestPutAsyncWithHttpInfo($expense_request_id, $model, $business_id, $employee_id) + public function expenseRequestPutAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPut'][0]) { $returnType = ''; - $request = $this->expenseRequestPutRequest($expense_request_id, $model, $business_id, $employee_id); + $request = $this->expenseRequestPutRequest($expense_request_id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1970,7 +2118,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1980,33 +2128,31 @@ function ($exception) { * Create request for operation 'expenseRequestPut' * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestPutRequest($expense_request_id, $model, $business_id, $employee_id) + public function expenseRequestPutRequest($expense_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['expenseRequestPut'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling expenseRequestPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling expenseRequestPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2014,6 +2160,14 @@ protected function expenseRequestPutRequest($expense_request_id, $model, $busine ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling expenseRequestPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -2022,6 +2176,7 @@ protected function expenseRequestPutRequest($expense_request_id, $model, $busine $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -2047,56 +2202,42 @@ protected function expenseRequestPutRequest($expense_request_id, $model, $busine ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2117,10 +2258,11 @@ protected function expenseRequestPutRequest($expense_request_id, $model, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2134,14 +2276,15 @@ protected function expenseRequestPutRequest($expense_request_id, $model, $busine * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function expenseRequestUploadAttachment($expense_request_id, $business_id, $employee_id) + public function expenseRequestUploadAttachment($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestUploadAttachment'][0]) { - list($response) = $this->expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, $business_id, $employee_id); + list($response) = $this->expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, $business_id, $employee_id, $contentType); return $response; } @@ -2153,15 +2296,15 @@ public function expenseRequestUploadAttachment($expense_request_id, $business_id * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, $business_id, $employee_id) + public function expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestUploadAttachment'][0]) { - $returnType = 'object'; - $request = $this->expenseRequestUploadAttachmentRequest($expense_request_id, $business_id, $employee_id); + $request = $this->expenseRequestUploadAttachmentRequest($expense_request_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2170,9 +2313,16 @@ public function expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2183,19 +2333,37 @@ public function expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2230,13 +2398,14 @@ public function expenseRequestUploadAttachmentWithHttpInfo($expense_request_id, * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestUploadAttachmentAsync($expense_request_id, $business_id, $employee_id) + public function expenseRequestUploadAttachmentAsync($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestUploadAttachment'][0]) { - return $this->expenseRequestUploadAttachmentAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id) + return $this->expenseRequestUploadAttachmentAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2252,24 +2421,24 @@ function ($response) { * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function expenseRequestUploadAttachmentAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id) + public function expenseRequestUploadAttachmentAsyncWithHttpInfo($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestUploadAttachment'][0]) { $returnType = 'object'; - $request = $this->expenseRequestUploadAttachmentRequest($expense_request_id, $business_id, $employee_id); + $request = $this->expenseRequestUploadAttachmentRequest($expense_request_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2292,7 +2461,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2304,24 +2473,28 @@ function ($exception) { * @param int $expense_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['expenseRequestUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function expenseRequestUploadAttachmentRequest($expense_request_id, $business_id, $employee_id) + public function expenseRequestUploadAttachmentRequest($expense_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['expenseRequestUploadAttachment'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling expenseRequestUploadAttachment' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling expenseRequestUploadAttachment' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2329,6 +2502,7 @@ protected function expenseRequestUploadAttachmentRequest($expense_request_id, $b ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expenserequest/{expenseRequestId}/attachment'; $formParams = []; $queryParams = []; @@ -2337,6 +2511,7 @@ protected function expenseRequestUploadAttachmentRequest($expense_request_id, $b $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -2362,53 +2537,35 @@ protected function expenseRequestUploadAttachmentRequest($expense_request_id, $b ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2429,10 +2586,11 @@ protected function expenseRequestUploadAttachmentRequest($expense_request_id, $b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeGroupsApi.php b/src/lib/Api/EmployeeGroupsApi.php index 0306c57..5a5027a 100644 --- a/src/lib/Api/EmployeeGroupsApi.php +++ b/src/lib/Api/EmployeeGroupsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeGroupGet' => [ + 'application/json', + ], + 'auEmployeeGroupGetGroups' => [ + 'application/json', + ], + 'auEmployeeGroupPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeeGroupPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeGroupDelete($id, $business_id) + public function auEmployeeGroupDelete($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupDelete'][0]) { - $this->auEmployeeGroupDeleteWithHttpInfo($id, $business_id); + $this->auEmployeeGroupDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auEmployeeGroupDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGroupDeleteWithHttpInfo($id, $business_id) + public function auEmployeeGroupDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupDelete'][0]) { - $returnType = ''; - $request = $this->auEmployeeGroupDeleteRequest($id, $business_id); + $request = $this->auEmployeeGroupDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auEmployeeGroupDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auEmployeeGroupDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auEmployeeGroupDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupDeleteAsync($id, $business_id) + public function auEmployeeGroupDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupDelete'][0]) { - return $this->auEmployeeGroupDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auEmployeeGroupDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupDeleteAsyncWithHttpInfo($id, $business_id) + public function auEmployeeGroupDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupDelete'][0]) { $returnType = ''; - $request = $this->auEmployeeGroupDeleteRequest($id, $business_id); + $request = $this->auEmployeeGroupDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGroupDeleteRequest($id, $business_id) + public function auEmployeeGroupDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupDelete'][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 auEmployeeGroupDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auEmployeeGroupDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employeegroup/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auEmployeeGroupDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auEmployeeGroupDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auEmployeeGroupDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auEmployeeGroupDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDetailedEmployeeGroupModel + * @return \OpenAPI\Client\Model\AuDetailedEmployeeGroupModel */ - public function auEmployeeGroupGet($id, $business_id) + public function auEmployeeGroupGet($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupGet'][0]) { - list($response) = $this->auEmployeeGroupGetWithHttpInfo($id, $business_id); + list($response) = $this->auEmployeeGroupGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auEmployeeGroupGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDetailedEmployeeGroupModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDetailedEmployeeGroupModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGroupGetWithHttpInfo($id, $business_id) + public function auEmployeeGroupGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupGet'][0]) { - $returnType = '\Swagger\Client\Model\AuDetailedEmployeeGroupModel'; - $request = $this->auEmployeeGroupGetRequest($id, $business_id); + $request = $this->auEmployeeGroupGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auEmployeeGroupGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auEmployeeGroupGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDetailedEmployeeGroupModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDetailedEmployeeGroupModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDetailedEmployeeGroupModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDetailedEmployeeGroupModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auEmployeeGroupGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDetailedEmployeeGroupModel', + '\OpenAPI\Client\Model\AuDetailedEmployeeGroupModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auEmployeeGroupGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupGetAsync($id, $business_id) + public function auEmployeeGroupGetAsync($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupGet'][0]) { - return $this->auEmployeeGroupGetAsyncWithHttpInfo($id, $business_id) + return $this->auEmployeeGroupGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupGetAsyncWithHttpInfo($id, $business_id) + public function auEmployeeGroupGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupGet'][0]) { - $returnType = '\Swagger\Client\Model\AuDetailedEmployeeGroupModel'; - $request = $this->auEmployeeGroupGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuDetailedEmployeeGroupModel'; + $request = $this->auEmployeeGroupGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGroupGetRequest($id, $business_id) + public function auEmployeeGroupGetRequest($id, $business_id, string $contentType = self::contentTypes['auEmployeeGroupGet'][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 auEmployeeGroupGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auEmployeeGroupGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employeegroup/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auEmployeeGroupGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auEmployeeGroupGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auEmployeeGroupGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -646,14 +714,15 @@ protected function auEmployeeGroupGetRequest($id, $business_id) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGetGroups'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeGroupModel[] + * @return \OpenAPI\Client\Model\AuEmployeeGroupModel[] */ - public function auEmployeeGroupGetGroups($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeGroupGetGroups($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGroupGetGroups'][0]) { - list($response) = $this->auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -667,15 +736,15 @@ public function auEmployeeGroupGetGroups($business_id, $filter = null, $orderby * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGetGroups'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeGroupModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeGroupModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGroupGetGroups'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeGroupModel[]'; - $request = $this->auEmployeeGroupGetGroupsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auEmployeeGroupGetGroupsRequest($business_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +753,16 @@ public function auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter = nul } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +773,37 @@ public function auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter = nul sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeGroupModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeGroupModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeGroupModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeGroupModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +820,7 @@ public function auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter = nul case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeGroupModel[]', + '\OpenAPI\Client\Model\AuEmployeeGroupModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -746,13 +840,14 @@ public function auEmployeeGroupGetGroupsWithHttpInfo($business_id, $filter = nul * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGetGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupGetGroupsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeGroupGetGroupsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGroupGetGroups'][0]) { - return $this->auEmployeeGroupGetGroupsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auEmployeeGroupGetGroupsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -770,24 +865,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGetGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupGetGroupsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeGroupGetGroupsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGroupGetGroups'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeGroupModel[]'; - $request = $this->auEmployeeGroupGetGroupsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuEmployeeGroupModel[]'; + $request = $this->auEmployeeGroupGetGroupsRequest($business_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +905,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -824,12 +919,14 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupGetGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeGroupGetGroups'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +934,11 @@ protected function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employeegroup'; $formParams = []; $queryParams = []; @@ -845,21 +947,42 @@ protected function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -870,53 +993,35 @@ protected function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1042,11 @@ protected function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1057,17 @@ protected function auEmployeeGroupGetGroupsRequest($business_id, $filter = null, * * Create Employee Group * - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group employee_group (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeGroupModel + * @return \OpenAPI\Client\Model\AuEmployeeGroupModel */ - public function auEmployeeGroupPost($employee_group, $business_id) + public function auEmployeeGroupPost($business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPost'][0]) { - list($response) = $this->auEmployeeGroupPostWithHttpInfo($employee_group, $business_id); + list($response) = $this->auEmployeeGroupPostWithHttpInfo($business_id, $employee_group, $contentType); return $response; } @@ -969,17 +1076,17 @@ public function auEmployeeGroupPost($employee_group, $business_id) * * Create Employee Group * - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeGroupModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeGroupModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGroupPostWithHttpInfo($employee_group, $business_id) + public function auEmployeeGroupPostWithHttpInfo($business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeGroupModel'; - $request = $this->auEmployeeGroupPostRequest($employee_group, $business_id); + $request = $this->auEmployeeGroupPostRequest($business_id, $employee_group, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1095,16 @@ public function auEmployeeGroupPostWithHttpInfo($employee_group, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1115,37 @@ public function auEmployeeGroupPostWithHttpInfo($employee_group, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeGroupModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeGroupModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeGroupModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeGroupModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1162,7 @@ public function auEmployeeGroupPostWithHttpInfo($employee_group, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeGroupModel', + '\OpenAPI\Client\Model\AuEmployeeGroupModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1177,16 @@ public function auEmployeeGroupPostWithHttpInfo($employee_group, $business_id) * * Create Employee Group * - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupPostAsync($employee_group, $business_id) + public function auEmployeeGroupPostAsync($business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPost'][0]) { - return $this->auEmployeeGroupPostAsyncWithHttpInfo($employee_group, $business_id) + return $this->auEmployeeGroupPostAsyncWithHttpInfo($business_id, $employee_group, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1199,26 @@ function ($response) { * * Create Employee Group * - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupPostAsyncWithHttpInfo($employee_group, $business_id) + public function auEmployeeGroupPostAsyncWithHttpInfo($business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeGroupModel'; - $request = $this->auEmployeeGroupPostRequest($employee_group, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeGroupModel'; + $request = $this->auEmployeeGroupPostRequest($business_id, $employee_group, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1241,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1250,16 @@ function ($exception) { /** * Create request for operation 'auEmployeeGroupPost' * - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGroupPostRequest($employee_group, $business_id) + public function auEmployeeGroupPostRequest($business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPost'][0]) { - // verify the required parameter 'employee_group' is set - if ($employee_group === null || (is_array($employee_group) && count($employee_group) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employee_group when calling auEmployeeGroupPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1267,14 @@ protected function auEmployeeGroupPostRequest($employee_group, $business_id) ); } + // verify the required parameter 'employee_group' is set + if ($employee_group === null || (is_array($employee_group) && count($employee_group) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employee_group when calling auEmployeeGroupPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employeegroup'; $formParams = []; $queryParams = []; @@ -1146,6 +1283,7 @@ protected function auEmployeeGroupPostRequest($employee_group, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1293,42 @@ protected function auEmployeeGroupPostRequest($employee_group, $business_id) ); } - // body params - $_tempBody = null; - if (isset($employee_group)) { - $_tempBody = $employee_group; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employee_group)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employee_group)); + } else { + $httpBody = $employee_group; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1349,11 @@ protected function auEmployeeGroupPostRequest($employee_group, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1365,17 @@ protected function auEmployeeGroupPostRequest($employee_group, $business_id) * Update Employee Group * * @param int $id id (required) - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group employee_group (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeGroupModel + * @return \OpenAPI\Client\Model\AuEmployeeGroupModel */ - public function auEmployeeGroupPut($id, $employee_group, $business_id) + public function auEmployeeGroupPut($id, $business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPut'][0]) { - list($response) = $this->auEmployeeGroupPutWithHttpInfo($id, $employee_group, $business_id); + list($response) = $this->auEmployeeGroupPutWithHttpInfo($id, $business_id, $employee_group, $contentType); return $response; } @@ -1259,17 +1385,17 @@ public function auEmployeeGroupPut($id, $employee_group, $business_id) * Update Employee Group * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeGroupModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeGroupModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeGroupPutWithHttpInfo($id, $employee_group, $business_id) + public function auEmployeeGroupPutWithHttpInfo($id, $business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeGroupModel'; - $request = $this->auEmployeeGroupPutRequest($id, $employee_group, $business_id); + $request = $this->auEmployeeGroupPutRequest($id, $business_id, $employee_group, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1404,16 @@ public function auEmployeeGroupPutWithHttpInfo($id, $employee_group, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1424,37 @@ public function auEmployeeGroupPutWithHttpInfo($id, $employee_group, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeGroupModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeGroupModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeGroupModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeGroupModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1471,7 @@ public function auEmployeeGroupPutWithHttpInfo($id, $employee_group, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeGroupModel', + '\OpenAPI\Client\Model\AuEmployeeGroupModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1487,16 @@ public function auEmployeeGroupPutWithHttpInfo($id, $employee_group, $business_i * Update Employee Group * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupPutAsync($id, $employee_group, $business_id) + public function auEmployeeGroupPutAsync($id, $business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPut'][0]) { - return $this->auEmployeeGroupPutAsyncWithHttpInfo($id, $employee_group, $business_id) + return $this->auEmployeeGroupPutAsyncWithHttpInfo($id, $business_id, $employee_group, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1510,26 @@ function ($response) { * Update Employee Group * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeGroupPutAsyncWithHttpInfo($id, $employee_group, $business_id) + public function auEmployeeGroupPutAsyncWithHttpInfo($id, $business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeGroupModel'; - $request = $this->auEmployeeGroupPutRequest($id, $employee_group, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeGroupModel'; + $request = $this->auEmployeeGroupPutRequest($id, $business_id, $employee_group, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1552,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1562,23 @@ function ($exception) { * Create request for operation 'auEmployeeGroupPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeGroupModel $employee_group (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeGroupModel $employee_group (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeGroupPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeGroupPutRequest($id, $employee_group, $business_id) + public function auEmployeeGroupPutRequest($id, $business_id, $employee_group, string $contentType = self::contentTypes['auEmployeeGroupPut'][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 auEmployeeGroupPut' ); } - // verify the required parameter 'employee_group' is set - if ($employee_group === null || (is_array($employee_group) && count($employee_group) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employee_group when calling auEmployeeGroupPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1586,14 @@ protected function auEmployeeGroupPutRequest($id, $employee_group, $business_id) ); } + // verify the required parameter 'employee_group' is set + if ($employee_group === null || (is_array($employee_group) && count($employee_group) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employee_group when calling auEmployeeGroupPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employeegroup/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1602,7 @@ protected function auEmployeeGroupPutRequest($id, $employee_group, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1620,42 @@ protected function auEmployeeGroupPutRequest($id, $employee_group, $business_id) ); } - // body params - $_tempBody = null; - if (isset($employee_group)) { - $_tempBody = $employee_group; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employee_group)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employee_group)); + } else { + $httpBody = $employee_group; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1676,11 @@ protected function auEmployeeGroupPutRequest($id, $employee_group, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeLeaveAllowancesApi.php b/src/lib/Api/EmployeeLeaveAllowancesApi.php index eaf8d67..a028ef0 100644 --- a/src/lib/Api/EmployeeLeaveAllowancesApi.php +++ b/src/lib/Api/EmployeeLeaveAllowancesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeLeaveAllowancePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +136,15 @@ public function getConfig() * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceModel[] + * @return \OpenAPI\Client\Model\AuLeaveAllowanceModel[] */ - public function auEmployeeLeaveAllowanceGet($business_id, $employee_id) + public function auEmployeeLeaveAllowanceGet($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceGet'][0]) { - list($response) = $this->auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_id); + list($response) = $this->auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -112,15 +155,15 @@ public function auEmployeeLeaveAllowanceGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_id) + public function auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceModel[]'; - $request = $this->auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id); + $request = $this->auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,9 +172,16 @@ public function auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -142,19 +192,37 @@ public function auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -171,7 +239,7 @@ public function auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceModel[]', + '\OpenAPI\Client\Model\AuLeaveAllowanceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -188,13 +256,14 @@ public function auEmployeeLeaveAllowanceGetWithHttpInfo($business_id, $employee_ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowanceGetAsync($business_id, $employee_id) + public function auEmployeeLeaveAllowanceGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceGet'][0]) { - return $this->auEmployeeLeaveAllowanceGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->auEmployeeLeaveAllowanceGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -209,24 +278,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowanceGetAsyncWithHttpInfo($business_id, $employee_id) + public function auEmployeeLeaveAllowanceGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceModel[]'; - $request = $this->auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceModel[]'; + $request = $this->auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -249,7 +318,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -260,18 +329,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id) + public function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeLeaveAllowanceGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -279,6 +351,7 @@ protected function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaveallowances'; $formParams = []; $queryParams = []; @@ -287,6 +360,7 @@ protected function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -304,53 +378,35 @@ protected function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -371,10 +427,11 @@ protected function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -385,17 +442,18 @@ protected function auEmployeeLeaveAllowanceGetRequest($business_id, $employee_id * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowanceModel[] $leave_allowances leave_allowances (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceModel[] $leave_allowances leave_allowances (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowancePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeLeaveAllowancePut($leave_allowances, $business_id, $employee_id) + public function auEmployeeLeaveAllowancePut($business_id, $employee_id, $leave_allowances, string $contentType = self::contentTypes['auEmployeeLeaveAllowancePut'][0]) { - $this->auEmployeeLeaveAllowancePutWithHttpInfo($leave_allowances, $business_id, $employee_id); + $this->auEmployeeLeaveAllowancePutWithHttpInfo($business_id, $employee_id, $leave_allowances, $contentType); } /** @@ -403,18 +461,18 @@ public function auEmployeeLeaveAllowancePut($leave_allowances, $business_id, $em * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowancePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeLeaveAllowancePutWithHttpInfo($leave_allowances, $business_id, $employee_id) + public function auEmployeeLeaveAllowancePutWithHttpInfo($business_id, $employee_id, $leave_allowances, string $contentType = self::contentTypes['auEmployeeLeaveAllowancePut'][0]) { - $returnType = ''; - $request = $this->auEmployeeLeaveAllowancePutRequest($leave_allowances, $business_id, $employee_id); + $request = $this->auEmployeeLeaveAllowancePutRequest($business_id, $employee_id, $leave_allowances, $contentType); try { $options = $this->createHttpClientOption(); @@ -423,9 +481,16 @@ public function auEmployeeLeaveAllowancePutWithHttpInfo($leave_allowances, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -436,11 +501,11 @@ public function auEmployeeLeaveAllowancePutWithHttpInfo($leave_allowances, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -458,16 +523,17 @@ public function auEmployeeLeaveAllowancePutWithHttpInfo($leave_allowances, $busi * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowancePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowancePutAsync($leave_allowances, $business_id, $employee_id) + public function auEmployeeLeaveAllowancePutAsync($business_id, $employee_id, $leave_allowances, string $contentType = self::contentTypes['auEmployeeLeaveAllowancePut'][0]) { - return $this->auEmployeeLeaveAllowancePutAsyncWithHttpInfo($leave_allowances, $business_id, $employee_id) + return $this->auEmployeeLeaveAllowancePutAsyncWithHttpInfo($business_id, $employee_id, $leave_allowances, $contentType) ->then( function ($response) { return $response[0]; @@ -480,17 +546,18 @@ function ($response) { * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowancePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowancePutAsyncWithHttpInfo($leave_allowances, $business_id, $employee_id) + public function auEmployeeLeaveAllowancePutAsyncWithHttpInfo($business_id, $employee_id, $leave_allowances, string $contentType = self::contentTypes['auEmployeeLeaveAllowancePut'][0]) { $returnType = ''; - $request = $this->auEmployeeLeaveAllowancePutRequest($leave_allowances, $business_id, $employee_id); + $request = $this->auEmployeeLeaveAllowancePutRequest($business_id, $employee_id, $leave_allowances, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -509,7 +576,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -518,27 +585,24 @@ function ($exception) { /** * Create request for operation 'auEmployeeLeaveAllowancePut' * - * @param \Swagger\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceModel[] $leave_allowances (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowancePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeLeaveAllowancePutRequest($leave_allowances, $business_id, $employee_id) + public function auEmployeeLeaveAllowancePutRequest($business_id, $employee_id, $leave_allowances, string $contentType = self::contentTypes['auEmployeeLeaveAllowancePut'][0]) { - // verify the required parameter 'leave_allowances' is set - if ($leave_allowances === null || (is_array($leave_allowances) && count($leave_allowances) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_allowances when calling auEmployeeLeaveAllowancePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeLeaveAllowancePut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -546,6 +610,14 @@ protected function auEmployeeLeaveAllowancePutRequest($leave_allowances, $busine ); } + // verify the required parameter 'leave_allowances' is set + if ($leave_allowances === null || (is_array($leave_allowances) && count($leave_allowances) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_allowances when calling auEmployeeLeaveAllowancePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaveallowances'; $formParams = []; $queryParams = []; @@ -554,6 +626,7 @@ protected function auEmployeeLeaveAllowancePutRequest($leave_allowances, $busine $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -571,56 +644,42 @@ protected function auEmployeeLeaveAllowancePutRequest($leave_allowances, $busine ); } - // body params - $_tempBody = null; - if (isset($leave_allowances)) { - $_tempBody = $leave_allowances; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_allowances)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_allowances)); + } else { + $httpBody = $leave_allowances; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -641,10 +700,11 @@ protected function auEmployeeLeaveAllowancePutRequest($leave_allowances, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeOnboardingApi.php b/src/lib/Api/EmployeeOnboardingApi.php index b0b1cc8..f506484 100644 --- a/src/lib/Api/EmployeeOnboardingApi.php +++ b/src/lib/Api/EmployeeOnboardingApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -92,16 +131,17 @@ public function getConfig() * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auBusinessEmployeeOnboardingInitiateSelfService($model, $business_id) + public function auBusinessEmployeeOnboardingInitiateSelfService($business_id, $model, string $contentType = self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'][0]) { - $this->auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($model, $business_id); + $this->auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($business_id, $model, $contentType); } /** @@ -109,17 +149,17 @@ public function auBusinessEmployeeOnboardingInitiateSelfService($model, $busines * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($model, $business_id) + public function auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'][0]) { - $returnType = ''; - $request = $this->auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model, $business_id); + $request = $this->auBusinessEmployeeOnboardingInitiateSelfServiceRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +168,16 @@ public function auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($mod } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +188,11 @@ public function auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($mod sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -163,15 +210,16 @@ public function auBusinessEmployeeOnboardingInitiateSelfServiceWithHttpInfo($mod * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessEmployeeOnboardingInitiateSelfServiceAsync($model, $business_id) + public function auBusinessEmployeeOnboardingInitiateSelfServiceAsync($business_id, $model, string $contentType = self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'][0]) { - return $this->auBusinessEmployeeOnboardingInitiateSelfServiceAsyncWithHttpInfo($model, $business_id) + return $this->auBusinessEmployeeOnboardingInitiateSelfServiceAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -184,16 +232,17 @@ function ($response) { * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessEmployeeOnboardingInitiateSelfServiceAsyncWithHttpInfo($model, $business_id) + public function auBusinessEmployeeOnboardingInitiateSelfServiceAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'][0]) { $returnType = ''; - $request = $this->auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model, $business_id); + $request = $this->auBusinessEmployeeOnboardingInitiateSelfServiceRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +261,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -221,20 +270,16 @@ function ($exception) { /** * Create request for operation 'auBusinessEmployeeOnboardingInitiateSelfService' * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model, $business_id) + public function auBusinessEmployeeOnboardingInitiateSelfServiceRequest($business_id, $model, string $contentType = self::contentTypes['auBusinessEmployeeOnboardingInitiateSelfService'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auBusinessEmployeeOnboardingInitiateSelfService' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +287,14 @@ protected function auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auBusinessEmployeeOnboardingInitiateSelfService' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employeeonboarding/initiateselfservice'; $formParams = []; $queryParams = []; @@ -250,6 +303,7 @@ protected function auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -259,56 +313,42 @@ protected function auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -329,10 +369,11 @@ protected function auBusinessEmployeeOnboardingInitiateSelfServiceRequest($model $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeePayRateScheduleApi.php b/src/lib/Api/EmployeePayRateScheduleApi.php index 7a87b7b..79aa893 100644 --- a/src/lib/Api/EmployeePayRateScheduleApi.php +++ b/src/lib/Api/EmployeePayRateScheduleApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'employeePayRateScheduleGet' => [ + 'application/json', + ], + 'employeePayRateScheduleList' => [ + 'application/json', + ], + 'employeePayRateSchedulePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeePayRateSchedulePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +150,15 @@ public function getConfig() * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeePayRateScheduleDelete($id, $business_id, $employee_id) + public function employeePayRateScheduleDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleDelete'][0]) { - $this->employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -113,15 +169,15 @@ public function employeePayRateScheduleDelete($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleDelete'][0]) { - $returnType = ''; - $request = $this->employeePayRateScheduleDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeePayRateScheduleDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +186,16 @@ public function employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $em } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +206,11 @@ public function employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $em sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -168,13 +231,14 @@ public function employeePayRateScheduleDeleteWithHttpInfo($id, $business_id, $em * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateScheduleDeleteAsync($id, $business_id, $employee_id) + public function employeePayRateScheduleDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleDelete'][0]) { - return $this->employeePayRateScheduleDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeePayRateScheduleDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -190,14 +254,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateScheduleDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeePayRateScheduleDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleDelete'][0]) { $returnType = ''; - $request = $this->employeePayRateScheduleDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeePayRateScheduleDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +281,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -228,24 +293,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeePayRateScheduleDeleteRequest($id, $business_id, $employee_id) + public function employeePayRateScheduleDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleDelete'][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 employeePayRateScheduleDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeePayRateScheduleDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +322,7 @@ protected function employeePayRateScheduleDeleteRequest($id, $business_id, $empl ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payrateschedule/{id}'; $formParams = []; $queryParams = []; @@ -261,6 +331,7 @@ protected function employeePayRateScheduleDeleteRequest($id, $business_id, $empl $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -286,53 +357,35 @@ protected function employeePayRateScheduleDeleteRequest($id, $business_id, $empl ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -353,10 +406,11 @@ protected function employeePayRateScheduleDeleteRequest($id, $business_id, $empl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -370,14 +424,15 @@ protected function employeePayRateScheduleDeleteRequest($id, $business_id, $empl * @param int $record_id record_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRateScheduleModel + * @return \OpenAPI\Client\Model\PayRateScheduleModel */ - public function employeePayRateScheduleGet($record_id, $business_id, $employee_id) + public function employeePayRateScheduleGet($record_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleGet'][0]) { - list($response) = $this->employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, $employee_id); + list($response) = $this->employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, $employee_id, $contentType); return $response; } @@ -389,15 +444,15 @@ public function employeePayRateScheduleGet($record_id, $business_id, $employee_i * @param int $record_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRateScheduleModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRateScheduleModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, $employee_id) + public function employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel'; - $request = $this->employeePayRateScheduleGetRequest($record_id, $business_id, $employee_id); + $request = $this->employeePayRateScheduleGetRequest($record_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -406,9 +461,16 @@ public function employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -419,19 +481,37 @@ public function employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRateScheduleModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRateScheduleModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRateScheduleModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -448,7 +528,7 @@ public function employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRateScheduleModel', + '\OpenAPI\Client\Model\PayRateScheduleModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -466,13 +546,14 @@ public function employeePayRateScheduleGetWithHttpInfo($record_id, $business_id, * @param int $record_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateScheduleGetAsync($record_id, $business_id, $employee_id) + public function employeePayRateScheduleGetAsync($record_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleGet'][0]) { - return $this->employeePayRateScheduleGetAsyncWithHttpInfo($record_id, $business_id, $employee_id) + return $this->employeePayRateScheduleGetAsyncWithHttpInfo($record_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -488,24 +569,24 @@ function ($response) { * @param int $record_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateScheduleGetAsyncWithHttpInfo($record_id, $business_id, $employee_id) + public function employeePayRateScheduleGetAsyncWithHttpInfo($record_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel'; - $request = $this->employeePayRateScheduleGetRequest($record_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel'; + $request = $this->employeePayRateScheduleGetRequest($record_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -528,7 +609,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -540,24 +621,28 @@ function ($exception) { * @param int $record_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeePayRateScheduleGetRequest($record_id, $business_id, $employee_id) + public function employeePayRateScheduleGetRequest($record_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleGet'][0]) { + // verify the required parameter 'record_id' is set if ($record_id === null || (is_array($record_id) && count($record_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $record_id when calling employeePayRateScheduleGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeePayRateScheduleGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -565,6 +650,7 @@ protected function employeePayRateScheduleGetRequest($record_id, $business_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payrateschedule/{recordId}'; $formParams = []; $queryParams = []; @@ -573,6 +659,7 @@ protected function employeePayRateScheduleGetRequest($record_id, $business_id, $ $multipart = false; + // path params if ($record_id !== null) { $resourcePath = str_replace( @@ -598,53 +685,35 @@ protected function employeePayRateScheduleGetRequest($record_id, $business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -665,10 +734,11 @@ protected function employeePayRateScheduleGetRequest($record_id, $business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -681,14 +751,15 @@ protected function employeePayRateScheduleGetRequest($record_id, $business_id, $ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRateScheduleModel[] + * @return \OpenAPI\Client\Model\PayRateScheduleModel[] */ - public function employeePayRateScheduleList($business_id, $employee_id) + public function employeePayRateScheduleList($business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleList'][0]) { - list($response) = $this->employeePayRateScheduleListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeePayRateScheduleListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -699,15 +770,15 @@ public function employeePayRateScheduleList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRateScheduleModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRateScheduleModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeePayRateScheduleListWithHttpInfo($business_id, $employee_id) + public function employeePayRateScheduleListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleList'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel[]'; - $request = $this->employeePayRateScheduleListRequest($business_id, $employee_id); + $request = $this->employeePayRateScheduleListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -716,9 +787,16 @@ public function employeePayRateScheduleListWithHttpInfo($business_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -729,19 +807,37 @@ public function employeePayRateScheduleListWithHttpInfo($business_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRateScheduleModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRateScheduleModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRateScheduleModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -758,7 +854,7 @@ public function employeePayRateScheduleListWithHttpInfo($business_id, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRateScheduleModel[]', + '\OpenAPI\Client\Model\PayRateScheduleModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -775,13 +871,14 @@ public function employeePayRateScheduleListWithHttpInfo($business_id, $employee_ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateScheduleListAsync($business_id, $employee_id) + public function employeePayRateScheduleListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleList'][0]) { - return $this->employeePayRateScheduleListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeePayRateScheduleListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -796,24 +893,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateScheduleListAsyncWithHttpInfo($business_id, $employee_id) + public function employeePayRateScheduleListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleList'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel[]'; - $request = $this->employeePayRateScheduleListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel[]'; + $request = $this->employeePayRateScheduleListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -836,7 +933,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -847,18 +944,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateScheduleList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeePayRateScheduleListRequest($business_id, $employee_id) + public function employeePayRateScheduleListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeePayRateScheduleList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeePayRateScheduleList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -866,6 +966,7 @@ protected function employeePayRateScheduleListRequest($business_id, $employee_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payrateschedule'; $formParams = []; $queryParams = []; @@ -874,6 +975,7 @@ protected function employeePayRateScheduleListRequest($business_id, $employee_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -891,53 +993,35 @@ protected function employeePayRateScheduleListRequest($business_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -958,10 +1042,11 @@ protected function employeePayRateScheduleListRequest($business_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -972,17 +1057,18 @@ protected function employeePayRateScheduleListRequest($business_id, $employee_id * * Create pay rate adjustment schedule record * - * @param \Swagger\Client\Model\PayRateScheduleModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRateScheduleModel + * @return \OpenAPI\Client\Model\PayRateScheduleModel */ - public function employeePayRateSchedulePost($model, $business_id, $employee_id) + public function employeePayRateSchedulePost($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePost'][0]) { - list($response) = $this->employeePayRateSchedulePostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeePayRateSchedulePostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -991,18 +1077,18 @@ public function employeePayRateSchedulePost($model, $business_id, $employee_id) * * Create pay rate adjustment schedule record * - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRateScheduleModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRateScheduleModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeePayRateSchedulePostWithHttpInfo($model, $business_id, $employee_id) + public function employeePayRateSchedulePostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePost'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel'; - $request = $this->employeePayRateSchedulePostRequest($model, $business_id, $employee_id); + $request = $this->employeePayRateSchedulePostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1011,9 +1097,16 @@ public function employeePayRateSchedulePostWithHttpInfo($model, $business_id, $e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1024,19 +1117,37 @@ public function employeePayRateSchedulePostWithHttpInfo($model, $business_id, $e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRateScheduleModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRateScheduleModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRateScheduleModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1053,7 +1164,7 @@ public function employeePayRateSchedulePostWithHttpInfo($model, $business_id, $e case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRateScheduleModel', + '\OpenAPI\Client\Model\PayRateScheduleModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1068,16 +1179,17 @@ public function employeePayRateSchedulePostWithHttpInfo($model, $business_id, $e * * Create pay rate adjustment schedule record * - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateSchedulePostAsync($model, $business_id, $employee_id) + public function employeePayRateSchedulePostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePost'][0]) { - return $this->employeePayRateSchedulePostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeePayRateSchedulePostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1090,27 +1202,27 @@ function ($response) { * * Create pay rate adjustment schedule record * - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateSchedulePostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeePayRateSchedulePostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePost'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel'; - $request = $this->employeePayRateSchedulePostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel'; + $request = $this->employeePayRateSchedulePostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1133,7 +1245,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1142,27 +1254,24 @@ function ($exception) { /** * Create request for operation 'employeePayRateSchedulePost' * - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeePayRateSchedulePostRequest($model, $business_id, $employee_id) + public function employeePayRateSchedulePostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeePayRateSchedulePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeePayRateSchedulePost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1170,6 +1279,14 @@ protected function employeePayRateSchedulePostRequest($model, $business_id, $emp ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeePayRateSchedulePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payrateschedule'; $formParams = []; $queryParams = []; @@ -1178,6 +1295,7 @@ protected function employeePayRateSchedulePostRequest($model, $business_id, $emp $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1195,56 +1313,42 @@ protected function employeePayRateSchedulePostRequest($model, $business_id, $emp ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1265,10 +1369,11 @@ protected function employeePayRateSchedulePostRequest($model, $business_id, $emp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1280,17 +1385,18 @@ protected function employeePayRateSchedulePostRequest($model, $business_id, $emp * Update pay rate adjustment schedule record * * @param int $id id (required) - * @param \Swagger\Client\Model\PayRateScheduleModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRateScheduleModel + * @return \OpenAPI\Client\Model\PayRateScheduleModel */ - public function employeePayRateSchedulePut($id, $model, $business_id, $employee_id) + public function employeePayRateSchedulePut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePut'][0]) { - list($response) = $this->employeePayRateSchedulePutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->employeePayRateSchedulePutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -1300,18 +1406,18 @@ public function employeePayRateSchedulePut($id, $model, $business_id, $employee_ * Update pay rate adjustment schedule record * * @param int $id (required) - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRateScheduleModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRateScheduleModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeePayRateSchedulePutWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeePayRateSchedulePutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePut'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel'; - $request = $this->employeePayRateSchedulePutRequest($id, $model, $business_id, $employee_id); + $request = $this->employeePayRateSchedulePutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1320,9 +1426,16 @@ public function employeePayRateSchedulePutWithHttpInfo($id, $model, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1333,19 +1446,37 @@ public function employeePayRateSchedulePutWithHttpInfo($id, $model, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRateScheduleModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRateScheduleModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRateScheduleModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1362,7 +1493,7 @@ public function employeePayRateSchedulePutWithHttpInfo($id, $model, $business_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRateScheduleModel', + '\OpenAPI\Client\Model\PayRateScheduleModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1378,16 +1509,17 @@ public function employeePayRateSchedulePutWithHttpInfo($id, $model, $business_id * Update pay rate adjustment schedule record * * @param int $id (required) - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateSchedulePutAsync($id, $model, $business_id, $employee_id) + public function employeePayRateSchedulePutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePut'][0]) { - return $this->employeePayRateSchedulePutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->employeePayRateSchedulePutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1401,27 +1533,27 @@ function ($response) { * Update pay rate adjustment schedule record * * @param int $id (required) - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRateSchedulePutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeePayRateSchedulePutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePut'][0]) { - $returnType = '\Swagger\Client\Model\PayRateScheduleModel'; - $request = $this->employeePayRateSchedulePutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\PayRateScheduleModel'; + $request = $this->employeePayRateSchedulePutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1444,7 +1576,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1454,33 +1586,31 @@ function ($exception) { * Create request for operation 'employeePayRateSchedulePut' * * @param int $id (required) - * @param \Swagger\Client\Model\PayRateScheduleModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\PayRateScheduleModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRateSchedulePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeePayRateSchedulePutRequest($id, $model, $business_id, $employee_id) + public function employeePayRateSchedulePutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeePayRateSchedulePut'][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 employeePayRateSchedulePut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeePayRateSchedulePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeePayRateSchedulePut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1488,6 +1618,14 @@ protected function employeePayRateSchedulePutRequest($id, $model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeePayRateSchedulePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payrateschedule/{id}'; $formParams = []; $queryParams = []; @@ -1496,6 +1634,7 @@ protected function employeePayRateSchedulePutRequest($id, $model, $business_id, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1521,56 +1660,42 @@ protected function employeePayRateSchedulePutRequest($id, $model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1591,10 +1716,11 @@ protected function employeePayRateSchedulePutRequest($id, $model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeQualificationsApi.php b/src/lib/Api/EmployeeQualificationsApi.php index 70b3eca..3151049 100644 --- a/src/lib/Api/EmployeeQualificationsApi.php +++ b/src/lib/Api/EmployeeQualificationsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'employeeQualificationDocumentContent' => [ + 'application/json', + ], + 'employeeQualificationDocumentDelete' => [ + 'application/json', + ], + 'employeeQualificationDocumentGet' => [ + 'application/json', + ], + 'employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById' => [ + 'application/json', + ], + 'employeeQualificationDocumentPost' => [ + 'application/json', + ], + 'employeeQualificationGet' => [ + 'application/json', + ], + 'employeeQualificationGetQualifications' => [ + 'application/json', + ], + 'employeeQualificationPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +158,15 @@ public function getConfig() * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeQualificationDelete($id, $business_id, $employee_id) + public function employeeQualificationDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDelete'][0]) { - $this->employeeQualificationDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeeQualificationDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -113,15 +177,15 @@ public function employeeQualificationDelete($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeeQualificationDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDelete'][0]) { - $returnType = ''; - $request = $this->employeeQualificationDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeQualificationDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +194,16 @@ public function employeeQualificationDeleteWithHttpInfo($id, $business_id, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +214,11 @@ public function employeeQualificationDeleteWithHttpInfo($id, $business_id, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -168,13 +239,14 @@ public function employeeQualificationDeleteWithHttpInfo($id, $business_id, $empl * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDeleteAsync($id, $business_id, $employee_id) + public function employeeQualificationDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDelete'][0]) { - return $this->employeeQualificationDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeQualificationDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -190,14 +262,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeQualificationDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDelete'][0]) { $returnType = ''; - $request = $this->employeeQualificationDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeQualificationDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +289,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -228,24 +301,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationDeleteRequest($id, $business_id, $employee_id) + public function employeeQualificationDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDelete'][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 employeeQualificationDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +330,7 @@ protected function employeeQualificationDeleteRequest($id, $business_id, $employ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification'; $formParams = []; $queryParams = []; @@ -261,9 +339,15 @@ protected function employeeQualificationDeleteRequest($id, $business_id, $employ $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -282,53 +366,35 @@ protected function employeeQualificationDeleteRequest($id, $business_id, $employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -349,10 +415,11 @@ protected function employeeQualificationDeleteRequest($id, $business_id, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -367,14 +434,15 @@ protected function employeeQualificationDeleteRequest($id, $business_id, $employ * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentContent'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentFile + * @return \OpenAPI\Client\Model\DocumentFile */ - public function employeeQualificationDocumentContent($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentContent($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentContent'][0]) { - list($response) = $this->employeeQualificationDocumentContentWithHttpInfo($qualification_id, $id, $business_id, $employee_id); + list($response) = $this->employeeQualificationDocumentContentWithHttpInfo($qualification_id, $id, $business_id, $employee_id, $contentType); return $response; } @@ -387,15 +455,15 @@ public function employeeQualificationDocumentContent($qualification_id, $id, $bu * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentContent'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationDocumentContentWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentContentWithHttpInfo($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentContent'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->employeeQualificationDocumentContentRequest($qualification_id, $id, $business_id, $employee_id); + $request = $this->employeeQualificationDocumentContentRequest($qualification_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -404,9 +472,16 @@ public function employeeQualificationDocumentContentWithHttpInfo($qualification_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -417,19 +492,37 @@ public function employeeQualificationDocumentContentWithHttpInfo($qualification_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentFile' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentFile' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentFile', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentFile'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -446,7 +539,7 @@ public function employeeQualificationDocumentContentWithHttpInfo($qualification_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentFile', + '\OpenAPI\Client\Model\DocumentFile', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -465,13 +558,14 @@ public function employeeQualificationDocumentContentWithHttpInfo($qualification_ * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentContentAsync($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentContentAsync($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentContent'][0]) { - return $this->employeeQualificationDocumentContentAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + return $this->employeeQualificationDocumentContentAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -488,24 +582,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentContentAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentContentAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentContent'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->employeeQualificationDocumentContentRequest($qualification_id, $id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\DocumentFile'; + $request = $this->employeeQualificationDocumentContentRequest($qualification_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -528,7 +622,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -541,30 +635,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentContent'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationDocumentContentRequest($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentContentRequest($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentContent'][0]) { + // verify the required parameter 'qualification_id' is set if ($qualification_id === null || (is_array($qualification_id) && count($qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $qualification_id when calling employeeQualificationDocumentContent' ); } + // 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 employeeQualificationDocumentContent' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationDocumentContent' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -572,6 +671,7 @@ protected function employeeQualificationDocumentContentRequest($qualification_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification/{qualificationId}/document/{id}/content'; $formParams = []; $queryParams = []; @@ -580,6 +680,7 @@ protected function employeeQualificationDocumentContentRequest($qualification_id $multipart = false; + // path params if ($qualification_id !== null) { $resourcePath = str_replace( @@ -613,53 +714,35 @@ protected function employeeQualificationDocumentContentRequest($qualification_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -680,10 +763,11 @@ protected function employeeQualificationDocumentContentRequest($qualification_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -698,14 +782,15 @@ protected function employeeQualificationDocumentContentRequest($qualification_id * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeQualificationDocumentDelete($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentDelete($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentDelete'][0]) { - $this->employeeQualificationDocumentDeleteWithHttpInfo($qualification_id, $id, $business_id, $employee_id); + $this->employeeQualificationDocumentDeleteWithHttpInfo($qualification_id, $id, $business_id, $employee_id, $contentType); } /** @@ -717,15 +802,15 @@ public function employeeQualificationDocumentDelete($qualification_id, $id, $bus * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationDocumentDeleteWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentDeleteWithHttpInfo($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentDelete'][0]) { - $returnType = ''; - $request = $this->employeeQualificationDocumentDeleteRequest($qualification_id, $id, $business_id, $employee_id); + $request = $this->employeeQualificationDocumentDeleteRequest($qualification_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -734,9 +819,16 @@ public function employeeQualificationDocumentDeleteWithHttpInfo($qualification_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -747,11 +839,11 @@ public function employeeQualificationDocumentDeleteWithHttpInfo($qualification_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -773,13 +865,14 @@ public function employeeQualificationDocumentDeleteWithHttpInfo($qualification_i * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentDeleteAsync($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentDeleteAsync($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentDelete'][0]) { - return $this->employeeQualificationDocumentDeleteAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + return $this->employeeQualificationDocumentDeleteAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -796,14 +889,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentDeleteAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentDeleteAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentDelete'][0]) { $returnType = ''; - $request = $this->employeeQualificationDocumentDeleteRequest($qualification_id, $id, $business_id, $employee_id); + $request = $this->employeeQualificationDocumentDeleteRequest($qualification_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -822,7 +916,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -835,30 +929,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationDocumentDeleteRequest($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentDeleteRequest($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentDelete'][0]) { + // verify the required parameter 'qualification_id' is set if ($qualification_id === null || (is_array($qualification_id) && count($qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $qualification_id when calling employeeQualificationDocumentDelete' ); } + // 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 employeeQualificationDocumentDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationDocumentDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -866,6 +965,7 @@ protected function employeeQualificationDocumentDeleteRequest($qualification_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification/{qualificationId}/document/{id}'; $formParams = []; $queryParams = []; @@ -874,6 +974,7 @@ protected function employeeQualificationDocumentDeleteRequest($qualification_id, $multipart = false; + // path params if ($qualification_id !== null) { $resourcePath = str_replace( @@ -907,53 +1008,35 @@ protected function employeeQualificationDocumentDeleteRequest($qualification_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -974,10 +1057,11 @@ protected function employeeQualificationDocumentDeleteRequest($qualification_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -991,14 +1075,15 @@ protected function employeeQualificationDocumentDeleteRequest($qualification_id, * @param int $qualification_id qualification_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeQualificationDocumentModel[] + * @return \OpenAPI\Client\Model\EmployeeQualificationDocumentModel[] */ - public function employeeQualificationDocumentGet($qualification_id, $business_id, $employee_id) + public function employeeQualificationDocumentGet($qualification_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGet'][0]) { - list($response) = $this->employeeQualificationDocumentGetWithHttpInfo($qualification_id, $business_id, $employee_id); + list($response) = $this->employeeQualificationDocumentGetWithHttpInfo($qualification_id, $business_id, $employee_id, $contentType); return $response; } @@ -1010,15 +1095,15 @@ public function employeeQualificationDocumentGet($qualification_id, $business_id * @param int $qualification_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeQualificationDocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeQualificationDocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationDocumentGetWithHttpInfo($qualification_id, $business_id, $employee_id) + public function employeeQualificationDocumentGetWithHttpInfo($qualification_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]'; - $request = $this->employeeQualificationDocumentGetRequest($qualification_id, $business_id, $employee_id); + $request = $this->employeeQualificationDocumentGetRequest($qualification_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1027,9 +1112,16 @@ public function employeeQualificationDocumentGetWithHttpInfo($qualification_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1040,19 +1132,37 @@ public function employeeQualificationDocumentGetWithHttpInfo($qualification_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1069,7 +1179,7 @@ public function employeeQualificationDocumentGetWithHttpInfo($qualification_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]', + '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1087,13 +1197,14 @@ public function employeeQualificationDocumentGetWithHttpInfo($qualification_id, * @param int $qualification_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentGetAsync($qualification_id, $business_id, $employee_id) + public function employeeQualificationDocumentGetAsync($qualification_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGet'][0]) { - return $this->employeeQualificationDocumentGetAsyncWithHttpInfo($qualification_id, $business_id, $employee_id) + return $this->employeeQualificationDocumentGetAsyncWithHttpInfo($qualification_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1109,24 +1220,24 @@ function ($response) { * @param int $qualification_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentGetAsyncWithHttpInfo($qualification_id, $business_id, $employee_id) + public function employeeQualificationDocumentGetAsyncWithHttpInfo($qualification_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]'; - $request = $this->employeeQualificationDocumentGetRequest($qualification_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]'; + $request = $this->employeeQualificationDocumentGetRequest($qualification_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1149,7 +1260,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1161,24 +1272,28 @@ function ($exception) { * @param int $qualification_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationDocumentGetRequest($qualification_id, $business_id, $employee_id) + public function employeeQualificationDocumentGetRequest($qualification_id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGet'][0]) { + // verify the required parameter 'qualification_id' is set if ($qualification_id === null || (is_array($qualification_id) && count($qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $qualification_id when calling employeeQualificationDocumentGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationDocumentGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1186,6 +1301,7 @@ protected function employeeQualificationDocumentGetRequest($qualification_id, $b ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification/{qualificationId}/document'; $formParams = []; $queryParams = []; @@ -1194,6 +1310,7 @@ protected function employeeQualificationDocumentGetRequest($qualification_id, $b $multipart = false; + // path params if ($qualification_id !== null) { $resourcePath = str_replace( @@ -1219,53 +1336,35 @@ protected function employeeQualificationDocumentGetRequest($qualification_id, $b ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1286,10 +1385,11 @@ protected function employeeQualificationDocumentGetRequest($qualification_id, $b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1304,14 +1404,15 @@ protected function employeeQualificationDocumentGetRequest($qualification_id, $b * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeQualificationDocumentModel + * @return \OpenAPI\Client\Model\EmployeeQualificationDocumentModel */ - public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'][0]) { - list($response) = $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdWithHttpInfo($qualification_id, $id, $business_id, $employee_id); + list($response) = $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdWithHttpInfo($qualification_id, $id, $business_id, $employee_id, $contentType); return $response; } @@ -1324,15 +1425,15 @@ public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmploye * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeQualificationDocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeQualificationDocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdWithHttpInfo($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationDocumentModel'; - $request = $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdRequest($qualification_id, $id, $business_id, $employee_id); + $request = $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdRequest($qualification_id, $id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1341,9 +1442,16 @@ public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmploye } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1354,19 +1462,37 @@ public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmploye sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeQualificationDocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeQualificationDocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1383,7 +1509,7 @@ public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmploye case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeQualificationDocumentModel', + '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1402,13 +1528,14 @@ public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmploye * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdAsync($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdAsync($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'][0]) { - return $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + return $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1425,24 +1552,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdAsyncWithHttpInfo($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationDocumentModel'; - $request = $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdRequest($qualification_id, $id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel'; + $request = $this->employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdRequest($qualification_id, $id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1465,7 +1592,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1478,30 +1605,35 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdRequest($qualification_id, $id, $business_id, $employee_id) + public function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentByIdRequest($qualification_id, $id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById'][0]) { + // verify the required parameter 'qualification_id' is set if ($qualification_id === null || (is_array($qualification_id) && count($qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $qualification_id when calling employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById' ); } + // 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 employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmployeeByEmployeeIdQualificationByQualificationIdDocumentById' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1509,6 +1641,7 @@ protected function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmpl ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification/{qualificationId}/document/{id}'; $formParams = []; $queryParams = []; @@ -1517,6 +1650,7 @@ protected function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmpl $multipart = false; + // path params if ($qualification_id !== null) { $resourcePath = str_replace( @@ -1550,53 +1684,35 @@ protected function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmpl ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1617,10 +1733,11 @@ protected function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmpl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1635,14 +1752,15 @@ protected function employeeQualificationDocumentGetApiV2BusinessByBusinessIdEmpl * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) * @param bool $visible visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeQualificationDocumentModel[] + * @return \OpenAPI\Client\Model\EmployeeQualificationDocumentModel[] */ - public function employeeQualificationDocumentPost($qualification_id, $business_id, $employee_id, $visible = 'false') + public function employeeQualificationDocumentPost($qualification_id, $business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeQualificationDocumentPost'][0]) { - list($response) = $this->employeeQualificationDocumentPostWithHttpInfo($qualification_id, $business_id, $employee_id, $visible); + list($response) = $this->employeeQualificationDocumentPostWithHttpInfo($qualification_id, $business_id, $employee_id, $visible, $contentType); return $response; } @@ -1655,15 +1773,15 @@ public function employeeQualificationDocumentPost($qualification_id, $business_i * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeQualificationDocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeQualificationDocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationDocumentPostWithHttpInfo($qualification_id, $business_id, $employee_id, $visible = 'false') + public function employeeQualificationDocumentPostWithHttpInfo($qualification_id, $business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeQualificationDocumentPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]'; - $request = $this->employeeQualificationDocumentPostRequest($qualification_id, $business_id, $employee_id, $visible); + $request = $this->employeeQualificationDocumentPostRequest($qualification_id, $business_id, $employee_id, $visible, $contentType); try { $options = $this->createHttpClientOption(); @@ -1672,9 +1790,16 @@ public function employeeQualificationDocumentPostWithHttpInfo($qualification_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1685,19 +1810,37 @@ public function employeeQualificationDocumentPostWithHttpInfo($qualification_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1714,7 +1857,7 @@ public function employeeQualificationDocumentPostWithHttpInfo($qualification_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]', + '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1733,13 +1876,14 @@ public function employeeQualificationDocumentPostWithHttpInfo($qualification_id, * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentPostAsync($qualification_id, $business_id, $employee_id, $visible = 'false') + public function employeeQualificationDocumentPostAsync($qualification_id, $business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeQualificationDocumentPost'][0]) { - return $this->employeeQualificationDocumentPostAsyncWithHttpInfo($qualification_id, $business_id, $employee_id, $visible) + return $this->employeeQualificationDocumentPostAsyncWithHttpInfo($qualification_id, $business_id, $employee_id, $visible, $contentType) ->then( function ($response) { return $response[0]; @@ -1756,24 +1900,24 @@ function ($response) { * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationDocumentPostAsyncWithHttpInfo($qualification_id, $business_id, $employee_id, $visible = 'false') + public function employeeQualificationDocumentPostAsyncWithHttpInfo($qualification_id, $business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeQualificationDocumentPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]'; - $request = $this->employeeQualificationDocumentPostRequest($qualification_id, $business_id, $employee_id, $visible); + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]'; + $request = $this->employeeQualificationDocumentPostRequest($qualification_id, $business_id, $employee_id, $visible, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1796,7 +1940,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1809,24 +1953,28 @@ function ($exception) { * @param string $business_id (required) * @param string $employee_id (required) * @param bool $visible (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationDocumentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationDocumentPostRequest($qualification_id, $business_id, $employee_id, $visible = 'false') + public function employeeQualificationDocumentPostRequest($qualification_id, $business_id, $employee_id, $visible = false, string $contentType = self::contentTypes['employeeQualificationDocumentPost'][0]) { + // verify the required parameter 'qualification_id' is set if ($qualification_id === null || (is_array($qualification_id) && count($qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $qualification_id when calling employeeQualificationDocumentPost' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationDocumentPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1834,6 +1982,8 @@ protected function employeeQualificationDocumentPostRequest($qualification_id, $ ); } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification/{qualificationId}/document'; $formParams = []; $queryParams = []; @@ -1842,9 +1992,15 @@ protected function employeeQualificationDocumentPostRequest($qualification_id, $ $multipart = false; // query params - if ($visible !== null) { - $queryParams['visible'] = ObjectSerializer::toQueryValue($visible); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $visible, + 'visible', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($qualification_id !== null) { @@ -1871,53 +2027,35 @@ protected function employeeQualificationDocumentPostRequest($qualification_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1938,10 +2076,11 @@ protected function employeeQualificationDocumentPostRequest($qualification_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1955,14 +2094,15 @@ protected function employeeQualificationDocumentPostRequest($qualification_id, $ * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeQualificationModel + * @return \OpenAPI\Client\Model\EmployeeQualificationModel */ - public function employeeQualificationGet($id, $business_id, $employee_id) + public function employeeQualificationGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGet'][0]) { - list($response) = $this->employeeQualificationGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeQualificationGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -1974,15 +2114,15 @@ public function employeeQualificationGet($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeQualificationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeQualificationModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationGetWithHttpInfo($id, $business_id, $employee_id) + public function employeeQualificationGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationModel'; - $request = $this->employeeQualificationGetRequest($id, $business_id, $employee_id); + $request = $this->employeeQualificationGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1991,9 +2131,16 @@ public function employeeQualificationGetWithHttpInfo($id, $business_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2004,19 +2151,37 @@ public function employeeQualificationGetWithHttpInfo($id, $business_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeQualificationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeQualificationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeQualificationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2033,7 +2198,7 @@ public function employeeQualificationGetWithHttpInfo($id, $business_id, $employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeQualificationModel', + '\OpenAPI\Client\Model\EmployeeQualificationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2051,13 +2216,14 @@ public function employeeQualificationGetWithHttpInfo($id, $business_id, $employe * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationGetAsync($id, $business_id, $employee_id) + public function employeeQualificationGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGet'][0]) { - return $this->employeeQualificationGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeQualificationGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2073,24 +2239,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeQualificationGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationModel'; - $request = $this->employeeQualificationGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationModel'; + $request = $this->employeeQualificationGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2113,7 +2279,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2125,24 +2291,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationGetRequest($id, $business_id, $employee_id) + public function employeeQualificationGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGet'][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 employeeQualificationGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2150,6 +2320,7 @@ protected function employeeQualificationGetRequest($id, $business_id, $employee_ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -2158,6 +2329,7 @@ protected function employeeQualificationGetRequest($id, $business_id, $employee_ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2183,53 +2355,35 @@ protected function employeeQualificationGetRequest($id, $business_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2250,10 +2404,11 @@ protected function employeeQualificationGetRequest($id, $business_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2266,14 +2421,15 @@ protected function employeeQualificationGetRequest($id, $business_id, $employee_ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGetQualifications'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeQualificationModel[] + * @return \OpenAPI\Client\Model\EmployeeQualificationModel[] */ - public function employeeQualificationGetQualifications($business_id, $employee_id) + public function employeeQualificationGetQualifications($business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGetQualifications'][0]) { - list($response) = $this->employeeQualificationGetQualificationsWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeQualificationGetQualificationsWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -2284,15 +2440,15 @@ public function employeeQualificationGetQualifications($business_id, $employee_i * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGetQualifications'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeQualificationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeQualificationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationGetQualificationsWithHttpInfo($business_id, $employee_id) + public function employeeQualificationGetQualificationsWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGetQualifications'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationModel[]'; - $request = $this->employeeQualificationGetQualificationsRequest($business_id, $employee_id); + $request = $this->employeeQualificationGetQualificationsRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2301,9 +2457,16 @@ public function employeeQualificationGetQualificationsWithHttpInfo($business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2314,19 +2477,37 @@ public function employeeQualificationGetQualificationsWithHttpInfo($business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeQualificationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeQualificationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeQualificationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2343,7 +2524,7 @@ public function employeeQualificationGetQualificationsWithHttpInfo($business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeQualificationModel[]', + '\OpenAPI\Client\Model\EmployeeQualificationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2360,13 +2541,14 @@ public function employeeQualificationGetQualificationsWithHttpInfo($business_id, * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationGetQualificationsAsync($business_id, $employee_id) + public function employeeQualificationGetQualificationsAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGetQualifications'][0]) { - return $this->employeeQualificationGetQualificationsAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeQualificationGetQualificationsAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2381,24 +2563,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationGetQualificationsAsyncWithHttpInfo($business_id, $employee_id) + public function employeeQualificationGetQualificationsAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGetQualifications'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeQualificationModel[]'; - $request = $this->employeeQualificationGetQualificationsRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeQualificationModel[]'; + $request = $this->employeeQualificationGetQualificationsRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2421,7 +2603,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2432,18 +2614,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationGetQualificationsRequest($business_id, $employee_id) + public function employeeQualificationGetQualificationsRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeQualificationGetQualifications'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationGetQualifications' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2451,6 +2636,7 @@ protected function employeeQualificationGetQualificationsRequest($business_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification'; $formParams = []; $queryParams = []; @@ -2459,6 +2645,7 @@ protected function employeeQualificationGetQualificationsRequest($business_id, $ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2476,53 +2663,35 @@ protected function employeeQualificationGetQualificationsRequest($business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2543,10 +2712,11 @@ protected function employeeQualificationGetQualificationsRequest($business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2557,17 +2727,18 @@ protected function employeeQualificationGetQualificationsRequest($business_id, $ * * Add/Update Employee Qualification * - * @param \Swagger\Client\Model\EmployeeQualificationModel $qualification qualification (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeQualificationModel $qualification qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeQualificationPost($qualification, $business_id, $employee_id) + public function employeeQualificationPost($business_id, $employee_id, $qualification, string $contentType = self::contentTypes['employeeQualificationPost'][0]) { - $this->employeeQualificationPostWithHttpInfo($qualification, $business_id, $employee_id); + $this->employeeQualificationPostWithHttpInfo($business_id, $employee_id, $qualification, $contentType); } /** @@ -2575,18 +2746,18 @@ public function employeeQualificationPost($qualification, $business_id, $employe * * Add/Update Employee Qualification * - * @param \Swagger\Client\Model\EmployeeQualificationModel $qualification (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeQualificationPostWithHttpInfo($qualification, $business_id, $employee_id) + public function employeeQualificationPostWithHttpInfo($business_id, $employee_id, $qualification, string $contentType = self::contentTypes['employeeQualificationPost'][0]) { - $returnType = ''; - $request = $this->employeeQualificationPostRequest($qualification, $business_id, $employee_id); + $request = $this->employeeQualificationPostRequest($business_id, $employee_id, $qualification, $contentType); try { $options = $this->createHttpClientOption(); @@ -2595,9 +2766,16 @@ public function employeeQualificationPostWithHttpInfo($qualification, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2608,11 +2786,11 @@ public function employeeQualificationPostWithHttpInfo($qualification, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2630,16 +2808,17 @@ public function employeeQualificationPostWithHttpInfo($qualification, $business_ * * Add/Update Employee Qualification * - * @param \Swagger\Client\Model\EmployeeQualificationModel $qualification (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationPostAsync($qualification, $business_id, $employee_id) + public function employeeQualificationPostAsync($business_id, $employee_id, $qualification, string $contentType = self::contentTypes['employeeQualificationPost'][0]) { - return $this->employeeQualificationPostAsyncWithHttpInfo($qualification, $business_id, $employee_id) + return $this->employeeQualificationPostAsyncWithHttpInfo($business_id, $employee_id, $qualification, $contentType) ->then( function ($response) { return $response[0]; @@ -2652,17 +2831,18 @@ function ($response) { * * Add/Update Employee Qualification * - * @param \Swagger\Client\Model\EmployeeQualificationModel $qualification (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeQualificationPostAsyncWithHttpInfo($qualification, $business_id, $employee_id) + public function employeeQualificationPostAsyncWithHttpInfo($business_id, $employee_id, $qualification, string $contentType = self::contentTypes['employeeQualificationPost'][0]) { $returnType = ''; - $request = $this->employeeQualificationPostRequest($qualification, $business_id, $employee_id); + $request = $this->employeeQualificationPostRequest($business_id, $employee_id, $qualification, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2681,7 +2861,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2690,27 +2870,24 @@ function ($exception) { /** * Create request for operation 'employeeQualificationPost' * - * @param \Swagger\Client\Model\EmployeeQualificationModel $qualification (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeQualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeQualificationPostRequest($qualification, $business_id, $employee_id) + public function employeeQualificationPostRequest($business_id, $employee_id, $qualification, string $contentType = self::contentTypes['employeeQualificationPost'][0]) { - // verify the required parameter 'qualification' is set - if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $qualification when calling employeeQualificationPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeQualificationPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2718,6 +2895,14 @@ protected function employeeQualificationPostRequest($qualification, $business_id ); } + // verify the required parameter 'qualification' is set + if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $qualification when calling employeeQualificationPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/qualification'; $formParams = []; $queryParams = []; @@ -2726,6 +2911,7 @@ protected function employeeQualificationPostRequest($qualification, $business_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2743,56 +2929,42 @@ protected function employeeQualificationPostRequest($qualification, $business_id ); } - // body params - $_tempBody = null; - if (isset($qualification)) { - $_tempBody = $qualification; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($qualification)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($qualification)); + } else { + $httpBody = $qualification; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2813,10 +2985,11 @@ protected function employeeQualificationPostRequest($qualification, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeRecurringTransactionsApi.php b/src/lib/Api/EmployeeRecurringTransactionsApi.php index b5f537e..a4a2346 100644 --- a/src/lib/Api/EmployeeRecurringTransactionsApi.php +++ b/src/lib/Api/EmployeeRecurringTransactionsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeRecurringDeductionGet' => [ + 'application/json', + ], + 'auEmployeeRecurringDeductionGetByExternalReferenceId' => [ + 'application/json', + ], + 'auEmployeeRecurringDeductionList' => [ + 'application/json', + ], + 'auEmployeeRecurringDeductionListList' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeeRecurringDeductionPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeeRecurringDeductionPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringAdditionalEarningsDelete' => [ + 'application/json', + ], + 'employeeRecurringAdditionalEarningsGet' => [ + 'application/json', + ], + 'employeeRecurringAdditionalEarningsList' => [ + 'application/json', + ], + 'employeeRecurringAdditionalEarningsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringAdditionalEarningsPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringExpenseDelete' => [ + 'application/json', + ], + 'employeeRecurringExpenseGet' => [ + 'application/json', + ], + 'employeeRecurringExpenseList' => [ + 'application/json', + ], + 'employeeRecurringExpensePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringExpensePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringSuperAdjustmentDelete' => [ + 'application/json', + ], + 'employeeRecurringSuperAdjustmentGet' => [ + 'application/json', + ], + 'employeeRecurringSuperAdjustmentList' => [ + 'application/json', + ], + 'employeeRecurringSuperAdjustmentPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringSuperAdjustmentPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringTaxAdjustmentDelete' => [ + 'application/json', + ], + 'employeeRecurringTaxAdjustmentGet' => [ + 'application/json', + ], + 'employeeRecurringTaxAdjustmentList' => [ + 'application/json', + ], + 'employeeRecurringTaxAdjustmentPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeeRecurringTaxAdjustmentPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employerrecurringliabilityDelete' => [ + 'application/json', + ], + 'employerrecurringliabilityGet' => [ + 'application/json', + ], + 'employerrecurringliabilityList' => [ + 'application/json', + ], + 'employerrecurringliabilityPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employerrecurringliabilityPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +275,15 @@ public function getConfig() * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeRecurringDeductionDelete($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionDelete'][0]) { - $this->auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -113,15 +294,15 @@ public function auEmployeeRecurringDeductionDelete($id, $business_id, $employee_ * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionDelete'][0]) { - $returnType = ''; - $request = $this->auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +311,16 @@ public function auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +331,11 @@ public function auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -168,13 +356,14 @@ public function auEmployeeRecurringDeductionDeleteWithHttpInfo($id, $business_id * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionDeleteAsync($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionDelete'][0]) { - return $this->auEmployeeRecurringDeductionDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->auEmployeeRecurringDeductionDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -190,14 +379,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionDelete'][0]) { $returnType = ''; - $request = $this->auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +406,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -228,24 +418,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionDelete'][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 auEmployeeRecurringDeductionDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeRecurringDeductionDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +447,7 @@ protected function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction/{id}'; $formParams = []; $queryParams = []; @@ -261,6 +456,7 @@ protected function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -286,53 +482,35 @@ protected function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -353,10 +531,11 @@ protected function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -370,14 +549,15 @@ protected function auEmployeeRecurringDeductionDeleteRequest($id, $business_id, * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeRecurringDeductionModel + * @return \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel */ - public function auEmployeeRecurringDeductionGet($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGet'][0]) { - list($response) = $this->auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -389,15 +569,15 @@ public function auEmployeeRecurringDeductionGet($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionGetRequest($id, $business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -406,9 +586,16 @@ public function auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -419,19 +606,37 @@ public function auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -448,7 +653,7 @@ public function auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel', + '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -466,13 +671,14 @@ public function auEmployeeRecurringDeductionGetWithHttpInfo($id, $business_id, $ * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionGetAsync($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGet'][0]) { - return $this->auEmployeeRecurringDeductionGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->auEmployeeRecurringDeductionGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -488,24 +694,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; + $request = $this->auEmployeeRecurringDeductionGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -528,7 +734,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -540,24 +746,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionGetRequest($id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGet'][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 auEmployeeRecurringDeductionGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeRecurringDeductionGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -565,6 +775,7 @@ protected function auEmployeeRecurringDeductionGetRequest($id, $business_id, $em ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction/{id}'; $formParams = []; $queryParams = []; @@ -573,6 +784,7 @@ protected function auEmployeeRecurringDeductionGetRequest($id, $business_id, $em $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -598,53 +810,35 @@ protected function auEmployeeRecurringDeductionGetRequest($id, $business_id, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -665,10 +859,11 @@ protected function auEmployeeRecurringDeductionGetRequest($id, $business_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -682,14 +877,15 @@ protected function auEmployeeRecurringDeductionGetRequest($id, $business_id, $em * @param string $external_reference_id external_reference_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeRecurringDeductionModel + * @return \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel */ - public function auEmployeeRecurringDeductionGetByExternalReferenceId($external_reference_id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetByExternalReferenceId($external_reference_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'][0]) { - list($response) = $this->auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo($external_reference_id, $business_id, $employee_id); + list($response) = $this->auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo($external_reference_id, $business_id, $employee_id, $contentType); return $response; } @@ -701,15 +897,15 @@ public function auEmployeeRecurringDeductionGetByExternalReferenceId($external_r * @param string $external_reference_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo($external_reference_id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo($external_reference_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($external_reference_id, $business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($external_reference_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -718,9 +914,16 @@ public function auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -731,19 +934,37 @@ public function auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -760,7 +981,7 @@ public function auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel', + '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -778,13 +999,14 @@ public function auEmployeeRecurringDeductionGetByExternalReferenceIdWithHttpInfo * @param string $external_reference_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionGetByExternalReferenceIdAsync($external_reference_id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetByExternalReferenceIdAsync($external_reference_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'][0]) { - return $this->auEmployeeRecurringDeductionGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $business_id, $employee_id) + return $this->auEmployeeRecurringDeductionGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -800,24 +1022,24 @@ function ($response) { * @param string $external_reference_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetByExternalReferenceIdAsyncWithHttpInfo($external_reference_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($external_reference_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; + $request = $this->auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($external_reference_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -840,7 +1062,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -852,24 +1074,28 @@ function ($exception) { * @param string $external_reference_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($external_reference_id, $business_id, $employee_id) + public function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($external_reference_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionGetByExternalReferenceId'][0]) { + // verify the required parameter 'external_reference_id' is set if ($external_reference_id === null || (is_array($external_reference_id) && count($external_reference_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $external_reference_id when calling auEmployeeRecurringDeductionGetByExternalReferenceId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeRecurringDeductionGetByExternalReferenceId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -877,6 +1103,7 @@ protected function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction/{externalReferenceId}'; $formParams = []; $queryParams = []; @@ -885,6 +1112,7 @@ protected function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($ $multipart = false; + // path params if ($external_reference_id !== null) { $resourcePath = str_replace( @@ -910,53 +1138,35 @@ protected function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -977,10 +1187,11 @@ protected function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -993,14 +1204,15 @@ protected function auEmployeeRecurringDeductionGetByExternalReferenceIdRequest($ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeRecurringDeductionModel[] + * @return \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[] */ - public function auEmployeeRecurringDeductionList($business_id, $employee_id) + public function auEmployeeRecurringDeductionList($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionList'][0]) { - list($response) = $this->auEmployeeRecurringDeductionListWithHttpInfo($business_id, $employee_id); + list($response) = $this->auEmployeeRecurringDeductionListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -1011,15 +1223,15 @@ public function auEmployeeRecurringDeductionList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeRecurringDeductionModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionListWithHttpInfo($business_id, $employee_id) + public function auEmployeeRecurringDeductionListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionList'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel[]'; - $request = $this->auEmployeeRecurringDeductionListRequest($business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1028,9 +1240,16 @@ public function auEmployeeRecurringDeductionListWithHttpInfo($business_id, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1041,19 +1260,37 @@ public function auEmployeeRecurringDeductionListWithHttpInfo($business_id, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1070,7 +1307,7 @@ public function auEmployeeRecurringDeductionListWithHttpInfo($business_id, $empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel[]', + '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1087,13 +1324,14 @@ public function auEmployeeRecurringDeductionListWithHttpInfo($business_id, $empl * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionListAsync($business_id, $employee_id) + public function auEmployeeRecurringDeductionListAsync($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionList'][0]) { - return $this->auEmployeeRecurringDeductionListAsyncWithHttpInfo($business_id, $employee_id) + return $this->auEmployeeRecurringDeductionListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1108,24 +1346,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionListAsyncWithHttpInfo($business_id, $employee_id) + public function auEmployeeRecurringDeductionListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionList'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel[]'; - $request = $this->auEmployeeRecurringDeductionListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]'; + $request = $this->auEmployeeRecurringDeductionListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1148,7 +1386,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1159,18 +1397,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionListRequest($business_id, $employee_id) + public function auEmployeeRecurringDeductionListRequest($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeRecurringDeductionList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeRecurringDeductionList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1178,6 +1419,7 @@ protected function auEmployeeRecurringDeductionListRequest($business_id, $employ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction'; $formParams = []; $queryParams = []; @@ -1186,6 +1428,7 @@ protected function auEmployeeRecurringDeductionListRequest($business_id, $employ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1203,53 +1446,35 @@ protected function auEmployeeRecurringDeductionListRequest($business_id, $employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1270,10 +1495,11 @@ protected function auEmployeeRecurringDeductionListRequest($business_id, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1284,16 +1510,17 @@ protected function auEmployeeRecurringDeductionListRequest($business_id, $employ * * List Employee Deductions By External Reference Id * - * @param string[] $external_reference_ids external_reference_ids (required) * @param string $business_id business_id (required) + * @param string[] $external_reference_ids external_reference_ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionListList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeRecurringDeductionModel[] + * @return \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[] */ - public function auEmployeeRecurringDeductionListList($external_reference_ids, $business_id) + public function auEmployeeRecurringDeductionListList($business_id, $external_reference_ids, string $contentType = self::contentTypes['auEmployeeRecurringDeductionListList'][0]) { - list($response) = $this->auEmployeeRecurringDeductionListListWithHttpInfo($external_reference_ids, $business_id); + list($response) = $this->auEmployeeRecurringDeductionListListWithHttpInfo($business_id, $external_reference_ids, $contentType); return $response; } @@ -1302,17 +1529,17 @@ public function auEmployeeRecurringDeductionListList($external_reference_ids, $b * * List Employee Deductions By External Reference Id * - * @param string[] $external_reference_ids (required) * @param string $business_id (required) + * @param string[] $external_reference_ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionListList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeRecurringDeductionModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionListListWithHttpInfo($external_reference_ids, $business_id) + public function auEmployeeRecurringDeductionListListWithHttpInfo($business_id, $external_reference_ids, string $contentType = self::contentTypes['auEmployeeRecurringDeductionListList'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel[]'; - $request = $this->auEmployeeRecurringDeductionListListRequest($external_reference_ids, $business_id); + $request = $this->auEmployeeRecurringDeductionListListRequest($business_id, $external_reference_ids, $contentType); try { $options = $this->createHttpClientOption(); @@ -1321,9 +1548,16 @@ public function auEmployeeRecurringDeductionListListWithHttpInfo($external_refer } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1334,19 +1568,37 @@ public function auEmployeeRecurringDeductionListListWithHttpInfo($external_refer sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1363,7 +1615,7 @@ public function auEmployeeRecurringDeductionListListWithHttpInfo($external_refer case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel[]', + '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1378,15 +1630,16 @@ public function auEmployeeRecurringDeductionListListWithHttpInfo($external_refer * * List Employee Deductions By External Reference Id * - * @param string[] $external_reference_ids (required) * @param string $business_id (required) + * @param string[] $external_reference_ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionListList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionListListAsync($external_reference_ids, $business_id) + public function auEmployeeRecurringDeductionListListAsync($business_id, $external_reference_ids, string $contentType = self::contentTypes['auEmployeeRecurringDeductionListList'][0]) { - return $this->auEmployeeRecurringDeductionListListAsyncWithHttpInfo($external_reference_ids, $business_id) + return $this->auEmployeeRecurringDeductionListListAsyncWithHttpInfo($business_id, $external_reference_ids, $contentType) ->then( function ($response) { return $response[0]; @@ -1399,26 +1652,26 @@ function ($response) { * * List Employee Deductions By External Reference Id * - * @param string[] $external_reference_ids (required) * @param string $business_id (required) + * @param string[] $external_reference_ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionListList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionListListAsyncWithHttpInfo($external_reference_ids, $business_id) + public function auEmployeeRecurringDeductionListListAsyncWithHttpInfo($business_id, $external_reference_ids, string $contentType = self::contentTypes['auEmployeeRecurringDeductionListList'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel[]'; - $request = $this->auEmployeeRecurringDeductionListListRequest($external_reference_ids, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel[]'; + $request = $this->auEmployeeRecurringDeductionListListRequest($business_id, $external_reference_ids, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1441,7 +1694,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1450,20 +1703,16 @@ function ($exception) { /** * Create request for operation 'auEmployeeRecurringDeductionListList' * - * @param string[] $external_reference_ids (required) * @param string $business_id (required) + * @param string[] $external_reference_ids (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionListList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionListListRequest($external_reference_ids, $business_id) + public function auEmployeeRecurringDeductionListListRequest($business_id, $external_reference_ids, string $contentType = self::contentTypes['auEmployeeRecurringDeductionListList'][0]) { - // verify the required parameter 'external_reference_ids' is set - if ($external_reference_ids === null || (is_array($external_reference_ids) && count($external_reference_ids) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_reference_ids when calling auEmployeeRecurringDeductionListList' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1471,6 +1720,14 @@ protected function auEmployeeRecurringDeductionListListRequest($external_referen ); } + // verify the required parameter 'external_reference_ids' is set + if ($external_reference_ids === null || (is_array($external_reference_ids) && count($external_reference_ids) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_reference_ids when calling auEmployeeRecurringDeductionListList' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/deduction'; $formParams = []; $queryParams = []; @@ -1479,6 +1736,7 @@ protected function auEmployeeRecurringDeductionListListRequest($external_referen $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1488,56 +1746,42 @@ protected function auEmployeeRecurringDeductionListListRequest($external_referen ); } - // body params - $_tempBody = null; - if (isset($external_reference_ids)) { - $_tempBody = $external_reference_ids; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($external_reference_ids)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($external_reference_ids)); + } else { + $httpBody = $external_reference_ids; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1558,10 +1802,11 @@ protected function auEmployeeRecurringDeductionListListRequest($external_referen $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1572,17 +1817,18 @@ protected function auEmployeeRecurringDeductionListListRequest($external_referen * * Create Employee Deduction * - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeRecurringDeductionModel + * @return \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel */ - public function auEmployeeRecurringDeductionPost($model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPost'][0]) { - list($response) = $this->auEmployeeRecurringDeductionPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->auEmployeeRecurringDeductionPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -1591,18 +1837,18 @@ public function auEmployeeRecurringDeductionPost($model, $business_id, $employee * * Create Employee Deduction * - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionPostWithHttpInfo($model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionPostRequest($model, $business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1611,9 +1857,16 @@ public function auEmployeeRecurringDeductionPostWithHttpInfo($model, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1624,19 +1877,37 @@ public function auEmployeeRecurringDeductionPostWithHttpInfo($model, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1653,7 +1924,7 @@ public function auEmployeeRecurringDeductionPostWithHttpInfo($model, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel', + '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1668,16 +1939,17 @@ public function auEmployeeRecurringDeductionPostWithHttpInfo($model, $business_i * * Create Employee Deduction * - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionPostAsync($model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPost'][0]) { - return $this->auEmployeeRecurringDeductionPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->auEmployeeRecurringDeductionPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1690,27 +1962,27 @@ function ($response) { * * Create Employee Deduction * - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; + $request = $this->auEmployeeRecurringDeductionPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1733,7 +2005,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1742,27 +2014,24 @@ function ($exception) { /** * Create request for operation 'auEmployeeRecurringDeductionPost' * - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionPostRequest($model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeeRecurringDeductionPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeRecurringDeductionPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1770,6 +2039,14 @@ protected function auEmployeeRecurringDeductionPostRequest($model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeeRecurringDeductionPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction'; $formParams = []; $queryParams = []; @@ -1778,6 +2055,7 @@ protected function auEmployeeRecurringDeductionPostRequest($model, $business_id, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1795,56 +2073,42 @@ protected function auEmployeeRecurringDeductionPostRequest($model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1865,10 +2129,11 @@ protected function auEmployeeRecurringDeductionPostRequest($model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1880,17 +2145,18 @@ protected function auEmployeeRecurringDeductionPostRequest($model, $business_id, * Update Employee Deduction * * @param int $id id (required) - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployeeRecurringDeductionModel + * @return \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel */ - public function auEmployeeRecurringDeductionPut($id, $model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPut'][0]) { - list($response) = $this->auEmployeeRecurringDeductionPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->auEmployeeRecurringDeductionPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -1900,18 +2166,18 @@ public function auEmployeeRecurringDeductionPut($id, $model, $business_id, $empl * Update Employee Deduction * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeRecurringDeductionPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionPutRequest($id, $model, $business_id, $employee_id); + $request = $this->auEmployeeRecurringDeductionPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1920,9 +2186,16 @@ public function auEmployeeRecurringDeductionPutWithHttpInfo($id, $model, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1933,19 +2206,37 @@ public function auEmployeeRecurringDeductionPutWithHttpInfo($id, $model, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1962,7 +2253,7 @@ public function auEmployeeRecurringDeductionPutWithHttpInfo($id, $model, $busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel', + '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1978,16 +2269,17 @@ public function auEmployeeRecurringDeductionPutWithHttpInfo($id, $model, $busine * Update Employee Deduction * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionPutAsync($id, $model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPut'][0]) { - return $this->auEmployeeRecurringDeductionPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->auEmployeeRecurringDeductionPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2001,27 +2293,27 @@ function ($response) { * Update Employee Deduction * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeRecurringDeductionPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployeeRecurringDeductionModel'; - $request = $this->auEmployeeRecurringDeductionPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel'; + $request = $this->auEmployeeRecurringDeductionPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2044,7 +2336,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2054,33 +2346,31 @@ function ($exception) { * Create request for operation 'auEmployeeRecurringDeductionPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployeeRecurringDeductionModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEmployeeRecurringDeductionModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeRecurringDeductionPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeRecurringDeductionPutRequest($id, $model, $business_id, $employee_id) + public function auEmployeeRecurringDeductionPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeRecurringDeductionPut'][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 auEmployeeRecurringDeductionPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeeRecurringDeductionPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeRecurringDeductionPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2088,13 +2378,22 @@ protected function auEmployeeRecurringDeductionPutRequest($id, $model, $business ); } - $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeeRecurringDeductionPut' + ); + } + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/deduction/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params if ($id !== null) { @@ -2121,56 +2420,42 @@ protected function auEmployeeRecurringDeductionPutRequest($id, $model, $business ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2191,10 +2476,11 @@ protected function auEmployeeRecurringDeductionPutRequest($id, $model, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2208,14 +2494,15 @@ protected function auEmployeeRecurringDeductionPutRequest($id, $model, $business * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeRecurringAdditionalEarningsDelete($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsDelete'][0]) { - $this->employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -2226,15 +2513,15 @@ public function employeeRecurringAdditionalEarningsDelete($id, $business_id, $em * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsDelete'][0]) { - $returnType = ''; - $request = $this->employeeRecurringAdditionalEarningsDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringAdditionalEarningsDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2243,9 +2530,16 @@ public function employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2256,11 +2550,11 @@ public function employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2281,13 +2575,14 @@ public function employeeRecurringAdditionalEarningsDeleteWithHttpInfo($id, $busi * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsDeleteAsync($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsDelete'][0]) { - return $this->employeeRecurringAdditionalEarningsDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringAdditionalEarningsDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2303,14 +2598,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsDelete'][0]) { $returnType = ''; - $request = $this->employeeRecurringAdditionalEarningsDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringAdditionalEarningsDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2329,7 +2625,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2341,24 +2637,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringAdditionalEarningsDeleteRequest($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsDelete'][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 employeeRecurringAdditionalEarningsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringAdditionalEarningsDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2366,6 +2666,7 @@ protected function employeeRecurringAdditionalEarningsDeleteRequest($id, $busine ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/additional-earnings/{id}'; $formParams = []; $queryParams = []; @@ -2374,6 +2675,7 @@ protected function employeeRecurringAdditionalEarningsDeleteRequest($id, $busine $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2399,53 +2701,35 @@ protected function employeeRecurringAdditionalEarningsDeleteRequest($id, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2466,10 +2750,11 @@ protected function employeeRecurringAdditionalEarningsDeleteRequest($id, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2483,14 +2768,15 @@ protected function employeeRecurringAdditionalEarningsDeleteRequest($id, $busine * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AdditionalEarningsModel + * @return \OpenAPI\Client\Model\AdditionalEarningsModel */ - public function employeeRecurringAdditionalEarningsGet($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsGet'][0]) { - list($response) = $this->employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -2502,15 +2788,15 @@ public function employeeRecurringAdditionalEarningsGet($id, $business_id, $emplo * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AdditionalEarningsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AdditionalEarningsModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsGet'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel'; - $request = $this->employeeRecurringAdditionalEarningsGetRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringAdditionalEarningsGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2519,9 +2805,16 @@ public function employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2532,19 +2825,37 @@ public function employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AdditionalEarningsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AdditionalEarningsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AdditionalEarningsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2561,7 +2872,7 @@ public function employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AdditionalEarningsModel', + '\OpenAPI\Client\Model\AdditionalEarningsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2579,13 +2890,14 @@ public function employeeRecurringAdditionalEarningsGetWithHttpInfo($id, $busines * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsGetAsync($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsGet'][0]) { - return $this->employeeRecurringAdditionalEarningsGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringAdditionalEarningsGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2601,24 +2913,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsGet'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel'; - $request = $this->employeeRecurringAdditionalEarningsGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel'; + $request = $this->employeeRecurringAdditionalEarningsGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2641,7 +2953,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2653,24 +2965,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringAdditionalEarningsGetRequest($id, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsGet'][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 employeeRecurringAdditionalEarningsGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringAdditionalEarningsGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2678,6 +2994,7 @@ protected function employeeRecurringAdditionalEarningsGetRequest($id, $business_ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/additional-earnings/{id}'; $formParams = []; $queryParams = []; @@ -2686,6 +3003,7 @@ protected function employeeRecurringAdditionalEarningsGetRequest($id, $business_ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2711,53 +3029,35 @@ protected function employeeRecurringAdditionalEarningsGetRequest($id, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2778,10 +3078,11 @@ protected function employeeRecurringAdditionalEarningsGetRequest($id, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2794,14 +3095,15 @@ protected function employeeRecurringAdditionalEarningsGetRequest($id, $business_ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AdditionalEarningsModel[] + * @return \OpenAPI\Client\Model\AdditionalEarningsModel[] */ - public function employeeRecurringAdditionalEarningsList($business_id, $employee_id) + public function employeeRecurringAdditionalEarningsList($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsList'][0]) { - list($response) = $this->employeeRecurringAdditionalEarningsListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeRecurringAdditionalEarningsListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -2812,15 +3114,15 @@ public function employeeRecurringAdditionalEarningsList($business_id, $employee_ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AdditionalEarningsModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AdditionalEarningsModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringAdditionalEarningsListWithHttpInfo($business_id, $employee_id) + public function employeeRecurringAdditionalEarningsListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsList'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel[]'; - $request = $this->employeeRecurringAdditionalEarningsListRequest($business_id, $employee_id); + $request = $this->employeeRecurringAdditionalEarningsListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2829,9 +3131,16 @@ public function employeeRecurringAdditionalEarningsListWithHttpInfo($business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2842,19 +3151,37 @@ public function employeeRecurringAdditionalEarningsListWithHttpInfo($business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AdditionalEarningsModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AdditionalEarningsModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AdditionalEarningsModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2871,7 +3198,7 @@ public function employeeRecurringAdditionalEarningsListWithHttpInfo($business_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AdditionalEarningsModel[]', + '\OpenAPI\Client\Model\AdditionalEarningsModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2888,13 +3215,14 @@ public function employeeRecurringAdditionalEarningsListWithHttpInfo($business_id * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsListAsync($business_id, $employee_id) + public function employeeRecurringAdditionalEarningsListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsList'][0]) { - return $this->employeeRecurringAdditionalEarningsListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeRecurringAdditionalEarningsListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2909,24 +3237,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsListAsyncWithHttpInfo($business_id, $employee_id) + public function employeeRecurringAdditionalEarningsListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsList'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel[]'; - $request = $this->employeeRecurringAdditionalEarningsListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel[]'; + $request = $this->employeeRecurringAdditionalEarningsListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2949,7 +3277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2960,18 +3288,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringAdditionalEarningsListRequest($business_id, $employee_id) + public function employeeRecurringAdditionalEarningsListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringAdditionalEarningsList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2979,6 +3310,7 @@ protected function employeeRecurringAdditionalEarningsListRequest($business_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/additional-earnings'; $formParams = []; $queryParams = []; @@ -2987,6 +3319,7 @@ protected function employeeRecurringAdditionalEarningsListRequest($business_id, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3004,53 +3337,35 @@ protected function employeeRecurringAdditionalEarningsListRequest($business_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3071,10 +3386,11 @@ protected function employeeRecurringAdditionalEarningsListRequest($business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3085,17 +3401,18 @@ protected function employeeRecurringAdditionalEarningsListRequest($business_id, * * Create Employee Additional Earning * - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AdditionalEarningsModel + * @return \OpenAPI\Client\Model\AdditionalEarningsModel */ - public function employeeRecurringAdditionalEarningsPost($model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPost'][0]) { - list($response) = $this->employeeRecurringAdditionalEarningsPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeeRecurringAdditionalEarningsPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -3104,18 +3421,18 @@ public function employeeRecurringAdditionalEarningsPost($model, $business_id, $e * * Create Employee Additional Earning * - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AdditionalEarningsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AdditionalEarningsModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringAdditionalEarningsPostWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPost'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel'; - $request = $this->employeeRecurringAdditionalEarningsPostRequest($model, $business_id, $employee_id); + $request = $this->employeeRecurringAdditionalEarningsPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3124,9 +3441,16 @@ public function employeeRecurringAdditionalEarningsPostWithHttpInfo($model, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3137,19 +3461,37 @@ public function employeeRecurringAdditionalEarningsPostWithHttpInfo($model, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AdditionalEarningsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AdditionalEarningsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AdditionalEarningsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3166,7 +3508,7 @@ public function employeeRecurringAdditionalEarningsPostWithHttpInfo($model, $bus case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AdditionalEarningsModel', + '\OpenAPI\Client\Model\AdditionalEarningsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3181,16 +3523,17 @@ public function employeeRecurringAdditionalEarningsPostWithHttpInfo($model, $bus * * Create Employee Additional Earning * - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsPostAsync($model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPost'][0]) { - return $this->employeeRecurringAdditionalEarningsPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeeRecurringAdditionalEarningsPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3203,27 +3546,27 @@ function ($response) { * * Create Employee Additional Earning * - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPost'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel'; - $request = $this->employeeRecurringAdditionalEarningsPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel'; + $request = $this->employeeRecurringAdditionalEarningsPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3246,7 +3589,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3255,27 +3598,24 @@ function ($exception) { /** * Create request for operation 'employeeRecurringAdditionalEarningsPost' * - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringAdditionalEarningsPostRequest($model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringAdditionalEarningsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringAdditionalEarningsPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3283,6 +3623,14 @@ protected function employeeRecurringAdditionalEarningsPostRequest($model, $busin ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringAdditionalEarningsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/additional-earnings'; $formParams = []; $queryParams = []; @@ -3291,6 +3639,7 @@ protected function employeeRecurringAdditionalEarningsPostRequest($model, $busin $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3308,56 +3657,42 @@ protected function employeeRecurringAdditionalEarningsPostRequest($model, $busin ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3378,10 +3713,11 @@ protected function employeeRecurringAdditionalEarningsPostRequest($model, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3393,17 +3729,18 @@ protected function employeeRecurringAdditionalEarningsPostRequest($model, $busin * Update Employee Additional Earning * * @param int $id id (required) - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AdditionalEarningsModel + * @return \OpenAPI\Client\Model\AdditionalEarningsModel */ - public function employeeRecurringAdditionalEarningsPut($id, $model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPut'][0]) { - list($response) = $this->employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -3413,18 +3750,18 @@ public function employeeRecurringAdditionalEarningsPut($id, $model, $business_id * Update Employee Additional Earning * * @param int $id (required) - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AdditionalEarningsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AdditionalEarningsModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPut'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel'; - $request = $this->employeeRecurringAdditionalEarningsPutRequest($id, $model, $business_id, $employee_id); + $request = $this->employeeRecurringAdditionalEarningsPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3433,9 +3770,16 @@ public function employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $model, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3446,19 +3790,37 @@ public function employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $model, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AdditionalEarningsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AdditionalEarningsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AdditionalEarningsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3475,7 +3837,7 @@ public function employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $model, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AdditionalEarningsModel', + '\OpenAPI\Client\Model\AdditionalEarningsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3491,16 +3853,17 @@ public function employeeRecurringAdditionalEarningsPutWithHttpInfo($id, $model, * Update Employee Additional Earning * * @param int $id (required) - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsPutAsync($id, $model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPut'][0]) { - return $this->employeeRecurringAdditionalEarningsPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->employeeRecurringAdditionalEarningsPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3514,27 +3877,27 @@ function ($response) { * Update Employee Additional Earning * * @param int $id (required) - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringAdditionalEarningsPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPut'][0]) { - $returnType = '\Swagger\Client\Model\AdditionalEarningsModel'; - $request = $this->employeeRecurringAdditionalEarningsPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AdditionalEarningsModel'; + $request = $this->employeeRecurringAdditionalEarningsPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3557,7 +3920,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3567,33 +3930,31 @@ function ($exception) { * Create request for operation 'employeeRecurringAdditionalEarningsPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AdditionalEarningsInputModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AdditionalEarningsInputModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringAdditionalEarningsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringAdditionalEarningsPutRequest($id, $model, $business_id, $employee_id) + public function employeeRecurringAdditionalEarningsPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringAdditionalEarningsPut'][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 employeeRecurringAdditionalEarningsPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringAdditionalEarningsPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringAdditionalEarningsPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3601,6 +3962,14 @@ protected function employeeRecurringAdditionalEarningsPutRequest($id, $model, $b ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringAdditionalEarningsPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/additional-earnings/{id}'; $formParams = []; $queryParams = []; @@ -3609,6 +3978,7 @@ protected function employeeRecurringAdditionalEarningsPutRequest($id, $model, $b $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -3634,56 +4004,42 @@ protected function employeeRecurringAdditionalEarningsPutRequest($id, $model, $b ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3704,10 +4060,11 @@ protected function employeeRecurringAdditionalEarningsPutRequest($id, $model, $b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3721,14 +4078,15 @@ protected function employeeRecurringAdditionalEarningsPutRequest($id, $model, $b * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeRecurringExpenseDelete($id, $business_id, $employee_id) + public function employeeRecurringExpenseDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseDelete'][0]) { - $this->employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -3739,15 +4097,15 @@ public function employeeRecurringExpenseDelete($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseDelete'][0]) { - $returnType = ''; - $request = $this->employeeRecurringExpenseDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringExpenseDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3756,9 +4114,16 @@ public function employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3769,11 +4134,11 @@ public function employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3794,13 +4159,14 @@ public function employeeRecurringExpenseDeleteWithHttpInfo($id, $business_id, $e * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpenseDeleteAsync($id, $business_id, $employee_id) + public function employeeRecurringExpenseDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseDelete'][0]) { - return $this->employeeRecurringExpenseDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringExpenseDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3816,14 +4182,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpenseDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringExpenseDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseDelete'][0]) { $returnType = ''; - $request = $this->employeeRecurringExpenseDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringExpenseDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3842,7 +4209,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3854,24 +4221,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringExpenseDeleteRequest($id, $business_id, $employee_id) + public function employeeRecurringExpenseDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseDelete'][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 employeeRecurringExpenseDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringExpenseDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3879,6 +4250,7 @@ protected function employeeRecurringExpenseDeleteRequest($id, $business_id, $emp ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expense/{id}'; $formParams = []; $queryParams = []; @@ -3887,6 +4259,7 @@ protected function employeeRecurringExpenseDeleteRequest($id, $business_id, $emp $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -3912,53 +4285,35 @@ protected function employeeRecurringExpenseDeleteRequest($id, $business_id, $emp ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3979,10 +4334,11 @@ protected function employeeRecurringExpenseDeleteRequest($id, $business_id, $emp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3996,14 +4352,15 @@ protected function employeeRecurringExpenseDeleteRequest($id, $business_id, $emp * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringExpenseModel + * @return \OpenAPI\Client\Model\EmployeeRecurringExpenseModel */ - public function employeeRecurringExpenseGet($id, $business_id, $employee_id) + public function employeeRecurringExpenseGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseGet'][0]) { - list($response) = $this->employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -4015,15 +4372,15 @@ public function employeeRecurringExpenseGet($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringExpenseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringExpenseModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel'; - $request = $this->employeeRecurringExpenseGetRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringExpenseGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4032,9 +4389,16 @@ public function employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4045,19 +4409,37 @@ public function employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4074,7 +4456,7 @@ public function employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringExpenseModel', + '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4092,13 +4474,14 @@ public function employeeRecurringExpenseGetWithHttpInfo($id, $business_id, $empl * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpenseGetAsync($id, $business_id, $employee_id) + public function employeeRecurringExpenseGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseGet'][0]) { - return $this->employeeRecurringExpenseGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringExpenseGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4114,24 +4497,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpenseGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringExpenseGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel'; - $request = $this->employeeRecurringExpenseGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel'; + $request = $this->employeeRecurringExpenseGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4154,7 +4537,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4166,24 +4549,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringExpenseGetRequest($id, $business_id, $employee_id) + public function employeeRecurringExpenseGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseGet'][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 employeeRecurringExpenseGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringExpenseGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4191,6 +4578,7 @@ protected function employeeRecurringExpenseGetRequest($id, $business_id, $employ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expense/{id}'; $formParams = []; $queryParams = []; @@ -4199,6 +4587,7 @@ protected function employeeRecurringExpenseGetRequest($id, $business_id, $employ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -4224,53 +4613,35 @@ protected function employeeRecurringExpenseGetRequest($id, $business_id, $employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4291,10 +4662,11 @@ protected function employeeRecurringExpenseGetRequest($id, $business_id, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4307,14 +4679,15 @@ protected function employeeRecurringExpenseGetRequest($id, $business_id, $employ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringExpenseModel[] + * @return \OpenAPI\Client\Model\EmployeeRecurringExpenseModel[] */ - public function employeeRecurringExpenseList($business_id, $employee_id) + public function employeeRecurringExpenseList($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseList'][0]) { - list($response) = $this->employeeRecurringExpenseListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeRecurringExpenseListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -4325,15 +4698,15 @@ public function employeeRecurringExpenseList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringExpenseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringExpenseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringExpenseListWithHttpInfo($business_id, $employee_id) + public function employeeRecurringExpenseListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel[]'; - $request = $this->employeeRecurringExpenseListRequest($business_id, $employee_id); + $request = $this->employeeRecurringExpenseListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4342,9 +4715,16 @@ public function employeeRecurringExpenseListWithHttpInfo($business_id, $employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4355,19 +4735,37 @@ public function employeeRecurringExpenseListWithHttpInfo($business_id, $employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4384,7 +4782,7 @@ public function employeeRecurringExpenseListWithHttpInfo($business_id, $employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringExpenseModel[]', + '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4401,13 +4799,14 @@ public function employeeRecurringExpenseListWithHttpInfo($business_id, $employee * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpenseListAsync($business_id, $employee_id) + public function employeeRecurringExpenseListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseList'][0]) { - return $this->employeeRecurringExpenseListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeRecurringExpenseListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4422,24 +4821,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpenseListAsyncWithHttpInfo($business_id, $employee_id) + public function employeeRecurringExpenseListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel[]'; - $request = $this->employeeRecurringExpenseListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel[]'; + $request = $this->employeeRecurringExpenseListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4462,7 +4861,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4473,18 +4872,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpenseList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringExpenseListRequest($business_id, $employee_id) + public function employeeRecurringExpenseListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringExpenseList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringExpenseList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4492,6 +4894,7 @@ protected function employeeRecurringExpenseListRequest($business_id, $employee_i ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expense'; $formParams = []; $queryParams = []; @@ -4500,6 +4903,7 @@ protected function employeeRecurringExpenseListRequest($business_id, $employee_i $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4517,53 +4921,35 @@ protected function employeeRecurringExpenseListRequest($business_id, $employee_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4584,10 +4970,11 @@ protected function employeeRecurringExpenseListRequest($business_id, $employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4598,17 +4985,18 @@ protected function employeeRecurringExpenseListRequest($business_id, $employee_i * * Create Employee Expense * - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringExpenseModel + * @return \OpenAPI\Client\Model\EmployeeRecurringExpenseModel */ - public function employeeRecurringExpensePost($model, $business_id, $employee_id) + public function employeeRecurringExpensePost($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePost'][0]) { - list($response) = $this->employeeRecurringExpensePostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeeRecurringExpensePostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -4617,18 +5005,18 @@ public function employeeRecurringExpensePost($model, $business_id, $employee_id) * * Create Employee Expense * - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringExpenseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringExpenseModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringExpensePostWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringExpensePostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel'; - $request = $this->employeeRecurringExpensePostRequest($model, $business_id, $employee_id); + $request = $this->employeeRecurringExpensePostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -4637,9 +5025,16 @@ public function employeeRecurringExpensePostWithHttpInfo($model, $business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4650,19 +5045,37 @@ public function employeeRecurringExpensePostWithHttpInfo($model, $business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4679,7 +5092,7 @@ public function employeeRecurringExpensePostWithHttpInfo($model, $business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringExpenseModel', + '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4694,16 +5107,17 @@ public function employeeRecurringExpensePostWithHttpInfo($model, $business_id, $ * * Create Employee Expense * - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpensePostAsync($model, $business_id, $employee_id) + public function employeeRecurringExpensePostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePost'][0]) { - return $this->employeeRecurringExpensePostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeeRecurringExpensePostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -4716,27 +5130,27 @@ function ($response) { * * Create Employee Expense * - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpensePostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringExpensePostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel'; - $request = $this->employeeRecurringExpensePostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel'; + $request = $this->employeeRecurringExpensePostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4759,7 +5173,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4768,27 +5182,24 @@ function ($exception) { /** * Create request for operation 'employeeRecurringExpensePost' * - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringExpensePostRequest($model, $business_id, $employee_id) + public function employeeRecurringExpensePostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringExpensePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringExpensePost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4796,6 +5207,14 @@ protected function employeeRecurringExpensePostRequest($model, $business_id, $em ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringExpensePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expense'; $formParams = []; $queryParams = []; @@ -4804,6 +5223,7 @@ protected function employeeRecurringExpensePostRequest($model, $business_id, $em $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4821,56 +5241,42 @@ protected function employeeRecurringExpensePostRequest($model, $business_id, $em ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4891,10 +5297,11 @@ protected function employeeRecurringExpensePostRequest($model, $business_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4906,17 +5313,18 @@ protected function employeeRecurringExpensePostRequest($model, $business_id, $em * Update Employee Expense * * @param int $id id (required) - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringExpenseModel + * @return \OpenAPI\Client\Model\EmployeeRecurringExpenseModel */ - public function employeeRecurringExpensePut($id, $model, $business_id, $employee_id) + public function employeeRecurringExpensePut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePut'][0]) { - list($response) = $this->employeeRecurringExpensePutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->employeeRecurringExpensePutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -4926,18 +5334,18 @@ public function employeeRecurringExpensePut($id, $model, $business_id, $employee * Update Employee Expense * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringExpenseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringExpenseModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringExpensePutWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringExpensePutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePut'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel'; - $request = $this->employeeRecurringExpensePutRequest($id, $model, $business_id, $employee_id); + $request = $this->employeeRecurringExpensePutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -4946,9 +5354,16 @@ public function employeeRecurringExpensePutWithHttpInfo($id, $model, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4959,19 +5374,37 @@ public function employeeRecurringExpensePutWithHttpInfo($id, $model, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringExpenseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4988,7 +5421,7 @@ public function employeeRecurringExpensePutWithHttpInfo($id, $model, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringExpenseModel', + '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5004,16 +5437,17 @@ public function employeeRecurringExpensePutWithHttpInfo($id, $model, $business_i * Update Employee Expense * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpensePutAsync($id, $model, $business_id, $employee_id) + public function employeeRecurringExpensePutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePut'][0]) { - return $this->employeeRecurringExpensePutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->employeeRecurringExpensePutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -5027,27 +5461,27 @@ function ($response) { * Update Employee Expense * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringExpensePutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringExpensePutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePut'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringExpenseModel'; - $request = $this->employeeRecurringExpensePutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringExpenseModel'; + $request = $this->employeeRecurringExpensePutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5070,7 +5504,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5080,33 +5514,31 @@ function ($exception) { * Create request for operation 'employeeRecurringExpensePut' * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringExpenseModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringExpenseModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringExpensePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringExpensePutRequest($id, $model, $business_id, $employee_id) + public function employeeRecurringExpensePutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringExpensePut'][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 employeeRecurringExpensePut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringExpensePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringExpensePut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5114,6 +5546,14 @@ protected function employeeRecurringExpensePutRequest($id, $model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringExpensePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/expense/{id}'; $formParams = []; $queryParams = []; @@ -5122,6 +5562,7 @@ protected function employeeRecurringExpensePutRequest($id, $model, $business_id, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -5147,56 +5588,42 @@ protected function employeeRecurringExpensePutRequest($id, $model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5217,10 +5644,11 @@ protected function employeeRecurringExpensePutRequest($id, $model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5234,14 +5662,15 @@ protected function employeeRecurringExpensePutRequest($id, $model, $business_id, * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeRecurringSuperAdjustmentDelete($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentDelete'][0]) { - $this->employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -5252,15 +5681,15 @@ public function employeeRecurringSuperAdjustmentDelete($id, $business_id, $emplo * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentDelete'][0]) { - $returnType = ''; - $request = $this->employeeRecurringSuperAdjustmentDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringSuperAdjustmentDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5269,9 +5698,16 @@ public function employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5282,11 +5718,11 @@ public function employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5307,13 +5743,14 @@ public function employeeRecurringSuperAdjustmentDeleteWithHttpInfo($id, $busines * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentDeleteAsync($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentDelete'][0]) { - return $this->employeeRecurringSuperAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringSuperAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5329,14 +5766,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentDelete'][0]) { $returnType = ''; - $request = $this->employeeRecurringSuperAdjustmentDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringSuperAdjustmentDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5355,7 +5793,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5367,24 +5805,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentDelete'][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 employeeRecurringSuperAdjustmentDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringSuperAdjustmentDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5392,6 +5834,7 @@ protected function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superadjustment/{id}'; $formParams = []; $queryParams = []; @@ -5400,6 +5843,7 @@ protected function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -5425,53 +5869,35 @@ protected function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5492,10 +5918,11 @@ protected function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5509,14 +5936,15 @@ protected function employeeRecurringSuperAdjustmentDeleteRequest($id, $business_ * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel + * @return \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel */ - public function employeeRecurringSuperAdjustmentGet($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentGet'][0]) { - list($response) = $this->employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -5528,15 +5956,15 @@ public function employeeRecurringSuperAdjustmentGet($id, $business_id, $employee * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel'; - $request = $this->employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5545,9 +5973,16 @@ public function employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5558,19 +5993,37 @@ public function employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5587,7 +6040,7 @@ public function employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel', + '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5605,13 +6058,14 @@ public function employeeRecurringSuperAdjustmentGetWithHttpInfo($id, $business_i * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentGetAsync($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentGet'][0]) { - return $this->employeeRecurringSuperAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringSuperAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5627,24 +6081,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel'; - $request = $this->employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel'; + $request = $this->employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5667,7 +6121,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5679,24 +6133,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentGet'][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 employeeRecurringSuperAdjustmentGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringSuperAdjustmentGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5704,6 +6162,7 @@ protected function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superadjustment/{id}'; $formParams = []; $queryParams = []; @@ -5712,6 +6171,7 @@ protected function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -5737,53 +6197,35 @@ protected function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5804,10 +6246,11 @@ protected function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5820,14 +6263,15 @@ protected function employeeRecurringSuperAdjustmentGetRequest($id, $business_id, * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel[] + * @return \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[] */ - public function employeeRecurringSuperAdjustmentList($business_id, $employee_id) + public function employeeRecurringSuperAdjustmentList($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentList'][0]) { - list($response) = $this->employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -5838,15 +6282,15 @@ public function employeeRecurringSuperAdjustmentList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $employee_id) + public function employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel[]'; - $request = $this->employeeRecurringSuperAdjustmentListRequest($business_id, $employee_id); + $request = $this->employeeRecurringSuperAdjustmentListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5855,9 +6299,16 @@ public function employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5868,19 +6319,37 @@ public function employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5897,7 +6366,7 @@ public function employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel[]', + '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5914,13 +6383,14 @@ public function employeeRecurringSuperAdjustmentListWithHttpInfo($business_id, $ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentListAsync($business_id, $employee_id) + public function employeeRecurringSuperAdjustmentListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentList'][0]) { - return $this->employeeRecurringSuperAdjustmentListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeRecurringSuperAdjustmentListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5935,24 +6405,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentListAsyncWithHttpInfo($business_id, $employee_id) + public function employeeRecurringSuperAdjustmentListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel[]'; - $request = $this->employeeRecurringSuperAdjustmentListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel[]'; + $request = $this->employeeRecurringSuperAdjustmentListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5975,7 +6445,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5986,18 +6456,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringSuperAdjustmentListRequest($business_id, $employee_id) + public function employeeRecurringSuperAdjustmentListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringSuperAdjustmentList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6005,6 +6478,7 @@ protected function employeeRecurringSuperAdjustmentListRequest($business_id, $em ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superadjustment'; $formParams = []; $queryParams = []; @@ -6013,6 +6487,7 @@ protected function employeeRecurringSuperAdjustmentListRequest($business_id, $em $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6030,53 +6505,35 @@ protected function employeeRecurringSuperAdjustmentListRequest($business_id, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6097,10 +6554,11 @@ protected function employeeRecurringSuperAdjustmentListRequest($business_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6111,17 +6569,18 @@ protected function employeeRecurringSuperAdjustmentListRequest($business_id, $em * * Create Employee Super Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel + * @return \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel */ - public function employeeRecurringSuperAdjustmentPost($model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPost'][0]) { - list($response) = $this->employeeRecurringSuperAdjustmentPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeeRecurringSuperAdjustmentPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -6130,18 +6589,18 @@ public function employeeRecurringSuperAdjustmentPost($model, $business_id, $empl * * Create Employee Super Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringSuperAdjustmentPostWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel'; - $request = $this->employeeRecurringSuperAdjustmentPostRequest($model, $business_id, $employee_id); + $request = $this->employeeRecurringSuperAdjustmentPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6150,9 +6609,16 @@ public function employeeRecurringSuperAdjustmentPostWithHttpInfo($model, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6163,19 +6629,37 @@ public function employeeRecurringSuperAdjustmentPostWithHttpInfo($model, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6192,7 +6676,7 @@ public function employeeRecurringSuperAdjustmentPostWithHttpInfo($model, $busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel', + '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6207,16 +6691,17 @@ public function employeeRecurringSuperAdjustmentPostWithHttpInfo($model, $busine * * Create Employee Super Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentPostAsync($model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPost'][0]) { - return $this->employeeRecurringSuperAdjustmentPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeeRecurringSuperAdjustmentPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6229,27 +6714,27 @@ function ($response) { * * Create Employee Super Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel'; - $request = $this->employeeRecurringSuperAdjustmentPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel'; + $request = $this->employeeRecurringSuperAdjustmentPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6272,7 +6757,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6281,27 +6766,24 @@ function ($exception) { /** * Create request for operation 'employeeRecurringSuperAdjustmentPost' * - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringSuperAdjustmentPostRequest($model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringSuperAdjustmentPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringSuperAdjustmentPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6309,6 +6791,14 @@ protected function employeeRecurringSuperAdjustmentPostRequest($model, $business ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringSuperAdjustmentPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superadjustment'; $formParams = []; $queryParams = []; @@ -6317,6 +6807,7 @@ protected function employeeRecurringSuperAdjustmentPostRequest($model, $business $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6334,56 +6825,42 @@ protected function employeeRecurringSuperAdjustmentPostRequest($model, $business ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6404,10 +6881,11 @@ protected function employeeRecurringSuperAdjustmentPostRequest($model, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6419,17 +6897,18 @@ protected function employeeRecurringSuperAdjustmentPostRequest($model, $business * Update Employee Super Adjustment * * @param int $id id (required) - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel + * @return \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel */ - public function employeeRecurringSuperAdjustmentPut($id, $model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPut'][0]) { - list($response) = $this->employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -6439,18 +6918,18 @@ public function employeeRecurringSuperAdjustmentPut($id, $model, $business_id, $ * Update Employee Super Adjustment * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPut'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel'; - $request = $this->employeeRecurringSuperAdjustmentPutRequest($id, $model, $business_id, $employee_id); + $request = $this->employeeRecurringSuperAdjustmentPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6459,9 +6938,16 @@ public function employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $model, $bu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6472,25 +6958,43 @@ public function employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $model, $bu sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() @@ -6501,7 +7005,7 @@ public function employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $model, $bu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel', + '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6517,16 +7021,17 @@ public function employeeRecurringSuperAdjustmentPutWithHttpInfo($id, $model, $bu * Update Employee Super Adjustment * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentPutAsync($id, $model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPut'][0]) { - return $this->employeeRecurringSuperAdjustmentPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->employeeRecurringSuperAdjustmentPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6540,27 +7045,27 @@ function ($response) { * Update Employee Super Adjustment * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringSuperAdjustmentPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPut'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel'; - $request = $this->employeeRecurringSuperAdjustmentPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel'; + $request = $this->employeeRecurringSuperAdjustmentPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6583,7 +7088,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6593,33 +7098,31 @@ function ($exception) { * Create request for operation 'employeeRecurringSuperAdjustmentPut' * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringSuperAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringSuperAdjustmentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringSuperAdjustmentPutRequest($id, $model, $business_id, $employee_id) + public function employeeRecurringSuperAdjustmentPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringSuperAdjustmentPut'][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 employeeRecurringSuperAdjustmentPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringSuperAdjustmentPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringSuperAdjustmentPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6627,6 +7130,14 @@ protected function employeeRecurringSuperAdjustmentPutRequest($id, $model, $busi ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringSuperAdjustmentPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superadjustment/{id}'; $formParams = []; $queryParams = []; @@ -6635,6 +7146,7 @@ protected function employeeRecurringSuperAdjustmentPutRequest($id, $model, $busi $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -6660,56 +7172,42 @@ protected function employeeRecurringSuperAdjustmentPutRequest($id, $model, $busi ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6730,10 +7228,11 @@ protected function employeeRecurringSuperAdjustmentPutRequest($id, $model, $busi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6747,14 +7246,15 @@ protected function employeeRecurringSuperAdjustmentPutRequest($id, $model, $busi * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employeeRecurringTaxAdjustmentDelete($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentDelete'][0]) { - $this->employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -6765,15 +7265,15 @@ public function employeeRecurringTaxAdjustmentDelete($id, $business_id, $employe * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentDelete'][0]) { - $returnType = ''; - $request = $this->employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6782,9 +7282,16 @@ public function employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6795,11 +7302,11 @@ public function employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6820,13 +7327,14 @@ public function employeeRecurringTaxAdjustmentDeleteWithHttpInfo($id, $business_ * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentDeleteAsync($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentDelete'][0]) { - return $this->employeeRecurringTaxAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringTaxAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6842,14 +7350,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentDelete'][0]) { $returnType = ''; - $request = $this->employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6868,7 +7377,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6880,24 +7389,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentDelete'][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 employeeRecurringTaxAdjustmentDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringTaxAdjustmentDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6905,6 +7418,7 @@ protected function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/taxadjustment/{id}'; $formParams = []; $queryParams = []; @@ -6913,6 +7427,7 @@ protected function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -6938,53 +7453,35 @@ protected function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7005,10 +7502,11 @@ protected function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7022,14 +7520,15 @@ protected function employeeRecurringTaxAdjustmentDeleteRequest($id, $business_id * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel + * @return \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel */ - public function employeeRecurringTaxAdjustmentGet($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentGet'][0]) { - list($response) = $this->employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -7041,15 +7540,15 @@ public function employeeRecurringTaxAdjustmentGet($id, $business_id, $employee_i * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel'; - $request = $this->employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $employee_id); + $request = $this->employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7058,9 +7557,16 @@ public function employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7071,19 +7577,37 @@ public function employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7100,7 +7624,7 @@ public function employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel', + '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7118,13 +7642,14 @@ public function employeeRecurringTaxAdjustmentGetWithHttpInfo($id, $business_id, * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentGetAsync($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentGet'][0]) { - return $this->employeeRecurringTaxAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employeeRecurringTaxAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7140,24 +7665,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel'; - $request = $this->employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel'; + $request = $this->employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7180,7 +7705,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7192,24 +7717,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentGet'][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 employeeRecurringTaxAdjustmentGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringTaxAdjustmentGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7217,6 +7746,7 @@ protected function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/taxadjustment/{id}'; $formParams = []; $queryParams = []; @@ -7225,6 +7755,7 @@ protected function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -7250,53 +7781,35 @@ protected function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7317,10 +7830,11 @@ protected function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7333,14 +7847,15 @@ protected function employeeRecurringTaxAdjustmentGetRequest($id, $business_id, $ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel[] + * @return \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[] */ - public function employeeRecurringTaxAdjustmentList($business_id, $employee_id) + public function employeeRecurringTaxAdjustmentList($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentList'][0]) { - list($response) = $this->employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -7351,15 +7866,15 @@ public function employeeRecurringTaxAdjustmentList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $employee_id) + public function employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel[]'; - $request = $this->employeeRecurringTaxAdjustmentListRequest($business_id, $employee_id); + $request = $this->employeeRecurringTaxAdjustmentListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7368,9 +7883,16 @@ public function employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $em } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7381,19 +7903,37 @@ public function employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $em sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7410,7 +7950,7 @@ public function employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $em case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel[]', + '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7427,13 +7967,14 @@ public function employeeRecurringTaxAdjustmentListWithHttpInfo($business_id, $em * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentListAsync($business_id, $employee_id) + public function employeeRecurringTaxAdjustmentListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentList'][0]) { - return $this->employeeRecurringTaxAdjustmentListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employeeRecurringTaxAdjustmentListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7448,24 +7989,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentListAsyncWithHttpInfo($business_id, $employee_id) + public function employeeRecurringTaxAdjustmentListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentList'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel[]'; - $request = $this->employeeRecurringTaxAdjustmentListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel[]'; + $request = $this->employeeRecurringTaxAdjustmentListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7488,7 +8029,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7499,18 +8040,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringTaxAdjustmentListRequest($business_id, $employee_id) + public function employeeRecurringTaxAdjustmentListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringTaxAdjustmentList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7518,6 +8062,7 @@ protected function employeeRecurringTaxAdjustmentListRequest($business_id, $empl ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/taxadjustment'; $formParams = []; $queryParams = []; @@ -7526,6 +8071,7 @@ protected function employeeRecurringTaxAdjustmentListRequest($business_id, $empl $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7543,53 +8089,35 @@ protected function employeeRecurringTaxAdjustmentListRequest($business_id, $empl ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7610,10 +8138,11 @@ protected function employeeRecurringTaxAdjustmentListRequest($business_id, $empl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7624,17 +8153,18 @@ protected function employeeRecurringTaxAdjustmentListRequest($business_id, $empl * * Create Employee Tax Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel + * @return \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel */ - public function employeeRecurringTaxAdjustmentPost($model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPost'][0]) { - list($response) = $this->employeeRecurringTaxAdjustmentPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employeeRecurringTaxAdjustmentPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -7643,18 +8173,18 @@ public function employeeRecurringTaxAdjustmentPost($model, $business_id, $employ * * Create Employee Tax Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringTaxAdjustmentPostWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel'; - $request = $this->employeeRecurringTaxAdjustmentPostRequest($model, $business_id, $employee_id); + $request = $this->employeeRecurringTaxAdjustmentPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -7663,9 +8193,16 @@ public function employeeRecurringTaxAdjustmentPostWithHttpInfo($model, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7676,19 +8213,37 @@ public function employeeRecurringTaxAdjustmentPostWithHttpInfo($model, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7705,7 +8260,7 @@ public function employeeRecurringTaxAdjustmentPostWithHttpInfo($model, $business case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel', + '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7720,16 +8275,17 @@ public function employeeRecurringTaxAdjustmentPostWithHttpInfo($model, $business * * Create Employee Tax Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentPostAsync($model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPost'][0]) { - return $this->employeeRecurringTaxAdjustmentPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employeeRecurringTaxAdjustmentPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -7742,27 +8298,27 @@ function ($response) { * * Create Employee Tax Adjustment * - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel'; - $request = $this->employeeRecurringTaxAdjustmentPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel'; + $request = $this->employeeRecurringTaxAdjustmentPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7785,7 +8341,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7794,27 +8350,24 @@ function ($exception) { /** * Create request for operation 'employeeRecurringTaxAdjustmentPost' * - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringTaxAdjustmentPostRequest($model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringTaxAdjustmentPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringTaxAdjustmentPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7822,6 +8375,14 @@ protected function employeeRecurringTaxAdjustmentPostRequest($model, $business_i ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringTaxAdjustmentPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/taxadjustment'; $formParams = []; $queryParams = []; @@ -7830,6 +8391,7 @@ protected function employeeRecurringTaxAdjustmentPostRequest($model, $business_i $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7847,56 +8409,42 @@ protected function employeeRecurringTaxAdjustmentPostRequest($model, $business_i ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7917,10 +8465,11 @@ protected function employeeRecurringTaxAdjustmentPostRequest($model, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7932,17 +8481,18 @@ protected function employeeRecurringTaxAdjustmentPostRequest($model, $business_i * Update Employee Tax Adjustment * * @param int $id id (required) - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel + * @return \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel */ - public function employeeRecurringTaxAdjustmentPut($id, $model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPut'][0]) { - list($response) = $this->employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -7952,18 +8502,18 @@ public function employeeRecurringTaxAdjustmentPut($id, $model, $business_id, $em * Update Employee Tax Adjustment * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPut'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel'; - $request = $this->employeeRecurringTaxAdjustmentPutRequest($id, $model, $business_id, $employee_id); + $request = $this->employeeRecurringTaxAdjustmentPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -7972,9 +8522,16 @@ public function employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $model, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7985,19 +8542,37 @@ public function employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $model, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8014,7 +8589,7 @@ public function employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $model, $busi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel', + '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8030,16 +8605,17 @@ public function employeeRecurringTaxAdjustmentPutWithHttpInfo($id, $model, $busi * Update Employee Tax Adjustment * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentPutAsync($id, $model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPut'][0]) { - return $this->employeeRecurringTaxAdjustmentPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->employeeRecurringTaxAdjustmentPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -8053,27 +8629,27 @@ function ($response) { * Update Employee Tax Adjustment * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeeRecurringTaxAdjustmentPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPut'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel'; - $request = $this->employeeRecurringTaxAdjustmentPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel'; + $request = $this->employeeRecurringTaxAdjustmentPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8096,7 +8672,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8106,33 +8682,31 @@ function ($exception) { * Create request for operation 'employeeRecurringTaxAdjustmentPut' * * @param int $id (required) - * @param \Swagger\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeRecurringTaxAdjustmentModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeeRecurringTaxAdjustmentPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeeRecurringTaxAdjustmentPutRequest($id, $model, $business_id, $employee_id) + public function employeeRecurringTaxAdjustmentPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employeeRecurringTaxAdjustmentPut'][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 employeeRecurringTaxAdjustmentPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employeeRecurringTaxAdjustmentPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employeeRecurringTaxAdjustmentPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -8140,6 +8714,14 @@ protected function employeeRecurringTaxAdjustmentPutRequest($id, $model, $busine ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employeeRecurringTaxAdjustmentPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/taxadjustment/{id}'; $formParams = []; $queryParams = []; @@ -8148,6 +8730,7 @@ protected function employeeRecurringTaxAdjustmentPutRequest($id, $model, $busine $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -8173,56 +8756,42 @@ protected function employeeRecurringTaxAdjustmentPutRequest($id, $model, $busine ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8243,10 +8812,11 @@ protected function employeeRecurringTaxAdjustmentPutRequest($id, $model, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8260,14 +8830,15 @@ protected function employeeRecurringTaxAdjustmentPutRequest($id, $model, $busine * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employerrecurringliabilityDelete($id, $business_id, $employee_id) + public function employerrecurringliabilityDelete($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityDelete'][0]) { - $this->employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, $employee_id); + $this->employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, $employee_id, $contentType); } /** @@ -8278,15 +8849,15 @@ public function employerrecurringliabilityDelete($id, $business_id, $employee_id * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, $employee_id) + public function employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityDelete'][0]) { - $returnType = ''; - $request = $this->employerrecurringliabilityDeleteRequest($id, $business_id, $employee_id); + $request = $this->employerrecurringliabilityDeleteRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8295,9 +8866,16 @@ public function employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8308,11 +8886,11 @@ public function employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -8333,13 +8911,14 @@ public function employerrecurringliabilityDeleteWithHttpInfo($id, $business_id, * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityDeleteAsync($id, $business_id, $employee_id) + public function employerrecurringliabilityDeleteAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityDelete'][0]) { - return $this->employerrecurringliabilityDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employerrecurringliabilityDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8355,14 +8934,15 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityDeleteAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employerrecurringliabilityDeleteAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityDelete'][0]) { $returnType = ''; - $request = $this->employerrecurringliabilityDeleteRequest($id, $business_id, $employee_id); + $request = $this->employerrecurringliabilityDeleteRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8381,7 +8961,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8393,24 +8973,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerrecurringliabilityDeleteRequest($id, $business_id, $employee_id) + public function employerrecurringliabilityDeleteRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityDelete'][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 employerrecurringliabilityDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employerrecurringliabilityDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -8418,6 +9002,7 @@ protected function employerrecurringliabilityDeleteRequest($id, $business_id, $e ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/employerliability/{id}'; $formParams = []; $queryParams = []; @@ -8426,6 +9011,7 @@ protected function employerrecurringliabilityDeleteRequest($id, $business_id, $e $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -8451,53 +9037,35 @@ protected function employerrecurringliabilityDeleteRequest($id, $business_id, $e ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8518,10 +9086,11 @@ protected function employerrecurringliabilityDeleteRequest($id, $business_id, $e $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8535,14 +9104,15 @@ protected function employerrecurringliabilityDeleteRequest($id, $business_id, $e * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployerRecurringLiabilityModel + * @return \OpenAPI\Client\Model\EmployerRecurringLiabilityModel */ - public function employerrecurringliabilityGet($id, $business_id, $employee_id) + public function employerrecurringliabilityGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityGet'][0]) { - list($response) = $this->employerrecurringliabilityGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->employerrecurringliabilityGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -8554,15 +9124,15 @@ public function employerrecurringliabilityGet($id, $business_id, $employee_id) * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployerRecurringLiabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployerRecurringLiabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function employerrecurringliabilityGetWithHttpInfo($id, $business_id, $employee_id) + public function employerrecurringliabilityGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel'; - $request = $this->employerrecurringliabilityGetRequest($id, $business_id, $employee_id); + $request = $this->employerrecurringliabilityGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8571,9 +9141,16 @@ public function employerrecurringliabilityGetWithHttpInfo($id, $business_id, $em } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8584,19 +9161,37 @@ public function employerrecurringliabilityGetWithHttpInfo($id, $business_id, $em sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8613,7 +9208,7 @@ public function employerrecurringliabilityGetWithHttpInfo($id, $business_id, $em case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployerRecurringLiabilityModel', + '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8631,13 +9226,14 @@ public function employerrecurringliabilityGetWithHttpInfo($id, $business_id, $em * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityGetAsync($id, $business_id, $employee_id) + public function employerrecurringliabilityGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityGet'][0]) { - return $this->employerrecurringliabilityGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->employerrecurringliabilityGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8653,24 +9249,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function employerrecurringliabilityGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel'; - $request = $this->employerrecurringliabilityGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel'; + $request = $this->employerrecurringliabilityGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8693,7 +9289,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8705,24 +9301,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerrecurringliabilityGetRequest($id, $business_id, $employee_id) + public function employerrecurringliabilityGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityGet'][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 employerrecurringliabilityGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employerrecurringliabilityGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -8730,6 +9330,7 @@ protected function employerrecurringliabilityGetRequest($id, $business_id, $empl ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/employerliability/{id}'; $formParams = []; $queryParams = []; @@ -8738,6 +9339,7 @@ protected function employerrecurringliabilityGetRequest($id, $business_id, $empl $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -8763,53 +9365,35 @@ protected function employerrecurringliabilityGetRequest($id, $business_id, $empl ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8830,10 +9414,11 @@ protected function employerrecurringliabilityGetRequest($id, $business_id, $empl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8846,14 +9431,15 @@ protected function employerrecurringliabilityGetRequest($id, $business_id, $empl * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployerRecurringLiabilityModel[] + * @return \OpenAPI\Client\Model\EmployerRecurringLiabilityModel[] */ - public function employerrecurringliabilityList($business_id, $employee_id) + public function employerrecurringliabilityList($business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityList'][0]) { - list($response) = $this->employerrecurringliabilityListWithHttpInfo($business_id, $employee_id); + list($response) = $this->employerrecurringliabilityListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -8864,15 +9450,15 @@ public function employerrecurringliabilityList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployerRecurringLiabilityModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployerRecurringLiabilityModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employerrecurringliabilityListWithHttpInfo($business_id, $employee_id) + public function employerrecurringliabilityListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityList'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel[]'; - $request = $this->employerrecurringliabilityListRequest($business_id, $employee_id); + $request = $this->employerrecurringliabilityListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8881,9 +9467,16 @@ public function employerrecurringliabilityListWithHttpInfo($business_id, $employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8894,19 +9487,37 @@ public function employerrecurringliabilityListWithHttpInfo($business_id, $employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8923,7 +9534,7 @@ public function employerrecurringliabilityListWithHttpInfo($business_id, $employ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployerRecurringLiabilityModel[]', + '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8940,13 +9551,14 @@ public function employerrecurringliabilityListWithHttpInfo($business_id, $employ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityListAsync($business_id, $employee_id) + public function employerrecurringliabilityListAsync($business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityList'][0]) { - return $this->employerrecurringliabilityListAsyncWithHttpInfo($business_id, $employee_id) + return $this->employerrecurringliabilityListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8961,24 +9573,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityListAsyncWithHttpInfo($business_id, $employee_id) + public function employerrecurringliabilityListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityList'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel[]'; - $request = $this->employerrecurringliabilityListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel[]'; + $request = $this->employerrecurringliabilityListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9001,7 +9613,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9012,18 +9624,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerrecurringliabilityListRequest($business_id, $employee_id) + public function employerrecurringliabilityListRequest($business_id, $employee_id, string $contentType = self::contentTypes['employerrecurringliabilityList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employerrecurringliabilityList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9031,6 +9646,7 @@ protected function employerrecurringliabilityListRequest($business_id, $employee ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/employerliability'; $formParams = []; $queryParams = []; @@ -9039,6 +9655,7 @@ protected function employerrecurringliabilityListRequest($business_id, $employee $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -9056,53 +9673,35 @@ protected function employerrecurringliabilityListRequest($business_id, $employee ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9123,10 +9722,11 @@ protected function employerrecurringliabilityListRequest($business_id, $employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9137,17 +9737,18 @@ protected function employerrecurringliabilityListRequest($business_id, $employee * * Create Employer liability * - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployerRecurringLiabilityModel + * @return \OpenAPI\Client\Model\EmployerRecurringLiabilityModel */ - public function employerrecurringliabilityPost($model, $business_id, $employee_id) + public function employerrecurringliabilityPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPost'][0]) { - list($response) = $this->employerrecurringliabilityPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employerrecurringliabilityPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -9156,18 +9757,18 @@ public function employerrecurringliabilityPost($model, $business_id, $employee_i * * Create Employer liability * - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployerRecurringLiabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployerRecurringLiabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function employerrecurringliabilityPostWithHttpInfo($model, $business_id, $employee_id) + public function employerrecurringliabilityPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel'; - $request = $this->employerrecurringliabilityPostRequest($model, $business_id, $employee_id); + $request = $this->employerrecurringliabilityPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -9176,9 +9777,16 @@ public function employerrecurringliabilityPostWithHttpInfo($model, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9189,19 +9797,37 @@ public function employerrecurringliabilityPostWithHttpInfo($model, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9218,7 +9844,7 @@ public function employerrecurringliabilityPostWithHttpInfo($model, $business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployerRecurringLiabilityModel', + '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9233,16 +9859,17 @@ public function employerrecurringliabilityPostWithHttpInfo($model, $business_id, * * Create Employer liability * - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityPostAsync($model, $business_id, $employee_id) + public function employerrecurringliabilityPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPost'][0]) { - return $this->employerrecurringliabilityPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employerrecurringliabilityPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -9255,27 +9882,27 @@ function ($response) { * * Create Employer liability * - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employerrecurringliabilityPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPost'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel'; - $request = $this->employerrecurringliabilityPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel'; + $request = $this->employerrecurringliabilityPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9298,7 +9925,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9307,27 +9934,24 @@ function ($exception) { /** * Create request for operation 'employerrecurringliabilityPost' * - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerrecurringliabilityPostRequest($model, $business_id, $employee_id) + public function employerrecurringliabilityPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employerrecurringliabilityPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employerrecurringliabilityPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9335,6 +9959,14 @@ protected function employerrecurringliabilityPostRequest($model, $business_id, $ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employerrecurringliabilityPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/employerliability'; $formParams = []; $queryParams = []; @@ -9343,6 +9975,7 @@ protected function employerrecurringliabilityPostRequest($model, $business_id, $ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -9360,56 +9993,42 @@ protected function employerrecurringliabilityPostRequest($model, $business_id, $ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9430,10 +10049,11 @@ protected function employerrecurringliabilityPostRequest($model, $business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9445,17 +10065,18 @@ protected function employerrecurringliabilityPostRequest($model, $business_id, $ * Update Employer liability * * @param int $id id (required) - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployerRecurringLiabilityModel + * @return \OpenAPI\Client\Model\EmployerRecurringLiabilityModel */ - public function employerrecurringliabilityPut($id, $model, $business_id, $employee_id) + public function employerrecurringliabilityPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPut'][0]) { - list($response) = $this->employerrecurringliabilityPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->employerrecurringliabilityPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -9465,18 +10086,18 @@ public function employerrecurringliabilityPut($id, $model, $business_id, $employ * Update Employer liability * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployerRecurringLiabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployerRecurringLiabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function employerrecurringliabilityPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function employerrecurringliabilityPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPut'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel'; - $request = $this->employerrecurringliabilityPutRequest($id, $model, $business_id, $employee_id); + $request = $this->employerrecurringliabilityPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -9485,9 +10106,16 @@ public function employerrecurringliabilityPutWithHttpInfo($id, $model, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9498,19 +10126,37 @@ public function employerrecurringliabilityPutWithHttpInfo($id, $model, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployerRecurringLiabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9527,7 +10173,7 @@ public function employerrecurringliabilityPutWithHttpInfo($id, $model, $business case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployerRecurringLiabilityModel', + '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9543,16 +10189,17 @@ public function employerrecurringliabilityPutWithHttpInfo($id, $model, $business * Update Employer liability * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityPutAsync($id, $model, $business_id, $employee_id) + public function employerrecurringliabilityPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPut'][0]) { - return $this->employerrecurringliabilityPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->employerrecurringliabilityPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -9566,27 +10213,27 @@ function ($response) { * Update Employer liability * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerrecurringliabilityPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function employerrecurringliabilityPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPut'][0]) { - $returnType = '\Swagger\Client\Model\EmployerRecurringLiabilityModel'; - $request = $this->employerrecurringliabilityPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployerRecurringLiabilityModel'; + $request = $this->employerrecurringliabilityPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9609,7 +10256,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9619,33 +10266,31 @@ function ($exception) { * Create request for operation 'employerrecurringliabilityPut' * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerRecurringLiabilityModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployerRecurringLiabilityModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerrecurringliabilityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerrecurringliabilityPutRequest($id, $model, $business_id, $employee_id) + public function employerrecurringliabilityPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['employerrecurringliabilityPut'][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 employerrecurringliabilityPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employerrecurringliabilityPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employerrecurringliabilityPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9653,6 +10298,14 @@ protected function employerrecurringliabilityPutRequest($id, $model, $business_i ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employerrecurringliabilityPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/employerliability/{id}'; $formParams = []; $queryParams = []; @@ -9661,6 +10314,7 @@ protected function employerrecurringliabilityPutRequest($id, $model, $business_i $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -9686,56 +10340,42 @@ protected function employerrecurringliabilityPutRequest($id, $model, $business_i ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9756,10 +10396,11 @@ protected function employerrecurringliabilityPutRequest($id, $model, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeReportingDimensionEarningsLineSplitApi.php b/src/lib/Api/EmployeeReportingDimensionEarningsLineSplitApi.php index d57b28a..a836d2b 100644 --- a/src/lib/Api/EmployeeReportingDimensionEarningsLineSplitApi.php +++ b/src/lib/Api/EmployeeReportingDimensionEarningsLineSplitApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'genericDimensionEarningsLineSplitGet' => [ + 'application/json', + ], + 'genericDimensionEarningsLineSplitGetById' => [ + 'application/json', + ], + 'genericDimensionEarningsLineSplitPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericDimensionEarningsLineSplitPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -96,14 +151,15 @@ public function getConfig() * @param int $dimension_value_id dimension_value_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericDimensionEarningsLineSplitDelete($dimension_id, $dimension_value_id, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitDelete($dimension_id, $dimension_value_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitDelete'][0]) { - $this->genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id); + $this->genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $contentType); } /** @@ -115,15 +171,15 @@ public function genericDimensionEarningsLineSplitDelete($dimension_id, $dimensio * @param int $dimension_value_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitDelete'][0]) { - $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $dimension_value_id, $business_id, $employee_id); + $request = $this->genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -132,9 +188,16 @@ public function genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -145,11 +208,11 @@ public function genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -171,13 +234,14 @@ public function genericDimensionEarningsLineSplitDeleteWithHttpInfo($dimension_i * @param int $dimension_value_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitDeleteAsync($dimension_id, $dimension_value_id, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitDeleteAsync($dimension_id, $dimension_value_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitDelete'][0]) { - return $this->genericDimensionEarningsLineSplitDeleteAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id) + return $this->genericDimensionEarningsLineSplitDeleteAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -194,14 +258,15 @@ function ($response) { * @param int $dimension_value_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitDeleteAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitDeleteAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitDelete'][0]) { $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $dimension_value_id, $business_id, $employee_id); + $request = $this->genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -220,7 +285,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -233,30 +298,35 @@ function ($exception) { * @param int $dimension_value_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $dimension_value_id, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitDelete'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling genericDimensionEarningsLineSplitDelete' ); } + // verify the required parameter 'dimension_value_id' is set if ($dimension_value_id === null || (is_array($dimension_value_id) && count($dimension_value_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_value_id when calling genericDimensionEarningsLineSplitDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericDimensionEarningsLineSplitDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -264,6 +334,7 @@ protected function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/dimension/{dimensionId}/value/{dimensionValueId}'; $formParams = []; $queryParams = []; @@ -272,6 +343,7 @@ protected function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $multipart = false; + // path params if ($dimension_id !== null) { $resourcePath = str_replace( @@ -305,53 +377,35 @@ protected function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -372,10 +426,11 @@ protected function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -392,14 +447,15 @@ protected function genericDimensionEarningsLineSplitDeleteRequest($dimension_id, * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DimensionEarningsLineSplitApiModel[] + * @return \OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[] */ - public function genericDimensionEarningsLineSplitGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGet($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGet'][0]) { - list($response) = $this->genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -414,15 +470,15 @@ public function genericDimensionEarningsLineSplitGet($business_id, $employee_id, * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DimensionEarningsLineSplitApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGet'][0]) { - $returnType = '\Swagger\Client\Model\DimensionEarningsLineSplitApiModel[]'; - $request = $this->genericDimensionEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->genericDimensionEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -431,9 +487,16 @@ public function genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -444,19 +507,37 @@ public function genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -473,7 +554,7 @@ public function genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DimensionEarningsLineSplitApiModel[]', + '\OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -494,13 +575,14 @@ public function genericDimensionEarningsLineSplitGetWithHttpInfo($business_id, $ * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGet'][0]) { - return $this->genericDimensionEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->genericDimensionEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -519,24 +601,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGet'][0]) { - $returnType = '\Swagger\Client\Model\DimensionEarningsLineSplitApiModel[]'; - $request = $this->genericDimensionEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\DimensionEarningsLineSplitApiModel[]'; + $request = $this->genericDimensionEarningsLineSplitGetRequest($business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -559,7 +641,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -574,18 +656,21 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericDimensionEarningsLineSplitGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericDimensionEarningsLineSplitGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -593,6 +678,11 @@ protected function genericDimensionEarningsLineSplitGetRequest($business_id, $em ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/dimension'; $formParams = []; $queryParams = []; @@ -601,21 +691,42 @@ protected function genericDimensionEarningsLineSplitGetRequest($business_id, $em $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -634,53 +745,35 @@ protected function genericDimensionEarningsLineSplitGetRequest($business_id, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -701,10 +794,11 @@ protected function genericDimensionEarningsLineSplitGetRequest($business_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -723,14 +817,15 @@ protected function genericDimensionEarningsLineSplitGetRequest($business_id, $em * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGetById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericDimensionEarningsLineSplitGetById($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetById($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGetById'][0]) { - $this->genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip); + $this->genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); } /** @@ -746,15 +841,15 @@ public function genericDimensionEarningsLineSplitGetById($dimension_id, $dimensi * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGetById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGetById'][0]) { - $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitGetByIdRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->genericDimensionEarningsLineSplitGetByIdRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -763,9 +858,16 @@ public function genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -776,11 +878,11 @@ public function genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -806,13 +908,14 @@ public function genericDimensionEarningsLineSplitGetByIdWithHttpInfo($dimension_ * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGetById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitGetByIdAsync($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetByIdAsync($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGetById'][0]) { - return $this->genericDimensionEarningsLineSplitGetByIdAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->genericDimensionEarningsLineSplitGetByIdAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -833,14 +936,15 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGetById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitGetByIdAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetByIdAsyncWithHttpInfo($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGetById'][0]) { $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitGetByIdRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->genericDimensionEarningsLineSplitGetByIdRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -859,7 +963,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -876,30 +980,35 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitGetById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id, $dimension_value_id, $business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitGetById'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling genericDimensionEarningsLineSplitGetById' ); } + // verify the required parameter 'dimension_value_id' is set if ($dimension_value_id === null || (is_array($dimension_value_id) && count($dimension_value_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_value_id when calling genericDimensionEarningsLineSplitGetById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericDimensionEarningsLineSplitGetById' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -907,6 +1016,11 @@ protected function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/dimension/{dimensionId}/value/{dimensionValueId}'; $formParams = []; $queryParams = []; @@ -915,21 +1029,42 @@ protected function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($dimension_id !== null) { @@ -964,53 +1099,35 @@ protected function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1031,10 +1148,11 @@ protected function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1045,17 +1163,18 @@ protected function genericDimensionEarningsLineSplitGetByIdRequest($dimension_id * * Create Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericDimensionEarningsLineSplitPost($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPost'][0]) { - $this->genericDimensionEarningsLineSplitPostWithHttpInfo($model, $business_id, $employee_id); + $this->genericDimensionEarningsLineSplitPostWithHttpInfo($business_id, $employee_id, $model, $contentType); } /** @@ -1063,18 +1182,18 @@ public function genericDimensionEarningsLineSplitPost($model, $business_id, $emp * * Create Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericDimensionEarningsLineSplitPostWithHttpInfo($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPost'][0]) { - $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitPostRequest($model, $business_id, $employee_id); + $request = $this->genericDimensionEarningsLineSplitPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1083,9 +1202,16 @@ public function genericDimensionEarningsLineSplitPostWithHttpInfo($model, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1096,11 +1222,11 @@ public function genericDimensionEarningsLineSplitPostWithHttpInfo($model, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1118,16 +1244,17 @@ public function genericDimensionEarningsLineSplitPostWithHttpInfo($model, $busin * * Create Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitPostAsync($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPost'][0]) { - return $this->genericDimensionEarningsLineSplitPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->genericDimensionEarningsLineSplitPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1140,17 +1267,18 @@ function ($response) { * * Create Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPost'][0]) { $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitPostRequest($model, $business_id, $employee_id); + $request = $this->genericDimensionEarningsLineSplitPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1169,7 +1297,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1178,27 +1306,24 @@ function ($exception) { /** * Create request for operation 'genericDimensionEarningsLineSplitPost' * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericDimensionEarningsLineSplitPostRequest($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericDimensionEarningsLineSplitPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericDimensionEarningsLineSplitPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1206,6 +1331,14 @@ protected function genericDimensionEarningsLineSplitPostRequest($model, $busines ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericDimensionEarningsLineSplitPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/dimension'; $formParams = []; $queryParams = []; @@ -1214,6 +1347,7 @@ protected function genericDimensionEarningsLineSplitPostRequest($model, $busines $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1231,56 +1365,42 @@ protected function genericDimensionEarningsLineSplitPostRequest($model, $busines ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1301,10 +1421,11 @@ protected function genericDimensionEarningsLineSplitPostRequest($model, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1315,17 +1436,18 @@ protected function genericDimensionEarningsLineSplitPostRequest($model, $busines * * Update Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericDimensionEarningsLineSplitPut($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPut($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPut'][0]) { - $this->genericDimensionEarningsLineSplitPutWithHttpInfo($model, $business_id, $employee_id); + $this->genericDimensionEarningsLineSplitPutWithHttpInfo($business_id, $employee_id, $model, $contentType); } /** @@ -1333,18 +1455,18 @@ public function genericDimensionEarningsLineSplitPut($model, $business_id, $empl * * Update Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericDimensionEarningsLineSplitPutWithHttpInfo($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPutWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPut'][0]) { - $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitPutRequest($model, $business_id, $employee_id); + $request = $this->genericDimensionEarningsLineSplitPutRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1353,9 +1475,16 @@ public function genericDimensionEarningsLineSplitPutWithHttpInfo($model, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1366,11 +1495,11 @@ public function genericDimensionEarningsLineSplitPutWithHttpInfo($model, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1388,16 +1517,17 @@ public function genericDimensionEarningsLineSplitPutWithHttpInfo($model, $busine * * Update Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitPutAsync($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPutAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPut'][0]) { - return $this->genericDimensionEarningsLineSplitPutAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->genericDimensionEarningsLineSplitPutAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1410,17 +1540,18 @@ function ($response) { * * Update Dimension Earnings Line Split * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericDimensionEarningsLineSplitPutAsyncWithHttpInfo($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPutAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPut'][0]) { $returnType = ''; - $request = $this->genericDimensionEarningsLineSplitPutRequest($model, $business_id, $employee_id); + $request = $this->genericDimensionEarningsLineSplitPutRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1439,7 +1570,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1448,27 +1579,24 @@ function ($exception) { /** * Create request for operation 'genericDimensionEarningsLineSplitPut' * - * @param \Swagger\Client\Model\EarningsLineSplitEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EarningsLineSplitEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericDimensionEarningsLineSplitPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericDimensionEarningsLineSplitPutRequest($model, $business_id, $employee_id) + public function genericDimensionEarningsLineSplitPutRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['genericDimensionEarningsLineSplitPut'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericDimensionEarningsLineSplitPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericDimensionEarningsLineSplitPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1476,6 +1604,14 @@ protected function genericDimensionEarningsLineSplitPutRequest($model, $business ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericDimensionEarningsLineSplitPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/earningslinesplit/dimension'; $formParams = []; $queryParams = []; @@ -1484,6 +1620,7 @@ protected function genericDimensionEarningsLineSplitPutRequest($model, $business $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1501,56 +1638,42 @@ protected function genericDimensionEarningsLineSplitPutRequest($model, $business ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1571,10 +1694,11 @@ protected function genericDimensionEarningsLineSplitPutRequest($model, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeSelfManagedSuperFundApi.php b/src/lib/Api/EmployeeSelfManagedSuperFundApi.php index 2989960..5c2c824 100644 --- a/src/lib/Api/EmployeeSelfManagedSuperFundApi.php +++ b/src/lib/Api/EmployeeSelfManagedSuperFundApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeSelfManagedSuperFundGetFunds' => [ + 'application/json', + ], + 'auEmployeeSelfManagedSuperFundPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeeSelfManagedSuperFundPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +147,15 @@ public function getConfig() * @param int $id id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SelfManagedSuperFundModel + * @return \OpenAPI\Client\Model\SelfManagedSuperFundModel */ - public function auEmployeeSelfManagedSuperFundGet($id, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundGet($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGet'][0]) { - list($response) = $this->auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, $employee_id); + list($response) = $this->auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, $employee_id, $contentType); return $response; } @@ -114,15 +167,15 @@ public function auEmployeeSelfManagedSuperFundGet($id, $business_id, $employee_i * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SelfManagedSuperFundModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SelfManagedSuperFundModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel'; - $request = $this->auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $employee_id); + $request = $this->auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -131,9 +184,16 @@ public function auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -144,19 +204,37 @@ public function auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SelfManagedSuperFundModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -173,7 +251,7 @@ public function auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SelfManagedSuperFundModel', + '\OpenAPI\Client\Model\SelfManagedSuperFundModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -191,13 +269,14 @@ public function auEmployeeSelfManagedSuperFundGetWithHttpInfo($id, $business_id, * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundGetAsync($id, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundGetAsync($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGet'][0]) { - return $this->auEmployeeSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id, $employee_id) + return $this->auEmployeeSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -213,24 +292,24 @@ function ($response) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel'; - $request = $this->auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel'; + $request = $this->auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +332,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -265,24 +344,28 @@ function ($exception) { * @param int $id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGet'][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 auEmployeeSelfManagedSuperFundGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSelfManagedSuperFundGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -290,6 +373,7 @@ protected function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/selfmanagedsuperfund/{id}'; $formParams = []; $queryParams = []; @@ -298,6 +382,7 @@ protected function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -323,53 +408,35 @@ protected function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -390,10 +457,11 @@ protected function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -406,18 +474,20 @@ protected function auEmployeeSelfManagedSuperFundGetRequest($id, $business_id, $ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SelfManagedSuperFundModel[] + * @return \OpenAPI\Client\Model\SelfManagedSuperFundModel[] */ - public function auEmployeeSelfManagedSuperFundGetFunds($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeSelfManagedSuperFundGetFunds($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'][0]) { - list($response) = $this->auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -428,19 +498,20 @@ public function auEmployeeSelfManagedSuperFundGetFunds($business_id, $employee_i * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SelfManagedSuperFundModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SelfManagedSuperFundModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel[]'; - $request = $this->auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -449,9 +520,16 @@ public function auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -462,19 +540,37 @@ public function auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -491,7 +587,7 @@ public function auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SelfManagedSuperFundModel[]', + '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -508,17 +604,19 @@ public function auEmployeeSelfManagedSuperFundGetFundsWithHttpInfo($business_id, * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundGetFundsAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeSelfManagedSuperFundGetFundsAsync($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'][0]) { - return $this->auEmployeeSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->auEmployeeSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -533,28 +631,29 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel[]'; - $request = $this->auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]'; + $request = $this->auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -577,7 +676,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -588,22 +687,26 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundGetFunds'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSelfManagedSuperFundGetFunds' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -611,6 +714,12 @@ protected function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $ ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/selfmanagedsuperfund'; $formParams = []; $queryParams = []; @@ -619,20 +728,45 @@ protected function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $ $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -652,53 +786,35 @@ protected function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -719,10 +835,11 @@ protected function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -733,17 +850,18 @@ protected function auEmployeeSelfManagedSuperFundGetFundsRequest($business_id, $ * * Create Employee Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund fund (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeSelfManagedSuperFundPost($fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPost($business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPost'][0]) { - $this->auEmployeeSelfManagedSuperFundPostWithHttpInfo($fund, $business_id, $employee_id); + $this->auEmployeeSelfManagedSuperFundPostWithHttpInfo($business_id, $employee_id, $fund, $contentType); } /** @@ -751,18 +869,18 @@ public function auEmployeeSelfManagedSuperFundPost($fund, $business_id, $employe * * Create Employee Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSelfManagedSuperFundPostWithHttpInfo($fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPostWithHttpInfo($business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPost'][0]) { - $returnType = ''; - $request = $this->auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id, $employee_id); + $request = $this->auEmployeeSelfManagedSuperFundPostRequest($business_id, $employee_id, $fund, $contentType); try { $options = $this->createHttpClientOption(); @@ -771,9 +889,16 @@ public function auEmployeeSelfManagedSuperFundPostWithHttpInfo($fund, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -784,11 +909,11 @@ public function auEmployeeSelfManagedSuperFundPostWithHttpInfo($fund, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -806,16 +931,17 @@ public function auEmployeeSelfManagedSuperFundPostWithHttpInfo($fund, $business_ * * Create Employee Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundPostAsync($fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPostAsync($business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPost'][0]) { - return $this->auEmployeeSelfManagedSuperFundPostAsyncWithHttpInfo($fund, $business_id, $employee_id) + return $this->auEmployeeSelfManagedSuperFundPostAsyncWithHttpInfo($business_id, $employee_id, $fund, $contentType) ->then( function ($response) { return $response[0]; @@ -828,17 +954,18 @@ function ($response) { * * Create Employee Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundPostAsyncWithHttpInfo($fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPostAsyncWithHttpInfo($business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPost'][0]) { $returnType = ''; - $request = $this->auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id, $employee_id); + $request = $this->auEmployeeSelfManagedSuperFundPostRequest($business_id, $employee_id, $fund, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -857,7 +984,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -866,27 +993,24 @@ function ($exception) { /** * Create request for operation 'auEmployeeSelfManagedSuperFundPost' * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPostRequest($business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPost'][0]) { - // verify the required parameter 'fund' is set - if ($fund === null || (is_array($fund) && count($fund) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $fund when calling auEmployeeSelfManagedSuperFundPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSelfManagedSuperFundPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -894,6 +1018,14 @@ protected function auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id ); } + // verify the required parameter 'fund' is set + if ($fund === null || (is_array($fund) && count($fund) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $fund when calling auEmployeeSelfManagedSuperFundPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/selfmanagedsuperfund'; $formParams = []; $queryParams = []; @@ -902,6 +1034,7 @@ protected function auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -919,56 +1052,42 @@ protected function auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id ); } - // body params - $_tempBody = null; - if (isset($fund)) { - $_tempBody = $fund; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($fund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fund)); + } else { + $httpBody = $fund; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -989,10 +1108,11 @@ protected function auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1004,17 +1124,18 @@ protected function auEmployeeSelfManagedSuperFundPostRequest($fund, $business_id * Update Employee Self Managed Super Fund * * @param int $id id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund fund (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeSelfManagedSuperFundPut($id, $fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPut($id, $business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPut'][0]) { - $this->auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id, $employee_id); + $this->auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $business_id, $employee_id, $fund, $contentType); } /** @@ -1023,18 +1144,18 @@ public function auEmployeeSelfManagedSuperFundPut($id, $fund, $business_id, $emp * Update Employee Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPut'][0]) { - $returnType = ''; - $request = $this->auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $business_id, $employee_id); + $request = $this->auEmployeeSelfManagedSuperFundPutRequest($id, $business_id, $employee_id, $fund, $contentType); try { $options = $this->createHttpClientOption(); @@ -1043,9 +1164,16 @@ public function auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $fund, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1056,11 +1184,11 @@ public function auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $fund, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1079,16 +1207,17 @@ public function auEmployeeSelfManagedSuperFundPutWithHttpInfo($id, $fund, $busin * Update Employee Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundPutAsync($id, $fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPutAsync($id, $business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPut'][0]) { - return $this->auEmployeeSelfManagedSuperFundPutAsyncWithHttpInfo($id, $fund, $business_id, $employee_id) + return $this->auEmployeeSelfManagedSuperFundPutAsyncWithHttpInfo($id, $business_id, $employee_id, $fund, $contentType) ->then( function ($response) { return $response[0]; @@ -1102,17 +1231,18 @@ function ($response) { * Update Employee Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSelfManagedSuperFundPutAsyncWithHttpInfo($id, $fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPutAsyncWithHttpInfo($id, $business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPut'][0]) { $returnType = ''; - $request = $this->auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $business_id, $employee_id); + $request = $this->auEmployeeSelfManagedSuperFundPutRequest($id, $business_id, $employee_id, $fund, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1131,7 +1261,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1141,33 +1271,31 @@ function ($exception) { * Create request for operation 'auEmployeeSelfManagedSuperFundPut' * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $business_id, $employee_id) + public function auEmployeeSelfManagedSuperFundPutRequest($id, $business_id, $employee_id, $fund, string $contentType = self::contentTypes['auEmployeeSelfManagedSuperFundPut'][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 auEmployeeSelfManagedSuperFundPut' ); } - // verify the required parameter 'fund' is set - if ($fund === null || (is_array($fund) && count($fund) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $fund when calling auEmployeeSelfManagedSuperFundPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSelfManagedSuperFundPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1175,6 +1303,14 @@ protected function auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $busines ); } + // verify the required parameter 'fund' is set + if ($fund === null || (is_array($fund) && count($fund) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $fund when calling auEmployeeSelfManagedSuperFundPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/selfmanagedsuperfund/{id}'; $formParams = []; $queryParams = []; @@ -1183,6 +1319,7 @@ protected function auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $busines $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1208,56 +1345,42 @@ protected function auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $busines ); } - // body params - $_tempBody = null; - if (isset($fund)) { - $_tempBody = $fund; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($fund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fund)); + } else { + $httpBody = $fund; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1278,10 +1401,11 @@ protected function auEmployeeSelfManagedSuperFundPutRequest($id, $fund, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployeeSuperFundApi.php b/src/lib/Api/EmployeeSuperFundApi.php index 0bef7e3..1e700d1 100644 --- a/src/lib/Api/EmployeeSuperFundApi.php +++ b/src/lib/Api/EmployeeSuperFundApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeSuperFundGet' => [ + 'application/json', + ], + 'auEmployeeSuperFundList' => [ + 'application/json', + ], + 'auEmployeeSuperFundPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployeeSuperFundPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +150,15 @@ public function getConfig() * @param int $superfund_id superfund_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SaveSuperFundResponseModel + * @return \OpenAPI\Client\Model\SaveSuperFundResponseModel */ - public function auEmployeeSuperFundDelete($superfund_id, $business_id, $employee_id) + public function auEmployeeSuperFundDelete($superfund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundDelete'][0]) { - list($response) = $this->auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_id, $employee_id); + list($response) = $this->auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_id, $employee_id, $contentType); return $response; } @@ -114,15 +170,15 @@ public function auEmployeeSuperFundDelete($superfund_id, $business_id, $employee * @param int $superfund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_id, $employee_id) + public function auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundDelete'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $employee_id); + $request = $this->auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -131,9 +187,16 @@ public function auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -144,19 +207,37 @@ public function auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SaveSuperFundResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -173,7 +254,7 @@ public function auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SaveSuperFundResponseModel', + '\OpenAPI\Client\Model\SaveSuperFundResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -191,13 +272,14 @@ public function auEmployeeSuperFundDeleteWithHttpInfo($superfund_id, $business_i * @param int $superfund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundDeleteAsync($superfund_id, $business_id, $employee_id) + public function auEmployeeSuperFundDeleteAsync($superfund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundDelete'][0]) { - return $this->auEmployeeSuperFundDeleteAsyncWithHttpInfo($superfund_id, $business_id, $employee_id) + return $this->auEmployeeSuperFundDeleteAsyncWithHttpInfo($superfund_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -213,24 +295,24 @@ function ($response) { * @param int $superfund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundDeleteAsyncWithHttpInfo($superfund_id, $business_id, $employee_id) + public function auEmployeeSuperFundDeleteAsyncWithHttpInfo($superfund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundDelete'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; + $request = $this->auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +335,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -265,24 +347,28 @@ function ($exception) { * @param int $superfund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $employee_id) + public function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundDelete'][0]) { + // verify the required parameter 'superfund_id' is set if ($superfund_id === null || (is_array($superfund_id) && count($superfund_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $superfund_id when calling auEmployeeSuperFundDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSuperFundDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -290,6 +376,7 @@ protected function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superfund/{superfundId}'; $formParams = []; $queryParams = []; @@ -298,6 +385,7 @@ protected function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $multipart = false; + // path params if ($superfund_id !== null) { $resourcePath = str_replace( @@ -323,53 +411,35 @@ protected function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -390,10 +460,11 @@ protected function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -407,14 +478,15 @@ protected function auEmployeeSuperFundDeleteRequest($superfund_id, $business_id, * @param int $super_fund_id super_fund_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperFundModel + * @return \OpenAPI\Client\Model\SuperFundModel */ - public function auEmployeeSuperFundGet($super_fund_id, $business_id, $employee_id) + public function auEmployeeSuperFundGet($super_fund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundGet'][0]) { - list($response) = $this->auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, $employee_id); + list($response) = $this->auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, $employee_id, $contentType); return $response; } @@ -426,15 +498,15 @@ public function auEmployeeSuperFundGet($super_fund_id, $business_id, $employee_i * @param int $super_fund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperFundModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperFundModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, $employee_id) + public function auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel'; - $request = $this->auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $employee_id); + $request = $this->auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -443,9 +515,16 @@ public function auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -456,19 +535,37 @@ public function auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperFundModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperFundModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperFundModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperFundModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -485,7 +582,7 @@ public function auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperFundModel', + '\OpenAPI\Client\Model\SuperFundModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -503,13 +600,14 @@ public function auEmployeeSuperFundGetWithHttpInfo($super_fund_id, $business_id, * @param int $super_fund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundGetAsync($super_fund_id, $business_id, $employee_id) + public function auEmployeeSuperFundGetAsync($super_fund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundGet'][0]) { - return $this->auEmployeeSuperFundGetAsyncWithHttpInfo($super_fund_id, $business_id, $employee_id) + return $this->auEmployeeSuperFundGetAsyncWithHttpInfo($super_fund_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -525,24 +623,24 @@ function ($response) { * @param int $super_fund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundGetAsyncWithHttpInfo($super_fund_id, $business_id, $employee_id) + public function auEmployeeSuperFundGetAsyncWithHttpInfo($super_fund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel'; - $request = $this->auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SuperFundModel'; + $request = $this->auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -565,7 +663,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -577,24 +675,28 @@ function ($exception) { * @param int $super_fund_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $employee_id) + public function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundGet'][0]) { + // verify the required parameter 'super_fund_id' is set if ($super_fund_id === null || (is_array($super_fund_id) && count($super_fund_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $super_fund_id when calling auEmployeeSuperFundGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSuperFundGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -602,6 +704,7 @@ protected function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superfund/{superFundId}'; $formParams = []; $queryParams = []; @@ -610,6 +713,7 @@ protected function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $ $multipart = false; + // path params if ($super_fund_id !== null) { $resourcePath = str_replace( @@ -635,53 +739,35 @@ protected function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -702,10 +788,11 @@ protected function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -718,14 +805,15 @@ protected function auEmployeeSuperFundGetRequest($super_fund_id, $business_id, $ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperFundModel[] + * @return \OpenAPI\Client\Model\SuperFundModel[] */ - public function auEmployeeSuperFundList($business_id, $employee_id) + public function auEmployeeSuperFundList($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundList'][0]) { - list($response) = $this->auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id); + list($response) = $this->auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -736,15 +824,15 @@ public function auEmployeeSuperFundList($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperFundModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperFundModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id) + public function auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundList'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel[]'; - $request = $this->auEmployeeSuperFundListRequest($business_id, $employee_id); + $request = $this->auEmployeeSuperFundListRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -753,9 +841,16 @@ public function auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -766,19 +861,37 @@ public function auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperFundModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperFundModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperFundModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperFundModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -795,7 +908,7 @@ public function auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperFundModel[]', + '\OpenAPI\Client\Model\SuperFundModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -812,13 +925,14 @@ public function auEmployeeSuperFundListWithHttpInfo($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundListAsync($business_id, $employee_id) + public function auEmployeeSuperFundListAsync($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundList'][0]) { - return $this->auEmployeeSuperFundListAsyncWithHttpInfo($business_id, $employee_id) + return $this->auEmployeeSuperFundListAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -833,24 +947,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundListAsyncWithHttpInfo($business_id, $employee_id) + public function auEmployeeSuperFundListAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundList'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel[]'; - $request = $this->auEmployeeSuperFundListRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SuperFundModel[]'; + $request = $this->auEmployeeSuperFundListRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -873,7 +987,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -884,18 +998,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSuperFundListRequest($business_id, $employee_id) + public function auEmployeeSuperFundListRequest($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeSuperFundList'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSuperFundList' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -903,6 +1020,7 @@ protected function auEmployeeSuperFundListRequest($business_id, $employee_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superfund'; $formParams = []; $queryParams = []; @@ -911,6 +1029,7 @@ protected function auEmployeeSuperFundListRequest($business_id, $employee_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -928,53 +1047,35 @@ protected function auEmployeeSuperFundListRequest($business_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -995,10 +1096,11 @@ protected function auEmployeeSuperFundListRequest($business_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1009,17 +1111,18 @@ protected function auEmployeeSuperFundListRequest($business_id, $employee_id) * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SaveSuperFundResponseModel + * @return \OpenAPI\Client\Model\SaveSuperFundResponseModel */ - public function auEmployeeSuperFundPost($model, $business_id, $employee_id) + public function auEmployeeSuperFundPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPost'][0]) { - list($response) = $this->auEmployeeSuperFundPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->auEmployeeSuperFundPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -1028,18 +1131,18 @@ public function auEmployeeSuperFundPost($model, $business_id, $employee_id) * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSuperFundPostWithHttpInfo($model, $business_id, $employee_id) + public function auEmployeeSuperFundPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPost'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEmployeeSuperFundPostRequest($model, $business_id, $employee_id); + $request = $this->auEmployeeSuperFundPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1048,9 +1151,16 @@ public function auEmployeeSuperFundPostWithHttpInfo($model, $business_id, $emplo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1061,19 +1171,37 @@ public function auEmployeeSuperFundPostWithHttpInfo($model, $business_id, $emplo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SaveSuperFundResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1090,7 +1218,7 @@ public function auEmployeeSuperFundPostWithHttpInfo($model, $business_id, $emplo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SaveSuperFundResponseModel', + '\OpenAPI\Client\Model\SaveSuperFundResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1105,16 +1233,17 @@ public function auEmployeeSuperFundPostWithHttpInfo($model, $business_id, $emplo * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundPostAsync($model, $business_id, $employee_id) + public function auEmployeeSuperFundPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPost'][0]) { - return $this->auEmployeeSuperFundPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->auEmployeeSuperFundPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1127,27 +1256,27 @@ function ($response) { * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function auEmployeeSuperFundPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPost'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEmployeeSuperFundPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; + $request = $this->auEmployeeSuperFundPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1170,7 +1299,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1179,27 +1308,24 @@ function ($exception) { /** * Create request for operation 'auEmployeeSuperFundPost' * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSuperFundPostRequest($model, $business_id, $employee_id) + public function auEmployeeSuperFundPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeeSuperFundPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSuperFundPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1207,6 +1333,14 @@ protected function auEmployeeSuperFundPostRequest($model, $business_id, $employe ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeeSuperFundPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superfund'; $formParams = []; $queryParams = []; @@ -1215,6 +1349,7 @@ protected function auEmployeeSuperFundPostRequest($model, $business_id, $employe $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1232,56 +1367,42 @@ protected function auEmployeeSuperFundPostRequest($model, $business_id, $employe ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1302,10 +1423,11 @@ protected function auEmployeeSuperFundPostRequest($model, $business_id, $employe $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1317,17 +1439,18 @@ protected function auEmployeeSuperFundPostRequest($model, $business_id, $employe * Update Super Fund * * @param int $id id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SaveSuperFundResponseModel + * @return \OpenAPI\Client\Model\SaveSuperFundResponseModel */ - public function auEmployeeSuperFundPut($id, $model, $business_id, $employee_id) + public function auEmployeeSuperFundPut($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPut'][0]) { - list($response) = $this->auEmployeeSuperFundPutWithHttpInfo($id, $model, $business_id, $employee_id); + list($response) = $this->auEmployeeSuperFundPutWithHttpInfo($id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -1337,18 +1460,18 @@ public function auEmployeeSuperFundPut($id, $model, $business_id, $employee_id) * Update Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeSuperFundPutWithHttpInfo($id, $model, $business_id, $employee_id) + public function auEmployeeSuperFundPutWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPut'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEmployeeSuperFundPutRequest($id, $model, $business_id, $employee_id); + $request = $this->auEmployeeSuperFundPutRequest($id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1357,9 +1480,16 @@ public function auEmployeeSuperFundPutWithHttpInfo($id, $model, $business_id, $e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1370,19 +1500,37 @@ public function auEmployeeSuperFundPutWithHttpInfo($id, $model, $business_id, $e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SaveSuperFundResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1399,7 +1547,7 @@ public function auEmployeeSuperFundPutWithHttpInfo($id, $model, $business_id, $e case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SaveSuperFundResponseModel', + '\OpenAPI\Client\Model\SaveSuperFundResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1415,16 +1563,17 @@ public function auEmployeeSuperFundPutWithHttpInfo($id, $model, $business_id, $e * Update Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundPutAsync($id, $model, $business_id, $employee_id) + public function auEmployeeSuperFundPutAsync($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPut'][0]) { - return $this->auEmployeeSuperFundPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + return $this->auEmployeeSuperFundPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1438,27 +1587,27 @@ function ($response) { * Update Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeSuperFundPutAsyncWithHttpInfo($id, $model, $business_id, $employee_id) + public function auEmployeeSuperFundPutAsyncWithHttpInfo($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPut'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEmployeeSuperFundPutRequest($id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; + $request = $this->auEmployeeSuperFundPutRequest($id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1481,7 +1630,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1491,33 +1640,31 @@ function ($exception) { * Create request for operation 'auEmployeeSuperFundPut' * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeSuperFundPutRequest($id, $model, $business_id, $employee_id) + public function auEmployeeSuperFundPutRequest($id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auEmployeeSuperFundPut'][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 auEmployeeSuperFundPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmployeeSuperFundPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeSuperFundPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1525,6 +1672,14 @@ protected function auEmployeeSuperFundPutRequest($id, $model, $business_id, $emp ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmployeeSuperFundPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/superfund/{id}'; $formParams = []; $queryParams = []; @@ -1533,6 +1688,7 @@ protected function auEmployeeSuperFundPutRequest($id, $model, $business_id, $emp $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1558,56 +1714,42 @@ protected function auEmployeeSuperFundPutRequest($id, $model, $business_id, $emp ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1628,10 +1770,11 @@ protected function auEmployeeSuperFundPutRequest($id, $model, $business_id, $emp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployerLiabilityCategoriesApi.php b/src/lib/Api/EmployerLiabilityCategoriesApi.php index 65ce7d9..deb7214 100644 --- a/src/lib/Api/EmployerLiabilityCategoriesApi.php +++ b/src/lib/Api/EmployerLiabilityCategoriesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'employerLiabilityCategoryGet' => [ + 'application/json', + ], + 'employerLiabilityCategoryGetEmployerLiabilityCategories' => [ + 'application/json', + ], + 'employerLiabilityCategoryPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employerLiabilityCategoryPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employerLiabilityCategoryDelete($id, $business_id) + public function employerLiabilityCategoryDelete($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryDelete'][0]) { - $this->employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id); + $this->employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function employerLiabilityCategoryDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id) + public function employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryDelete'][0]) { - $returnType = ''; - $request = $this->employerLiabilityCategoryDeleteRequest($id, $business_id); + $request = $this->employerLiabilityCategoryDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function employerLiabilityCategoryDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryDeleteAsync($id, $business_id) + public function employerLiabilityCategoryDeleteAsync($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryDelete'][0]) { - return $this->employerLiabilityCategoryDeleteAsyncWithHttpInfo($id, $business_id) + return $this->employerLiabilityCategoryDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryDeleteAsyncWithHttpInfo($id, $business_id) + public function employerLiabilityCategoryDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryDelete'][0]) { $returnType = ''; - $request = $this->employerLiabilityCategoryDeleteRequest($id, $business_id); + $request = $this->employerLiabilityCategoryDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerLiabilityCategoryDeleteRequest($id, $business_id) + public function employerLiabilityCategoryDeleteRequest($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryDelete'][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 employerLiabilityCategoryDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function employerLiabilityCategoryDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employerliabilitycategory/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function employerLiabilityCategoryDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function employerLiabilityCategoryDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function employerLiabilityCategoryDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function employerLiabilityCategoryDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployerLiabilityCategoryModel + * @return \OpenAPI\Client\Model\EmployerLiabilityCategoryModel */ - public function employerLiabilityCategoryGet($id, $business_id) + public function employerLiabilityCategoryGet($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryGet'][0]) { - list($response) = $this->employerLiabilityCategoryGetWithHttpInfo($id, $business_id); + list($response) = $this->employerLiabilityCategoryGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function employerLiabilityCategoryGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployerLiabilityCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployerLiabilityCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function employerLiabilityCategoryGetWithHttpInfo($id, $business_id) + public function employerLiabilityCategoryGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployerLiabilityCategoryModel'; - $request = $this->employerLiabilityCategoryGetRequest($id, $business_id); + $request = $this->employerLiabilityCategoryGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function employerLiabilityCategoryGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function employerLiabilityCategoryGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployerLiabilityCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployerLiabilityCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function employerLiabilityCategoryGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployerLiabilityCategoryModel', + '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function employerLiabilityCategoryGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryGetAsync($id, $business_id) + public function employerLiabilityCategoryGetAsync($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryGet'][0]) { - return $this->employerLiabilityCategoryGetAsyncWithHttpInfo($id, $business_id) + return $this->employerLiabilityCategoryGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryGetAsyncWithHttpInfo($id, $business_id) + public function employerLiabilityCategoryGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployerLiabilityCategoryModel'; - $request = $this->employerLiabilityCategoryGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel'; + $request = $this->employerLiabilityCategoryGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerLiabilityCategoryGetRequest($id, $business_id) + public function employerLiabilityCategoryGetRequest($id, $business_id, string $contentType = self::contentTypes['employerLiabilityCategoryGet'][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 employerLiabilityCategoryGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function employerLiabilityCategoryGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employerliabilitycategory/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function employerLiabilityCategoryGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function employerLiabilityCategoryGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function employerLiabilityCategoryGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function employerLiabilityCategoryGetRequest($id, $business_id) * List Employer Liability Categories * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployerLiabilityCategoryModel[] + * @return \OpenAPI\Client\Model\EmployerLiabilityCategoryModel[] */ - public function employerLiabilityCategoryGetEmployerLiabilityCategories($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employerLiabilityCategoryGetEmployerLiabilityCategories($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'][0]) { - list($response) = $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function employerLiabilityCategoryGetEmployerLiabilityCategories($busines * List Employer Liability Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployerLiabilityCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployerLiabilityCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'][0]) { - $returnType = '\Swagger\Client\Model\EmployerLiabilityCategoryModel[]'; - $request = $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpI } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpI sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployerLiabilityCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployerLiabilityCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpI case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployerLiabilityCategoryModel[]', + '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function employerLiabilityCategoryGetEmployerLiabilityCategoriesWithHttpI * List Employer Liability Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryGetEmployerLiabilityCategoriesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employerLiabilityCategoryGetEmployerLiabilityCategoriesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'][0]) { - return $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Employer Liability Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryGetEmployerLiabilityCategoriesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employerLiabilityCategoryGetEmployerLiabilityCategoriesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'][0]) { - $returnType = '\Swagger\Client\Model\EmployerLiabilityCategoryModel[]'; - $request = $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\EmployerLiabilityCategoryModel[]'; + $request = $this->employerLiabilityCategoryGetEmployerLiabilityCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'employerLiabilityCategoryGetEmployerLiabilityCategories' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerLiabilityCategoryGetEmployerLiabilityCategoriesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function employerLiabilityCategoryGetEmployerLiabilityCategoriesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['employerLiabilityCategoryGetEmployerLiabilityCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function employerLiabilityCategoryGetEmployerLiabilityCategoriesReques ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employerliabilitycategory'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function employerLiabilityCategoryGetEmployerLiabilityCategoriesReques $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function employerLiabilityCategoryGetEmployerLiabilityCategoriesReques ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function employerLiabilityCategoryGetEmployerLiabilityCategoriesReques $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function employerLiabilityCategoryGetEmployerLiabilityCategoriesReques * * Create Employer Liability Category * - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category employer_liability_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employerLiabilityCategoryPost($employer_liability_category, $business_id) + public function employerLiabilityCategoryPost($business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPost'][0]) { - $this->employerLiabilityCategoryPostWithHttpInfo($employer_liability_category, $business_id); + $this->employerLiabilityCategoryPostWithHttpInfo($business_id, $employer_liability_category, $contentType); } /** @@ -968,17 +1085,17 @@ public function employerLiabilityCategoryPost($employer_liability_category, $bus * * Create Employer Liability Category * - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employerLiabilityCategoryPostWithHttpInfo($employer_liability_category, $business_id) + public function employerLiabilityCategoryPostWithHttpInfo($business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPost'][0]) { - $returnType = ''; - $request = $this->employerLiabilityCategoryPostRequest($employer_liability_category, $business_id); + $request = $this->employerLiabilityCategoryPostRequest($business_id, $employer_liability_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -987,9 +1104,16 @@ public function employerLiabilityCategoryPostWithHttpInfo($employer_liability_ca } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1000,11 +1124,11 @@ public function employerLiabilityCategoryPostWithHttpInfo($employer_liability_ca sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1022,15 +1146,16 @@ public function employerLiabilityCategoryPostWithHttpInfo($employer_liability_ca * * Create Employer Liability Category * - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryPostAsync($employer_liability_category, $business_id) + public function employerLiabilityCategoryPostAsync($business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPost'][0]) { - return $this->employerLiabilityCategoryPostAsyncWithHttpInfo($employer_liability_category, $business_id) + return $this->employerLiabilityCategoryPostAsyncWithHttpInfo($business_id, $employer_liability_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1043,16 +1168,17 @@ function ($response) { * * Create Employer Liability Category * - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryPostAsyncWithHttpInfo($employer_liability_category, $business_id) + public function employerLiabilityCategoryPostAsyncWithHttpInfo($business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPost'][0]) { $returnType = ''; - $request = $this->employerLiabilityCategoryPostRequest($employer_liability_category, $business_id); + $request = $this->employerLiabilityCategoryPostRequest($business_id, $employer_liability_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1071,7 +1197,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1080,20 +1206,16 @@ function ($exception) { /** * Create request for operation 'employerLiabilityCategoryPost' * - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerLiabilityCategoryPostRequest($employer_liability_category, $business_id) + public function employerLiabilityCategoryPostRequest($business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPost'][0]) { - // verify the required parameter 'employer_liability_category' is set - if ($employer_liability_category === null || (is_array($employer_liability_category) && count($employer_liability_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employer_liability_category when calling employerLiabilityCategoryPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1101,6 +1223,14 @@ protected function employerLiabilityCategoryPostRequest($employer_liability_cate ); } + // verify the required parameter 'employer_liability_category' is set + if ($employer_liability_category === null || (is_array($employer_liability_category) && count($employer_liability_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employer_liability_category when calling employerLiabilityCategoryPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employerliabilitycategory'; $formParams = []; $queryParams = []; @@ -1109,6 +1239,7 @@ protected function employerLiabilityCategoryPostRequest($employer_liability_cate $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1118,56 +1249,42 @@ protected function employerLiabilityCategoryPostRequest($employer_liability_cate ); } - // body params - $_tempBody = null; - if (isset($employer_liability_category)) { - $_tempBody = $employer_liability_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employer_liability_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employer_liability_category)); + } else { + $httpBody = $employer_liability_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1188,10 +1305,11 @@ protected function employerLiabilityCategoryPostRequest($employer_liability_cate $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1203,16 +1321,17 @@ protected function employerLiabilityCategoryPostRequest($employer_liability_cate * Update Employer Liability Category * * @param int $id id (required) - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category employer_liability_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function employerLiabilityCategoryPut($id, $employer_liability_category, $business_id) + public function employerLiabilityCategoryPut($id, $business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPut'][0]) { - $this->employerLiabilityCategoryPutWithHttpInfo($id, $employer_liability_category, $business_id); + $this->employerLiabilityCategoryPutWithHttpInfo($id, $business_id, $employer_liability_category, $contentType); } /** @@ -1221,17 +1340,17 @@ public function employerLiabilityCategoryPut($id, $employer_liability_category, * Update Employer Liability Category * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function employerLiabilityCategoryPutWithHttpInfo($id, $employer_liability_category, $business_id) + public function employerLiabilityCategoryPutWithHttpInfo($id, $business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPut'][0]) { - $returnType = ''; - $request = $this->employerLiabilityCategoryPutRequest($id, $employer_liability_category, $business_id); + $request = $this->employerLiabilityCategoryPutRequest($id, $business_id, $employer_liability_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -1240,9 +1359,16 @@ public function employerLiabilityCategoryPutWithHttpInfo($id, $employer_liabilit } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1253,11 +1379,11 @@ public function employerLiabilityCategoryPutWithHttpInfo($id, $employer_liabilit sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1276,15 +1402,16 @@ public function employerLiabilityCategoryPutWithHttpInfo($id, $employer_liabilit * Update Employer Liability Category * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryPutAsync($id, $employer_liability_category, $business_id) + public function employerLiabilityCategoryPutAsync($id, $business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPut'][0]) { - return $this->employerLiabilityCategoryPutAsyncWithHttpInfo($id, $employer_liability_category, $business_id) + return $this->employerLiabilityCategoryPutAsyncWithHttpInfo($id, $business_id, $employer_liability_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1298,16 +1425,17 @@ function ($response) { * Update Employer Liability Category * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employerLiabilityCategoryPutAsyncWithHttpInfo($id, $employer_liability_category, $business_id) + public function employerLiabilityCategoryPutAsyncWithHttpInfo($id, $business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPut'][0]) { $returnType = ''; - $request = $this->employerLiabilityCategoryPutRequest($id, $employer_liability_category, $business_id); + $request = $this->employerLiabilityCategoryPutRequest($id, $business_id, $employer_liability_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1326,7 +1454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1336,26 +1464,23 @@ function ($exception) { * Create request for operation 'employerLiabilityCategoryPut' * * @param int $id (required) - * @param \Swagger\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployerLiabilityCategoryModel $employer_liability_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employerLiabilityCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employerLiabilityCategoryPutRequest($id, $employer_liability_category, $business_id) + public function employerLiabilityCategoryPutRequest($id, $business_id, $employer_liability_category, string $contentType = self::contentTypes['employerLiabilityCategoryPut'][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 employerLiabilityCategoryPut' ); } - // verify the required parameter 'employer_liability_category' is set - if ($employer_liability_category === null || (is_array($employer_liability_category) && count($employer_liability_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employer_liability_category when calling employerLiabilityCategoryPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1363,6 +1488,14 @@ protected function employerLiabilityCategoryPutRequest($id, $employer_liability_ ); } + // verify the required parameter 'employer_liability_category' is set + if ($employer_liability_category === null || (is_array($employer_liability_category) && count($employer_liability_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employer_liability_category when calling employerLiabilityCategoryPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employerliabilitycategory/{id}'; $formParams = []; $queryParams = []; @@ -1371,6 +1504,7 @@ protected function employerLiabilityCategoryPutRequest($id, $employer_liability_ $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1388,56 +1522,42 @@ protected function employerLiabilityCategoryPutRequest($id, $employer_liability_ ); } - // body params - $_tempBody = null; - if (isset($employer_liability_category)) { - $_tempBody = $employer_liability_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employer_liability_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employer_liability_category)); + } else { + $httpBody = $employer_liability_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1458,10 +1578,11 @@ protected function employerLiabilityCategoryPutRequest($id, $employer_liability_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmployingEntitiesApi.php b/src/lib/Api/EmployingEntitiesApi.php index f9d8b7c..1fcc830 100644 --- a/src/lib/Api/EmployingEntitiesApi.php +++ b/src/lib/Api/EmployingEntitiesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployingEntityGet' => [ + 'application/json', + ], + 'auEmployingEntityGetEmployingEntities' => [ + 'application/json', + ], + 'auEmployingEntityPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmployingEntityPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployingEntityDelete($id, $business_id) + public function auEmployingEntityDelete($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityDelete'][0]) { - $this->auEmployingEntityDeleteWithHttpInfo($id, $business_id); + $this->auEmployingEntityDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auEmployingEntityDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployingEntityDeleteWithHttpInfo($id, $business_id) + public function auEmployingEntityDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityDelete'][0]) { - $returnType = ''; - $request = $this->auEmployingEntityDeleteRequest($id, $business_id); + $request = $this->auEmployingEntityDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auEmployingEntityDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auEmployingEntityDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auEmployingEntityDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityDeleteAsync($id, $business_id) + public function auEmployingEntityDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityDelete'][0]) { - return $this->auEmployingEntityDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auEmployingEntityDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityDeleteAsyncWithHttpInfo($id, $business_id) + public function auEmployingEntityDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityDelete'][0]) { $returnType = ''; - $request = $this->auEmployingEntityDeleteRequest($id, $business_id); + $request = $this->auEmployingEntityDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployingEntityDeleteRequest($id, $business_id) + public function auEmployingEntityDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityDelete'][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 auEmployingEntityDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auEmployingEntityDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employingentity/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auEmployingEntityDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auEmployingEntityDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auEmployingEntityDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auEmployingEntityDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployingEntityModel + * @return \OpenAPI\Client\Model\AuEmployingEntityModel */ - public function auEmployingEntityGet($id, $business_id) + public function auEmployingEntityGet($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityGet'][0]) { - list($response) = $this->auEmployingEntityGetWithHttpInfo($id, $business_id); + list($response) = $this->auEmployingEntityGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auEmployingEntityGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployingEntityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployingEntityModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployingEntityGetWithHttpInfo($id, $business_id) + public function auEmployingEntityGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel'; - $request = $this->auEmployingEntityGetRequest($id, $business_id); + $request = $this->auEmployingEntityGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auEmployingEntityGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auEmployingEntityGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployingEntityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployingEntityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployingEntityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auEmployingEntityGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployingEntityModel', + '\OpenAPI\Client\Model\AuEmployingEntityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auEmployingEntityGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityGetAsync($id, $business_id) + public function auEmployingEntityGetAsync($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityGet'][0]) { - return $this->auEmployingEntityGetAsyncWithHttpInfo($id, $business_id) + return $this->auEmployingEntityGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityGetAsyncWithHttpInfo($id, $business_id) + public function auEmployingEntityGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel'; - $request = $this->auEmployingEntityGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel'; + $request = $this->auEmployingEntityGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployingEntityGetRequest($id, $business_id) + public function auEmployingEntityGetRequest($id, $business_id, string $contentType = self::contentTypes['auEmployingEntityGet'][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 auEmployingEntityGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auEmployingEntityGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employingentity/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auEmployingEntityGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auEmployingEntityGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auEmployingEntityGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auEmployingEntityGetRequest($id, $business_id) * List Employing Entities * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGetEmployingEntities'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployingEntityModel[] + * @return \OpenAPI\Client\Model\AuEmployingEntityModel[] */ - public function auEmployingEntityGetEmployingEntities($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployingEntityGetEmployingEntities($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployingEntityGetEmployingEntities'][0]) { - list($response) = $this->auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auEmployingEntityGetEmployingEntities($business_id, $filter = nu * List Employing Entities * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGetEmployingEntities'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployingEntityModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployingEntityModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployingEntityGetEmployingEntities'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel[]'; - $request = $this->auEmployingEntityGetEmployingEntitiesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auEmployingEntityGetEmployingEntitiesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployingEntityModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployingEntityModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployingEntityModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployingEntityModel[]', + '\OpenAPI\Client\Model\AuEmployingEntityModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auEmployingEntityGetEmployingEntitiesWithHttpInfo($business_id, * List Employing Entities * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGetEmployingEntities'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityGetEmployingEntitiesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployingEntityGetEmployingEntitiesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployingEntityGetEmployingEntities'][0]) { - return $this->auEmployingEntityGetEmployingEntitiesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auEmployingEntityGetEmployingEntitiesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Employing Entities * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGetEmployingEntities'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityGetEmployingEntitiesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployingEntityGetEmployingEntitiesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployingEntityGetEmployingEntities'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel[]'; - $request = $this->auEmployingEntityGetEmployingEntitiesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel[]'; + $request = $this->auEmployingEntityGetEmployingEntitiesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auEmployingEntityGetEmployingEntities' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityGetEmployingEntities'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployingEntityGetEmployingEntitiesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmployingEntityGetEmployingEntitiesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmployingEntityGetEmployingEntities'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auEmployingEntityGetEmployingEntitiesRequest($business_id, $f ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employingentity'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auEmployingEntityGetEmployingEntitiesRequest($business_id, $f $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auEmployingEntityGetEmployingEntitiesRequest($business_id, $f ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auEmployingEntityGetEmployingEntitiesRequest($business_id, $f $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auEmployingEntityGetEmployingEntitiesRequest($business_id, $f * * Create Employing Entity * - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity employing_entity (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployingEntityModel + * @return \OpenAPI\Client\Model\AuEmployingEntityModel */ - public function auEmployingEntityPost($employing_entity, $business_id) + public function auEmployingEntityPost($business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPost'][0]) { - list($response) = $this->auEmployingEntityPostWithHttpInfo($employing_entity, $business_id); + list($response) = $this->auEmployingEntityPostWithHttpInfo($business_id, $employing_entity, $contentType); return $response; } @@ -969,17 +1086,17 @@ public function auEmployingEntityPost($employing_entity, $business_id) * * Create Employing Entity * - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployingEntityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployingEntityModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployingEntityPostWithHttpInfo($employing_entity, $business_id) + public function auEmployingEntityPostWithHttpInfo($business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel'; - $request = $this->auEmployingEntityPostRequest($employing_entity, $business_id); + $request = $this->auEmployingEntityPostRequest($business_id, $employing_entity, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1105,16 @@ public function auEmployingEntityPostWithHttpInfo($employing_entity, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1125,37 @@ public function auEmployingEntityPostWithHttpInfo($employing_entity, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployingEntityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployingEntityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployingEntityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1172,7 @@ public function auEmployingEntityPostWithHttpInfo($employing_entity, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployingEntityModel', + '\OpenAPI\Client\Model\AuEmployingEntityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1187,16 @@ public function auEmployingEntityPostWithHttpInfo($employing_entity, $business_i * * Create Employing Entity * - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityPostAsync($employing_entity, $business_id) + public function auEmployingEntityPostAsync($business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPost'][0]) { - return $this->auEmployingEntityPostAsyncWithHttpInfo($employing_entity, $business_id) + return $this->auEmployingEntityPostAsyncWithHttpInfo($business_id, $employing_entity, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1209,26 @@ function ($response) { * * Create Employing Entity * - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityPostAsyncWithHttpInfo($employing_entity, $business_id) + public function auEmployingEntityPostAsyncWithHttpInfo($business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel'; - $request = $this->auEmployingEntityPostRequest($employing_entity, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel'; + $request = $this->auEmployingEntityPostRequest($business_id, $employing_entity, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1260,16 @@ function ($exception) { /** * Create request for operation 'auEmployingEntityPost' * - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployingEntityPostRequest($employing_entity, $business_id) + public function auEmployingEntityPostRequest($business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPost'][0]) { - // verify the required parameter 'employing_entity' is set - if ($employing_entity === null || (is_array($employing_entity) && count($employing_entity) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employing_entity when calling auEmployingEntityPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1277,14 @@ protected function auEmployingEntityPostRequest($employing_entity, $business_id) ); } + // verify the required parameter 'employing_entity' is set + if ($employing_entity === null || (is_array($employing_entity) && count($employing_entity) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employing_entity when calling auEmployingEntityPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employingentity'; $formParams = []; $queryParams = []; @@ -1146,6 +1293,7 @@ protected function auEmployingEntityPostRequest($employing_entity, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1303,42 @@ protected function auEmployingEntityPostRequest($employing_entity, $business_id) ); } - // body params - $_tempBody = null; - if (isset($employing_entity)) { - $_tempBody = $employing_entity; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employing_entity)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employing_entity)); + } else { + $httpBody = $employing_entity; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1359,11 @@ protected function auEmployingEntityPostRequest($employing_entity, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1375,17 @@ protected function auEmployingEntityPostRequest($employing_entity, $business_id) * Update Employing Entity * * @param int $id id (required) - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity employing_entity (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEmployingEntityModel + * @return \OpenAPI\Client\Model\AuEmployingEntityModel */ - public function auEmployingEntityPut($id, $employing_entity, $business_id) + public function auEmployingEntityPut($id, $business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPut'][0]) { - list($response) = $this->auEmployingEntityPutWithHttpInfo($id, $employing_entity, $business_id); + list($response) = $this->auEmployingEntityPutWithHttpInfo($id, $business_id, $employing_entity, $contentType); return $response; } @@ -1259,17 +1395,17 @@ public function auEmployingEntityPut($id, $employing_entity, $business_id) * Update Employing Entity * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEmployingEntityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEmployingEntityModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployingEntityPutWithHttpInfo($id, $employing_entity, $business_id) + public function auEmployingEntityPutWithHttpInfo($id, $business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel'; - $request = $this->auEmployingEntityPutRequest($id, $employing_entity, $business_id); + $request = $this->auEmployingEntityPutRequest($id, $business_id, $employing_entity, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1414,16 @@ public function auEmployingEntityPutWithHttpInfo($id, $employing_entity, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1434,37 @@ public function auEmployingEntityPutWithHttpInfo($id, $employing_entity, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEmployingEntityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEmployingEntityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEmployingEntityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1481,7 @@ public function auEmployingEntityPutWithHttpInfo($id, $employing_entity, $busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEmployingEntityModel', + '\OpenAPI\Client\Model\AuEmployingEntityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1497,16 @@ public function auEmployingEntityPutWithHttpInfo($id, $employing_entity, $busine * Update Employing Entity * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityPutAsync($id, $employing_entity, $business_id) + public function auEmployingEntityPutAsync($id, $business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPut'][0]) { - return $this->auEmployingEntityPutAsyncWithHttpInfo($id, $employing_entity, $business_id) + return $this->auEmployingEntityPutAsyncWithHttpInfo($id, $business_id, $employing_entity, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1520,26 @@ function ($response) { * Update Employing Entity * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployingEntityPutAsyncWithHttpInfo($id, $employing_entity, $business_id) + public function auEmployingEntityPutAsyncWithHttpInfo($id, $business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEmployingEntityModel'; - $request = $this->auEmployingEntityPutRequest($id, $employing_entity, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEmployingEntityModel'; + $request = $this->auEmployingEntityPutRequest($id, $business_id, $employing_entity, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1572,23 @@ function ($exception) { * Create request for operation 'auEmployingEntityPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuEmployingEntityModel $employing_entity (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuEmployingEntityModel $employing_entity (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployingEntityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployingEntityPutRequest($id, $employing_entity, $business_id) + public function auEmployingEntityPutRequest($id, $business_id, $employing_entity, string $contentType = self::contentTypes['auEmployingEntityPut'][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 auEmployingEntityPut' ); } - // verify the required parameter 'employing_entity' is set - if ($employing_entity === null || (is_array($employing_entity) && count($employing_entity) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $employing_entity when calling auEmployingEntityPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1596,14 @@ protected function auEmployingEntityPutRequest($id, $employing_entity, $business ); } + // verify the required parameter 'employing_entity' is set + if ($employing_entity === null || (is_array($employing_entity) && count($employing_entity) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $employing_entity when calling auEmployingEntityPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employingentity/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1612,7 @@ protected function auEmployingEntityPutRequest($id, $employing_entity, $business $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1630,42 @@ protected function auEmployingEntityPutRequest($id, $employing_entity, $business ); } - // body params - $_tempBody = null; - if (isset($employing_entity)) { - $_tempBody = $employing_entity; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($employing_entity)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($employing_entity)); + } else { + $httpBody = $employing_entity; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1686,11 @@ protected function auEmployingEntityPutRequest($id, $employing_entity, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EmploymentAgreementApi.php b/src/lib/Api/EmploymentAgreementApi.php index 1041ee4..5502a2c 100644 --- a/src/lib/Api/EmploymentAgreementApi.php +++ b/src/lib/Api/EmploymentAgreementApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmploymentAgreementEvaluate' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEmploymentAgreementGet' => [ + 'application/json', + ], + 'auEmploymentAgreementGetAll' => [ + 'application/json', + ], + 'auEmploymentAgreementShiftPeriods' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employmentAgreementEmployeeShiftPeriods' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employmentAgreementEvaluateEmployee' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -93,16 +166,17 @@ public function getConfig() * Bulk Evaluate Shift Costings * * @param int $id id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel[] $requests requests (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel[] $requests requests (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementBulkEvaluate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftCostingsResponseModel[] + * @return \OpenAPI\Client\Model\ShiftCostingsResponseModel[] */ - public function auEmploymentAgreementBulkEvaluate($id, $requests, $business_id) + public function auEmploymentAgreementBulkEvaluate($id, $business_id, $requests, string $contentType = self::contentTypes['auEmploymentAgreementBulkEvaluate'][0]) { - list($response) = $this->auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $requests, $business_id); + list($response) = $this->auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $business_id, $requests, $contentType); return $response; } @@ -112,17 +186,17 @@ public function auEmploymentAgreementBulkEvaluate($id, $requests, $business_id) * Bulk Evaluate Shift Costings * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel[] $requests (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel[] $requests (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementBulkEvaluate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftCostingsResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftCostingsResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $requests, $business_id) + public function auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $business_id, $requests, string $contentType = self::contentTypes['auEmploymentAgreementBulkEvaluate'][0]) { - $returnType = '\Swagger\Client\Model\ShiftCostingsResponseModel[]'; - $request = $this->auEmploymentAgreementBulkEvaluateRequest($id, $requests, $business_id); + $request = $this->auEmploymentAgreementBulkEvaluateRequest($id, $business_id, $requests, $contentType); try { $options = $this->createHttpClientOption(); @@ -131,9 +205,16 @@ public function auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $requests, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -144,19 +225,37 @@ public function auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $requests, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftCostingsResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftCostingsResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftCostingsResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftCostingsResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -173,7 +272,7 @@ public function auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $requests, $b case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftCostingsResponseModel[]', + '\OpenAPI\Client\Model\ShiftCostingsResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -189,15 +288,16 @@ public function auEmploymentAgreementBulkEvaluateWithHttpInfo($id, $requests, $b * Bulk Evaluate Shift Costings * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel[] $requests (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel[] $requests (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementBulkEvaluate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementBulkEvaluateAsync($id, $requests, $business_id) + public function auEmploymentAgreementBulkEvaluateAsync($id, $business_id, $requests, string $contentType = self::contentTypes['auEmploymentAgreementBulkEvaluate'][0]) { - return $this->auEmploymentAgreementBulkEvaluateAsyncWithHttpInfo($id, $requests, $business_id) + return $this->auEmploymentAgreementBulkEvaluateAsyncWithHttpInfo($id, $business_id, $requests, $contentType) ->then( function ($response) { return $response[0]; @@ -211,26 +311,26 @@ function ($response) { * Bulk Evaluate Shift Costings * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel[] $requests (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel[] $requests (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementBulkEvaluate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementBulkEvaluateAsyncWithHttpInfo($id, $requests, $business_id) + public function auEmploymentAgreementBulkEvaluateAsyncWithHttpInfo($id, $business_id, $requests, string $contentType = self::contentTypes['auEmploymentAgreementBulkEvaluate'][0]) { - $returnType = '\Swagger\Client\Model\ShiftCostingsResponseModel[]'; - $request = $this->auEmploymentAgreementBulkEvaluateRequest($id, $requests, $business_id); + $returnType = '\OpenAPI\Client\Model\ShiftCostingsResponseModel[]'; + $request = $this->auEmploymentAgreementBulkEvaluateRequest($id, $business_id, $requests, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +353,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -263,26 +363,23 @@ function ($exception) { * Create request for operation 'auEmploymentAgreementBulkEvaluate' * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel[] $requests (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel[] $requests (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementBulkEvaluate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmploymentAgreementBulkEvaluateRequest($id, $requests, $business_id) + public function auEmploymentAgreementBulkEvaluateRequest($id, $business_id, $requests, string $contentType = self::contentTypes['auEmploymentAgreementBulkEvaluate'][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 auEmploymentAgreementBulkEvaluate' ); } - // verify the required parameter 'requests' is set - if ($requests === null || (is_array($requests) && count($requests) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $requests when calling auEmploymentAgreementBulkEvaluate' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -290,6 +387,14 @@ protected function auEmploymentAgreementBulkEvaluateRequest($id, $requests, $bus ); } + // verify the required parameter 'requests' is set + if ($requests === null || (is_array($requests) && count($requests) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $requests when calling auEmploymentAgreementBulkEvaluate' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employmentagreement/{id}/shiftcosting/bulk'; $formParams = []; $queryParams = []; @@ -298,6 +403,7 @@ protected function auEmploymentAgreementBulkEvaluateRequest($id, $requests, $bus $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -315,56 +421,42 @@ protected function auEmploymentAgreementBulkEvaluateRequest($id, $requests, $bus ); } - // body params - $_tempBody = null; - if (isset($requests)) { - $_tempBody = $requests; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($requests)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($requests)); + } else { + $httpBody = $requests; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -385,10 +477,11 @@ protected function auEmploymentAgreementBulkEvaluateRequest($id, $requests, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -400,16 +493,17 @@ protected function auEmploymentAgreementBulkEvaluateRequest($id, $requests, $bus * Evaluate Shift Costings * * @param int $id id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementEvaluate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftCostingsResponseModel + * @return \OpenAPI\Client\Model\ShiftCostingsResponseModel */ - public function auEmploymentAgreementEvaluate($id, $model, $business_id) + public function auEmploymentAgreementEvaluate($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementEvaluate'][0]) { - list($response) = $this->auEmploymentAgreementEvaluateWithHttpInfo($id, $model, $business_id); + list($response) = $this->auEmploymentAgreementEvaluateWithHttpInfo($id, $business_id, $model, $contentType); return $response; } @@ -419,17 +513,17 @@ public function auEmploymentAgreementEvaluate($id, $model, $business_id) * Evaluate Shift Costings * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementEvaluate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftCostingsResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftCostingsResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmploymentAgreementEvaluateWithHttpInfo($id, $model, $business_id) + public function auEmploymentAgreementEvaluateWithHttpInfo($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementEvaluate'][0]) { - $returnType = '\Swagger\Client\Model\ShiftCostingsResponseModel'; - $request = $this->auEmploymentAgreementEvaluateRequest($id, $model, $business_id); + $request = $this->auEmploymentAgreementEvaluateRequest($id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -438,9 +532,16 @@ public function auEmploymentAgreementEvaluateWithHttpInfo($id, $model, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -451,19 +552,37 @@ public function auEmploymentAgreementEvaluateWithHttpInfo($id, $model, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftCostingsResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftCostingsResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftCostingsResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftCostingsResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -480,7 +599,7 @@ public function auEmploymentAgreementEvaluateWithHttpInfo($id, $model, $business case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftCostingsResponseModel', + '\OpenAPI\Client\Model\ShiftCostingsResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -496,15 +615,16 @@ public function auEmploymentAgreementEvaluateWithHttpInfo($id, $model, $business * Evaluate Shift Costings * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementEvaluate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementEvaluateAsync($id, $model, $business_id) + public function auEmploymentAgreementEvaluateAsync($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementEvaluate'][0]) { - return $this->auEmploymentAgreementEvaluateAsyncWithHttpInfo($id, $model, $business_id) + return $this->auEmploymentAgreementEvaluateAsyncWithHttpInfo($id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -518,26 +638,26 @@ function ($response) { * Evaluate Shift Costings * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementEvaluate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementEvaluateAsyncWithHttpInfo($id, $model, $business_id) + public function auEmploymentAgreementEvaluateAsyncWithHttpInfo($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementEvaluate'][0]) { - $returnType = '\Swagger\Client\Model\ShiftCostingsResponseModel'; - $request = $this->auEmploymentAgreementEvaluateRequest($id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\ShiftCostingsResponseModel'; + $request = $this->auEmploymentAgreementEvaluateRequest($id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -560,7 +680,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -570,26 +690,23 @@ function ($exception) { * Create request for operation 'auEmploymentAgreementEvaluate' * * @param int $id (required) - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementEvaluate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmploymentAgreementEvaluateRequest($id, $model, $business_id) + public function auEmploymentAgreementEvaluateRequest($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementEvaluate'][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 auEmploymentAgreementEvaluate' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmploymentAgreementEvaluate' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -597,6 +714,14 @@ protected function auEmploymentAgreementEvaluateRequest($id, $model, $business_i ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmploymentAgreementEvaluate' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employmentagreement/{id}/shiftcosting'; $formParams = []; $queryParams = []; @@ -605,6 +730,7 @@ protected function auEmploymentAgreementEvaluateRequest($id, $model, $business_i $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -622,56 +748,42 @@ protected function auEmploymentAgreementEvaluateRequest($id, $model, $business_i ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -692,10 +804,11 @@ protected function auEmploymentAgreementEvaluateRequest($id, $model, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -708,14 +821,15 @@ protected function auEmploymentAgreementEvaluateRequest($id, $model, $business_i * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmploymentAgreementModel + * @return \OpenAPI\Client\Model\EmploymentAgreementModel */ - public function auEmploymentAgreementGet($id, $business_id) + public function auEmploymentAgreementGet($id, $business_id, string $contentType = self::contentTypes['auEmploymentAgreementGet'][0]) { - list($response) = $this->auEmploymentAgreementGetWithHttpInfo($id, $business_id); + list($response) = $this->auEmploymentAgreementGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -726,15 +840,15 @@ public function auEmploymentAgreementGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmploymentAgreementModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmploymentAgreementModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmploymentAgreementGetWithHttpInfo($id, $business_id) + public function auEmploymentAgreementGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmploymentAgreementGet'][0]) { - $returnType = '\Swagger\Client\Model\EmploymentAgreementModel'; - $request = $this->auEmploymentAgreementGetRequest($id, $business_id); + $request = $this->auEmploymentAgreementGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -743,9 +857,16 @@ public function auEmploymentAgreementGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -756,19 +877,37 @@ public function auEmploymentAgreementGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmploymentAgreementModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmploymentAgreementModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmploymentAgreementModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmploymentAgreementModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -785,7 +924,7 @@ public function auEmploymentAgreementGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmploymentAgreementModel', + '\OpenAPI\Client\Model\EmploymentAgreementModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -802,13 +941,14 @@ public function auEmploymentAgreementGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementGetAsync($id, $business_id) + public function auEmploymentAgreementGetAsync($id, $business_id, string $contentType = self::contentTypes['auEmploymentAgreementGet'][0]) { - return $this->auEmploymentAgreementGetAsyncWithHttpInfo($id, $business_id) + return $this->auEmploymentAgreementGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -823,24 +963,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementGetAsyncWithHttpInfo($id, $business_id) + public function auEmploymentAgreementGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auEmploymentAgreementGet'][0]) { - $returnType = '\Swagger\Client\Model\EmploymentAgreementModel'; - $request = $this->auEmploymentAgreementGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\EmploymentAgreementModel'; + $request = $this->auEmploymentAgreementGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -863,7 +1003,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -874,18 +1014,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmploymentAgreementGetRequest($id, $business_id) + public function auEmploymentAgreementGetRequest($id, $business_id, string $contentType = self::contentTypes['auEmploymentAgreementGet'][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 auEmploymentAgreementGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -893,6 +1036,7 @@ protected function auEmploymentAgreementGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employmentagreement/{id}'; $formParams = []; $queryParams = []; @@ -901,6 +1045,7 @@ protected function auEmploymentAgreementGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -918,53 +1063,35 @@ protected function auEmploymentAgreementGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -985,10 +1112,11 @@ protected function auEmploymentAgreementGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1000,18 +1128,20 @@ protected function auEmploymentAgreementGetRequest($id, $business_id) * List Employment Agreements * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BasicEmploymentAgreementModel[] + * @return \OpenAPI\Client\Model\BasicEmploymentAgreementModel[] */ - public function auEmploymentAgreementGetAll($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmploymentAgreementGetAll($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmploymentAgreementGetAll'][0]) { - list($response) = $this->auEmploymentAgreementGetAllWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEmploymentAgreementGetAllWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -1021,19 +1151,20 @@ public function auEmploymentAgreementGetAll($business_id, $filter = null, $order * List Employment Agreements * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BasicEmploymentAgreementModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BasicEmploymentAgreementModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmploymentAgreementGetAllWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmploymentAgreementGetAllWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmploymentAgreementGetAll'][0]) { - $returnType = '\Swagger\Client\Model\BasicEmploymentAgreementModel[]'; - $request = $this->auEmploymentAgreementGetAllRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auEmploymentAgreementGetAllRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -1042,9 +1173,16 @@ public function auEmploymentAgreementGetAllWithHttpInfo($business_id, $filter = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1055,19 +1193,37 @@ public function auEmploymentAgreementGetAllWithHttpInfo($business_id, $filter = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BasicEmploymentAgreementModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BasicEmploymentAgreementModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BasicEmploymentAgreementModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BasicEmploymentAgreementModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1084,7 +1240,7 @@ public function auEmploymentAgreementGetAllWithHttpInfo($business_id, $filter = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BasicEmploymentAgreementModel[]', + '\OpenAPI\Client\Model\BasicEmploymentAgreementModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1100,17 +1256,19 @@ public function auEmploymentAgreementGetAllWithHttpInfo($business_id, $filter = * List Employment Agreements * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementGetAllAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmploymentAgreementGetAllAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmploymentAgreementGetAll'][0]) { - return $this->auEmploymentAgreementGetAllAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auEmploymentAgreementGetAllAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -1124,28 +1282,29 @@ function ($response) { * List Employment Agreements * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementGetAllAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmploymentAgreementGetAllAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmploymentAgreementGetAll'][0]) { - $returnType = '\Swagger\Client\Model\BasicEmploymentAgreementModel[]'; - $request = $this->auEmploymentAgreementGetAllRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\BasicEmploymentAgreementModel[]'; + $request = $this->auEmploymentAgreementGetAllRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1168,7 +1327,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1178,16 +1337,19 @@ function ($exception) { * Create request for operation 'auEmploymentAgreementGetAll' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmploymentAgreementGetAllRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEmploymentAgreementGetAllRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEmploymentAgreementGetAll'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1195,6 +1357,12 @@ protected function auEmploymentAgreementGetAllRequest($business_id, $filter = nu ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employmentagreement'; $formParams = []; $queryParams = []; @@ -1203,20 +1371,45 @@ protected function auEmploymentAgreementGetAllRequest($business_id, $filter = nu $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -1228,53 +1421,35 @@ protected function auEmploymentAgreementGetAllRequest($business_id, $filter = nu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1295,10 +1470,11 @@ protected function auEmploymentAgreementGetAllRequest($business_id, $filter = nu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1310,16 +1486,17 @@ protected function auEmploymentAgreementGetAllRequest($business_id, $filter = nu * Get Shift Periods * * @param int $id id (required) - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementShiftPeriods'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftPeriodModel[] + * @return \OpenAPI\Client\Model\ShiftPeriodModel[] */ - public function auEmploymentAgreementShiftPeriods($id, $model, $business_id) + public function auEmploymentAgreementShiftPeriods($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementShiftPeriods'][0]) { - list($response) = $this->auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $model, $business_id); + list($response) = $this->auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $business_id, $model, $contentType); return $response; } @@ -1329,17 +1506,17 @@ public function auEmploymentAgreementShiftPeriods($id, $model, $business_id) * Get Shift Periods * * @param int $id (required) - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementShiftPeriods'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftPeriodModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftPeriodModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $model, $business_id) + public function auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementShiftPeriods'][0]) { - $returnType = '\Swagger\Client\Model\ShiftPeriodModel[]'; - $request = $this->auEmploymentAgreementShiftPeriodsRequest($id, $model, $business_id); + $request = $this->auEmploymentAgreementShiftPeriodsRequest($id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1348,9 +1525,16 @@ public function auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $model, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1361,19 +1545,37 @@ public function auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $model, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftPeriodModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftPeriodModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftPeriodModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftPeriodModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1390,7 +1592,7 @@ public function auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $model, $busi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftPeriodModel[]', + '\OpenAPI\Client\Model\ShiftPeriodModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1406,15 +1608,16 @@ public function auEmploymentAgreementShiftPeriodsWithHttpInfo($id, $model, $busi * Get Shift Periods * * @param int $id (required) - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementShiftPeriods'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementShiftPeriodsAsync($id, $model, $business_id) + public function auEmploymentAgreementShiftPeriodsAsync($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementShiftPeriods'][0]) { - return $this->auEmploymentAgreementShiftPeriodsAsyncWithHttpInfo($id, $model, $business_id) + return $this->auEmploymentAgreementShiftPeriodsAsyncWithHttpInfo($id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1428,26 +1631,26 @@ function ($response) { * Get Shift Periods * * @param int $id (required) - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementShiftPeriods'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmploymentAgreementShiftPeriodsAsyncWithHttpInfo($id, $model, $business_id) + public function auEmploymentAgreementShiftPeriodsAsyncWithHttpInfo($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementShiftPeriods'][0]) { - $returnType = '\Swagger\Client\Model\ShiftPeriodModel[]'; - $request = $this->auEmploymentAgreementShiftPeriodsRequest($id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\ShiftPeriodModel[]'; + $request = $this->auEmploymentAgreementShiftPeriodsRequest($id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1470,7 +1673,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1480,26 +1683,23 @@ function ($exception) { * Create request for operation 'auEmploymentAgreementShiftPeriods' * * @param int $id (required) - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmploymentAgreementShiftPeriods'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmploymentAgreementShiftPeriodsRequest($id, $model, $business_id) + public function auEmploymentAgreementShiftPeriodsRequest($id, $business_id, $model, string $contentType = self::contentTypes['auEmploymentAgreementShiftPeriods'][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 auEmploymentAgreementShiftPeriods' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEmploymentAgreementShiftPeriods' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1507,6 +1707,14 @@ protected function auEmploymentAgreementShiftPeriodsRequest($id, $model, $busine ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEmploymentAgreementShiftPeriods' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employmentagreement/{id}/shiftperiods'; $formParams = []; $queryParams = []; @@ -1515,6 +1723,7 @@ protected function auEmploymentAgreementShiftPeriodsRequest($id, $model, $busine $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1532,56 +1741,42 @@ protected function auEmploymentAgreementShiftPeriodsRequest($id, $model, $busine ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1602,10 +1797,11 @@ protected function auEmploymentAgreementShiftPeriodsRequest($id, $model, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1616,17 +1812,18 @@ protected function auEmploymentAgreementShiftPeriodsRequest($id, $model, $busine * * Get Shift Periods for Employee * - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEmployeeShiftPeriods'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftPeriodModel[] + * @return \OpenAPI\Client\Model\ShiftPeriodModel[] */ - public function employmentAgreementEmployeeShiftPeriods($model, $business_id, $employee_id) + public function employmentAgreementEmployeeShiftPeriods($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEmployeeShiftPeriods'][0]) { - list($response) = $this->employmentAgreementEmployeeShiftPeriodsWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employmentAgreementEmployeeShiftPeriodsWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -1635,18 +1832,18 @@ public function employmentAgreementEmployeeShiftPeriods($model, $business_id, $e * * Get Shift Periods for Employee * - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEmployeeShiftPeriods'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftPeriodModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftPeriodModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employmentAgreementEmployeeShiftPeriodsWithHttpInfo($model, $business_id, $employee_id) + public function employmentAgreementEmployeeShiftPeriodsWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEmployeeShiftPeriods'][0]) { - $returnType = '\Swagger\Client\Model\ShiftPeriodModel[]'; - $request = $this->employmentAgreementEmployeeShiftPeriodsRequest($model, $business_id, $employee_id); + $request = $this->employmentAgreementEmployeeShiftPeriodsRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1655,9 +1852,16 @@ public function employmentAgreementEmployeeShiftPeriodsWithHttpInfo($model, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1668,19 +1872,37 @@ public function employmentAgreementEmployeeShiftPeriodsWithHttpInfo($model, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftPeriodModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftPeriodModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftPeriodModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftPeriodModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1697,7 +1919,7 @@ public function employmentAgreementEmployeeShiftPeriodsWithHttpInfo($model, $bus case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftPeriodModel[]', + '\OpenAPI\Client\Model\ShiftPeriodModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1712,16 +1934,17 @@ public function employmentAgreementEmployeeShiftPeriodsWithHttpInfo($model, $bus * * Get Shift Periods for Employee * - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEmployeeShiftPeriods'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employmentAgreementEmployeeShiftPeriodsAsync($model, $business_id, $employee_id) + public function employmentAgreementEmployeeShiftPeriodsAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEmployeeShiftPeriods'][0]) { - return $this->employmentAgreementEmployeeShiftPeriodsAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employmentAgreementEmployeeShiftPeriodsAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1734,27 +1957,27 @@ function ($response) { * * Get Shift Periods for Employee * - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEmployeeShiftPeriods'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employmentAgreementEmployeeShiftPeriodsAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employmentAgreementEmployeeShiftPeriodsAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEmployeeShiftPeriods'][0]) { - $returnType = '\Swagger\Client\Model\ShiftPeriodModel[]'; - $request = $this->employmentAgreementEmployeeShiftPeriodsRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ShiftPeriodModel[]'; + $request = $this->employmentAgreementEmployeeShiftPeriodsRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1777,7 +2000,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1786,27 +2009,24 @@ function ($exception) { /** * Create request for operation 'employmentAgreementEmployeeShiftPeriods' * - * @param \Swagger\Client\Model\GetShiftPeriodsModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\GetShiftPeriodsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEmployeeShiftPeriods'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employmentAgreementEmployeeShiftPeriodsRequest($model, $business_id, $employee_id) + public function employmentAgreementEmployeeShiftPeriodsRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEmployeeShiftPeriods'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employmentAgreementEmployeeShiftPeriods' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employmentAgreementEmployeeShiftPeriods' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1814,6 +2034,14 @@ protected function employmentAgreementEmployeeShiftPeriodsRequest($model, $busin ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employmentAgreementEmployeeShiftPeriods' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/timesheet/shiftperiods'; $formParams = []; $queryParams = []; @@ -1822,6 +2050,7 @@ protected function employmentAgreementEmployeeShiftPeriodsRequest($model, $busin $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1839,56 +2068,42 @@ protected function employmentAgreementEmployeeShiftPeriodsRequest($model, $busin ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1909,10 +2124,11 @@ protected function employmentAgreementEmployeeShiftPeriodsRequest($model, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1923,17 +2139,18 @@ protected function employmentAgreementEmployeeShiftPeriodsRequest($model, $busin * * Get Shift Costings for Employee * - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEvaluateEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftCostingsResponseModel + * @return \OpenAPI\Client\Model\ShiftCostingsResponseModel */ - public function employmentAgreementEvaluateEmployee($model, $business_id, $employee_id) + public function employmentAgreementEvaluateEmployee($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEvaluateEmployee'][0]) { - list($response) = $this->employmentAgreementEvaluateEmployeeWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->employmentAgreementEvaluateEmployeeWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -1942,18 +2159,18 @@ public function employmentAgreementEvaluateEmployee($model, $business_id, $emplo * * Get Shift Costings for Employee * - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEvaluateEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftCostingsResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftCostingsResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function employmentAgreementEvaluateEmployeeWithHttpInfo($model, $business_id, $employee_id) + public function employmentAgreementEvaluateEmployeeWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEvaluateEmployee'][0]) { - $returnType = '\Swagger\Client\Model\ShiftCostingsResponseModel'; - $request = $this->employmentAgreementEvaluateEmployeeRequest($model, $business_id, $employee_id); + $request = $this->employmentAgreementEvaluateEmployeeRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1962,9 +2179,16 @@ public function employmentAgreementEvaluateEmployeeWithHttpInfo($model, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1975,19 +2199,37 @@ public function employmentAgreementEvaluateEmployeeWithHttpInfo($model, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftCostingsResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftCostingsResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftCostingsResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftCostingsResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2004,7 +2246,7 @@ public function employmentAgreementEvaluateEmployeeWithHttpInfo($model, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftCostingsResponseModel', + '\OpenAPI\Client\Model\ShiftCostingsResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2019,16 +2261,17 @@ public function employmentAgreementEvaluateEmployeeWithHttpInfo($model, $busines * * Get Shift Costings for Employee * - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEvaluateEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employmentAgreementEvaluateEmployeeAsync($model, $business_id, $employee_id) + public function employmentAgreementEvaluateEmployeeAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEvaluateEmployee'][0]) { - return $this->employmentAgreementEvaluateEmployeeAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->employmentAgreementEvaluateEmployeeAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2041,27 +2284,27 @@ function ($response) { * * Get Shift Costings for Employee * - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEvaluateEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employmentAgreementEvaluateEmployeeAsyncWithHttpInfo($model, $business_id, $employee_id) + public function employmentAgreementEvaluateEmployeeAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEvaluateEmployee'][0]) { - $returnType = '\Swagger\Client\Model\ShiftCostingsResponseModel'; - $request = $this->employmentAgreementEvaluateEmployeeRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ShiftCostingsResponseModel'; + $request = $this->employmentAgreementEvaluateEmployeeRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2084,7 +2327,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2093,27 +2336,24 @@ function ($exception) { /** * Create request for operation 'employmentAgreementEvaluateEmployee' * - * @param \Swagger\Client\Model\ShiftCostingsRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ShiftCostingsRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employmentAgreementEvaluateEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employmentAgreementEvaluateEmployeeRequest($model, $business_id, $employee_id) + public function employmentAgreementEvaluateEmployeeRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['employmentAgreementEvaluateEmployee'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling employmentAgreementEvaluateEmployee' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling employmentAgreementEvaluateEmployee' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2121,6 +2361,14 @@ protected function employmentAgreementEvaluateEmployeeRequest($model, $business_ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling employmentAgreementEvaluateEmployee' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/timesheet/shiftcosting'; $formParams = []; $queryParams = []; @@ -2129,6 +2377,7 @@ protected function employmentAgreementEvaluateEmployeeRequest($model, $business_ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2146,56 +2395,42 @@ protected function employmentAgreementEvaluateEmployeeRequest($model, $business_ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2216,10 +2451,11 @@ protected function employmentAgreementEvaluateEmployeeRequest($model, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/EssApi.php b/src/lib/Api/EssApi.php index d50f304..ad24f1f 100644 --- a/src/lib/Api/EssApi.php +++ b/src/lib/Api/EssApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEssBankAccountGet' => [ + 'application/json', + ], + 'auEssBankAccountList' => [ + 'application/json', + ], + 'auEssBankAccountPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssBankAccountPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssDocumentAcknowledgeDocument' => [ + 'application/json', + ], + 'auEssDocumentDownloadDocument' => [ + 'application/json', + ], + 'auEssDocumentGetDocumentById' => [ + 'application/json', + ], + 'auEssDocumentGetPayslip' => [ + 'application/json', + ], + 'auEssDocumentListDocuments' => [ + 'application/json', + ], + 'auEssDocumentListPayslips' => [ + 'application/json', + ], + 'auEssDocumentPaymentSummaries' => [ + 'application/json', + ], + 'auEssDocumentPaymentSummary' => [ + 'application/json', + ], + 'auEssEmployeeFeatures' => [ + 'application/json', + ], + 'auEssEmployeeGetDashboard' => [ + 'application/json', + ], + 'auEssEmployeeGetDetails' => [ + 'application/json', + ], + 'auEssEmployeeGetEmergencyContacts' => [ + 'application/json', + ], + 'auEssEmployeeGetEssDetails' => [ + 'application/json', + ], + 'auEssEmployeeGetPublicHolidays' => [ + 'application/json', + ], + 'auEssEmployeeGetSatisfactionSurveys' => [ + 'application/json', + ], + 'auEssEmployeeSaveDetails' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssEmployeeSaveEmergencyContacts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssEmployeeSaveSatisfaction' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssEmployeeUpdateDetails' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssEmployeeUpdateEmergencyContacts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssLookupAddresses' => [ + 'application/json', + ], + 'auEssLookupLocation' => [ + 'application/json', + ], + 'auEssLookupShiftCondition' => [ + 'application/json', + ], + 'auEssLookupSuburb' => [ + 'application/json', + ], + 'auEssLookupSuburbs' => [ + 'application/json', + ], + 'auEssLookupTitle' => [ + 'application/json', + ], + 'auEssLookupWorkType' => [ + 'application/json', + ], + 'auEssSelfManagedSuperFundGet' => [ + 'application/json', + ], + 'auEssSelfManagedSuperFundGetFunds' => [ + 'application/json', + ], + 'auEssSelfManagedSuperFundPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssSelfManagedSuperFundPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftAcceptRosterShift' => [ + 'application/json', + ], + 'auEssShiftAcceptRosterShiftSwap' => [ + 'application/json', + ], + 'auEssShiftAcceptRosterShiftSwaps' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftAcceptRosterShifts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftCancelRosterShiftSwap' => [ + 'application/json', + ], + 'auEssShiftCancelRosterShiftSwaps' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftDeclineRosterShift' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftDeclineRosterShiftSwap' => [ + 'application/json', + ], + 'auEssShiftDeclineRosterShiftSwaps' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftDeclineRosterShifts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssShiftEmployeesEligibleForShiftSwap' => [ + 'application/json', + ], + 'auEssShiftGetShift' => [ + 'application/json', + ], + 'auEssShiftGetShifts' => [ + 'application/json', + ], + 'auEssShiftMatchingClockOffRosterShift' => [ + 'application/json', + ], + 'auEssShiftMatchingClockOnRosterShift' => [ + 'application/json', + ], + 'auEssShiftNearbyRosterShifts' => [ + 'application/json', + ], + 'auEssShiftProposeRosterShiftSwap' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssSuperFundDelete' => [ + 'application/json', + ], + 'auEssSuperFundGet' => [ + 'application/json', + ], + 'auEssSuperFundList' => [ + 'application/json', + ], + 'auEssSuperFundPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssSuperFundProductSearch' => [ + 'application/json', + ], + 'auEssSuperFundPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceAddShiftNote' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceClockOffEmployee' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceClockOn' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceDiscardCurrentShift' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceEndShiftBreak' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceGetLookupData' => [ + 'application/json', + ], + 'auEssTimeAndAttendanceGetShiftNotes' => [ + 'application/json', + ], + 'auEssTimeAndAttendanceGetShifts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceMarkShiftNotesRead' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimeAndAttendanceStartShiftBreak' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimesheetData' => [ + 'application/json', + ], + 'auEssTimesheetDelete' => [ + 'application/json', + ], + 'auEssTimesheetEdit' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auEssTimesheetList' => [ + 'application/json', + ], + 'auEssTimesheetSave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essDeviceTokenRegister' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essDeviceTokenUnregister' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essExpenseCancelExpenseRequest' => [ + 'application/json', + ], + 'essExpenseCreateExpenseRequest' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essExpenseExpenseCategories' => [ + 'application/json', + ], + 'essExpenseGetExpenseRequest' => [ + 'application/json', + ], + 'essExpenseGetExpenseRequests' => [ + 'application/json', + ], + 'essExpenseSummary' => [ + 'application/json', + ], + 'essExpenseTaxCodes' => [ + 'application/json', + ], + 'essExpenseUpdateExpenseRequest' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essExpenseUploadAttachment' => [ + 'application/json', + ], + 'essLeaveApplyForLeave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essLeaveBalances' => [ + 'application/json', + ], + 'essLeaveCancel' => [ + 'application/json', + ], + 'essLeaveDeleteAttachment' => [ + 'application/json', + ], + 'essLeaveEditLeave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essLeaveEstimate' => [ + 'application/json', + ], + 'essLeaveLeaveCategories' => [ + 'application/json', + ], + 'essLeaveLeaveRequest' => [ + 'application/json', + ], + 'essLeaveLeaveRequests' => [ + 'application/json', + ], + 'essLeaveUpload' => [ + 'application/json', + ], + 'essProfileImageDelete' => [ + 'application/json', + ], + 'essProfileImageGetImage' => [ + 'application/json', + ], + 'essProfileImagePost' => [ + 'application/json', + ], + 'essQualificationDelete' => [ + 'application/json', + ], + 'essQualificationDeleteAttachment' => [ + 'application/json', + ], + 'essQualificationGet' => [ + 'application/json', + ], + 'essQualificationGetQualifications' => [ + 'application/json', + ], + 'essQualificationPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essQualificationPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essQualificationUploadAttachment' => [ + 'application/json', + ], + 'essSecurityEmployees' => [ + 'application/json', + ], + 'essSecurityForgottenPassword' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essUnavailabilityCreate' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'essUnavailabilityDelete' => [ + 'application/json', + ], + 'essUnavailabilityGet' => [ + 'application/json', + ], + 'essUnavailabilityList' => [ + 'application/json', + ], + 'essUnavailabilitySave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +618,15 @@ public function getConfig() * * @param int $bank_account_id bank_account_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssSaveBankAccountResponseModel + * @return \OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel */ - public function auEssBankAccountDelete($bank_account_id, $employee_id) + public function auEssBankAccountDelete($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountDelete'][0]) { - list($response) = $this->auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_id); + list($response) = $this->auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_id, $contentType); return $response; } @@ -112,15 +637,15 @@ public function auEssBankAccountDelete($bank_account_id, $employee_id) * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_id) + public function auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountDelete'][0]) { - $returnType = '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel'; - $request = $this->auEssBankAccountDeleteRequest($bank_account_id, $employee_id); + $request = $this->auEssBankAccountDeleteRequest($bank_account_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,9 +654,16 @@ public function auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -142,19 +674,37 @@ public function auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -171,7 +721,7 @@ public function auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel', + '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -188,13 +738,14 @@ public function auEssBankAccountDeleteWithHttpInfo($bank_account_id, $employee_i * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountDeleteAsync($bank_account_id, $employee_id) + public function auEssBankAccountDeleteAsync($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountDelete'][0]) { - return $this->auEssBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $employee_id) + return $this->auEssBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -209,24 +760,24 @@ function ($response) { * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $employee_id) + public function auEssBankAccountDeleteAsyncWithHttpInfo($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountDelete'][0]) { - $returnType = '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel'; - $request = $this->auEssBankAccountDeleteRequest($bank_account_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel'; + $request = $this->auEssBankAccountDeleteRequest($bank_account_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -249,7 +800,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -260,18 +811,21 @@ function ($exception) { * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssBankAccountDeleteRequest($bank_account_id, $employee_id) + public function auEssBankAccountDeleteRequest($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountDelete'][0]) { + // verify the required parameter 'bank_account_id' is set if ($bank_account_id === null || (is_array($bank_account_id) && count($bank_account_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $bank_account_id when calling auEssBankAccountDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -279,6 +833,7 @@ protected function auEssBankAccountDeleteRequest($bank_account_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/bankaccounts/{bankAccountId}'; $formParams = []; $queryParams = []; @@ -287,6 +842,7 @@ protected function auEssBankAccountDeleteRequest($bank_account_id, $employee_id) $multipart = false; + // path params if ($bank_account_id !== null) { $resourcePath = str_replace( @@ -304,53 +860,35 @@ protected function auEssBankAccountDeleteRequest($bank_account_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -371,10 +909,11 @@ protected function auEssBankAccountDeleteRequest($bank_account_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -387,14 +926,15 @@ protected function auEssBankAccountDeleteRequest($bank_account_id, $employee_id) * * @param int $bank_account_id bank_account_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssBankAccountModel + * @return \OpenAPI\Client\Model\AuEssBankAccountModel */ - public function auEssBankAccountGet($bank_account_id, $employee_id) + public function auEssBankAccountGet($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountGet'][0]) { - list($response) = $this->auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id); + list($response) = $this->auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id, $contentType); return $response; } @@ -405,15 +945,15 @@ public function auEssBankAccountGet($bank_account_id, $employee_id) * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssBankAccountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssBankAccountModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id) + public function auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBankAccountModel'; - $request = $this->auEssBankAccountGetRequest($bank_account_id, $employee_id); + $request = $this->auEssBankAccountGetRequest($bank_account_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -422,9 +962,16 @@ public function auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -435,19 +982,37 @@ public function auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssBankAccountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssBankAccountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssBankAccountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssBankAccountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -464,7 +1029,7 @@ public function auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssBankAccountModel', + '\OpenAPI\Client\Model\AuEssBankAccountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -481,13 +1046,14 @@ public function auEssBankAccountGetWithHttpInfo($bank_account_id, $employee_id) * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountGetAsync($bank_account_id, $employee_id) + public function auEssBankAccountGetAsync($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountGet'][0]) { - return $this->auEssBankAccountGetAsyncWithHttpInfo($bank_account_id, $employee_id) + return $this->auEssBankAccountGetAsyncWithHttpInfo($bank_account_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -502,24 +1068,24 @@ function ($response) { * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountGetAsyncWithHttpInfo($bank_account_id, $employee_id) + public function auEssBankAccountGetAsyncWithHttpInfo($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountGet'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBankAccountModel'; - $request = $this->auEssBankAccountGetRequest($bank_account_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssBankAccountModel'; + $request = $this->auEssBankAccountGetRequest($bank_account_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -542,7 +1108,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -553,18 +1119,21 @@ function ($exception) { * * @param int $bank_account_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssBankAccountGetRequest($bank_account_id, $employee_id) + public function auEssBankAccountGetRequest($bank_account_id, $employee_id, string $contentType = self::contentTypes['auEssBankAccountGet'][0]) { + // verify the required parameter 'bank_account_id' is set if ($bank_account_id === null || (is_array($bank_account_id) && count($bank_account_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $bank_account_id when calling auEssBankAccountGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -572,6 +1141,7 @@ protected function auEssBankAccountGetRequest($bank_account_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/bankaccounts/{bankAccountId}'; $formParams = []; $queryParams = []; @@ -580,6 +1150,7 @@ protected function auEssBankAccountGetRequest($bank_account_id, $employee_id) $multipart = false; + // path params if ($bank_account_id !== null) { $resourcePath = str_replace( @@ -597,53 +1168,35 @@ protected function auEssBankAccountGetRequest($bank_account_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -664,10 +1217,11 @@ protected function auEssBankAccountGetRequest($bank_account_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -679,14 +1233,15 @@ protected function auEssBankAccountGetRequest($bank_account_id, $employee_id) * List Bank Accounts * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssBankAccountModel[] + * @return \OpenAPI\Client\Model\AuEssBankAccountModel[] */ - public function auEssBankAccountList($employee_id) + public function auEssBankAccountList($employee_id, string $contentType = self::contentTypes['auEssBankAccountList'][0]) { - list($response) = $this->auEssBankAccountListWithHttpInfo($employee_id); + list($response) = $this->auEssBankAccountListWithHttpInfo($employee_id, $contentType); return $response; } @@ -696,15 +1251,15 @@ public function auEssBankAccountList($employee_id) * List Bank Accounts * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssBankAccountModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssBankAccountModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssBankAccountListWithHttpInfo($employee_id) + public function auEssBankAccountListWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssBankAccountList'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBankAccountModel[]'; - $request = $this->auEssBankAccountListRequest($employee_id); + $request = $this->auEssBankAccountListRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -713,9 +1268,16 @@ public function auEssBankAccountListWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -726,19 +1288,37 @@ public function auEssBankAccountListWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssBankAccountModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssBankAccountModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssBankAccountModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssBankAccountModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -755,7 +1335,7 @@ public function auEssBankAccountListWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssBankAccountModel[]', + '\OpenAPI\Client\Model\AuEssBankAccountModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -771,13 +1351,14 @@ public function auEssBankAccountListWithHttpInfo($employee_id) * List Bank Accounts * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountListAsync($employee_id) + public function auEssBankAccountListAsync($employee_id, string $contentType = self::contentTypes['auEssBankAccountList'][0]) { - return $this->auEssBankAccountListAsyncWithHttpInfo($employee_id) + return $this->auEssBankAccountListAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -791,24 +1372,24 @@ function ($response) { * List Bank Accounts * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountListAsyncWithHttpInfo($employee_id) + public function auEssBankAccountListAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssBankAccountList'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBankAccountModel[]'; - $request = $this->auEssBankAccountListRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssBankAccountModel[]'; + $request = $this->auEssBankAccountListRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -831,7 +1412,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -841,12 +1422,14 @@ function ($exception) { * Create request for operation 'auEssBankAccountList' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssBankAccountListRequest($employee_id) + public function auEssBankAccountListRequest($employee_id, string $contentType = self::contentTypes['auEssBankAccountList'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -854,6 +1437,7 @@ protected function auEssBankAccountListRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/bankaccounts'; $formParams = []; $queryParams = []; @@ -862,6 +1446,7 @@ protected function auEssBankAccountListRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -871,53 +1456,35 @@ protected function auEssBankAccountListRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -938,10 +1505,11 @@ protected function auEssBankAccountListRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -952,16 +1520,17 @@ protected function auEssBankAccountListRequest($employee_id) * * Create Bank Account * - * @param \Swagger\Client\Model\AuEssBankAccountModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssSaveBankAccountResponseModel + * @return \OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel */ - public function auEssBankAccountPost($model, $employee_id) + public function auEssBankAccountPost($employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPost'][0]) { - list($response) = $this->auEssBankAccountPostWithHttpInfo($model, $employee_id); + list($response) = $this->auEssBankAccountPostWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -970,17 +1539,17 @@ public function auEssBankAccountPost($model, $employee_id) * * Create Bank Account * - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssBankAccountPostWithHttpInfo($model, $employee_id) + public function auEssBankAccountPostWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel'; - $request = $this->auEssBankAccountPostRequest($model, $employee_id); + $request = $this->auEssBankAccountPostRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -989,9 +1558,16 @@ public function auEssBankAccountPostWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1002,19 +1578,37 @@ public function auEssBankAccountPostWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1031,7 +1625,7 @@ public function auEssBankAccountPostWithHttpInfo($model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel', + '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1046,15 +1640,16 @@ public function auEssBankAccountPostWithHttpInfo($model, $employee_id) * * Create Bank Account * - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountPostAsync($model, $employee_id) + public function auEssBankAccountPostAsync($employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPost'][0]) { - return $this->auEssBankAccountPostAsyncWithHttpInfo($model, $employee_id) + return $this->auEssBankAccountPostAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1067,26 +1662,26 @@ function ($response) { * * Create Bank Account * - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountPostAsyncWithHttpInfo($model, $employee_id) + public function auEssBankAccountPostAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPost'][0]) { - $returnType = '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel'; - $request = $this->auEssBankAccountPostRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel'; + $request = $this->auEssBankAccountPostRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1109,7 +1704,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1118,20 +1713,16 @@ function ($exception) { /** * Create request for operation 'auEssBankAccountPost' * - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssBankAccountPostRequest($model, $employee_id) + public function auEssBankAccountPostRequest($employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssBankAccountPost' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1139,6 +1730,14 @@ protected function auEssBankAccountPostRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssBankAccountPost' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/bankaccounts'; $formParams = []; $queryParams = []; @@ -1147,6 +1746,7 @@ protected function auEssBankAccountPostRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1156,56 +1756,42 @@ protected function auEssBankAccountPostRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1226,10 +1812,11 @@ protected function auEssBankAccountPostRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1241,16 +1828,17 @@ protected function auEssBankAccountPostRequest($model, $employee_id) * Update Bank Account * * @param int $id id (required) - * @param \Swagger\Client\Model\AuEssBankAccountModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssSaveBankAccountResponseModel + * @return \OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel */ - public function auEssBankAccountPut($id, $model, $employee_id) + public function auEssBankAccountPut($id, $employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPut'][0]) { - list($response) = $this->auEssBankAccountPutWithHttpInfo($id, $model, $employee_id); + list($response) = $this->auEssBankAccountPutWithHttpInfo($id, $employee_id, $model, $contentType); return $response; } @@ -1260,17 +1848,17 @@ public function auEssBankAccountPut($id, $model, $employee_id) * Update Bank Account * * @param int $id (required) - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssBankAccountPutWithHttpInfo($id, $model, $employee_id) + public function auEssBankAccountPutWithHttpInfo($id, $employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel'; - $request = $this->auEssBankAccountPutRequest($id, $model, $employee_id); + $request = $this->auEssBankAccountPutRequest($id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1279,9 +1867,16 @@ public function auEssBankAccountPutWithHttpInfo($id, $model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1292,19 +1887,37 @@ public function auEssBankAccountPutWithHttpInfo($id, $model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1321,7 +1934,7 @@ public function auEssBankAccountPutWithHttpInfo($id, $model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel', + '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1337,15 +1950,16 @@ public function auEssBankAccountPutWithHttpInfo($id, $model, $employee_id) * Update Bank Account * * @param int $id (required) - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountPutAsync($id, $model, $employee_id) + public function auEssBankAccountPutAsync($id, $employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPut'][0]) { - return $this->auEssBankAccountPutAsyncWithHttpInfo($id, $model, $employee_id) + return $this->auEssBankAccountPutAsyncWithHttpInfo($id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1359,26 +1973,26 @@ function ($response) { * Update Bank Account * * @param int $id (required) - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssBankAccountPutAsyncWithHttpInfo($id, $model, $employee_id) + public function auEssBankAccountPutAsyncWithHttpInfo($id, $employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPut'][0]) { - $returnType = '\Swagger\Client\Model\AuEssSaveBankAccountResponseModel'; - $request = $this->auEssBankAccountPutRequest($id, $model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssSaveBankAccountResponseModel'; + $request = $this->auEssBankAccountPutRequest($id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1401,7 +2015,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1411,26 +2025,23 @@ function ($exception) { * Create request for operation 'auEssBankAccountPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuEssBankAccountModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssBankAccountModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssBankAccountPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssBankAccountPutRequest($id, $model, $employee_id) + public function auEssBankAccountPutRequest($id, $employee_id, $model, string $contentType = self::contentTypes['auEssBankAccountPut'][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 auEssBankAccountPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssBankAccountPut' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1438,6 +2049,14 @@ protected function auEssBankAccountPutRequest($id, $model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssBankAccountPut' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/bankaccounts/{id}'; $formParams = []; $queryParams = []; @@ -1446,6 +2065,7 @@ protected function auEssBankAccountPutRequest($id, $model, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1463,56 +2083,42 @@ protected function auEssBankAccountPutRequest($id, $model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1533,10 +2139,11 @@ protected function auEssBankAccountPutRequest($id, $model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1549,14 +2156,15 @@ protected function auEssBankAccountPutRequest($id, $model, $employee_id) * * @param string $document_id document_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentAcknowledgeDocument'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssDocumentModel + * @return \OpenAPI\Client\Model\EssDocumentModel */ - public function auEssDocumentAcknowledgeDocument($document_id, $employee_id) + public function auEssDocumentAcknowledgeDocument($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentAcknowledgeDocument'][0]) { - list($response) = $this->auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $employee_id); + list($response) = $this->auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $employee_id, $contentType); return $response; } @@ -1567,15 +2175,15 @@ public function auEssDocumentAcknowledgeDocument($document_id, $employee_id) * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentAcknowledgeDocument'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssDocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssDocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $employee_id) + public function auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentAcknowledgeDocument'][0]) { - $returnType = '\Swagger\Client\Model\EssDocumentModel'; - $request = $this->auEssDocumentAcknowledgeDocumentRequest($document_id, $employee_id); + $request = $this->auEssDocumentAcknowledgeDocumentRequest($document_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1584,9 +2192,16 @@ public function auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1597,19 +2212,37 @@ public function auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssDocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssDocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssDocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssDocumentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1626,7 +2259,7 @@ public function auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssDocumentModel', + '\OpenAPI\Client\Model\EssDocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1643,13 +2276,14 @@ public function auEssDocumentAcknowledgeDocumentWithHttpInfo($document_id, $empl * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentAcknowledgeDocument'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentAcknowledgeDocumentAsync($document_id, $employee_id) + public function auEssDocumentAcknowledgeDocumentAsync($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentAcknowledgeDocument'][0]) { - return $this->auEssDocumentAcknowledgeDocumentAsyncWithHttpInfo($document_id, $employee_id) + return $this->auEssDocumentAcknowledgeDocumentAsyncWithHttpInfo($document_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1664,24 +2298,24 @@ function ($response) { * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentAcknowledgeDocument'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentAcknowledgeDocumentAsyncWithHttpInfo($document_id, $employee_id) + public function auEssDocumentAcknowledgeDocumentAsyncWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentAcknowledgeDocument'][0]) { - $returnType = '\Swagger\Client\Model\EssDocumentModel'; - $request = $this->auEssDocumentAcknowledgeDocumentRequest($document_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssDocumentModel'; + $request = $this->auEssDocumentAcknowledgeDocumentRequest($document_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1704,7 +2338,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1715,18 +2349,21 @@ function ($exception) { * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentAcknowledgeDocument'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentAcknowledgeDocumentRequest($document_id, $employee_id) + public function auEssDocumentAcknowledgeDocumentRequest($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentAcknowledgeDocument'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling auEssDocumentAcknowledgeDocument' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1734,6 +2371,7 @@ protected function auEssDocumentAcknowledgeDocumentRequest($document_id, $employ ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/acknowledge/{documentId}'; $formParams = []; $queryParams = []; @@ -1742,6 +2380,7 @@ protected function auEssDocumentAcknowledgeDocumentRequest($document_id, $employ $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -1759,53 +2398,35 @@ protected function auEssDocumentAcknowledgeDocumentRequest($document_id, $employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1826,10 +2447,11 @@ protected function auEssDocumentAcknowledgeDocumentRequest($document_id, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1842,14 +2464,15 @@ protected function auEssDocumentAcknowledgeDocumentRequest($document_id, $employ * * @param string $document_id document_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentDownloadDocument'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function auEssDocumentDownloadDocument($document_id, $employee_id) + public function auEssDocumentDownloadDocument($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentDownloadDocument'][0]) { - list($response) = $this->auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employee_id); + list($response) = $this->auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employee_id, $contentType); return $response; } @@ -1860,15 +2483,15 @@ public function auEssDocumentDownloadDocument($document_id, $employee_id) * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentDownloadDocument'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employee_id) + public function auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentDownloadDocument'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auEssDocumentDownloadDocumentRequest($document_id, $employee_id); + $request = $this->auEssDocumentDownloadDocumentRequest($document_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1877,9 +2500,16 @@ public function auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1890,19 +2520,37 @@ public function auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1919,7 +2567,7 @@ public function auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1936,13 +2584,14 @@ public function auEssDocumentDownloadDocumentWithHttpInfo($document_id, $employe * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentDownloadDocument'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentDownloadDocumentAsync($document_id, $employee_id) + public function auEssDocumentDownloadDocumentAsync($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentDownloadDocument'][0]) { - return $this->auEssDocumentDownloadDocumentAsyncWithHttpInfo($document_id, $employee_id) + return $this->auEssDocumentDownloadDocumentAsyncWithHttpInfo($document_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1957,24 +2606,24 @@ function ($response) { * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentDownloadDocument'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentDownloadDocumentAsyncWithHttpInfo($document_id, $employee_id) + public function auEssDocumentDownloadDocumentAsyncWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentDownloadDocument'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auEssDocumentDownloadDocumentRequest($document_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->auEssDocumentDownloadDocumentRequest($document_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1997,7 +2646,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2008,18 +2657,21 @@ function ($exception) { * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentDownloadDocument'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentDownloadDocumentRequest($document_id, $employee_id) + public function auEssDocumentDownloadDocumentRequest($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentDownloadDocument'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling auEssDocumentDownloadDocument' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2027,6 +2679,7 @@ protected function auEssDocumentDownloadDocumentRequest($document_id, $employee_ ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/download/{documentId}'; $formParams = []; $queryParams = []; @@ -2035,6 +2688,7 @@ protected function auEssDocumentDownloadDocumentRequest($document_id, $employee_ $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -2052,53 +2706,35 @@ protected function auEssDocumentDownloadDocumentRequest($document_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2119,10 +2755,11 @@ protected function auEssDocumentDownloadDocumentRequest($document_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2135,14 +2772,15 @@ protected function auEssDocumentDownloadDocumentRequest($document_id, $employee_ * * @param string $document_id document_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetDocumentById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssDocumentModel + * @return \OpenAPI\Client\Model\EssDocumentModel */ - public function auEssDocumentGetDocumentById($document_id, $employee_id) + public function auEssDocumentGetDocumentById($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetDocumentById'][0]) { - list($response) = $this->auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee_id); + list($response) = $this->auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee_id, $contentType); return $response; } @@ -2153,15 +2791,15 @@ public function auEssDocumentGetDocumentById($document_id, $employee_id) * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetDocumentById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssDocumentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssDocumentModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee_id) + public function auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetDocumentById'][0]) { - $returnType = '\Swagger\Client\Model\EssDocumentModel'; - $request = $this->auEssDocumentGetDocumentByIdRequest($document_id, $employee_id); + $request = $this->auEssDocumentGetDocumentByIdRequest($document_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2170,9 +2808,16 @@ public function auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2183,19 +2828,37 @@ public function auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssDocumentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssDocumentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssDocumentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssDocumentModel'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2212,7 +2875,7 @@ public function auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssDocumentModel', + '\OpenAPI\Client\Model\EssDocumentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2229,13 +2892,14 @@ public function auEssDocumentGetDocumentByIdWithHttpInfo($document_id, $employee * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentGetDocumentByIdAsync($document_id, $employee_id) + public function auEssDocumentGetDocumentByIdAsync($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetDocumentById'][0]) { - return $this->auEssDocumentGetDocumentByIdAsyncWithHttpInfo($document_id, $employee_id) + return $this->auEssDocumentGetDocumentByIdAsyncWithHttpInfo($document_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2250,24 +2914,24 @@ function ($response) { * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentGetDocumentByIdAsyncWithHttpInfo($document_id, $employee_id) + public function auEssDocumentGetDocumentByIdAsyncWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetDocumentById'][0]) { - $returnType = '\Swagger\Client\Model\EssDocumentModel'; - $request = $this->auEssDocumentGetDocumentByIdRequest($document_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssDocumentModel'; + $request = $this->auEssDocumentGetDocumentByIdRequest($document_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2290,7 +2954,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2301,18 +2965,21 @@ function ($exception) { * * @param string $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetDocumentById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentGetDocumentByIdRequest($document_id, $employee_id) + public function auEssDocumentGetDocumentByIdRequest($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetDocumentById'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling auEssDocumentGetDocumentById' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2320,6 +2987,7 @@ protected function auEssDocumentGetDocumentByIdRequest($document_id, $employee_i ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/{documentId}'; $formParams = []; $queryParams = []; @@ -2328,6 +2996,7 @@ protected function auEssDocumentGetDocumentByIdRequest($document_id, $employee_i $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -2345,53 +3014,35 @@ protected function auEssDocumentGetDocumentByIdRequest($document_id, $employee_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2412,10 +3063,11 @@ protected function auEssDocumentGetDocumentByIdRequest($document_id, $employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2428,14 +3080,15 @@ protected function auEssDocumentGetDocumentByIdRequest($document_id, $employee_i * * @param int $payrun_id payrun_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetPayslip'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function auEssDocumentGetPayslip($payrun_id, $employee_id) + public function auEssDocumentGetPayslip($payrun_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetPayslip'][0]) { - list($response) = $this->auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id); + list($response) = $this->auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id, $contentType); return $response; } @@ -2446,15 +3099,15 @@ public function auEssDocumentGetPayslip($payrun_id, $employee_id) * * @param int $payrun_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetPayslip'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id) + public function auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetPayslip'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auEssDocumentGetPayslipRequest($payrun_id, $employee_id); + $request = $this->auEssDocumentGetPayslipRequest($payrun_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2463,9 +3116,16 @@ public function auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2476,19 +3136,37 @@ public function auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2505,7 +3183,7 @@ public function auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2522,13 +3200,14 @@ public function auEssDocumentGetPayslipWithHttpInfo($payrun_id, $employee_id) * * @param int $payrun_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetPayslip'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentGetPayslipAsync($payrun_id, $employee_id) + public function auEssDocumentGetPayslipAsync($payrun_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetPayslip'][0]) { - return $this->auEssDocumentGetPayslipAsyncWithHttpInfo($payrun_id, $employee_id) + return $this->auEssDocumentGetPayslipAsyncWithHttpInfo($payrun_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2543,24 +3222,24 @@ function ($response) { * * @param int $payrun_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetPayslip'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentGetPayslipAsyncWithHttpInfo($payrun_id, $employee_id) + public function auEssDocumentGetPayslipAsyncWithHttpInfo($payrun_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetPayslip'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auEssDocumentGetPayslipRequest($payrun_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->auEssDocumentGetPayslipRequest($payrun_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2583,7 +3262,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2594,18 +3273,21 @@ function ($exception) { * * @param int $payrun_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentGetPayslip'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentGetPayslipRequest($payrun_id, $employee_id) + public function auEssDocumentGetPayslipRequest($payrun_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentGetPayslip'][0]) { + // verify the required parameter 'payrun_id' is set if ($payrun_id === null || (is_array($payrun_id) && count($payrun_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $payrun_id when calling auEssDocumentGetPayslip' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2613,6 +3295,7 @@ protected function auEssDocumentGetPayslipRequest($payrun_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/payslip/{payrunId}'; $formParams = []; $queryParams = []; @@ -2621,6 +3304,7 @@ protected function auEssDocumentGetPayslipRequest($payrun_id, $employee_id) $multipart = false; + // path params if ($payrun_id !== null) { $resourcePath = str_replace( @@ -2638,53 +3322,35 @@ protected function auEssDocumentGetPayslipRequest($payrun_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2705,10 +3371,11 @@ protected function auEssDocumentGetPayslipRequest($payrun_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2720,14 +3387,15 @@ protected function auEssDocumentGetPayslipRequest($payrun_id, $employee_id) * List all Documents * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListDocuments'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssDocumentModel[] + * @return \OpenAPI\Client\Model\EssDocumentModel[] */ - public function auEssDocumentListDocuments($employee_id) + public function auEssDocumentListDocuments($employee_id, string $contentType = self::contentTypes['auEssDocumentListDocuments'][0]) { - list($response) = $this->auEssDocumentListDocumentsWithHttpInfo($employee_id); + list($response) = $this->auEssDocumentListDocumentsWithHttpInfo($employee_id, $contentType); return $response; } @@ -2737,15 +3405,15 @@ public function auEssDocumentListDocuments($employee_id) * List all Documents * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListDocuments'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssDocumentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssDocumentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentListDocumentsWithHttpInfo($employee_id) + public function auEssDocumentListDocumentsWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssDocumentListDocuments'][0]) { - $returnType = '\Swagger\Client\Model\EssDocumentModel[]'; - $request = $this->auEssDocumentListDocumentsRequest($employee_id); + $request = $this->auEssDocumentListDocumentsRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2754,9 +3422,16 @@ public function auEssDocumentListDocumentsWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2767,19 +3442,37 @@ public function auEssDocumentListDocumentsWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssDocumentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssDocumentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssDocumentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssDocumentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2796,7 +3489,7 @@ public function auEssDocumentListDocumentsWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssDocumentModel[]', + '\OpenAPI\Client\Model\EssDocumentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2812,13 +3505,14 @@ public function auEssDocumentListDocumentsWithHttpInfo($employee_id) * List all Documents * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListDocuments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentListDocumentsAsync($employee_id) + public function auEssDocumentListDocumentsAsync($employee_id, string $contentType = self::contentTypes['auEssDocumentListDocuments'][0]) { - return $this->auEssDocumentListDocumentsAsyncWithHttpInfo($employee_id) + return $this->auEssDocumentListDocumentsAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2832,24 +3526,24 @@ function ($response) { * List all Documents * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListDocuments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentListDocumentsAsyncWithHttpInfo($employee_id) + public function auEssDocumentListDocumentsAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssDocumentListDocuments'][0]) { - $returnType = '\Swagger\Client\Model\EssDocumentModel[]'; - $request = $this->auEssDocumentListDocumentsRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EssDocumentModel[]'; + $request = $this->auEssDocumentListDocumentsRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2872,7 +3566,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2882,12 +3576,14 @@ function ($exception) { * Create request for operation 'auEssDocumentListDocuments' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListDocuments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentListDocumentsRequest($employee_id) + public function auEssDocumentListDocumentsRequest($employee_id, string $contentType = self::contentTypes['auEssDocumentListDocuments'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2895,6 +3591,7 @@ protected function auEssDocumentListDocumentsRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/document'; $formParams = []; $queryParams = []; @@ -2903,6 +3600,7 @@ protected function auEssDocumentListDocumentsRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -2912,53 +3610,35 @@ protected function auEssDocumentListDocumentsRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2979,10 +3659,11 @@ protected function auEssDocumentListDocumentsRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2994,14 +3675,15 @@ protected function auEssDocumentListDocumentsRequest($employee_id) * List Pay Slips * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListPayslips'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssPayslipModel[] + * @return \OpenAPI\Client\Model\EssPayslipModel[] */ - public function auEssDocumentListPayslips($employee_id) + public function auEssDocumentListPayslips($employee_id, string $contentType = self::contentTypes['auEssDocumentListPayslips'][0]) { - list($response) = $this->auEssDocumentListPayslipsWithHttpInfo($employee_id); + list($response) = $this->auEssDocumentListPayslipsWithHttpInfo($employee_id, $contentType); return $response; } @@ -3011,15 +3693,15 @@ public function auEssDocumentListPayslips($employee_id) * List Pay Slips * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListPayslips'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssPayslipModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssPayslipModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentListPayslipsWithHttpInfo($employee_id) + public function auEssDocumentListPayslipsWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssDocumentListPayslips'][0]) { - $returnType = '\Swagger\Client\Model\EssPayslipModel[]'; - $request = $this->auEssDocumentListPayslipsRequest($employee_id); + $request = $this->auEssDocumentListPayslipsRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3028,9 +3710,16 @@ public function auEssDocumentListPayslipsWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3041,19 +3730,37 @@ public function auEssDocumentListPayslipsWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssPayslipModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssPayslipModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssPayslipModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssPayslipModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3070,7 +3777,7 @@ public function auEssDocumentListPayslipsWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssPayslipModel[]', + '\OpenAPI\Client\Model\EssPayslipModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3086,13 +3793,14 @@ public function auEssDocumentListPayslipsWithHttpInfo($employee_id) * List Pay Slips * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListPayslips'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentListPayslipsAsync($employee_id) + public function auEssDocumentListPayslipsAsync($employee_id, string $contentType = self::contentTypes['auEssDocumentListPayslips'][0]) { - return $this->auEssDocumentListPayslipsAsyncWithHttpInfo($employee_id) + return $this->auEssDocumentListPayslipsAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3106,24 +3814,24 @@ function ($response) { * List Pay Slips * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListPayslips'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentListPayslipsAsyncWithHttpInfo($employee_id) + public function auEssDocumentListPayslipsAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssDocumentListPayslips'][0]) { - $returnType = '\Swagger\Client\Model\EssPayslipModel[]'; - $request = $this->auEssDocumentListPayslipsRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EssPayslipModel[]'; + $request = $this->auEssDocumentListPayslipsRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3146,7 +3854,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3156,12 +3864,14 @@ function ($exception) { * Create request for operation 'auEssDocumentListPayslips' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentListPayslips'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentListPayslipsRequest($employee_id) + public function auEssDocumentListPayslipsRequest($employee_id, string $contentType = self::contentTypes['auEssDocumentListPayslips'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3169,6 +3879,7 @@ protected function auEssDocumentListPayslipsRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/payslip'; $formParams = []; $queryParams = []; @@ -3177,6 +3888,7 @@ protected function auEssDocumentListPayslipsRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -3186,53 +3898,35 @@ protected function auEssDocumentListPayslipsRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3253,10 +3947,11 @@ protected function auEssDocumentListPayslipsRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3268,14 +3963,15 @@ protected function auEssDocumentListPayslipsRequest($employee_id) * Get Payment Summaries * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummaries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssPaymentSummaryModel[] + * @return \OpenAPI\Client\Model\EssPaymentSummaryModel[] */ - public function auEssDocumentPaymentSummaries($employee_id) + public function auEssDocumentPaymentSummaries($employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummaries'][0]) { - list($response) = $this->auEssDocumentPaymentSummariesWithHttpInfo($employee_id); + list($response) = $this->auEssDocumentPaymentSummariesWithHttpInfo($employee_id, $contentType); return $response; } @@ -3285,15 +3981,15 @@ public function auEssDocumentPaymentSummaries($employee_id) * Get Payment Summaries * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummaries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssPaymentSummaryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssPaymentSummaryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentPaymentSummariesWithHttpInfo($employee_id) + public function auEssDocumentPaymentSummariesWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummaries'][0]) { - $returnType = '\Swagger\Client\Model\EssPaymentSummaryModel[]'; - $request = $this->auEssDocumentPaymentSummariesRequest($employee_id); + $request = $this->auEssDocumentPaymentSummariesRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3302,9 +3998,16 @@ public function auEssDocumentPaymentSummariesWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3315,19 +4018,37 @@ public function auEssDocumentPaymentSummariesWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssPaymentSummaryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssPaymentSummaryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssPaymentSummaryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssPaymentSummaryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3344,7 +4065,7 @@ public function auEssDocumentPaymentSummariesWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssPaymentSummaryModel[]', + '\OpenAPI\Client\Model\EssPaymentSummaryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3360,13 +4081,14 @@ public function auEssDocumentPaymentSummariesWithHttpInfo($employee_id) * Get Payment Summaries * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummaries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentPaymentSummariesAsync($employee_id) + public function auEssDocumentPaymentSummariesAsync($employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummaries'][0]) { - return $this->auEssDocumentPaymentSummariesAsyncWithHttpInfo($employee_id) + return $this->auEssDocumentPaymentSummariesAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3380,24 +4102,24 @@ function ($response) { * Get Payment Summaries * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummaries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentPaymentSummariesAsyncWithHttpInfo($employee_id) + public function auEssDocumentPaymentSummariesAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummaries'][0]) { - $returnType = '\Swagger\Client\Model\EssPaymentSummaryModel[]'; - $request = $this->auEssDocumentPaymentSummariesRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EssPaymentSummaryModel[]'; + $request = $this->auEssDocumentPaymentSummariesRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3420,7 +4142,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3430,12 +4152,14 @@ function ($exception) { * Create request for operation 'auEssDocumentPaymentSummaries' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummaries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentPaymentSummariesRequest($employee_id) + public function auEssDocumentPaymentSummariesRequest($employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummaries'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3443,6 +4167,7 @@ protected function auEssDocumentPaymentSummariesRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/paymentsummaries'; $formParams = []; $queryParams = []; @@ -3451,6 +4176,7 @@ protected function auEssDocumentPaymentSummariesRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -3460,53 +4186,35 @@ protected function auEssDocumentPaymentSummariesRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3527,10 +4235,11 @@ protected function auEssDocumentPaymentSummariesRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3543,14 +4252,15 @@ protected function auEssDocumentPaymentSummariesRequest($employee_id) * * @param int $document_id document_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummary'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function auEssDocumentPaymentSummary($document_id, $employee_id) + public function auEssDocumentPaymentSummary($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummary'][0]) { - list($response) = $this->auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_id); + list($response) = $this->auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_id, $contentType); return $response; } @@ -3561,15 +4271,15 @@ public function auEssDocumentPaymentSummary($document_id, $employee_id) * * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummary'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_id) + public function auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummary'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auEssDocumentPaymentSummaryRequest($document_id, $employee_id); + $request = $this->auEssDocumentPaymentSummaryRequest($document_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3578,9 +4288,16 @@ public function auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3591,19 +4308,37 @@ public function auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3620,7 +4355,7 @@ public function auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3637,13 +4372,14 @@ public function auEssDocumentPaymentSummaryWithHttpInfo($document_id, $employee_ * * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentPaymentSummaryAsync($document_id, $employee_id) + public function auEssDocumentPaymentSummaryAsync($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummary'][0]) { - return $this->auEssDocumentPaymentSummaryAsyncWithHttpInfo($document_id, $employee_id) + return $this->auEssDocumentPaymentSummaryAsyncWithHttpInfo($document_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3658,24 +4394,24 @@ function ($response) { * * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssDocumentPaymentSummaryAsyncWithHttpInfo($document_id, $employee_id) + public function auEssDocumentPaymentSummaryAsyncWithHttpInfo($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummary'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auEssDocumentPaymentSummaryRequest($document_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->auEssDocumentPaymentSummaryRequest($document_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3698,7 +4434,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3709,18 +4445,21 @@ function ($exception) { * * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssDocumentPaymentSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssDocumentPaymentSummaryRequest($document_id, $employee_id) + public function auEssDocumentPaymentSummaryRequest($document_id, $employee_id, string $contentType = self::contentTypes['auEssDocumentPaymentSummary'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling auEssDocumentPaymentSummary' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3728,6 +4467,7 @@ protected function auEssDocumentPaymentSummaryRequest($document_id, $employee_id ); } + $resourcePath = '/api/v2/ess/{employeeId}/document/paymentsummary/{documentId}'; $formParams = []; $queryParams = []; @@ -3736,6 +4476,7 @@ protected function auEssDocumentPaymentSummaryRequest($document_id, $employee_id $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -3753,53 +4494,35 @@ protected function auEssDocumentPaymentSummaryRequest($document_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3820,10 +4543,11 @@ protected function auEssDocumentPaymentSummaryRequest($document_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3835,14 +4559,15 @@ protected function auEssDocumentPaymentSummaryRequest($document_id, $employee_id * Get Enabled Features * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeFeatures'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuFeaturesModel + * @return \OpenAPI\Client\Model\AuFeaturesModel */ - public function auEssEmployeeFeatures($employee_id) + public function auEssEmployeeFeatures($employee_id, string $contentType = self::contentTypes['auEssEmployeeFeatures'][0]) { - list($response) = $this->auEssEmployeeFeaturesWithHttpInfo($employee_id); + list($response) = $this->auEssEmployeeFeaturesWithHttpInfo($employee_id, $contentType); return $response; } @@ -3852,15 +4577,15 @@ public function auEssEmployeeFeatures($employee_id) * Get Enabled Features * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeFeatures'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuFeaturesModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuFeaturesModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeFeaturesWithHttpInfo($employee_id) + public function auEssEmployeeFeaturesWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeFeatures'][0]) { - $returnType = '\Swagger\Client\Model\AuFeaturesModel'; - $request = $this->auEssEmployeeFeaturesRequest($employee_id); + $request = $this->auEssEmployeeFeaturesRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3869,9 +4594,16 @@ public function auEssEmployeeFeaturesWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3882,19 +4614,37 @@ public function auEssEmployeeFeaturesWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuFeaturesModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuFeaturesModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuFeaturesModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuFeaturesModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3911,7 +4661,7 @@ public function auEssEmployeeFeaturesWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuFeaturesModel', + '\OpenAPI\Client\Model\AuFeaturesModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3927,13 +4677,14 @@ public function auEssEmployeeFeaturesWithHttpInfo($employee_id) * Get Enabled Features * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeFeatures'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeFeaturesAsync($employee_id) + public function auEssEmployeeFeaturesAsync($employee_id, string $contentType = self::contentTypes['auEssEmployeeFeatures'][0]) { - return $this->auEssEmployeeFeaturesAsyncWithHttpInfo($employee_id) + return $this->auEssEmployeeFeaturesAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3947,24 +4698,24 @@ function ($response) { * Get Enabled Features * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeFeatures'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeFeaturesAsyncWithHttpInfo($employee_id) + public function auEssEmployeeFeaturesAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeFeatures'][0]) { - $returnType = '\Swagger\Client\Model\AuFeaturesModel'; - $request = $this->auEssEmployeeFeaturesRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuFeaturesModel'; + $request = $this->auEssEmployeeFeaturesRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3987,7 +4738,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3997,12 +4748,14 @@ function ($exception) { * Create request for operation 'auEssEmployeeFeatures' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeFeatures'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeFeaturesRequest($employee_id) + public function auEssEmployeeFeaturesRequest($employee_id, string $contentType = self::contentTypes['auEssEmployeeFeatures'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4010,6 +4763,7 @@ protected function auEssEmployeeFeaturesRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/security/features'; $formParams = []; $queryParams = []; @@ -4018,6 +4772,7 @@ protected function auEssEmployeeFeaturesRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4027,53 +4782,35 @@ protected function auEssEmployeeFeaturesRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4094,10 +4831,11 @@ protected function auEssEmployeeFeaturesRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4109,14 +4847,15 @@ protected function auEssEmployeeFeaturesRequest($employee_id) * Get Dashboard * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDashboard'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDashboardModel + * @return \OpenAPI\Client\Model\AuDashboardModel */ - public function auEssEmployeeGetDashboard($employee_id) + public function auEssEmployeeGetDashboard($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDashboard'][0]) { - list($response) = $this->auEssEmployeeGetDashboardWithHttpInfo($employee_id); + list($response) = $this->auEssEmployeeGetDashboardWithHttpInfo($employee_id, $contentType); return $response; } @@ -4126,15 +4865,15 @@ public function auEssEmployeeGetDashboard($employee_id) * Get Dashboard * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDashboard'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDashboardModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDashboardModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeGetDashboardWithHttpInfo($employee_id) + public function auEssEmployeeGetDashboardWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDashboard'][0]) { - $returnType = '\Swagger\Client\Model\AuDashboardModel'; - $request = $this->auEssEmployeeGetDashboardRequest($employee_id); + $request = $this->auEssEmployeeGetDashboardRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4143,9 +4882,16 @@ public function auEssEmployeeGetDashboardWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4156,19 +4902,37 @@ public function auEssEmployeeGetDashboardWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDashboardModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDashboardModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDashboardModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDashboardModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4185,7 +4949,7 @@ public function auEssEmployeeGetDashboardWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDashboardModel', + '\OpenAPI\Client\Model\AuDashboardModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4201,13 +4965,14 @@ public function auEssEmployeeGetDashboardWithHttpInfo($employee_id) * Get Dashboard * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDashboard'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetDashboardAsync($employee_id) + public function auEssEmployeeGetDashboardAsync($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDashboard'][0]) { - return $this->auEssEmployeeGetDashboardAsyncWithHttpInfo($employee_id) + return $this->auEssEmployeeGetDashboardAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4221,24 +4986,24 @@ function ($response) { * Get Dashboard * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDashboard'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetDashboardAsyncWithHttpInfo($employee_id) + public function auEssEmployeeGetDashboardAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDashboard'][0]) { - $returnType = '\Swagger\Client\Model\AuDashboardModel'; - $request = $this->auEssEmployeeGetDashboardRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuDashboardModel'; + $request = $this->auEssEmployeeGetDashboardRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4261,7 +5026,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4271,12 +5036,14 @@ function ($exception) { * Create request for operation 'auEssEmployeeGetDashboard' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDashboard'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeGetDashboardRequest($employee_id) + public function auEssEmployeeGetDashboardRequest($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDashboard'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4284,6 +5051,7 @@ protected function auEssEmployeeGetDashboardRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/dashboard'; $formParams = []; $queryParams = []; @@ -4292,6 +5060,7 @@ protected function auEssEmployeeGetDashboardRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4301,53 +5070,35 @@ protected function auEssEmployeeGetDashboardRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4368,10 +5119,11 @@ protected function auEssEmployeeGetDashboardRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4383,14 +5135,15 @@ protected function auEssEmployeeGetDashboardRequest($employee_id) * Get Details * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssEmployeeDetailsModel + * @return \OpenAPI\Client\Model\EssEmployeeDetailsModel */ - public function auEssEmployeeGetDetails($employee_id) + public function auEssEmployeeGetDetails($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDetails'][0]) { - list($response) = $this->auEssEmployeeGetDetailsWithHttpInfo($employee_id); + list($response) = $this->auEssEmployeeGetDetailsWithHttpInfo($employee_id, $contentType); return $response; } @@ -4400,15 +5153,15 @@ public function auEssEmployeeGetDetails($employee_id) * Get Details * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssEmployeeDetailsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssEmployeeDetailsModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeGetDetailsWithHttpInfo($employee_id) + public function auEssEmployeeGetDetailsWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDetails'][0]) { - $returnType = '\Swagger\Client\Model\EssEmployeeDetailsModel'; - $request = $this->auEssEmployeeGetDetailsRequest($employee_id); + $request = $this->auEssEmployeeGetDetailsRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4417,9 +5170,16 @@ public function auEssEmployeeGetDetailsWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4430,19 +5190,37 @@ public function auEssEmployeeGetDetailsWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssEmployeeDetailsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssEmployeeDetailsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssEmployeeDetailsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssEmployeeDetailsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4459,7 +5237,7 @@ public function auEssEmployeeGetDetailsWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssEmployeeDetailsModel', + '\OpenAPI\Client\Model\EssEmployeeDetailsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4475,13 +5253,14 @@ public function auEssEmployeeGetDetailsWithHttpInfo($employee_id) * Get Details * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetDetailsAsync($employee_id) + public function auEssEmployeeGetDetailsAsync($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDetails'][0]) { - return $this->auEssEmployeeGetDetailsAsyncWithHttpInfo($employee_id) + return $this->auEssEmployeeGetDetailsAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4495,24 +5274,24 @@ function ($response) { * Get Details * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetDetailsAsyncWithHttpInfo($employee_id) + public function auEssEmployeeGetDetailsAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDetails'][0]) { - $returnType = '\Swagger\Client\Model\EssEmployeeDetailsModel'; - $request = $this->auEssEmployeeGetDetailsRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EssEmployeeDetailsModel'; + $request = $this->auEssEmployeeGetDetailsRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4535,7 +5314,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4545,12 +5324,14 @@ function ($exception) { * Create request for operation 'auEssEmployeeGetDetails' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeGetDetailsRequest($employee_id) + public function auEssEmployeeGetDetailsRequest($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetDetails'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4558,6 +5339,7 @@ protected function auEssEmployeeGetDetailsRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/details'; $formParams = []; $queryParams = []; @@ -4566,6 +5348,7 @@ protected function auEssEmployeeGetDetailsRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4575,53 +5358,35 @@ protected function auEssEmployeeGetDetailsRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4642,10 +5407,11 @@ protected function auEssEmployeeGetDetailsRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4657,14 +5423,15 @@ protected function auEssEmployeeGetDetailsRequest($employee_id) * Get Emergency Contacts * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEmergencyContacts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeEmergencyContactsEditModel + * @return \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel */ - public function auEssEmployeeGetEmergencyContacts($employee_id) + public function auEssEmployeeGetEmergencyContacts($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEmergencyContacts'][0]) { - list($response) = $this->auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id); + list($response) = $this->auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id, $contentType); return $response; } @@ -4674,15 +5441,15 @@ public function auEssEmployeeGetEmergencyContacts($employee_id) * Get Emergency Contacts * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEmergencyContacts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeEmergencyContactsEditModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id) + public function auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEmergencyContacts'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel'; - $request = $this->auEssEmployeeGetEmergencyContactsRequest($employee_id); + $request = $this->auEssEmployeeGetEmergencyContactsRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4691,9 +5458,16 @@ public function auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4704,19 +5478,37 @@ public function auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4733,7 +5525,7 @@ public function auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel', + '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4749,13 +5541,14 @@ public function auEssEmployeeGetEmergencyContactsWithHttpInfo($employee_id) * Get Emergency Contacts * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetEmergencyContactsAsync($employee_id) + public function auEssEmployeeGetEmergencyContactsAsync($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEmergencyContacts'][0]) { - return $this->auEssEmployeeGetEmergencyContactsAsyncWithHttpInfo($employee_id) + return $this->auEssEmployeeGetEmergencyContactsAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4769,24 +5562,24 @@ function ($response) { * Get Emergency Contacts * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetEmergencyContactsAsyncWithHttpInfo($employee_id) + public function auEssEmployeeGetEmergencyContactsAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEmergencyContacts'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel'; - $request = $this->auEssEmployeeGetEmergencyContactsRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel'; + $request = $this->auEssEmployeeGetEmergencyContactsRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4809,7 +5602,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4819,12 +5612,14 @@ function ($exception) { * Create request for operation 'auEssEmployeeGetEmergencyContacts' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeGetEmergencyContactsRequest($employee_id) + public function auEssEmployeeGetEmergencyContactsRequest($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEmergencyContacts'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -4832,6 +5627,7 @@ protected function auEssEmployeeGetEmergencyContactsRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/emergencycontacts'; $formParams = []; $queryParams = []; @@ -4840,6 +5636,7 @@ protected function auEssEmployeeGetEmergencyContactsRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -4849,53 +5646,35 @@ protected function auEssEmployeeGetEmergencyContactsRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4916,10 +5695,11 @@ protected function auEssEmployeeGetEmergencyContactsRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4931,14 +5711,15 @@ protected function auEssEmployeeGetEmergencyContactsRequest($employee_id) * Get Personal Details * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEssDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssEmployeeDetailsViewModel + * @return \OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel */ - public function auEssEmployeeGetEssDetails($employee_id) + public function auEssEmployeeGetEssDetails($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEssDetails'][0]) { - list($response) = $this->auEssEmployeeGetEssDetailsWithHttpInfo($employee_id); + list($response) = $this->auEssEmployeeGetEssDetailsWithHttpInfo($employee_id, $contentType); return $response; } @@ -4948,15 +5729,15 @@ public function auEssEmployeeGetEssDetails($employee_id) * Get Personal Details * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEssDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssEmployeeDetailsViewModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeGetEssDetailsWithHttpInfo($employee_id) + public function auEssEmployeeGetEssDetailsWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEssDetails'][0]) { - $returnType = '\Swagger\Client\Model\AuEssEmployeeDetailsViewModel'; - $request = $this->auEssEmployeeGetEssDetailsRequest($employee_id); + $request = $this->auEssEmployeeGetEssDetailsRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4965,9 +5746,16 @@ public function auEssEmployeeGetEssDetailsWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4978,19 +5766,37 @@ public function auEssEmployeeGetEssDetailsWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5007,7 +5813,7 @@ public function auEssEmployeeGetEssDetailsWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssEmployeeDetailsViewModel', + '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5023,13 +5829,14 @@ public function auEssEmployeeGetEssDetailsWithHttpInfo($employee_id) * Get Personal Details * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEssDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetEssDetailsAsync($employee_id) + public function auEssEmployeeGetEssDetailsAsync($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEssDetails'][0]) { - return $this->auEssEmployeeGetEssDetailsAsyncWithHttpInfo($employee_id) + return $this->auEssEmployeeGetEssDetailsAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5043,24 +5850,24 @@ function ($response) { * Get Personal Details * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEssDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetEssDetailsAsyncWithHttpInfo($employee_id) + public function auEssEmployeeGetEssDetailsAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEssDetails'][0]) { - $returnType = '\Swagger\Client\Model\AuEssEmployeeDetailsViewModel'; - $request = $this->auEssEmployeeGetEssDetailsRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel'; + $request = $this->auEssEmployeeGetEssDetailsRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5083,7 +5890,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5093,12 +5900,14 @@ function ($exception) { * Create request for operation 'auEssEmployeeGetEssDetails' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetEssDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeGetEssDetailsRequest($employee_id) + public function auEssEmployeeGetEssDetailsRequest($employee_id, string $contentType = self::contentTypes['auEssEmployeeGetEssDetails'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5106,6 +5915,7 @@ protected function auEssEmployeeGetEssDetailsRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/personaldetails'; $formParams = []; $queryParams = []; @@ -5114,6 +5924,7 @@ protected function auEssEmployeeGetEssDetailsRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -5123,53 +5934,35 @@ protected function auEssEmployeeGetEssDetailsRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5190,10 +5983,11 @@ protected function auEssEmployeeGetEssDetailsRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5207,14 +6001,15 @@ protected function auEssEmployeeGetEssDetailsRequest($employee_id) * @param string $employee_id employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetPublicHolidays'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PublicHolidayModel[] + * @return \OpenAPI\Client\Model\PublicHolidayModel[] */ - public function auEssEmployeeGetPublicHolidays($employee_id, $filter_from_date, $filter_to_date) + public function auEssEmployeeGetPublicHolidays($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssEmployeeGetPublicHolidays'][0]) { - list($response) = $this->auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter_from_date, $filter_to_date); + list($response) = $this->auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType); return $response; } @@ -5226,15 +6021,15 @@ public function auEssEmployeeGetPublicHolidays($employee_id, $filter_from_date, * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetPublicHolidays'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PublicHolidayModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PublicHolidayModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + public function auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssEmployeeGetPublicHolidays'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel[]'; - $request = $this->auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_from_date, $filter_to_date); + $request = $this->auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -5243,9 +6038,16 @@ public function auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5256,19 +6058,37 @@ public function auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PublicHolidayModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicHolidayModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicHolidayModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5285,7 +6105,7 @@ public function auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PublicHolidayModel[]', + '\OpenAPI\Client\Model\PublicHolidayModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5303,13 +6123,14 @@ public function auEssEmployeeGetPublicHolidaysWithHttpInfo($employee_id, $filter * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetPublicHolidays'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetPublicHolidaysAsync($employee_id, $filter_from_date, $filter_to_date) + public function auEssEmployeeGetPublicHolidaysAsync($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssEmployeeGetPublicHolidays'][0]) { - return $this->auEssEmployeeGetPublicHolidaysAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + return $this->auEssEmployeeGetPublicHolidaysAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -5325,24 +6146,24 @@ function ($response) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetPublicHolidays'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetPublicHolidaysAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + public function auEssEmployeeGetPublicHolidaysAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssEmployeeGetPublicHolidays'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel[]'; - $request = $this->auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_from_date, $filter_to_date); + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel[]'; + $request = $this->auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5365,7 +6186,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5377,24 +6198,28 @@ function ($exception) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetPublicHolidays'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_from_date, $filter_to_date) + public function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssEmployeeGetPublicHolidays'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssEmployeeGetPublicHolidays' ); } + // verify the required parameter 'filter_from_date' is set if ($filter_from_date === null || (is_array($filter_from_date) && count($filter_from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $filter_from_date when calling auEssEmployeeGetPublicHolidays' ); } + // verify the required parameter 'filter_to_date' is set if ($filter_to_date === null || (is_array($filter_to_date) && count($filter_to_date) === 0)) { throw new \InvalidArgumentException( @@ -5402,6 +6227,7 @@ protected function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_f ); } + $resourcePath = '/api/v2/ess/{employeeId}/publicHolidays'; $formParams = []; $queryParams = []; @@ -5410,13 +6236,24 @@ protected function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_f $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -5427,53 +6264,35 @@ protected function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_f ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5494,10 +6313,11 @@ protected function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_f $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5511,14 +6331,15 @@ protected function auEssEmployeeGetPublicHolidaysRequest($employee_id, $filter_f * @param string $employee_id employee_id (required) * @param \DateTime $from_date from_date (optional) * @param \DateTime $to_date to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetSatisfactionSurveys'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssSatisfactionSurvey[] + * @return \OpenAPI\Client\Model\EssSatisfactionSurvey[] */ - public function auEssEmployeeGetSatisfactionSurveys($employee_id, $from_date = null, $to_date = null) + public function auEssEmployeeGetSatisfactionSurveys($employee_id, $from_date = null, $to_date = null, string $contentType = self::contentTypes['auEssEmployeeGetSatisfactionSurveys'][0]) { - list($response) = $this->auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $from_date, $to_date); + list($response) = $this->auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $from_date, $to_date, $contentType); return $response; } @@ -5530,15 +6351,15 @@ public function auEssEmployeeGetSatisfactionSurveys($employee_id, $from_date = n * @param string $employee_id (required) * @param \DateTime $from_date (optional) * @param \DateTime $to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetSatisfactionSurveys'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssSatisfactionSurvey[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssSatisfactionSurvey[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $from_date = null, $to_date = null) + public function auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $from_date = null, $to_date = null, string $contentType = self::contentTypes['auEssEmployeeGetSatisfactionSurveys'][0]) { - $returnType = '\Swagger\Client\Model\EssSatisfactionSurvey[]'; - $request = $this->auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $from_date, $to_date); + $request = $this->auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $from_date, $to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -5547,9 +6368,16 @@ public function auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $f } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5560,19 +6388,37 @@ public function auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $f sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssSatisfactionSurvey[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssSatisfactionSurvey[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssSatisfactionSurvey[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssSatisfactionSurvey[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5589,7 +6435,7 @@ public function auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $f case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssSatisfactionSurvey[]', + '\OpenAPI\Client\Model\EssSatisfactionSurvey[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5607,13 +6453,14 @@ public function auEssEmployeeGetSatisfactionSurveysWithHttpInfo($employee_id, $f * @param string $employee_id (required) * @param \DateTime $from_date (optional) * @param \DateTime $to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetSatisfactionSurveys'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetSatisfactionSurveysAsync($employee_id, $from_date = null, $to_date = null) + public function auEssEmployeeGetSatisfactionSurveysAsync($employee_id, $from_date = null, $to_date = null, string $contentType = self::contentTypes['auEssEmployeeGetSatisfactionSurveys'][0]) { - return $this->auEssEmployeeGetSatisfactionSurveysAsyncWithHttpInfo($employee_id, $from_date, $to_date) + return $this->auEssEmployeeGetSatisfactionSurveysAsyncWithHttpInfo($employee_id, $from_date, $to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -5629,24 +6476,24 @@ function ($response) { * @param string $employee_id (required) * @param \DateTime $from_date (optional) * @param \DateTime $to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetSatisfactionSurveys'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeGetSatisfactionSurveysAsyncWithHttpInfo($employee_id, $from_date = null, $to_date = null) + public function auEssEmployeeGetSatisfactionSurveysAsyncWithHttpInfo($employee_id, $from_date = null, $to_date = null, string $contentType = self::contentTypes['auEssEmployeeGetSatisfactionSurveys'][0]) { - $returnType = '\Swagger\Client\Model\EssSatisfactionSurvey[]'; - $request = $this->auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $from_date, $to_date); + $returnType = '\OpenAPI\Client\Model\EssSatisfactionSurvey[]'; + $request = $this->auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $from_date, $to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5669,7 +6516,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5681,12 +6528,14 @@ function ($exception) { * @param string $employee_id (required) * @param \DateTime $from_date (optional) * @param \DateTime $to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeGetSatisfactionSurveys'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $from_date = null, $to_date = null) + public function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $from_date = null, $to_date = null, string $contentType = self::contentTypes['auEssEmployeeGetSatisfactionSurveys'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5694,6 +6543,9 @@ protected function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $fro ); } + + + $resourcePath = '/api/v2/ess/{employeeId}/satisfaction'; $formParams = []; $queryParams = []; @@ -5702,13 +6554,24 @@ protected function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $fro $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -5719,53 +6582,35 @@ protected function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $fro ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5786,10 +6631,11 @@ protected function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $fro $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5800,16 +6646,17 @@ protected function auEssEmployeeGetSatisfactionSurveysRequest($employee_id, $fro * * Save Details * - * @param \Swagger\Client\Model\EmployeePartialEditModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeePartialEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuUnstructuredEmployeeModel + * @return \OpenAPI\Client\Model\AuUnstructuredEmployeeModel */ - public function auEssEmployeeSaveDetails($model, $employee_id) + public function auEssEmployeeSaveDetails($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveDetails'][0]) { - list($response) = $this->auEssEmployeeSaveDetailsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssEmployeeSaveDetailsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -5818,17 +6665,17 @@ public function auEssEmployeeSaveDetails($model, $employee_id) * * Save Details * - * @param \Swagger\Client\Model\EmployeePartialEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeePartialEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuUnstructuredEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeSaveDetailsWithHttpInfo($model, $employee_id) + public function auEssEmployeeSaveDetailsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveDetails'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEssEmployeeSaveDetailsRequest($model, $employee_id); + $request = $this->auEssEmployeeSaveDetailsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -5837,9 +6684,16 @@ public function auEssEmployeeSaveDetailsWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5850,19 +6704,37 @@ public function auEssEmployeeSaveDetailsWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuUnstructuredEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5879,7 +6751,7 @@ public function auEssEmployeeSaveDetailsWithHttpInfo($model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuUnstructuredEmployeeModel', + '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5894,15 +6766,16 @@ public function auEssEmployeeSaveDetailsWithHttpInfo($model, $employee_id) * * Save Details * - * @param \Swagger\Client\Model\EmployeePartialEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeePartialEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeSaveDetailsAsync($model, $employee_id) + public function auEssEmployeeSaveDetailsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveDetails'][0]) { - return $this->auEssEmployeeSaveDetailsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssEmployeeSaveDetailsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -5915,26 +6788,26 @@ function ($response) { * * Save Details * - * @param \Swagger\Client\Model\EmployeePartialEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeePartialEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeSaveDetailsAsyncWithHttpInfo($model, $employee_id) + public function auEssEmployeeSaveDetailsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveDetails'][0]) { - $returnType = '\Swagger\Client\Model\AuUnstructuredEmployeeModel'; - $request = $this->auEssEmployeeSaveDetailsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuUnstructuredEmployeeModel'; + $request = $this->auEssEmployeeSaveDetailsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5957,7 +6830,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5966,20 +6839,16 @@ function ($exception) { /** * Create request for operation 'auEssEmployeeSaveDetails' * - * @param \Swagger\Client\Model\EmployeePartialEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeePartialEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeSaveDetailsRequest($model, $employee_id) + public function auEssEmployeeSaveDetailsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveDetails'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssEmployeeSaveDetails' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -5987,6 +6856,14 @@ protected function auEssEmployeeSaveDetailsRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssEmployeeSaveDetails' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/details'; $formParams = []; $queryParams = []; @@ -5995,6 +6872,7 @@ protected function auEssEmployeeSaveDetailsRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -6004,56 +6882,42 @@ protected function auEssEmployeeSaveDetailsRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6074,10 +6938,11 @@ protected function auEssEmployeeSaveDetailsRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6088,16 +6953,17 @@ protected function auEssEmployeeSaveDetailsRequest($model, $employee_id) * * Save Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveEmergencyContacts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeEmergencyContactsEditModel + * @return \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel */ - public function auEssEmployeeSaveEmergencyContacts($model, $employee_id) + public function auEssEmployeeSaveEmergencyContacts($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveEmergencyContacts'][0]) { - list($response) = $this->auEssEmployeeSaveEmergencyContactsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssEmployeeSaveEmergencyContactsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -6106,17 +6972,17 @@ public function auEssEmployeeSaveEmergencyContacts($model, $employee_id) * * Save Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveEmergencyContacts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeEmergencyContactsEditModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeSaveEmergencyContactsWithHttpInfo($model, $employee_id) + public function auEssEmployeeSaveEmergencyContactsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveEmergencyContacts'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel'; - $request = $this->auEssEmployeeSaveEmergencyContactsRequest($model, $employee_id); + $request = $this->auEssEmployeeSaveEmergencyContactsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6125,9 +6991,16 @@ public function auEssEmployeeSaveEmergencyContactsWithHttpInfo($model, $employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6138,19 +7011,37 @@ public function auEssEmployeeSaveEmergencyContactsWithHttpInfo($model, $employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6167,7 +7058,7 @@ public function auEssEmployeeSaveEmergencyContactsWithHttpInfo($model, $employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel', + '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6182,15 +7073,16 @@ public function auEssEmployeeSaveEmergencyContactsWithHttpInfo($model, $employee * * Save Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeSaveEmergencyContactsAsync($model, $employee_id) + public function auEssEmployeeSaveEmergencyContactsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveEmergencyContacts'][0]) { - return $this->auEssEmployeeSaveEmergencyContactsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssEmployeeSaveEmergencyContactsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6203,26 +7095,26 @@ function ($response) { * * Save Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeSaveEmergencyContactsAsyncWithHttpInfo($model, $employee_id) + public function auEssEmployeeSaveEmergencyContactsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveEmergencyContacts'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel'; - $request = $this->auEssEmployeeSaveEmergencyContactsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel'; + $request = $this->auEssEmployeeSaveEmergencyContactsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6245,7 +7137,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6254,20 +7146,16 @@ function ($exception) { /** * Create request for operation 'auEssEmployeeSaveEmergencyContacts' * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeSaveEmergencyContactsRequest($model, $employee_id) + public function auEssEmployeeSaveEmergencyContactsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeSaveEmergencyContacts'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssEmployeeSaveEmergencyContacts' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6275,6 +7163,14 @@ protected function auEssEmployeeSaveEmergencyContactsRequest($model, $employee_i ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssEmployeeSaveEmergencyContacts' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/emergencycontacts'; $formParams = []; $queryParams = []; @@ -6283,6 +7179,7 @@ protected function auEssEmployeeSaveEmergencyContactsRequest($model, $employee_i $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -6292,56 +7189,42 @@ protected function auEssEmployeeSaveEmergencyContactsRequest($model, $employee_i ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6362,10 +7245,11 @@ protected function auEssEmployeeSaveEmergencyContactsRequest($model, $employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6376,16 +7260,17 @@ protected function auEssEmployeeSaveEmergencyContactsRequest($model, $employee_i * * Submit Satisfaction Survey * - * @param \Swagger\Client\Model\EssSatisfactionSurvey $survey survey (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssSatisfactionSurvey $survey survey (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveSatisfaction'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string */ - public function auEssEmployeeSaveSatisfaction($survey, $employee_id) + public function auEssEmployeeSaveSatisfaction($employee_id, $survey, string $contentType = self::contentTypes['auEssEmployeeSaveSatisfaction'][0]) { - list($response) = $this->auEssEmployeeSaveSatisfactionWithHttpInfo($survey, $employee_id); + list($response) = $this->auEssEmployeeSaveSatisfactionWithHttpInfo($employee_id, $survey, $contentType); return $response; } @@ -6394,17 +7279,17 @@ public function auEssEmployeeSaveSatisfaction($survey, $employee_id) * * Submit Satisfaction Survey * - * @param \Swagger\Client\Model\EssSatisfactionSurvey $survey (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssSatisfactionSurvey $survey (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveSatisfaction'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeSaveSatisfactionWithHttpInfo($survey, $employee_id) + public function auEssEmployeeSaveSatisfactionWithHttpInfo($employee_id, $survey, string $contentType = self::contentTypes['auEssEmployeeSaveSatisfaction'][0]) { - $returnType = 'string'; - $request = $this->auEssEmployeeSaveSatisfactionRequest($survey, $employee_id); + $request = $this->auEssEmployeeSaveSatisfactionRequest($employee_id, $survey, $contentType); try { $options = $this->createHttpClientOption(); @@ -6413,9 +7298,16 @@ public function auEssEmployeeSaveSatisfactionWithHttpInfo($survey, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6426,19 +7318,37 @@ public function auEssEmployeeSaveSatisfactionWithHttpInfo($survey, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $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 = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6470,15 +7380,16 @@ public function auEssEmployeeSaveSatisfactionWithHttpInfo($survey, $employee_id) * * Submit Satisfaction Survey * - * @param \Swagger\Client\Model\EssSatisfactionSurvey $survey (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssSatisfactionSurvey $survey (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveSatisfaction'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeSaveSatisfactionAsync($survey, $employee_id) + public function auEssEmployeeSaveSatisfactionAsync($employee_id, $survey, string $contentType = self::contentTypes['auEssEmployeeSaveSatisfaction'][0]) { - return $this->auEssEmployeeSaveSatisfactionAsyncWithHttpInfo($survey, $employee_id) + return $this->auEssEmployeeSaveSatisfactionAsyncWithHttpInfo($employee_id, $survey, $contentType) ->then( function ($response) { return $response[0]; @@ -6491,26 +7402,26 @@ function ($response) { * * Submit Satisfaction Survey * - * @param \Swagger\Client\Model\EssSatisfactionSurvey $survey (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssSatisfactionSurvey $survey (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveSatisfaction'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeSaveSatisfactionAsyncWithHttpInfo($survey, $employee_id) + public function auEssEmployeeSaveSatisfactionAsyncWithHttpInfo($employee_id, $survey, string $contentType = self::contentTypes['auEssEmployeeSaveSatisfaction'][0]) { $returnType = 'string'; - $request = $this->auEssEmployeeSaveSatisfactionRequest($survey, $employee_id); + $request = $this->auEssEmployeeSaveSatisfactionRequest($employee_id, $survey, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6533,7 +7444,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6542,20 +7453,16 @@ function ($exception) { /** * Create request for operation 'auEssEmployeeSaveSatisfaction' * - * @param \Swagger\Client\Model\EssSatisfactionSurvey $survey (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssSatisfactionSurvey $survey (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeSaveSatisfaction'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeSaveSatisfactionRequest($survey, $employee_id) + public function auEssEmployeeSaveSatisfactionRequest($employee_id, $survey, string $contentType = self::contentTypes['auEssEmployeeSaveSatisfaction'][0]) { - // verify the required parameter 'survey' is set - if ($survey === null || (is_array($survey) && count($survey) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $survey when calling auEssEmployeeSaveSatisfaction' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6563,6 +7470,14 @@ protected function auEssEmployeeSaveSatisfactionRequest($survey, $employee_id) ); } + // verify the required parameter 'survey' is set + if ($survey === null || (is_array($survey) && count($survey) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $survey when calling auEssEmployeeSaveSatisfaction' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/satisfaction'; $formParams = []; $queryParams = []; @@ -6571,6 +7486,7 @@ protected function auEssEmployeeSaveSatisfactionRequest($survey, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -6580,56 +7496,42 @@ protected function auEssEmployeeSaveSatisfactionRequest($survey, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($survey)) { - $_tempBody = $survey; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($survey)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($survey)); + } else { + $httpBody = $survey; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6650,10 +7552,11 @@ protected function auEssEmployeeSaveSatisfactionRequest($survey, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6664,16 +7567,17 @@ protected function auEssEmployeeSaveSatisfactionRequest($survey, $employee_id) * * Update Personal Details * - * @param \Swagger\Client\Model\AuEssEmployeeDetailsEditModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\AuEssEmployeeDetailsEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssEmployeeDetailsViewModel + * @return \OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel */ - public function auEssEmployeeUpdateDetails($model, $employee_id) + public function auEssEmployeeUpdateDetails($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateDetails'][0]) { - list($response) = $this->auEssEmployeeUpdateDetailsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssEmployeeUpdateDetailsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -6682,17 +7586,17 @@ public function auEssEmployeeUpdateDetails($model, $employee_id) * * Update Personal Details * - * @param \Swagger\Client\Model\AuEssEmployeeDetailsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssEmployeeDetailsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateDetails'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssEmployeeDetailsViewModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeUpdateDetailsWithHttpInfo($model, $employee_id) + public function auEssEmployeeUpdateDetailsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateDetails'][0]) { - $returnType = '\Swagger\Client\Model\AuEssEmployeeDetailsViewModel'; - $request = $this->auEssEmployeeUpdateDetailsRequest($model, $employee_id); + $request = $this->auEssEmployeeUpdateDetailsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6701,9 +7605,16 @@ public function auEssEmployeeUpdateDetailsWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6714,19 +7625,37 @@ public function auEssEmployeeUpdateDetailsWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6743,7 +7672,7 @@ public function auEssEmployeeUpdateDetailsWithHttpInfo($model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssEmployeeDetailsViewModel', + '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6758,15 +7687,16 @@ public function auEssEmployeeUpdateDetailsWithHttpInfo($model, $employee_id) * * Update Personal Details * - * @param \Swagger\Client\Model\AuEssEmployeeDetailsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssEmployeeDetailsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeUpdateDetailsAsync($model, $employee_id) + public function auEssEmployeeUpdateDetailsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateDetails'][0]) { - return $this->auEssEmployeeUpdateDetailsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssEmployeeUpdateDetailsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6779,26 +7709,26 @@ function ($response) { * * Update Personal Details * - * @param \Swagger\Client\Model\AuEssEmployeeDetailsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssEmployeeDetailsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeUpdateDetailsAsyncWithHttpInfo($model, $employee_id) + public function auEssEmployeeUpdateDetailsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateDetails'][0]) { - $returnType = '\Swagger\Client\Model\AuEssEmployeeDetailsViewModel'; - $request = $this->auEssEmployeeUpdateDetailsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssEmployeeDetailsViewModel'; + $request = $this->auEssEmployeeUpdateDetailsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6821,7 +7751,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6830,20 +7760,16 @@ function ($exception) { /** * Create request for operation 'auEssEmployeeUpdateDetails' * - * @param \Swagger\Client\Model\AuEssEmployeeDetailsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\AuEssEmployeeDetailsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeUpdateDetailsRequest($model, $employee_id) + public function auEssEmployeeUpdateDetailsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateDetails'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssEmployeeUpdateDetails' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -6851,6 +7777,14 @@ protected function auEssEmployeeUpdateDetailsRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssEmployeeUpdateDetails' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/personaldetails'; $formParams = []; $queryParams = []; @@ -6859,6 +7793,7 @@ protected function auEssEmployeeUpdateDetailsRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -6868,56 +7803,42 @@ protected function auEssEmployeeUpdateDetailsRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6938,10 +7859,11 @@ protected function auEssEmployeeUpdateDetailsRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6952,16 +7874,17 @@ protected function auEssEmployeeUpdateDetailsRequest($model, $employee_id) * * Update Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateEmergencyContacts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeEmergencyContactsEditModel + * @return \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel */ - public function auEssEmployeeUpdateEmergencyContacts($model, $employee_id) + public function auEssEmployeeUpdateEmergencyContacts($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateEmergencyContacts'][0]) { - list($response) = $this->auEssEmployeeUpdateEmergencyContactsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssEmployeeUpdateEmergencyContactsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -6970,17 +7893,17 @@ public function auEssEmployeeUpdateEmergencyContacts($model, $employee_id) * * Update Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateEmergencyContacts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeEmergencyContactsEditModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssEmployeeUpdateEmergencyContactsWithHttpInfo($model, $employee_id) + public function auEssEmployeeUpdateEmergencyContactsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateEmergencyContacts'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel'; - $request = $this->auEssEmployeeUpdateEmergencyContactsRequest($model, $employee_id); + $request = $this->auEssEmployeeUpdateEmergencyContactsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6989,9 +7912,16 @@ public function auEssEmployeeUpdateEmergencyContactsWithHttpInfo($model, $employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7002,19 +7932,37 @@ public function auEssEmployeeUpdateEmergencyContactsWithHttpInfo($model, $employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7031,7 +7979,7 @@ public function auEssEmployeeUpdateEmergencyContactsWithHttpInfo($model, $employ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel', + '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7046,15 +7994,16 @@ public function auEssEmployeeUpdateEmergencyContactsWithHttpInfo($model, $employ * * Update Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeUpdateEmergencyContactsAsync($model, $employee_id) + public function auEssEmployeeUpdateEmergencyContactsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateEmergencyContacts'][0]) { - return $this->auEssEmployeeUpdateEmergencyContactsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssEmployeeUpdateEmergencyContactsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -7067,26 +8016,26 @@ function ($response) { * * Update Emergency Contacts * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssEmployeeUpdateEmergencyContactsAsyncWithHttpInfo($model, $employee_id) + public function auEssEmployeeUpdateEmergencyContactsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateEmergencyContacts'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeEmergencyContactsEditModel'; - $request = $this->auEssEmployeeUpdateEmergencyContactsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel'; + $request = $this->auEssEmployeeUpdateEmergencyContactsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7109,7 +8058,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7118,20 +8067,16 @@ function ($exception) { /** * Create request for operation 'auEssEmployeeUpdateEmergencyContacts' * - * @param \Swagger\Client\Model\EmployeeEmergencyContactsEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EmployeeEmergencyContactsEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssEmployeeUpdateEmergencyContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssEmployeeUpdateEmergencyContactsRequest($model, $employee_id) + public function auEssEmployeeUpdateEmergencyContactsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssEmployeeUpdateEmergencyContacts'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssEmployeeUpdateEmergencyContacts' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7139,6 +8084,14 @@ protected function auEssEmployeeUpdateEmergencyContactsRequest($model, $employee ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssEmployeeUpdateEmergencyContacts' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/emergencycontacts'; $formParams = []; $queryParams = []; @@ -7147,6 +8100,7 @@ protected function auEssEmployeeUpdateEmergencyContactsRequest($model, $employee $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -7156,56 +8110,42 @@ protected function auEssEmployeeUpdateEmergencyContactsRequest($model, $employee ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7226,10 +8166,11 @@ protected function auEssEmployeeUpdateEmergencyContactsRequest($model, $employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7240,14 +8181,15 @@ protected function auEssEmployeeUpdateEmergencyContactsRequest($model, $employee * * @param int $suburb_id suburb_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupAddresses'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssLookupAddresses($suburb_id, $employee_id) + public function auEssLookupAddresses($suburb_id, $employee_id, string $contentType = self::contentTypes['auEssLookupAddresses'][0]) { - $this->auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id); + $this->auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id, $contentType); } /** @@ -7255,15 +8197,15 @@ public function auEssLookupAddresses($suburb_id, $employee_id) * * @param int $suburb_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupAddresses'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id) + public function auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id, string $contentType = self::contentTypes['auEssLookupAddresses'][0]) { - $returnType = ''; - $request = $this->auEssLookupAddressesRequest($suburb_id, $employee_id); + $request = $this->auEssLookupAddressesRequest($suburb_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7272,9 +8214,16 @@ public function auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7285,11 +8234,11 @@ public function auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -7305,17 +8254,16 @@ public function auEssLookupAddressesWithHttpInfo($suburb_id, $employee_id) /** * Operation auEssLookupAddressesAsync * - * - * * @param int $suburb_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupAddresses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupAddressesAsync($suburb_id, $employee_id) + public function auEssLookupAddressesAsync($suburb_id, $employee_id, string $contentType = self::contentTypes['auEssLookupAddresses'][0]) { - return $this->auEssLookupAddressesAsyncWithHttpInfo($suburb_id, $employee_id) + return $this->auEssLookupAddressesAsyncWithHttpInfo($suburb_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7326,18 +8274,17 @@ function ($response) { /** * Operation auEssLookupAddressesAsyncWithHttpInfo * - * - * * @param int $suburb_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupAddresses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupAddressesAsyncWithHttpInfo($suburb_id, $employee_id) + public function auEssLookupAddressesAsyncWithHttpInfo($suburb_id, $employee_id, string $contentType = self::contentTypes['auEssLookupAddresses'][0]) { $returnType = ''; - $request = $this->auEssLookupAddressesRequest($suburb_id, $employee_id); + $request = $this->auEssLookupAddressesRequest($suburb_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7356,7 +8303,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7367,18 +8314,21 @@ function ($exception) { * * @param int $suburb_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupAddresses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupAddressesRequest($suburb_id, $employee_id) + public function auEssLookupAddressesRequest($suburb_id, $employee_id, string $contentType = self::contentTypes['auEssLookupAddresses'][0]) { + // verify the required parameter 'suburb_id' is set if ($suburb_id === null || (is_array($suburb_id) && count($suburb_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $suburb_id when calling auEssLookupAddresses' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7386,6 +8336,7 @@ protected function auEssLookupAddressesRequest($suburb_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/lookup/addresses/{suburbId}'; $formParams = []; $queryParams = []; @@ -7394,6 +8345,7 @@ protected function auEssLookupAddressesRequest($suburb_id, $employee_id) $multipart = false; + // path params if ($suburb_id !== null) { $resourcePath = str_replace( @@ -7411,53 +8363,35 @@ protected function auEssLookupAddressesRequest($suburb_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7478,10 +8412,11 @@ protected function auEssLookupAddressesRequest($suburb_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7493,14 +8428,15 @@ protected function auEssLookupAddressesRequest($suburb_id, $employee_id) * Get Locations * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupLocation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function auEssLookupLocation($employee_id) + public function auEssLookupLocation($employee_id, string $contentType = self::contentTypes['auEssLookupLocation'][0]) { - list($response) = $this->auEssLookupLocationWithHttpInfo($employee_id); + list($response) = $this->auEssLookupLocationWithHttpInfo($employee_id, $contentType); return $response; } @@ -7510,15 +8446,15 @@ public function auEssLookupLocation($employee_id) * Get Locations * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupLocation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupLocationWithHttpInfo($employee_id) + public function auEssLookupLocationWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupLocation'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->auEssLookupLocationRequest($employee_id); + $request = $this->auEssLookupLocationRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7527,9 +8463,16 @@ public function auEssLookupLocationWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7540,19 +8483,37 @@ public function auEssLookupLocationWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7569,7 +8530,7 @@ public function auEssLookupLocationWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7585,13 +8546,14 @@ public function auEssLookupLocationWithHttpInfo($employee_id) * Get Locations * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupLocation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupLocationAsync($employee_id) + public function auEssLookupLocationAsync($employee_id, string $contentType = self::contentTypes['auEssLookupLocation'][0]) { - return $this->auEssLookupLocationAsyncWithHttpInfo($employee_id) + return $this->auEssLookupLocationAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7605,24 +8567,24 @@ function ($response) { * Get Locations * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupLocation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupLocationAsyncWithHttpInfo($employee_id) + public function auEssLookupLocationAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupLocation'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->auEssLookupLocationRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->auEssLookupLocationRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7645,7 +8607,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7655,12 +8617,14 @@ function ($exception) { * Create request for operation 'auEssLookupLocation' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupLocation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupLocationRequest($employee_id) + public function auEssLookupLocationRequest($employee_id, string $contentType = self::contentTypes['auEssLookupLocation'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7668,6 +8632,7 @@ protected function auEssLookupLocationRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/lookup/location'; $formParams = []; $queryParams = []; @@ -7676,6 +8641,7 @@ protected function auEssLookupLocationRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -7685,53 +8651,35 @@ protected function auEssLookupLocationRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7752,10 +8700,11 @@ protected function auEssLookupLocationRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7767,14 +8716,15 @@ protected function auEssLookupLocationRequest($employee_id) * Get Shift Conditions * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupShiftCondition'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuWorkTypeModel[] */ - public function auEssLookupShiftCondition($employee_id) + public function auEssLookupShiftCondition($employee_id, string $contentType = self::contentTypes['auEssLookupShiftCondition'][0]) { - list($response) = $this->auEssLookupShiftConditionWithHttpInfo($employee_id); + list($response) = $this->auEssLookupShiftConditionWithHttpInfo($employee_id, $contentType); return $response; } @@ -7784,15 +8734,15 @@ public function auEssLookupShiftCondition($employee_id) * Get Shift Conditions * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupShiftCondition'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupShiftConditionWithHttpInfo($employee_id) + public function auEssLookupShiftConditionWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupShiftCondition'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEssLookupShiftConditionRequest($employee_id); + $request = $this->auEssLookupShiftConditionRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7801,9 +8751,16 @@ public function auEssLookupShiftConditionWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7814,19 +8771,37 @@ public function auEssLookupShiftConditionWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7843,7 +8818,7 @@ public function auEssLookupShiftConditionWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel[]', + '\OpenAPI\Client\Model\AuWorkTypeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7859,13 +8834,14 @@ public function auEssLookupShiftConditionWithHttpInfo($employee_id) * Get Shift Conditions * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupShiftCondition'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupShiftConditionAsync($employee_id) + public function auEssLookupShiftConditionAsync($employee_id, string $contentType = self::contentTypes['auEssLookupShiftCondition'][0]) { - return $this->auEssLookupShiftConditionAsyncWithHttpInfo($employee_id) + return $this->auEssLookupShiftConditionAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7879,24 +8855,24 @@ function ($response) { * Get Shift Conditions * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupShiftCondition'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupShiftConditionAsyncWithHttpInfo($employee_id) + public function auEssLookupShiftConditionAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupShiftCondition'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEssLookupShiftConditionRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; + $request = $this->auEssLookupShiftConditionRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7919,7 +8895,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7929,12 +8905,14 @@ function ($exception) { * Create request for operation 'auEssLookupShiftCondition' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupShiftCondition'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupShiftConditionRequest($employee_id) + public function auEssLookupShiftConditionRequest($employee_id, string $contentType = self::contentTypes['auEssLookupShiftCondition'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -7942,6 +8920,7 @@ protected function auEssLookupShiftConditionRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/lookup/shiftcondition'; $formParams = []; $queryParams = []; @@ -7950,6 +8929,7 @@ protected function auEssLookupShiftConditionRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -7959,53 +8939,35 @@ protected function auEssLookupShiftConditionRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8026,10 +8988,11 @@ protected function auEssLookupShiftConditionRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8045,14 +9008,15 @@ protected function auEssLookupShiftConditionRequest($employee_id) * @param string $post_code post_code (required) * @param string $employee_id employee_id (required) * @param string $country_id country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburb'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuburbResult + * @return \OpenAPI\Client\Model\SuburbResult */ - public function auEssLookupSuburb($suburb, $state, $post_code, $employee_id, $country_id = null) + public function auEssLookupSuburb($suburb, $state, $post_code, $employee_id, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburb'][0]) { - list($response) = $this->auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id); + list($response) = $this->auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id, $contentType); return $response; } @@ -8066,15 +9030,15 @@ public function auEssLookupSuburb($suburb, $state, $post_code, $employee_id, $co * @param string $post_code (required) * @param string $employee_id (required) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburb'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuburbResult, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuburbResult, HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id = null) + public function auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburb'][0]) { - $returnType = '\Swagger\Client\Model\SuburbResult'; - $request = $this->auEssLookupSuburbRequest($suburb, $state, $post_code, $employee_id, $country_id); + $request = $this->auEssLookupSuburbRequest($suburb, $state, $post_code, $employee_id, $country_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8083,9 +9047,16 @@ public function auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8096,19 +9067,37 @@ public function auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuburbResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuburbResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuburbResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuburbResult'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8125,7 +9114,7 @@ public function auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuburbResult', + '\OpenAPI\Client\Model\SuburbResult', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8145,13 +9134,14 @@ public function auEssLookupSuburbWithHttpInfo($suburb, $state, $post_code, $empl * @param string $post_code (required) * @param string $employee_id (required) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburb'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupSuburbAsync($suburb, $state, $post_code, $employee_id, $country_id = null) + public function auEssLookupSuburbAsync($suburb, $state, $post_code, $employee_id, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburb'][0]) { - return $this->auEssLookupSuburbAsyncWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id) + return $this->auEssLookupSuburbAsyncWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8169,24 +9159,24 @@ function ($response) { * @param string $post_code (required) * @param string $employee_id (required) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburb'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupSuburbAsyncWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id = null) + public function auEssLookupSuburbAsyncWithHttpInfo($suburb, $state, $post_code, $employee_id, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburb'][0]) { - $returnType = '\Swagger\Client\Model\SuburbResult'; - $request = $this->auEssLookupSuburbRequest($suburb, $state, $post_code, $employee_id, $country_id); + $returnType = '\OpenAPI\Client\Model\SuburbResult'; + $request = $this->auEssLookupSuburbRequest($suburb, $state, $post_code, $employee_id, $country_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8209,7 +9199,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8223,30 +9213,35 @@ function ($exception) { * @param string $post_code (required) * @param string $employee_id (required) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburb'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupSuburbRequest($suburb, $state, $post_code, $employee_id, $country_id = null) + public function auEssLookupSuburbRequest($suburb, $state, $post_code, $employee_id, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburb'][0]) { + // verify the required parameter 'suburb' is set if ($suburb === null || (is_array($suburb) && count($suburb) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $suburb when calling auEssLookupSuburb' ); } + // verify the required parameter 'state' is set if ($state === null || (is_array($state) && count($state) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $state when calling auEssLookupSuburb' ); } + // verify the required parameter 'post_code' is set if ($post_code === null || (is_array($post_code) && count($post_code) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $post_code when calling auEssLookupSuburb' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -8254,6 +9249,8 @@ protected function auEssLookupSuburbRequest($suburb, $state, $post_code, $employ ); } + + $resourcePath = '/api/v2/ess/{employeeId}/lookup/suburb'; $formParams = []; $queryParams = []; @@ -8262,21 +9259,42 @@ protected function auEssLookupSuburbRequest($suburb, $state, $post_code, $employ $multipart = false; // query params - if ($suburb !== null) { - $queryParams['suburb'] = ObjectSerializer::toQueryValue($suburb); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $suburb, + 'suburb', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($state !== null) { - $queryParams['state'] = ObjectSerializer::toQueryValue($state); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $state, + 'state', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($post_code !== null) { - $queryParams['postCode'] = ObjectSerializer::toQueryValue($post_code); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $post_code, + 'postCode', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($country_id !== null) { - $queryParams['countryId'] = ObjectSerializer::toQueryValue($country_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $country_id, + 'countryId', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -8287,53 +9305,35 @@ protected function auEssLookupSuburbRequest($suburb, $state, $post_code, $employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8354,10 +9354,11 @@ protected function auEssLookupSuburbRequest($suburb, $state, $post_code, $employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8373,14 +9374,15 @@ protected function auEssLookupSuburbRequest($suburb, $state, $post_code, $employ * @param int $page_num page_num (optional, default to 1) * @param int $page_size page_size (optional, default to 20) * @param string $country_id country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburbs'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PagedResultModelOfSuburbModel + * @return \OpenAPI\Client\Model\PagedResultModelOfSuburbModel */ - public function auEssLookupSuburbs($term, $employee_id, $page_num = '1', $page_size = '20', $country_id = null) + public function auEssLookupSuburbs($term, $employee_id, $page_num = 1, $page_size = 20, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburbs'][0]) { - list($response) = $this->auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num, $page_size, $country_id); + list($response) = $this->auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num, $page_size, $country_id, $contentType); return $response; } @@ -8394,15 +9396,15 @@ public function auEssLookupSuburbs($term, $employee_id, $page_num = '1', $page_s * @param int $page_num (optional, default to 1) * @param int $page_size (optional, default to 20) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburbs'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PagedResultModelOfSuburbModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PagedResultModelOfSuburbModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num = '1', $page_size = '20', $country_id = null) + public function auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num = 1, $page_size = 20, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburbs'][0]) { - $returnType = '\Swagger\Client\Model\PagedResultModelOfSuburbModel'; - $request = $this->auEssLookupSuburbsRequest($term, $employee_id, $page_num, $page_size, $country_id); + $request = $this->auEssLookupSuburbsRequest($term, $employee_id, $page_num, $page_size, $country_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8411,9 +9413,16 @@ public function auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8424,19 +9433,37 @@ public function auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PagedResultModelOfSuburbModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PagedResultModelOfSuburbModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PagedResultModelOfSuburbModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PagedResultModelOfSuburbModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8453,7 +9480,7 @@ public function auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PagedResultModelOfSuburbModel', + '\OpenAPI\Client\Model\PagedResultModelOfSuburbModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8473,13 +9500,14 @@ public function auEssLookupSuburbsWithHttpInfo($term, $employee_id, $page_num = * @param int $page_num (optional, default to 1) * @param int $page_size (optional, default to 20) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburbs'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupSuburbsAsync($term, $employee_id, $page_num = '1', $page_size = '20', $country_id = null) + public function auEssLookupSuburbsAsync($term, $employee_id, $page_num = 1, $page_size = 20, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburbs'][0]) { - return $this->auEssLookupSuburbsAsyncWithHttpInfo($term, $employee_id, $page_num, $page_size, $country_id) + return $this->auEssLookupSuburbsAsyncWithHttpInfo($term, $employee_id, $page_num, $page_size, $country_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8497,24 +9525,24 @@ function ($response) { * @param int $page_num (optional, default to 1) * @param int $page_size (optional, default to 20) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburbs'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupSuburbsAsyncWithHttpInfo($term, $employee_id, $page_num = '1', $page_size = '20', $country_id = null) + public function auEssLookupSuburbsAsyncWithHttpInfo($term, $employee_id, $page_num = 1, $page_size = 20, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburbs'][0]) { - $returnType = '\Swagger\Client\Model\PagedResultModelOfSuburbModel'; - $request = $this->auEssLookupSuburbsRequest($term, $employee_id, $page_num, $page_size, $country_id); + $returnType = '\OpenAPI\Client\Model\PagedResultModelOfSuburbModel'; + $request = $this->auEssLookupSuburbsRequest($term, $employee_id, $page_num, $page_size, $country_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8537,7 +9565,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8551,18 +9579,21 @@ function ($exception) { * @param int $page_num (optional, default to 1) * @param int $page_size (optional, default to 20) * @param string $country_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupSuburbs'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupSuburbsRequest($term, $employee_id, $page_num = '1', $page_size = '20', $country_id = null) + public function auEssLookupSuburbsRequest($term, $employee_id, $page_num = 1, $page_size = 20, $country_id = null, string $contentType = self::contentTypes['auEssLookupSuburbs'][0]) { + // verify the required parameter 'term' is set if ($term === null || (is_array($term) && count($term) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $term when calling auEssLookupSuburbs' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -8570,6 +9601,10 @@ protected function auEssLookupSuburbsRequest($term, $employee_id, $page_num = '1 ); } + + + + $resourcePath = '/api/v2/ess/{employeeId}/lookup/suburbs'; $formParams = []; $queryParams = []; @@ -8578,21 +9613,42 @@ protected function auEssLookupSuburbsRequest($term, $employee_id, $page_num = '1 $multipart = false; // query params - if ($term !== null) { - $queryParams['term'] = ObjectSerializer::toQueryValue($term); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $term, + 'term', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($page_num !== null) { - $queryParams['pageNum'] = ObjectSerializer::toQueryValue($page_num); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_num, + 'pageNum', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - $queryParams['pageSize'] = ObjectSerializer::toQueryValue($page_size); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($country_id !== null) { - $queryParams['countryId'] = ObjectSerializer::toQueryValue($country_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $country_id, + 'countryId', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -8603,53 +9659,35 @@ protected function auEssLookupSuburbsRequest($term, $employee_id, $page_num = '1 ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8670,10 +9708,11 @@ protected function auEssLookupSuburbsRequest($term, $employee_id, $page_num = '1 $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8685,14 +9724,15 @@ protected function auEssLookupSuburbsRequest($term, $employee_id, $page_num = '1 * Get Titles * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupTitle'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TitleViewModel[] + * @return \OpenAPI\Client\Model\TitleViewModel[] */ - public function auEssLookupTitle($employee_id) + public function auEssLookupTitle($employee_id, string $contentType = self::contentTypes['auEssLookupTitle'][0]) { - list($response) = $this->auEssLookupTitleWithHttpInfo($employee_id); + list($response) = $this->auEssLookupTitleWithHttpInfo($employee_id, $contentType); return $response; } @@ -8702,15 +9742,15 @@ public function auEssLookupTitle($employee_id) * Get Titles * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupTitle'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TitleViewModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TitleViewModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupTitleWithHttpInfo($employee_id) + public function auEssLookupTitleWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupTitle'][0]) { - $returnType = '\Swagger\Client\Model\TitleViewModel[]'; - $request = $this->auEssLookupTitleRequest($employee_id); + $request = $this->auEssLookupTitleRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8719,9 +9759,16 @@ public function auEssLookupTitleWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8732,22 +9779,40 @@ public function auEssLookupTitleWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TitleViewModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TitleViewModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TitleViewModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TitleViewModel[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -8761,7 +9826,7 @@ public function auEssLookupTitleWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TitleViewModel[]', + '\OpenAPI\Client\Model\TitleViewModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8777,13 +9842,14 @@ public function auEssLookupTitleWithHttpInfo($employee_id) * Get Titles * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupTitle'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupTitleAsync($employee_id) + public function auEssLookupTitleAsync($employee_id, string $contentType = self::contentTypes['auEssLookupTitle'][0]) { - return $this->auEssLookupTitleAsyncWithHttpInfo($employee_id) + return $this->auEssLookupTitleAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8797,24 +9863,24 @@ function ($response) { * Get Titles * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupTitle'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupTitleAsyncWithHttpInfo($employee_id) + public function auEssLookupTitleAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupTitle'][0]) { - $returnType = '\Swagger\Client\Model\TitleViewModel[]'; - $request = $this->auEssLookupTitleRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\TitleViewModel[]'; + $request = $this->auEssLookupTitleRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8837,7 +9903,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8847,12 +9913,14 @@ function ($exception) { * Create request for operation 'auEssLookupTitle' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupTitle'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupTitleRequest($employee_id) + public function auEssLookupTitleRequest($employee_id, string $contentType = self::contentTypes['auEssLookupTitle'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -8860,6 +9928,7 @@ protected function auEssLookupTitleRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/lookup/title'; $formParams = []; $queryParams = []; @@ -8868,6 +9937,7 @@ protected function auEssLookupTitleRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -8877,53 +9947,35 @@ protected function auEssLookupTitleRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8944,10 +9996,11 @@ protected function auEssLookupTitleRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8959,14 +10012,15 @@ protected function auEssLookupTitleRequest($employee_id) * Get Work Types * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupWorkType'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuWorkTypeModel[] */ - public function auEssLookupWorkType($employee_id) + public function auEssLookupWorkType($employee_id, string $contentType = self::contentTypes['auEssLookupWorkType'][0]) { - list($response) = $this->auEssLookupWorkTypeWithHttpInfo($employee_id); + list($response) = $this->auEssLookupWorkTypeWithHttpInfo($employee_id, $contentType); return $response; } @@ -8976,15 +10030,15 @@ public function auEssLookupWorkType($employee_id) * Get Work Types * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupWorkType'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssLookupWorkTypeWithHttpInfo($employee_id) + public function auEssLookupWorkTypeWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupWorkType'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEssLookupWorkTypeRequest($employee_id); + $request = $this->auEssLookupWorkTypeRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8993,9 +10047,16 @@ public function auEssLookupWorkTypeWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9006,19 +10067,37 @@ public function auEssLookupWorkTypeWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9035,7 +10114,7 @@ public function auEssLookupWorkTypeWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel[]', + '\OpenAPI\Client\Model\AuWorkTypeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9051,13 +10130,14 @@ public function auEssLookupWorkTypeWithHttpInfo($employee_id) * Get Work Types * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupWorkType'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupWorkTypeAsync($employee_id) + public function auEssLookupWorkTypeAsync($employee_id, string $contentType = self::contentTypes['auEssLookupWorkType'][0]) { - return $this->auEssLookupWorkTypeAsyncWithHttpInfo($employee_id) + return $this->auEssLookupWorkTypeAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -9071,24 +10151,24 @@ function ($response) { * Get Work Types * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupWorkType'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssLookupWorkTypeAsyncWithHttpInfo($employee_id) + public function auEssLookupWorkTypeAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssLookupWorkType'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auEssLookupWorkTypeRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; + $request = $this->auEssLookupWorkTypeRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9111,7 +10191,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9121,12 +10201,14 @@ function ($exception) { * Create request for operation 'auEssLookupWorkType' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssLookupWorkType'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssLookupWorkTypeRequest($employee_id) + public function auEssLookupWorkTypeRequest($employee_id, string $contentType = self::contentTypes['auEssLookupWorkType'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9134,6 +10216,7 @@ protected function auEssLookupWorkTypeRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/lookup/worktype'; $formParams = []; $queryParams = []; @@ -9142,6 +10225,7 @@ protected function auEssLookupWorkTypeRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -9151,53 +10235,35 @@ protected function auEssLookupWorkTypeRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9218,10 +10284,11 @@ protected function auEssLookupWorkTypeRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9234,14 +10301,15 @@ protected function auEssLookupWorkTypeRequest($employee_id) * * @param int $id id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SelfManagedSuperFundModel + * @return \OpenAPI\Client\Model\SelfManagedSuperFundModel */ - public function auEssSelfManagedSuperFundGet($id, $employee_id) + public function auEssSelfManagedSuperFundGet($id, $employee_id, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGet'][0]) { - list($response) = $this->auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id); + list($response) = $this->auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id, $contentType); return $response; } @@ -9252,15 +10320,15 @@ public function auEssSelfManagedSuperFundGet($id, $employee_id) * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SelfManagedSuperFundModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SelfManagedSuperFundModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id) + public function auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel'; - $request = $this->auEssSelfManagedSuperFundGetRequest($id, $employee_id); + $request = $this->auEssSelfManagedSuperFundGetRequest($id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -9269,9 +10337,16 @@ public function auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9282,19 +10357,37 @@ public function auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SelfManagedSuperFundModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9311,7 +10404,7 @@ public function auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SelfManagedSuperFundModel', + '\OpenAPI\Client\Model\SelfManagedSuperFundModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9328,13 +10421,14 @@ public function auEssSelfManagedSuperFundGetWithHttpInfo($id, $employee_id) * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundGetAsync($id, $employee_id) + public function auEssSelfManagedSuperFundGetAsync($id, $employee_id, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGet'][0]) { - return $this->auEssSelfManagedSuperFundGetAsyncWithHttpInfo($id, $employee_id) + return $this->auEssSelfManagedSuperFundGetAsyncWithHttpInfo($id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -9349,24 +10443,24 @@ function ($response) { * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundGetAsyncWithHttpInfo($id, $employee_id) + public function auEssSelfManagedSuperFundGetAsyncWithHttpInfo($id, $employee_id, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel'; - $request = $this->auEssSelfManagedSuperFundGetRequest($id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel'; + $request = $this->auEssSelfManagedSuperFundGetRequest($id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9389,7 +10483,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9400,18 +10494,21 @@ function ($exception) { * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSelfManagedSuperFundGetRequest($id, $employee_id) + public function auEssSelfManagedSuperFundGetRequest($id, $employee_id, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGet'][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 auEssSelfManagedSuperFundGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9419,6 +10516,7 @@ protected function auEssSelfManagedSuperFundGetRequest($id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/selfmanagedsuperfund/{id}'; $formParams = []; $queryParams = []; @@ -9427,6 +10525,7 @@ protected function auEssSelfManagedSuperFundGetRequest($id, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -9444,53 +10543,35 @@ protected function auEssSelfManagedSuperFundGetRequest($id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9511,10 +10592,11 @@ protected function auEssSelfManagedSuperFundGetRequest($id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9526,18 +10608,20 @@ protected function auEssSelfManagedSuperFundGetRequest($id, $employee_id) * List Self Managed Super Funds * * @param string $employee_id employee_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGetFunds'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SelfManagedSuperFundModel[] + * @return \OpenAPI\Client\Model\SelfManagedSuperFundModel[] */ - public function auEssSelfManagedSuperFundGetFunds($employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEssSelfManagedSuperFundGetFunds($employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGetFunds'][0]) { - list($response) = $this->auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -9547,19 +10631,20 @@ public function auEssSelfManagedSuperFundGetFunds($employee_id, $filter = null, * List Self Managed Super Funds * * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGetFunds'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SelfManagedSuperFundModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SelfManagedSuperFundModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGetFunds'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel[]'; - $request = $this->auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filter, $orderby, $top, $skip); + $request = $this->auEssSelfManagedSuperFundGetFundsRequest($employee_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -9568,9 +10653,16 @@ public function auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $fil } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9581,19 +10673,37 @@ public function auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $fil sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9610,7 +10720,7 @@ public function auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $fil case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SelfManagedSuperFundModel[]', + '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9626,17 +10736,19 @@ public function auEssSelfManagedSuperFundGetFundsWithHttpInfo($employee_id, $fil * List Self Managed Super Funds * * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundGetFundsAsync($employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEssSelfManagedSuperFundGetFundsAsync($employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGetFunds'][0]) { - return $this->auEssSelfManagedSuperFundGetFundsAsyncWithHttpInfo($employee_id, $filter, $orderby, $top, $skip) + return $this->auEssSelfManagedSuperFundGetFundsAsyncWithHttpInfo($employee_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -9650,28 +10762,29 @@ function ($response) { * List Self Managed Super Funds * * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundGetFundsAsyncWithHttpInfo($employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEssSelfManagedSuperFundGetFundsAsyncWithHttpInfo($employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGetFunds'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel[]'; - $request = $this->auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]'; + $request = $this->auEssSelfManagedSuperFundGetFundsRequest($employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9694,7 +10807,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9704,16 +10817,19 @@ function ($exception) { * Create request for operation 'auEssSelfManagedSuperFundGetFunds' * * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auEssSelfManagedSuperFundGetFunds'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9721,6 +10837,12 @@ protected function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filte ); } + + + + + + $resourcePath = '/api/v2/ess/{employeeId}/selfmanagedsuperfund'; $formParams = []; $queryParams = []; @@ -9729,20 +10851,45 @@ protected function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filte $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -9754,53 +10901,35 @@ protected function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filte ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9821,10 +10950,11 @@ protected function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filte $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9835,16 +10965,17 @@ protected function auEssSelfManagedSuperFundGetFundsRequest($employee_id, $filte * * Create ESS Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund fund (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssSelfManagedSuperFundPost($fund, $employee_id) + public function auEssSelfManagedSuperFundPost($employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPost'][0]) { - $this->auEssSelfManagedSuperFundPostWithHttpInfo($fund, $employee_id); + $this->auEssSelfManagedSuperFundPostWithHttpInfo($employee_id, $fund, $contentType); } /** @@ -9852,17 +10983,17 @@ public function auEssSelfManagedSuperFundPost($fund, $employee_id) * * Create ESS Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSelfManagedSuperFundPostWithHttpInfo($fund, $employee_id) + public function auEssSelfManagedSuperFundPostWithHttpInfo($employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPost'][0]) { - $returnType = ''; - $request = $this->auEssSelfManagedSuperFundPostRequest($fund, $employee_id); + $request = $this->auEssSelfManagedSuperFundPostRequest($employee_id, $fund, $contentType); try { $options = $this->createHttpClientOption(); @@ -9871,9 +11002,16 @@ public function auEssSelfManagedSuperFundPostWithHttpInfo($fund, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9884,11 +11022,11 @@ public function auEssSelfManagedSuperFundPostWithHttpInfo($fund, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -9906,15 +11044,16 @@ public function auEssSelfManagedSuperFundPostWithHttpInfo($fund, $employee_id) * * Create ESS Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundPostAsync($fund, $employee_id) + public function auEssSelfManagedSuperFundPostAsync($employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPost'][0]) { - return $this->auEssSelfManagedSuperFundPostAsyncWithHttpInfo($fund, $employee_id) + return $this->auEssSelfManagedSuperFundPostAsyncWithHttpInfo($employee_id, $fund, $contentType) ->then( function ($response) { return $response[0]; @@ -9927,16 +11066,17 @@ function ($response) { * * Create ESS Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundPostAsyncWithHttpInfo($fund, $employee_id) + public function auEssSelfManagedSuperFundPostAsyncWithHttpInfo($employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPost'][0]) { $returnType = ''; - $request = $this->auEssSelfManagedSuperFundPostRequest($fund, $employee_id); + $request = $this->auEssSelfManagedSuperFundPostRequest($employee_id, $fund, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9955,7 +11095,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9964,20 +11104,16 @@ function ($exception) { /** * Create request for operation 'auEssSelfManagedSuperFundPost' * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSelfManagedSuperFundPostRequest($fund, $employee_id) + public function auEssSelfManagedSuperFundPostRequest($employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPost'][0]) { - // verify the required parameter 'fund' is set - if ($fund === null || (is_array($fund) && count($fund) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $fund when calling auEssSelfManagedSuperFundPost' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -9985,6 +11121,14 @@ protected function auEssSelfManagedSuperFundPostRequest($fund, $employee_id) ); } + // verify the required parameter 'fund' is set + if ($fund === null || (is_array($fund) && count($fund) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $fund when calling auEssSelfManagedSuperFundPost' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/selfmanagedsuperfund'; $formParams = []; $queryParams = []; @@ -9993,6 +11137,7 @@ protected function auEssSelfManagedSuperFundPostRequest($fund, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -10002,56 +11147,42 @@ protected function auEssSelfManagedSuperFundPostRequest($fund, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($fund)) { - $_tempBody = $fund; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($fund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fund)); + } else { + $httpBody = $fund; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10072,10 +11203,11 @@ protected function auEssSelfManagedSuperFundPostRequest($fund, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10087,16 +11219,17 @@ protected function auEssSelfManagedSuperFundPostRequest($fund, $employee_id) * Update ESS Self Managed Super Fund * * @param int $id id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund fund (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssSelfManagedSuperFundPut($id, $fund, $employee_id) + public function auEssSelfManagedSuperFundPut($id, $employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPut'][0]) { - $this->auEssSelfManagedSuperFundPutWithHttpInfo($id, $fund, $employee_id); + $this->auEssSelfManagedSuperFundPutWithHttpInfo($id, $employee_id, $fund, $contentType); } /** @@ -10105,17 +11238,17 @@ public function auEssSelfManagedSuperFundPut($id, $fund, $employee_id) * Update ESS Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSelfManagedSuperFundPutWithHttpInfo($id, $fund, $employee_id) + public function auEssSelfManagedSuperFundPutWithHttpInfo($id, $employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPut'][0]) { - $returnType = ''; - $request = $this->auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id); + $request = $this->auEssSelfManagedSuperFundPutRequest($id, $employee_id, $fund, $contentType); try { $options = $this->createHttpClientOption(); @@ -10124,9 +11257,16 @@ public function auEssSelfManagedSuperFundPutWithHttpInfo($id, $fund, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10137,11 +11277,11 @@ public function auEssSelfManagedSuperFundPutWithHttpInfo($id, $fund, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -10160,15 +11300,16 @@ public function auEssSelfManagedSuperFundPutWithHttpInfo($id, $fund, $employee_i * Update ESS Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundPutAsync($id, $fund, $employee_id) + public function auEssSelfManagedSuperFundPutAsync($id, $employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPut'][0]) { - return $this->auEssSelfManagedSuperFundPutAsyncWithHttpInfo($id, $fund, $employee_id) + return $this->auEssSelfManagedSuperFundPutAsyncWithHttpInfo($id, $employee_id, $fund, $contentType) ->then( function ($response) { return $response[0]; @@ -10182,16 +11323,17 @@ function ($response) { * Update ESS Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSelfManagedSuperFundPutAsyncWithHttpInfo($id, $fund, $employee_id) + public function auEssSelfManagedSuperFundPutAsyncWithHttpInfo($id, $employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPut'][0]) { $returnType = ''; - $request = $this->auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id); + $request = $this->auEssSelfManagedSuperFundPutRequest($id, $employee_id, $fund, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10210,7 +11352,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10220,26 +11362,23 @@ function ($exception) { * Create request for operation 'auEssSelfManagedSuperFundPut' * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id) + public function auEssSelfManagedSuperFundPutRequest($id, $employee_id, $fund, string $contentType = self::contentTypes['auEssSelfManagedSuperFundPut'][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 auEssSelfManagedSuperFundPut' ); } - // verify the required parameter 'fund' is set - if ($fund === null || (is_array($fund) && count($fund) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $fund when calling auEssSelfManagedSuperFundPut' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -10247,6 +11386,14 @@ protected function auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id) ); } + // verify the required parameter 'fund' is set + if ($fund === null || (is_array($fund) && count($fund) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $fund when calling auEssSelfManagedSuperFundPut' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/selfmanagedsuperfund/{id}'; $formParams = []; $queryParams = []; @@ -10255,6 +11402,7 @@ protected function auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -10272,56 +11420,42 @@ protected function auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($fund)) { - $_tempBody = $fund; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($fund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fund)); + } else { + $httpBody = $fund; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10342,10 +11476,11 @@ protected function auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10358,14 +11493,15 @@ protected function auEssSelfManagedSuperFundPutRequest($id, $fund, $employee_id) * * @param int $shift_id shift_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuAcceptRosterShiftResponseModel + * @return \OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel */ - public function auEssShiftAcceptRosterShift($shift_id, $employee_id) + public function auEssShiftAcceptRosterShift($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShift'][0]) { - list($response) = $this->auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id); + list($response) = $this->auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id, $contentType); return $response; } @@ -10376,15 +11512,15 @@ public function auEssShiftAcceptRosterShift($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuAcceptRosterShiftResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuAcceptRosterShiftResponseModel'; - $request = $this->auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id); + $request = $this->auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -10393,9 +11529,16 @@ public function auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10406,19 +11549,37 @@ public function auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10435,7 +11596,7 @@ public function auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuAcceptRosterShiftResponseModel', + '\OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10452,13 +11613,14 @@ public function auEssShiftAcceptRosterShiftWithHttpInfo($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftAsync($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftAsync($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShift'][0]) { - return $this->auEssShiftAcceptRosterShiftAsyncWithHttpInfo($shift_id, $employee_id) + return $this->auEssShiftAcceptRosterShiftAsyncWithHttpInfo($shift_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -10473,24 +11635,24 @@ function ($response) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftAsyncWithHttpInfo($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftAsyncWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuAcceptRosterShiftResponseModel'; - $request = $this->auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuAcceptRosterShiftResponseModel'; + $request = $this->auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10513,7 +11675,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10524,18 +11686,21 @@ function ($exception) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShift'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftAcceptRosterShift' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -10543,6 +11708,7 @@ protected function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}/accept'; $formParams = []; $queryParams = []; @@ -10551,6 +11717,7 @@ protected function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id) $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -10568,53 +11735,35 @@ protected function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10635,10 +11784,11 @@ protected function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10651,14 +11801,15 @@ protected function auEssShiftAcceptRosterShiftRequest($shift_id, $employee_id) * * @param int $shift_id shift_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssRosterShiftActionResponse */ - public function auEssShiftAcceptRosterShiftSwap($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftSwap($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwap'][0]) { - list($response) = $this->auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee_id); + list($response) = $this->auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee_id, $contentType); return $response; } @@ -10669,15 +11820,15 @@ public function auEssShiftAcceptRosterShiftSwap($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_id); + $request = $this->auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -10686,9 +11837,16 @@ public function auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10699,19 +11857,37 @@ public function auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10728,7 +11904,7 @@ public function auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10745,13 +11921,14 @@ public function auEssShiftAcceptRosterShiftSwapWithHttpInfo($shift_id, $employee * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftSwapAsync($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftSwapAsync($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwap'][0]) { - return $this->auEssShiftAcceptRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + return $this->auEssShiftAcceptRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -10766,24 +11943,24 @@ function ($response) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; + $request = $this->auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10806,7 +11983,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10817,18 +11994,21 @@ function ($exception) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_id) + public function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwap'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftAcceptRosterShiftSwap' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -10836,6 +12016,7 @@ protected function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_i ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}/swap/accept'; $formParams = []; $queryParams = []; @@ -10844,6 +12025,7 @@ protected function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_i $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -10861,53 +12043,35 @@ protected function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10928,10 +12092,11 @@ protected function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10942,16 +12107,17 @@ protected function auEssShiftAcceptRosterShiftSwapRequest($shift_id, $employee_i * * Bulk Accept Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwaps'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssBulkRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse */ - public function auEssShiftAcceptRosterShiftSwaps($model, $employee_id) + public function auEssShiftAcceptRosterShiftSwaps($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwaps'][0]) { - list($response) = $this->auEssShiftAcceptRosterShiftSwapsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssShiftAcceptRosterShiftSwapsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -10960,17 +12126,17 @@ public function auEssShiftAcceptRosterShiftSwaps($model, $employee_id) * * Bulk Accept Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwaps'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssBulkRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftAcceptRosterShiftSwapsWithHttpInfo($model, $employee_id) + public function auEssShiftAcceptRosterShiftSwapsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwaps'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse'; - $request = $this->auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id); + $request = $this->auEssShiftAcceptRosterShiftSwapsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -10979,9 +12145,16 @@ public function auEssShiftAcceptRosterShiftSwapsWithHttpInfo($model, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10992,19 +12165,37 @@ public function auEssShiftAcceptRosterShiftSwapsWithHttpInfo($model, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11021,7 +12212,7 @@ public function auEssShiftAcceptRosterShiftSwapsWithHttpInfo($model, $employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11036,15 +12227,16 @@ public function auEssShiftAcceptRosterShiftSwapsWithHttpInfo($model, $employee_i * * Bulk Accept Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftSwapsAsync($model, $employee_id) + public function auEssShiftAcceptRosterShiftSwapsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwaps'][0]) { - return $this->auEssShiftAcceptRosterShiftSwapsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssShiftAcceptRosterShiftSwapsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -11057,26 +12249,26 @@ function ($response) { * * Bulk Accept Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftSwapsAsyncWithHttpInfo($model, $employee_id) + public function auEssShiftAcceptRosterShiftSwapsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwaps'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse'; - $request = $this->auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse'; + $request = $this->auEssShiftAcceptRosterShiftSwapsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11099,7 +12291,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11108,20 +12300,16 @@ function ($exception) { /** * Create request for operation 'auEssShiftAcceptRosterShiftSwaps' * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id) + public function auEssShiftAcceptRosterShiftSwapsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShiftSwaps'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftAcceptRosterShiftSwaps' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -11129,6 +12317,14 @@ protected function auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftAcceptRosterShiftSwaps' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/swap/accept'; $formParams = []; $queryParams = []; @@ -11137,6 +12333,7 @@ protected function auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -11146,56 +12343,42 @@ protected function auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11216,10 +12399,11 @@ protected function auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11230,16 +12414,17 @@ protected function auEssShiftAcceptRosterShiftSwapsRequest($model, $employee_id) * * Bulk Accept Roster Shifts * - * @param \Swagger\Client\Model\EssBulkAcceptRosterShiftsModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkAcceptRosterShiftsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuAcceptRosterShiftsResponseModel + * @return \OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel */ - public function auEssShiftAcceptRosterShifts($model, $employee_id) + public function auEssShiftAcceptRosterShifts($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShifts'][0]) { - list($response) = $this->auEssShiftAcceptRosterShiftsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssShiftAcceptRosterShiftsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -11248,17 +12433,17 @@ public function auEssShiftAcceptRosterShifts($model, $employee_id) * * Bulk Accept Roster Shifts * - * @param \Swagger\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuAcceptRosterShiftsResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftAcceptRosterShiftsWithHttpInfo($model, $employee_id) + public function auEssShiftAcceptRosterShiftsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuAcceptRosterShiftsResponseModel'; - $request = $this->auEssShiftAcceptRosterShiftsRequest($model, $employee_id); + $request = $this->auEssShiftAcceptRosterShiftsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -11267,9 +12452,16 @@ public function auEssShiftAcceptRosterShiftsWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11280,19 +12472,37 @@ public function auEssShiftAcceptRosterShiftsWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11309,7 +12519,7 @@ public function auEssShiftAcceptRosterShiftsWithHttpInfo($model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuAcceptRosterShiftsResponseModel', + '\OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11324,15 +12534,16 @@ public function auEssShiftAcceptRosterShiftsWithHttpInfo($model, $employee_id) * * Bulk Accept Roster Shifts * - * @param \Swagger\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftsAsync($model, $employee_id) + public function auEssShiftAcceptRosterShiftsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShifts'][0]) { - return $this->auEssShiftAcceptRosterShiftsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssShiftAcceptRosterShiftsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -11345,26 +12556,26 @@ function ($response) { * * Bulk Accept Roster Shifts * - * @param \Swagger\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftAcceptRosterShiftsAsyncWithHttpInfo($model, $employee_id) + public function auEssShiftAcceptRosterShiftsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuAcceptRosterShiftsResponseModel'; - $request = $this->auEssShiftAcceptRosterShiftsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuAcceptRosterShiftsResponseModel'; + $request = $this->auEssShiftAcceptRosterShiftsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11387,7 +12598,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11396,20 +12607,16 @@ function ($exception) { /** * Create request for operation 'auEssShiftAcceptRosterShifts' * - * @param \Swagger\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkAcceptRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftAcceptRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftAcceptRosterShiftsRequest($model, $employee_id) + public function auEssShiftAcceptRosterShiftsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssShiftAcceptRosterShifts'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftAcceptRosterShifts' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -11417,6 +12624,14 @@ protected function auEssShiftAcceptRosterShiftsRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftAcceptRosterShifts' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/accept'; $formParams = []; $queryParams = []; @@ -11425,6 +12640,7 @@ protected function auEssShiftAcceptRosterShiftsRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -11434,56 +12650,42 @@ protected function auEssShiftAcceptRosterShiftsRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11504,10 +12706,11 @@ protected function auEssShiftAcceptRosterShiftsRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11520,14 +12723,15 @@ protected function auEssShiftAcceptRosterShiftsRequest($model, $employee_id) * * @param int $shift_id shift_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssRosterShiftActionResponse */ - public function auEssShiftCancelRosterShiftSwap($shift_id, $employee_id) + public function auEssShiftCancelRosterShiftSwap($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwap'][0]) { - list($response) = $this->auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee_id); + list($response) = $this->auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee_id, $contentType); return $response; } @@ -11538,15 +12742,15 @@ public function auEssShiftCancelRosterShiftSwap($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee_id) + public function auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_id); + $request = $this->auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -11555,9 +12759,16 @@ public function auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11568,19 +12779,37 @@ public function auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11597,7 +12826,7 @@ public function auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11614,13 +12843,14 @@ public function auEssShiftCancelRosterShiftSwapWithHttpInfo($shift_id, $employee * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftCancelRosterShiftSwapAsync($shift_id, $employee_id) + public function auEssShiftCancelRosterShiftSwapAsync($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwap'][0]) { - return $this->auEssShiftCancelRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + return $this->auEssShiftCancelRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -11635,24 +12865,24 @@ function ($response) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftCancelRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + public function auEssShiftCancelRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; + $request = $this->auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11675,7 +12905,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11686,18 +12916,21 @@ function ($exception) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_id) + public function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwap'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftCancelRosterShiftSwap' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -11705,6 +12938,7 @@ protected function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_i ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}/swap/cancel'; $formParams = []; $queryParams = []; @@ -11713,6 +12947,7 @@ protected function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_i $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -11730,53 +12965,35 @@ protected function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11797,10 +13014,11 @@ protected function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11811,16 +13029,17 @@ protected function auEssShiftCancelRosterShiftSwapRequest($shift_id, $employee_i * * Bulk Cancel Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwaps'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssBulkRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse */ - public function auEssShiftCancelRosterShiftSwaps($model, $employee_id) + public function auEssShiftCancelRosterShiftSwaps($employee_id, $model, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwaps'][0]) { - list($response) = $this->auEssShiftCancelRosterShiftSwapsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssShiftCancelRosterShiftSwapsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -11829,17 +13048,17 @@ public function auEssShiftCancelRosterShiftSwaps($model, $employee_id) * * Bulk Cancel Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwaps'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssBulkRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftCancelRosterShiftSwapsWithHttpInfo($model, $employee_id) + public function auEssShiftCancelRosterShiftSwapsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwaps'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse'; - $request = $this->auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id); + $request = $this->auEssShiftCancelRosterShiftSwapsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -11848,9 +13067,16 @@ public function auEssShiftCancelRosterShiftSwapsWithHttpInfo($model, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11861,19 +13087,37 @@ public function auEssShiftCancelRosterShiftSwapsWithHttpInfo($model, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11890,7 +13134,7 @@ public function auEssShiftCancelRosterShiftSwapsWithHttpInfo($model, $employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11905,15 +13149,16 @@ public function auEssShiftCancelRosterShiftSwapsWithHttpInfo($model, $employee_i * * Bulk Cancel Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftCancelRosterShiftSwapsAsync($model, $employee_id) + public function auEssShiftCancelRosterShiftSwapsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwaps'][0]) { - return $this->auEssShiftCancelRosterShiftSwapsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssShiftCancelRosterShiftSwapsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -11926,26 +13171,26 @@ function ($response) { * * Bulk Cancel Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftCancelRosterShiftSwapsAsyncWithHttpInfo($model, $employee_id) + public function auEssShiftCancelRosterShiftSwapsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwaps'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse'; - $request = $this->auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse'; + $request = $this->auEssShiftCancelRosterShiftSwapsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11968,7 +13213,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11977,20 +13222,16 @@ function ($exception) { /** * Create request for operation 'auEssShiftCancelRosterShiftSwaps' * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftCancelRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id) + public function auEssShiftCancelRosterShiftSwapsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssShiftCancelRosterShiftSwaps'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftCancelRosterShiftSwaps' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -11998,6 +13239,14 @@ protected function auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftCancelRosterShiftSwaps' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/swap/cancel'; $formParams = []; $queryParams = []; @@ -12006,6 +13255,7 @@ protected function auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -12015,56 +13265,42 @@ protected function auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12085,10 +13321,11 @@ protected function auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12100,16 +13337,17 @@ protected function auEssShiftCancelRosterShiftSwapsRequest($model, $employee_id) * Decline Roster Shift * * @param int $shift_id shift_id (required) - * @param \Swagger\Client\Model\EssDeclineRosterShiftModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssDeclineRosterShiftModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssRosterShiftCountModel + * @return \OpenAPI\Client\Model\EssRosterShiftCountModel */ - public function auEssShiftDeclineRosterShift($shift_id, $model, $employee_id) + public function auEssShiftDeclineRosterShift($shift_id, $employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShift'][0]) { - list($response) = $this->auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $model, $employee_id); + list($response) = $this->auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $employee_id, $model, $contentType); return $response; } @@ -12119,17 +13357,17 @@ public function auEssShiftDeclineRosterShift($shift_id, $model, $employee_id) * Decline Roster Shift * * @param int $shift_id (required) - * @param \Swagger\Client\Model\EssDeclineRosterShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssDeclineRosterShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssRosterShiftCountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssRosterShiftCountModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $model, $employee_id) + public function auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\EssRosterShiftCountModel'; - $request = $this->auEssShiftDeclineRosterShiftRequest($shift_id, $model, $employee_id); + $request = $this->auEssShiftDeclineRosterShiftRequest($shift_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -12138,9 +13376,16 @@ public function auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $model, $emp } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12151,19 +13396,37 @@ public function auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $model, $emp sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssRosterShiftCountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssRosterShiftCountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssRosterShiftCountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssRosterShiftCountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12180,7 +13443,7 @@ public function auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $model, $emp case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssRosterShiftCountModel', + '\OpenAPI\Client\Model\EssRosterShiftCountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12196,15 +13459,16 @@ public function auEssShiftDeclineRosterShiftWithHttpInfo($shift_id, $model, $emp * Decline Roster Shift * * @param int $shift_id (required) - * @param \Swagger\Client\Model\EssDeclineRosterShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssDeclineRosterShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftAsync($shift_id, $model, $employee_id) + public function auEssShiftDeclineRosterShiftAsync($shift_id, $employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShift'][0]) { - return $this->auEssShiftDeclineRosterShiftAsyncWithHttpInfo($shift_id, $model, $employee_id) + return $this->auEssShiftDeclineRosterShiftAsyncWithHttpInfo($shift_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -12218,26 +13482,26 @@ function ($response) { * Decline Roster Shift * * @param int $shift_id (required) - * @param \Swagger\Client\Model\EssDeclineRosterShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssDeclineRosterShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftAsyncWithHttpInfo($shift_id, $model, $employee_id) + public function auEssShiftDeclineRosterShiftAsyncWithHttpInfo($shift_id, $employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\EssRosterShiftCountModel'; - $request = $this->auEssShiftDeclineRosterShiftRequest($shift_id, $model, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssRosterShiftCountModel'; + $request = $this->auEssShiftDeclineRosterShiftRequest($shift_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12260,7 +13524,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12270,26 +13534,23 @@ function ($exception) { * Create request for operation 'auEssShiftDeclineRosterShift' * * @param int $shift_id (required) - * @param \Swagger\Client\Model\EssDeclineRosterShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssDeclineRosterShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftDeclineRosterShiftRequest($shift_id, $model, $employee_id) + public function auEssShiftDeclineRosterShiftRequest($shift_id, $employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShift'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftDeclineRosterShift' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftDeclineRosterShift' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -12297,6 +13558,14 @@ protected function auEssShiftDeclineRosterShiftRequest($shift_id, $model, $emplo ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftDeclineRosterShift' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}/decline'; $formParams = []; $queryParams = []; @@ -12305,6 +13574,7 @@ protected function auEssShiftDeclineRosterShiftRequest($shift_id, $model, $emplo $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -12322,56 +13592,42 @@ protected function auEssShiftDeclineRosterShiftRequest($shift_id, $model, $emplo ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12392,10 +13648,11 @@ protected function auEssShiftDeclineRosterShiftRequest($shift_id, $model, $emplo $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12408,14 +13665,15 @@ protected function auEssShiftDeclineRosterShiftRequest($shift_id, $model, $emplo * * @param int $shift_id shift_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssRosterShiftActionResponse */ - public function auEssShiftDeclineRosterShiftSwap($shift_id, $employee_id) + public function auEssShiftDeclineRosterShiftSwap($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwap'][0]) { - list($response) = $this->auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employee_id); + list($response) = $this->auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employee_id, $contentType); return $response; } @@ -12426,15 +13684,15 @@ public function auEssShiftDeclineRosterShiftSwap($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employee_id) + public function auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_id); + $request = $this->auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -12443,9 +13701,16 @@ public function auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12456,19 +13721,37 @@ public function auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12485,7 +13768,7 @@ public function auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12502,13 +13785,14 @@ public function auEssShiftDeclineRosterShiftSwapWithHttpInfo($shift_id, $employe * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftSwapAsync($shift_id, $employee_id) + public function auEssShiftDeclineRosterShiftSwapAsync($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwap'][0]) { - return $this->auEssShiftDeclineRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + return $this->auEssShiftDeclineRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -12523,24 +13807,24 @@ function ($response) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + public function auEssShiftDeclineRosterShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; + $request = $this->auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12563,7 +13847,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12574,18 +13858,21 @@ function ($exception) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_id) + public function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwap'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftDeclineRosterShiftSwap' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -12593,6 +13880,7 @@ protected function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_ ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}/swap/decline'; $formParams = []; $queryParams = []; @@ -12601,6 +13889,7 @@ protected function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_ $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -12618,53 +13907,35 @@ protected function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12685,10 +13956,11 @@ protected function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12699,16 +13971,17 @@ protected function auEssShiftDeclineRosterShiftSwapRequest($shift_id, $employee_ * * Bulk Decline Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwaps'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssBulkRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse */ - public function auEssShiftDeclineRosterShiftSwaps($model, $employee_id) + public function auEssShiftDeclineRosterShiftSwaps($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwaps'][0]) { - list($response) = $this->auEssShiftDeclineRosterShiftSwapsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssShiftDeclineRosterShiftSwapsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -12717,17 +13990,17 @@ public function auEssShiftDeclineRosterShiftSwaps($model, $employee_id) * * Bulk Decline Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwaps'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssBulkRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftDeclineRosterShiftSwapsWithHttpInfo($model, $employee_id) + public function auEssShiftDeclineRosterShiftSwapsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwaps'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse'; - $request = $this->auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id); + $request = $this->auEssShiftDeclineRosterShiftSwapsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -12736,9 +14009,16 @@ public function auEssShiftDeclineRosterShiftSwapsWithHttpInfo($model, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12749,19 +14029,37 @@ public function auEssShiftDeclineRosterShiftSwapsWithHttpInfo($model, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12778,7 +14076,7 @@ public function auEssShiftDeclineRosterShiftSwapsWithHttpInfo($model, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12793,15 +14091,16 @@ public function auEssShiftDeclineRosterShiftSwapsWithHttpInfo($model, $employee_ * * Bulk Decline Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftSwapsAsync($model, $employee_id) + public function auEssShiftDeclineRosterShiftSwapsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwaps'][0]) { - return $this->auEssShiftDeclineRosterShiftSwapsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssShiftDeclineRosterShiftSwapsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -12814,26 +14113,26 @@ function ($response) { * * Bulk Decline Roster Shift Swaps * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftSwapsAsyncWithHttpInfo($model, $employee_id) + public function auEssShiftDeclineRosterShiftSwapsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwaps'][0]) { - $returnType = '\Swagger\Client\Model\AuEssBulkRosterShiftActionResponse'; - $request = $this->auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssBulkRosterShiftActionResponse'; + $request = $this->auEssShiftDeclineRosterShiftSwapsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12856,7 +14155,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12865,20 +14164,16 @@ function ($exception) { /** * Create request for operation 'auEssShiftDeclineRosterShiftSwaps' * - * @param \Swagger\Client\Model\EssBulkRosterShiftSwapModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkRosterShiftSwapModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShiftSwaps'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id) + public function auEssShiftDeclineRosterShiftSwapsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShiftSwaps'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftDeclineRosterShiftSwaps' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -12886,6 +14181,14 @@ protected function auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftDeclineRosterShiftSwaps' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/swap/decline'; $formParams = []; $queryParams = []; @@ -12894,6 +14197,7 @@ protected function auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -12903,56 +14207,42 @@ protected function auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12973,10 +14263,11 @@ protected function auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12987,16 +14278,17 @@ protected function auEssShiftDeclineRosterShiftSwapsRequest($model, $employee_id * * Bulk Decline Roster Shifts * - * @param \Swagger\Client\Model\EssBulkDeclineRosterShiftsModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkDeclineRosterShiftsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssRosterShiftCountModel + * @return \OpenAPI\Client\Model\EssRosterShiftCountModel */ - public function auEssShiftDeclineRosterShifts($model, $employee_id) + public function auEssShiftDeclineRosterShifts($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShifts'][0]) { - list($response) = $this->auEssShiftDeclineRosterShiftsWithHttpInfo($model, $employee_id); + list($response) = $this->auEssShiftDeclineRosterShiftsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -13005,17 +14297,17 @@ public function auEssShiftDeclineRosterShifts($model, $employee_id) * * Bulk Decline Roster Shifts * - * @param \Swagger\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssRosterShiftCountModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssRosterShiftCountModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftDeclineRosterShiftsWithHttpInfo($model, $employee_id) + public function auEssShiftDeclineRosterShiftsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\EssRosterShiftCountModel'; - $request = $this->auEssShiftDeclineRosterShiftsRequest($model, $employee_id); + $request = $this->auEssShiftDeclineRosterShiftsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -13024,9 +14316,16 @@ public function auEssShiftDeclineRosterShiftsWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13037,19 +14336,37 @@ public function auEssShiftDeclineRosterShiftsWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssRosterShiftCountModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssRosterShiftCountModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssRosterShiftCountModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssRosterShiftCountModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13066,7 +14383,7 @@ public function auEssShiftDeclineRosterShiftsWithHttpInfo($model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssRosterShiftCountModel', + '\OpenAPI\Client\Model\EssRosterShiftCountModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13081,15 +14398,16 @@ public function auEssShiftDeclineRosterShiftsWithHttpInfo($model, $employee_id) * * Bulk Decline Roster Shifts * - * @param \Swagger\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftsAsync($model, $employee_id) + public function auEssShiftDeclineRosterShiftsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShifts'][0]) { - return $this->auEssShiftDeclineRosterShiftsAsyncWithHttpInfo($model, $employee_id) + return $this->auEssShiftDeclineRosterShiftsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -13102,26 +14420,26 @@ function ($response) { * * Bulk Decline Roster Shifts * - * @param \Swagger\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftDeclineRosterShiftsAsyncWithHttpInfo($model, $employee_id) + public function auEssShiftDeclineRosterShiftsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\EssRosterShiftCountModel'; - $request = $this->auEssShiftDeclineRosterShiftsRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssRosterShiftCountModel'; + $request = $this->auEssShiftDeclineRosterShiftsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13144,7 +14462,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13153,20 +14471,16 @@ function ($exception) { /** * Create request for operation 'auEssShiftDeclineRosterShifts' * - * @param \Swagger\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssBulkDeclineRosterShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftDeclineRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftDeclineRosterShiftsRequest($model, $employee_id) + public function auEssShiftDeclineRosterShiftsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssShiftDeclineRosterShifts'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftDeclineRosterShifts' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -13174,6 +14488,14 @@ protected function auEssShiftDeclineRosterShiftsRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftDeclineRosterShifts' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/decline'; $formParams = []; $queryParams = []; @@ -13182,6 +14504,7 @@ protected function auEssShiftDeclineRosterShiftsRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -13191,56 +14514,42 @@ protected function auEssShiftDeclineRosterShiftsRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13261,10 +14570,11 @@ protected function auEssShiftDeclineRosterShiftsRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13277,14 +14587,15 @@ protected function auEssShiftDeclineRosterShiftsRequest($model, $employee_id) * * @param int $shift_id shift_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssShiftSwapCandidate[] + * @return \OpenAPI\Client\Model\EssShiftSwapCandidate[] */ - public function auEssShiftEmployeesEligibleForShiftSwap($shift_id, $employee_id) + public function auEssShiftEmployeesEligibleForShiftSwap($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'][0]) { - list($response) = $this->auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $employee_id); + list($response) = $this->auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $employee_id, $contentType); return $response; } @@ -13295,15 +14606,15 @@ public function auEssShiftEmployeesEligibleForShiftSwap($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssShiftSwapCandidate[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssShiftSwapCandidate[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $employee_id) + public function auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\EssShiftSwapCandidate[]'; - $request = $this->auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $employee_id); + $request = $this->auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13312,9 +14623,16 @@ public function auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13325,19 +14643,37 @@ public function auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssShiftSwapCandidate[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssShiftSwapCandidate[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssShiftSwapCandidate[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssShiftSwapCandidate[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13354,7 +14690,7 @@ public function auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssShiftSwapCandidate[]', + '\OpenAPI\Client\Model\EssShiftSwapCandidate[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13371,13 +14707,14 @@ public function auEssShiftEmployeesEligibleForShiftSwapWithHttpInfo($shift_id, $ * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftEmployeesEligibleForShiftSwapAsync($shift_id, $employee_id) + public function auEssShiftEmployeesEligibleForShiftSwapAsync($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'][0]) { - return $this->auEssShiftEmployeesEligibleForShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + return $this->auEssShiftEmployeesEligibleForShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13392,24 +14729,24 @@ function ($response) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftEmployeesEligibleForShiftSwapAsyncWithHttpInfo($shift_id, $employee_id) + public function auEssShiftEmployeesEligibleForShiftSwapAsyncWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\EssShiftSwapCandidate[]'; - $request = $this->auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssShiftSwapCandidate[]'; + $request = $this->auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13432,7 +14769,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13443,18 +14780,21 @@ function ($exception) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $employee_id) + public function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftEmployeesEligibleForShiftSwap'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftEmployeesEligibleForShiftSwap' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -13462,6 +14802,7 @@ protected function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $em ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}/swap/candidates'; $formParams = []; $queryParams = []; @@ -13470,6 +14811,7 @@ protected function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $em $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -13487,53 +14829,35 @@ protected function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13554,10 +14878,11 @@ protected function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13570,14 +14895,15 @@ protected function auEssShiftEmployeesEligibleForShiftSwapRequest($shift_id, $em * * @param int $shift_id shift_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftModel + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel */ - public function auEssShiftGetShift($shift_id, $employee_id) + public function auEssShiftGetShift($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShift'][0]) { - list($response) = $this->auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id); + list($response) = $this->auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id, $contentType); return $response; } @@ -13588,15 +14914,15 @@ public function auEssShiftGetShift($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id) + public function auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShift'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel'; - $request = $this->auEssShiftGetShiftRequest($shift_id, $employee_id); + $request = $this->auEssShiftGetShiftRequest($shift_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13605,9 +14931,16 @@ public function auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13618,19 +14951,37 @@ public function auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13647,7 +14998,7 @@ public function auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftModel', + '\OpenAPI\Client\Model\AuEssRosterShiftModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13664,13 +15015,14 @@ public function auEssShiftGetShiftWithHttpInfo($shift_id, $employee_id) * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftGetShiftAsync($shift_id, $employee_id) + public function auEssShiftGetShiftAsync($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShift'][0]) { - return $this->auEssShiftGetShiftAsyncWithHttpInfo($shift_id, $employee_id) + return $this->auEssShiftGetShiftAsyncWithHttpInfo($shift_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13685,24 +15037,24 @@ function ($response) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftGetShiftAsyncWithHttpInfo($shift_id, $employee_id) + public function auEssShiftGetShiftAsyncWithHttpInfo($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShift'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel'; - $request = $this->auEssShiftGetShiftRequest($shift_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel'; + $request = $this->auEssShiftGetShiftRequest($shift_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13725,7 +15077,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13736,18 +15088,21 @@ function ($exception) { * * @param int $shift_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftGetShiftRequest($shift_id, $employee_id) + public function auEssShiftGetShiftRequest($shift_id, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShift'][0]) { + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssShiftGetShift' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -13755,6 +15110,7 @@ protected function auEssShiftGetShiftRequest($shift_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/{shiftId}'; $formParams = []; $queryParams = []; @@ -13763,6 +15119,7 @@ protected function auEssShiftGetShiftRequest($shift_id, $employee_id) $multipart = false; + // path params if ($shift_id !== null) { $resourcePath = str_replace( @@ -13780,53 +15137,35 @@ protected function auEssShiftGetShiftRequest($shift_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13847,10 +15186,11 @@ protected function auEssShiftGetShiftRequest($shift_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13864,14 +15204,15 @@ protected function auEssShiftGetShiftRequest($shift_id, $employee_id) * @param \DateTime $from_date from_date (required) * @param \DateTime $to_date to_date (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[] */ - public function auEssShiftGetShifts($from_date, $to_date, $employee_id) + public function auEssShiftGetShifts($from_date, $to_date, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShifts'][0]) { - list($response) = $this->auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_id); + list($response) = $this->auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_id, $contentType); return $response; } @@ -13883,15 +15224,15 @@ public function auEssShiftGetShifts($from_date, $to_date, $employee_id) * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_id) + public function auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id); + $request = $this->auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13900,9 +15241,16 @@ public function auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13913,19 +15261,37 @@ public function auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13942,7 +15308,7 @@ public function auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftModel[]', + '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13960,13 +15326,14 @@ public function auEssShiftGetShiftsWithHttpInfo($from_date, $to_date, $employee_ * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftGetShiftsAsync($from_date, $to_date, $employee_id) + public function auEssShiftGetShiftsAsync($from_date, $to_date, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShifts'][0]) { - return $this->auEssShiftGetShiftsAsyncWithHttpInfo($from_date, $to_date, $employee_id) + return $this->auEssShiftGetShiftsAsyncWithHttpInfo($from_date, $to_date, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13982,24 +15349,24 @@ function ($response) { * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftGetShiftsAsyncWithHttpInfo($from_date, $to_date, $employee_id) + public function auEssShiftGetShiftsAsyncWithHttpInfo($from_date, $to_date, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; + $request = $this->auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14022,7 +15389,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14034,24 +15401,28 @@ function ($exception) { * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftGetShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id) + public function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id, string $contentType = self::contentTypes['auEssShiftGetShifts'][0]) { + // verify the required parameter 'from_date' is set if ($from_date === null || (is_array($from_date) && count($from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $from_date when calling auEssShiftGetShifts' ); } + // verify the required parameter 'to_date' is set if ($to_date === null || (is_array($to_date) && count($to_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $to_date when calling auEssShiftGetShifts' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -14059,6 +15430,7 @@ protected function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift'; $formParams = []; $queryParams = []; @@ -14067,13 +15439,24 @@ protected function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -14084,53 +15467,35 @@ protected function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14151,10 +15516,11 @@ protected function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14167,14 +15533,15 @@ protected function auEssShiftGetShiftsRequest($from_date, $to_date, $employee_id * * @param \DateTime $local_time local_time (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOffRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftMatchingResultModel + * @return \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel */ - public function auEssShiftMatchingClockOffRosterShift($local_time, $employee_id) + public function auEssShiftMatchingClockOffRosterShift($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOffRosterShift'][0]) { - list($response) = $this->auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $employee_id); + list($response) = $this->auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $employee_id, $contentType); return $response; } @@ -14185,15 +15552,15 @@ public function auEssShiftMatchingClockOffRosterShift($local_time, $employee_id) * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOffRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $employee_id) + public function auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOffRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auEssShiftMatchingClockOffRosterShiftRequest($local_time, $employee_id); + $request = $this->auEssShiftMatchingClockOffRosterShiftRequest($local_time, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14202,9 +15569,16 @@ public function auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14215,19 +15589,37 @@ public function auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14244,7 +15636,7 @@ public function auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftMatchingResultModel', + '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14261,13 +15653,14 @@ public function auEssShiftMatchingClockOffRosterShiftWithHttpInfo($local_time, $ * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftMatchingClockOffRosterShiftAsync($local_time, $employee_id) + public function auEssShiftMatchingClockOffRosterShiftAsync($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOffRosterShift'][0]) { - return $this->auEssShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($local_time, $employee_id) + return $this->auEssShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($local_time, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14282,24 +15675,24 @@ function ($response) { * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($local_time, $employee_id) + public function auEssShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOffRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auEssShiftMatchingClockOffRosterShiftRequest($local_time, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; + $request = $this->auEssShiftMatchingClockOffRosterShiftRequest($local_time, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14322,7 +15715,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14333,18 +15726,21 @@ function ($exception) { * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $employee_id) + public function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOffRosterShift'][0]) { + // verify the required parameter 'local_time' is set if ($local_time === null || (is_array($local_time) && count($local_time) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $local_time when calling auEssShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -14352,6 +15748,7 @@ protected function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $em ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/matchingclockoff'; $formParams = []; $queryParams = []; @@ -14360,9 +15757,15 @@ protected function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $em $multipart = false; // query params - if ($local_time !== null) { - $queryParams['localTime'] = ObjectSerializer::toQueryValue($local_time); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $local_time, + 'localTime', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -14373,53 +15776,35 @@ protected function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14440,10 +15825,11 @@ protected function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14456,14 +15842,15 @@ protected function auEssShiftMatchingClockOffRosterShiftRequest($local_time, $em * * @param \DateTime $local_time local_time (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOnRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftMatchingResultModel + * @return \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel */ - public function auEssShiftMatchingClockOnRosterShift($local_time, $employee_id) + public function auEssShiftMatchingClockOnRosterShift($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOnRosterShift'][0]) { - list($response) = $this->auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $employee_id); + list($response) = $this->auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $employee_id, $contentType); return $response; } @@ -14474,15 +15861,15 @@ public function auEssShiftMatchingClockOnRosterShift($local_time, $employee_id) * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOnRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $employee_id) + public function auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOnRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auEssShiftMatchingClockOnRosterShiftRequest($local_time, $employee_id); + $request = $this->auEssShiftMatchingClockOnRosterShiftRequest($local_time, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14491,9 +15878,16 @@ public function auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14504,19 +15898,37 @@ public function auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14533,7 +15945,7 @@ public function auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $e case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftMatchingResultModel', + '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14550,13 +15962,14 @@ public function auEssShiftMatchingClockOnRosterShiftWithHttpInfo($local_time, $e * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftMatchingClockOnRosterShiftAsync($local_time, $employee_id) + public function auEssShiftMatchingClockOnRosterShiftAsync($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOnRosterShift'][0]) { - return $this->auEssShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($local_time, $employee_id) + return $this->auEssShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($local_time, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14571,24 +15984,24 @@ function ($response) { * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($local_time, $employee_id) + public function auEssShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOnRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auEssShiftMatchingClockOnRosterShiftRequest($local_time, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; + $request = $this->auEssShiftMatchingClockOnRosterShiftRequest($local_time, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14611,7 +16024,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14622,18 +16035,21 @@ function ($exception) { * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $employee_id) + public function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftMatchingClockOnRosterShift'][0]) { + // verify the required parameter 'local_time' is set if ($local_time === null || (is_array($local_time) && count($local_time) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $local_time when calling auEssShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -14641,6 +16057,7 @@ protected function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $emp ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/matchingclockon'; $formParams = []; $queryParams = []; @@ -14649,9 +16066,15 @@ protected function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $emp $multipart = false; // query params - if ($local_time !== null) { - $queryParams['localTime'] = ObjectSerializer::toQueryValue($local_time); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $local_time, + 'localTime', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -14662,53 +16085,35 @@ protected function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $emp ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14729,10 +16134,11 @@ protected function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $emp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14745,14 +16151,15 @@ protected function auEssShiftMatchingClockOnRosterShiftRequest($local_time, $emp * * @param \DateTime $local_time local_time (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftNearbyRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[] */ - public function auEssShiftNearbyRosterShifts($local_time, $employee_id) + public function auEssShiftNearbyRosterShifts($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftNearbyRosterShifts'][0]) { - list($response) = $this->auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_id); + list($response) = $this->auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_id, $contentType); return $response; } @@ -14763,15 +16170,15 @@ public function auEssShiftNearbyRosterShifts($local_time, $employee_id) * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftNearbyRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_id) + public function auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftNearbyRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id); + $request = $this->auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14780,9 +16187,16 @@ public function auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14793,19 +16207,37 @@ public function auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14822,7 +16254,7 @@ public function auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftModel[]', + '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14839,13 +16271,14 @@ public function auEssShiftNearbyRosterShiftsWithHttpInfo($local_time, $employee_ * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftNearbyRosterShiftsAsync($local_time, $employee_id) + public function auEssShiftNearbyRosterShiftsAsync($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftNearbyRosterShifts'][0]) { - return $this->auEssShiftNearbyRosterShiftsAsyncWithHttpInfo($local_time, $employee_id) + return $this->auEssShiftNearbyRosterShiftsAsyncWithHttpInfo($local_time, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14860,24 +16293,24 @@ function ($response) { * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftNearbyRosterShiftsAsyncWithHttpInfo($local_time, $employee_id) + public function auEssShiftNearbyRosterShiftsAsyncWithHttpInfo($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftNearbyRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; + $request = $this->auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14900,7 +16333,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14911,18 +16344,21 @@ function ($exception) { * * @param \DateTime $local_time (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id) + public function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id, string $contentType = self::contentTypes['auEssShiftNearbyRosterShifts'][0]) { + // verify the required parameter 'local_time' is set if ($local_time === null || (is_array($local_time) && count($local_time) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $local_time when calling auEssShiftNearbyRosterShifts' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -14930,6 +16366,7 @@ protected function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id ); } + $resourcePath = '/api/v2/ess/{employeeId}/shift/nearby'; $formParams = []; $queryParams = []; @@ -14938,9 +16375,15 @@ protected function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id $multipart = false; // query params - if ($local_time !== null) { - $queryParams['localTime'] = ObjectSerializer::toQueryValue($local_time); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $local_time, + 'localTime', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -14951,53 +16394,35 @@ protected function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15018,10 +16443,11 @@ protected function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15032,16 +16458,17 @@ protected function auEssShiftNearbyRosterShiftsRequest($local_time, $employee_id * * Propose Shift Swap * - * @param \Swagger\Client\Model\SwapShiftModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SwapShiftModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftProposeRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftActionResponse + * @return \OpenAPI\Client\Model\AuEssRosterShiftActionResponse */ - public function auEssShiftProposeRosterShiftSwap($model, $employee_id) + public function auEssShiftProposeRosterShiftSwap($employee_id, $model, string $contentType = self::contentTypes['auEssShiftProposeRosterShiftSwap'][0]) { - list($response) = $this->auEssShiftProposeRosterShiftSwapWithHttpInfo($model, $employee_id); + list($response) = $this->auEssShiftProposeRosterShiftSwapWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -15050,17 +16477,17 @@ public function auEssShiftProposeRosterShiftSwap($model, $employee_id) * * Propose Shift Swap * - * @param \Swagger\Client\Model\SwapShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SwapShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftProposeRosterShiftSwap'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftActionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auEssShiftProposeRosterShiftSwapWithHttpInfo($model, $employee_id) + public function auEssShiftProposeRosterShiftSwapWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftProposeRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftProposeRosterShiftSwapRequest($model, $employee_id); + $request = $this->auEssShiftProposeRosterShiftSwapRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -15069,9 +16496,16 @@ public function auEssShiftProposeRosterShiftSwapWithHttpInfo($model, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15082,19 +16516,37 @@ public function auEssShiftProposeRosterShiftSwapWithHttpInfo($model, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftActionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15111,7 +16563,7 @@ public function auEssShiftProposeRosterShiftSwapWithHttpInfo($model, $employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftActionResponse', + '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15126,15 +16578,16 @@ public function auEssShiftProposeRosterShiftSwapWithHttpInfo($model, $employee_i * * Propose Shift Swap * - * @param \Swagger\Client\Model\SwapShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SwapShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftProposeRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftProposeRosterShiftSwapAsync($model, $employee_id) + public function auEssShiftProposeRosterShiftSwapAsync($employee_id, $model, string $contentType = self::contentTypes['auEssShiftProposeRosterShiftSwap'][0]) { - return $this->auEssShiftProposeRosterShiftSwapAsyncWithHttpInfo($model, $employee_id) + return $this->auEssShiftProposeRosterShiftSwapAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -15147,26 +16600,26 @@ function ($response) { * * Propose Shift Swap * - * @param \Swagger\Client\Model\SwapShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SwapShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftProposeRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssShiftProposeRosterShiftSwapAsyncWithHttpInfo($model, $employee_id) + public function auEssShiftProposeRosterShiftSwapAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssShiftProposeRosterShiftSwap'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftActionResponse'; - $request = $this->auEssShiftProposeRosterShiftSwapRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftActionResponse'; + $request = $this->auEssShiftProposeRosterShiftSwapRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15189,7 +16642,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15198,20 +16651,16 @@ function ($exception) { /** * Create request for operation 'auEssShiftProposeRosterShiftSwap' * - * @param \Swagger\Client\Model\SwapShiftModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SwapShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssShiftProposeRosterShiftSwap'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssShiftProposeRosterShiftSwapRequest($model, $employee_id) + public function auEssShiftProposeRosterShiftSwapRequest($employee_id, $model, string $contentType = self::contentTypes['auEssShiftProposeRosterShiftSwap'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssShiftProposeRosterShiftSwap' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -15219,6 +16668,14 @@ protected function auEssShiftProposeRosterShiftSwapRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssShiftProposeRosterShiftSwap' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/shift/swap/propose'; $formParams = []; $queryParams = []; @@ -15227,6 +16684,7 @@ protected function auEssShiftProposeRosterShiftSwapRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -15236,56 +16694,42 @@ protected function auEssShiftProposeRosterShiftSwapRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15306,10 +16750,11 @@ protected function auEssShiftProposeRosterShiftSwapRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15322,14 +16767,15 @@ protected function auEssShiftProposeRosterShiftSwapRequest($model, $employee_id) * * @param int $superfund_id superfund_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SaveSuperFundResponseModel + * @return \OpenAPI\Client\Model\SaveSuperFundResponseModel */ - public function auEssSuperFundDelete($superfund_id, $employee_id) + public function auEssSuperFundDelete($superfund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundDelete'][0]) { - list($response) = $this->auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id); + list($response) = $this->auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id, $contentType); return $response; } @@ -15340,15 +16786,15 @@ public function auEssSuperFundDelete($superfund_id, $employee_id) * * @param int $superfund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id) + public function auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundDelete'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEssSuperFundDeleteRequest($superfund_id, $employee_id); + $request = $this->auEssSuperFundDeleteRequest($superfund_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -15357,9 +16803,16 @@ public function auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15370,19 +16823,37 @@ public function auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SaveSuperFundResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15399,7 +16870,7 @@ public function auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SaveSuperFundResponseModel', + '\OpenAPI\Client\Model\SaveSuperFundResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15416,13 +16887,14 @@ public function auEssSuperFundDeleteWithHttpInfo($superfund_id, $employee_id) * * @param int $superfund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundDeleteAsync($superfund_id, $employee_id) + public function auEssSuperFundDeleteAsync($superfund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundDelete'][0]) { - return $this->auEssSuperFundDeleteAsyncWithHttpInfo($superfund_id, $employee_id) + return $this->auEssSuperFundDeleteAsyncWithHttpInfo($superfund_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -15437,24 +16909,24 @@ function ($response) { * * @param int $superfund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundDeleteAsyncWithHttpInfo($superfund_id, $employee_id) + public function auEssSuperFundDeleteAsyncWithHttpInfo($superfund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundDelete'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEssSuperFundDeleteRequest($superfund_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; + $request = $this->auEssSuperFundDeleteRequest($superfund_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15477,7 +16949,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15488,18 +16960,21 @@ function ($exception) { * * @param int $superfund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSuperFundDeleteRequest($superfund_id, $employee_id) + public function auEssSuperFundDeleteRequest($superfund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundDelete'][0]) { + // verify the required parameter 'superfund_id' is set if ($superfund_id === null || (is_array($superfund_id) && count($superfund_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $superfund_id when calling auEssSuperFundDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -15507,6 +16982,7 @@ protected function auEssSuperFundDeleteRequest($superfund_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/superfunds/{superfundId}'; $formParams = []; $queryParams = []; @@ -15515,6 +16991,7 @@ protected function auEssSuperFundDeleteRequest($superfund_id, $employee_id) $multipart = false; + // path params if ($superfund_id !== null) { $resourcePath = str_replace( @@ -15532,53 +17009,35 @@ protected function auEssSuperFundDeleteRequest($superfund_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15599,10 +17058,11 @@ protected function auEssSuperFundDeleteRequest($superfund_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15615,14 +17075,15 @@ protected function auEssSuperFundDeleteRequest($superfund_id, $employee_id) * * @param int $super_fund_id super_fund_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperFundModel + * @return \OpenAPI\Client\Model\SuperFundModel */ - public function auEssSuperFundGet($super_fund_id, $employee_id) + public function auEssSuperFundGet($super_fund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundGet'][0]) { - list($response) = $this->auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id); + list($response) = $this->auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id, $contentType); return $response; } @@ -15633,15 +17094,15 @@ public function auEssSuperFundGet($super_fund_id, $employee_id) * * @param int $super_fund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperFundModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperFundModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id) + public function auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel'; - $request = $this->auEssSuperFundGetRequest($super_fund_id, $employee_id); + $request = $this->auEssSuperFundGetRequest($super_fund_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -15650,9 +17111,16 @@ public function auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15663,19 +17131,37 @@ public function auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperFundModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperFundModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperFundModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperFundModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15692,7 +17178,7 @@ public function auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperFundModel', + '\OpenAPI\Client\Model\SuperFundModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15709,13 +17195,14 @@ public function auEssSuperFundGetWithHttpInfo($super_fund_id, $employee_id) * * @param int $super_fund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundGetAsync($super_fund_id, $employee_id) + public function auEssSuperFundGetAsync($super_fund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundGet'][0]) { - return $this->auEssSuperFundGetAsyncWithHttpInfo($super_fund_id, $employee_id) + return $this->auEssSuperFundGetAsyncWithHttpInfo($super_fund_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -15730,24 +17217,24 @@ function ($response) { * * @param int $super_fund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundGetAsyncWithHttpInfo($super_fund_id, $employee_id) + public function auEssSuperFundGetAsyncWithHttpInfo($super_fund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel'; - $request = $this->auEssSuperFundGetRequest($super_fund_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\SuperFundModel'; + $request = $this->auEssSuperFundGetRequest($super_fund_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15770,7 +17257,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15781,18 +17268,21 @@ function ($exception) { * * @param int $super_fund_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSuperFundGetRequest($super_fund_id, $employee_id) + public function auEssSuperFundGetRequest($super_fund_id, $employee_id, string $contentType = self::contentTypes['auEssSuperFundGet'][0]) { + // verify the required parameter 'super_fund_id' is set if ($super_fund_id === null || (is_array($super_fund_id) && count($super_fund_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $super_fund_id when calling auEssSuperFundGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -15800,6 +17290,7 @@ protected function auEssSuperFundGetRequest($super_fund_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/superfunds/{superFundId}'; $formParams = []; $queryParams = []; @@ -15808,6 +17299,7 @@ protected function auEssSuperFundGetRequest($super_fund_id, $employee_id) $multipart = false; + // path params if ($super_fund_id !== null) { $resourcePath = str_replace( @@ -15825,53 +17317,35 @@ protected function auEssSuperFundGetRequest($super_fund_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15892,10 +17366,11 @@ protected function auEssSuperFundGetRequest($super_fund_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15907,14 +17382,15 @@ protected function auEssSuperFundGetRequest($super_fund_id, $employee_id) * List Super Funds * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperFundModel[] + * @return \OpenAPI\Client\Model\SuperFundModel[] */ - public function auEssSuperFundList($employee_id) + public function auEssSuperFundList($employee_id, string $contentType = self::contentTypes['auEssSuperFundList'][0]) { - list($response) = $this->auEssSuperFundListWithHttpInfo($employee_id); + list($response) = $this->auEssSuperFundListWithHttpInfo($employee_id, $contentType); return $response; } @@ -15924,15 +17400,15 @@ public function auEssSuperFundList($employee_id) * List Super Funds * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperFundModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperFundModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssSuperFundListWithHttpInfo($employee_id) + public function auEssSuperFundListWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssSuperFundList'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel[]'; - $request = $this->auEssSuperFundListRequest($employee_id); + $request = $this->auEssSuperFundListRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -15941,9 +17417,16 @@ public function auEssSuperFundListWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15954,19 +17437,37 @@ public function auEssSuperFundListWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperFundModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperFundModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperFundModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperFundModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15983,7 +17484,7 @@ public function auEssSuperFundListWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperFundModel[]', + '\OpenAPI\Client\Model\SuperFundModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15999,13 +17500,14 @@ public function auEssSuperFundListWithHttpInfo($employee_id) * List Super Funds * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundListAsync($employee_id) + public function auEssSuperFundListAsync($employee_id, string $contentType = self::contentTypes['auEssSuperFundList'][0]) { - return $this->auEssSuperFundListAsyncWithHttpInfo($employee_id) + return $this->auEssSuperFundListAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -16019,24 +17521,24 @@ function ($response) { * List Super Funds * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundListAsyncWithHttpInfo($employee_id) + public function auEssSuperFundListAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssSuperFundList'][0]) { - $returnType = '\Swagger\Client\Model\SuperFundModel[]'; - $request = $this->auEssSuperFundListRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\SuperFundModel[]'; + $request = $this->auEssSuperFundListRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16059,7 +17561,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16069,12 +17571,14 @@ function ($exception) { * Create request for operation 'auEssSuperFundList' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSuperFundListRequest($employee_id) + public function auEssSuperFundListRequest($employee_id, string $contentType = self::contentTypes['auEssSuperFundList'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -16082,6 +17586,7 @@ protected function auEssSuperFundListRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/superfunds'; $formParams = []; $queryParams = []; @@ -16090,6 +17595,7 @@ protected function auEssSuperFundListRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -16099,53 +17605,35 @@ protected function auEssSuperFundListRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16166,10 +17654,11 @@ protected function auEssSuperFundListRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16180,16 +17669,17 @@ protected function auEssSuperFundListRequest($employee_id) * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SaveSuperFundResponseModel + * @return \OpenAPI\Client\Model\SaveSuperFundResponseModel */ - public function auEssSuperFundPost($model, $employee_id) + public function auEssSuperFundPost($employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPost'][0]) { - list($response) = $this->auEssSuperFundPostWithHttpInfo($model, $employee_id); + list($response) = $this->auEssSuperFundPostWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -16198,17 +17688,17 @@ public function auEssSuperFundPost($model, $employee_id) * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSuperFundPostWithHttpInfo($model, $employee_id) + public function auEssSuperFundPostWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPost'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEssSuperFundPostRequest($model, $employee_id); + $request = $this->auEssSuperFundPostRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -16217,9 +17707,16 @@ public function auEssSuperFundPostWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16230,19 +17727,37 @@ public function auEssSuperFundPostWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SaveSuperFundResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16259,7 +17774,7 @@ public function auEssSuperFundPostWithHttpInfo($model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SaveSuperFundResponseModel', + '\OpenAPI\Client\Model\SaveSuperFundResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16274,15 +17789,16 @@ public function auEssSuperFundPostWithHttpInfo($model, $employee_id) * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundPostAsync($model, $employee_id) + public function auEssSuperFundPostAsync($employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPost'][0]) { - return $this->auEssSuperFundPostAsyncWithHttpInfo($model, $employee_id) + return $this->auEssSuperFundPostAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -16295,26 +17811,26 @@ function ($response) { * * Create Super Fund * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundPostAsyncWithHttpInfo($model, $employee_id) + public function auEssSuperFundPostAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPost'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEssSuperFundPostRequest($model, $employee_id); + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; + $request = $this->auEssSuperFundPostRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16337,7 +17853,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16346,20 +17862,16 @@ function ($exception) { /** * Create request for operation 'auEssSuperFundPost' * - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSuperFundPostRequest($model, $employee_id) + public function auEssSuperFundPostRequest($employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssSuperFundPost' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -16367,6 +17879,14 @@ protected function auEssSuperFundPostRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssSuperFundPost' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/superfunds'; $formParams = []; $queryParams = []; @@ -16375,6 +17895,7 @@ protected function auEssSuperFundPostRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -16384,56 +17905,42 @@ protected function auEssSuperFundPostRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16454,10 +17961,11 @@ protected function auEssSuperFundPostRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16468,15 +17976,16 @@ protected function auEssSuperFundPostRequest($model, $employee_id) * * @param string $term term (required) * @param string $employee_id employee_id (required) - * @param string $search_by search_by (optional, default to 0) + * @param string $search_by search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundProductSearch'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperProductEditModel[] + * @return \OpenAPI\Client\Model\SuperProductEditModel[] */ - public function auEssSuperFundProductSearch($term, $employee_id, $search_by = '0') + public function auEssSuperFundProductSearch($term, $employee_id, $search_by = '0', string $contentType = self::contentTypes['auEssSuperFundProductSearch'][0]) { - list($response) = $this->auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $search_by); + list($response) = $this->auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $search_by, $contentType); return $response; } @@ -16485,16 +17994,16 @@ public function auEssSuperFundProductSearch($term, $employee_id, $search_by = '0 * * @param string $term (required) * @param string $employee_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundProductSearch'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperProductEditModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperProductEditModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $search_by = '0') + public function auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $search_by = '0', string $contentType = self::contentTypes['auEssSuperFundProductSearch'][0]) { - $returnType = '\Swagger\Client\Model\SuperProductEditModel[]'; - $request = $this->auEssSuperFundProductSearchRequest($term, $employee_id, $search_by); + $request = $this->auEssSuperFundProductSearchRequest($term, $employee_id, $search_by, $contentType); try { $options = $this->createHttpClientOption(); @@ -16503,9 +18012,16 @@ public function auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $se } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16516,19 +18032,37 @@ public function auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $se sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperProductEditModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperProductEditModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperProductEditModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperProductEditModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16545,7 +18079,7 @@ public function auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $se case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperProductEditModel[]', + '\OpenAPI\Client\Model\SuperProductEditModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16558,18 +18092,17 @@ public function auEssSuperFundProductSearchWithHttpInfo($term, $employee_id, $se /** * Operation auEssSuperFundProductSearchAsync * - * - * * @param string $term (required) * @param string $employee_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundProductSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundProductSearchAsync($term, $employee_id, $search_by = '0') + public function auEssSuperFundProductSearchAsync($term, $employee_id, $search_by = '0', string $contentType = self::contentTypes['auEssSuperFundProductSearch'][0]) { - return $this->auEssSuperFundProductSearchAsyncWithHttpInfo($term, $employee_id, $search_by) + return $this->auEssSuperFundProductSearchAsyncWithHttpInfo($term, $employee_id, $search_by, $contentType) ->then( function ($response) { return $response[0]; @@ -16580,29 +18113,27 @@ function ($response) { /** * Operation auEssSuperFundProductSearchAsyncWithHttpInfo * - * - * * @param string $term (required) * @param string $employee_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundProductSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundProductSearchAsyncWithHttpInfo($term, $employee_id, $search_by = '0') + public function auEssSuperFundProductSearchAsyncWithHttpInfo($term, $employee_id, $search_by = '0', string $contentType = self::contentTypes['auEssSuperFundProductSearch'][0]) { - $returnType = '\Swagger\Client\Model\SuperProductEditModel[]'; - $request = $this->auEssSuperFundProductSearchRequest($term, $employee_id, $search_by); + $returnType = '\OpenAPI\Client\Model\SuperProductEditModel[]'; + $request = $this->auEssSuperFundProductSearchRequest($term, $employee_id, $search_by, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16625,7 +18156,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16636,19 +18167,22 @@ function ($exception) { * * @param string $term (required) * @param string $employee_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundProductSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSuperFundProductSearchRequest($term, $employee_id, $search_by = '0') + public function auEssSuperFundProductSearchRequest($term, $employee_id, $search_by = '0', string $contentType = self::contentTypes['auEssSuperFundProductSearch'][0]) { + // verify the required parameter 'term' is set if ($term === null || (is_array($term) && count($term) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $term when calling auEssSuperFundProductSearch' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -16656,6 +18190,8 @@ protected function auEssSuperFundProductSearchRequest($term, $employee_id, $sear ); } + + $resourcePath = '/api/v2/ess/{employeeId}/superfunds/productsearch'; $formParams = []; $queryParams = []; @@ -16664,13 +18200,24 @@ protected function auEssSuperFundProductSearchRequest($term, $employee_id, $sear $multipart = false; // query params - if ($term !== null) { - $queryParams['term'] = ObjectSerializer::toQueryValue($term); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $term, + 'term', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($search_by !== null) { - $queryParams['searchBy'] = ObjectSerializer::toQueryValue($search_by); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_by, + 'searchBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -16681,53 +18228,35 @@ protected function auEssSuperFundProductSearchRequest($term, $employee_id, $sear ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16748,10 +18277,11 @@ protected function auEssSuperFundProductSearchRequest($term, $employee_id, $sear $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16763,16 +18293,17 @@ protected function auEssSuperFundProductSearchRequest($term, $employee_id, $sear * Update Super Fund * * @param int $id id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SaveSuperFundResponseModel + * @return \OpenAPI\Client\Model\SaveSuperFundResponseModel */ - public function auEssSuperFundPut($id, $model, $employee_id) + public function auEssSuperFundPut($id, $employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPut'][0]) { - list($response) = $this->auEssSuperFundPutWithHttpInfo($id, $model, $employee_id); + list($response) = $this->auEssSuperFundPutWithHttpInfo($id, $employee_id, $model, $contentType); return $response; } @@ -16782,17 +18313,17 @@ public function auEssSuperFundPut($id, $model, $employee_id) * Update Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SaveSuperFundResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssSuperFundPutWithHttpInfo($id, $model, $employee_id) + public function auEssSuperFundPutWithHttpInfo($id, $employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPut'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEssSuperFundPutRequest($id, $model, $employee_id); + $request = $this->auEssSuperFundPutRequest($id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -16801,9 +18332,16 @@ public function auEssSuperFundPutWithHttpInfo($id, $model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16814,19 +18352,37 @@ public function auEssSuperFundPutWithHttpInfo($id, $model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SaveSuperFundResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SaveSuperFundResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16843,7 +18399,7 @@ public function auEssSuperFundPutWithHttpInfo($id, $model, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SaveSuperFundResponseModel', + '\OpenAPI\Client\Model\SaveSuperFundResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16859,15 +18415,16 @@ public function auEssSuperFundPutWithHttpInfo($id, $model, $employee_id) * Update Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundPutAsync($id, $model, $employee_id) + public function auEssSuperFundPutAsync($id, $employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPut'][0]) { - return $this->auEssSuperFundPutAsyncWithHttpInfo($id, $model, $employee_id) + return $this->auEssSuperFundPutAsyncWithHttpInfo($id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -16881,26 +18438,26 @@ function ($response) { * Update Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssSuperFundPutAsyncWithHttpInfo($id, $model, $employee_id) + public function auEssSuperFundPutAsyncWithHttpInfo($id, $employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPut'][0]) { - $returnType = '\Swagger\Client\Model\SaveSuperFundResponseModel'; - $request = $this->auEssSuperFundPutRequest($id, $model, $employee_id); + $returnType = '\OpenAPI\Client\Model\SaveSuperFundResponseModel'; + $request = $this->auEssSuperFundPutRequest($id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16923,7 +18480,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16933,33 +18490,38 @@ function ($exception) { * Create request for operation 'auEssSuperFundPut' * * @param int $id (required) - * @param \Swagger\Client\Model\SaveSuperFundModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\SaveSuperFundModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssSuperFundPutRequest($id, $model, $employee_id) + public function auEssSuperFundPutRequest($id, $employee_id, $model, string $contentType = self::contentTypes['auEssSuperFundPut'][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 auEssSuperFundPut' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { + + // verify the required parameter 'employee_id' is set + if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssSuperFundPut' + 'Missing the required parameter $employee_id when calling auEssSuperFundPut' ); } - // verify the required parameter 'employee_id' is set - if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { + + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $employee_id when calling auEssSuperFundPut' + 'Missing the required parameter $model when calling auEssSuperFundPut' ); } + $resourcePath = '/api/v2/ess/{employeeId}/superfunds/{id}'; $formParams = []; $queryParams = []; @@ -16968,6 +18530,7 @@ protected function auEssSuperFundPutRequest($id, $model, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -16985,56 +18548,42 @@ protected function auEssSuperFundPutRequest($id, $model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17055,10 +18604,11 @@ protected function auEssSuperFundPutRequest($id, $model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17071,15 +18621,16 @@ protected function auEssSuperFundPutRequest($id, $model, $employee_id) * * @param int $employee_id employee_id (required) * @param int $shift_id shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model model (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceAddShiftNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceAddShiftNote($employee_id, $shift_id, $model) + public function auEssTimeAndAttendanceAddShiftNote($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceAddShiftNote'][0]) { - $this->auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $shift_id, $model); + $this->auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $shift_id, $model, $contentType); } /** @@ -17089,16 +18640,16 @@ public function auEssTimeAndAttendanceAddShiftNote($employee_id, $shift_id, $mod * * @param int $employee_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceAddShiftNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $shift_id, $model) + public function auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceAddShiftNote'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shift_id, $model); + $request = $this->auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shift_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -17107,9 +18658,16 @@ public function auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $sh } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17120,11 +18678,11 @@ public function auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $sh sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -17144,14 +18702,15 @@ public function auEssTimeAndAttendanceAddShiftNoteWithHttpInfo($employee_id, $sh * * @param int $employee_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceAddShiftNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceAddShiftNoteAsync($employee_id, $shift_id, $model) + public function auEssTimeAndAttendanceAddShiftNoteAsync($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceAddShiftNote'][0]) { - return $this->auEssTimeAndAttendanceAddShiftNoteAsyncWithHttpInfo($employee_id, $shift_id, $model) + return $this->auEssTimeAndAttendanceAddShiftNoteAsyncWithHttpInfo($employee_id, $shift_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -17166,15 +18725,16 @@ function ($response) { * * @param int $employee_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceAddShiftNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceAddShiftNoteAsyncWithHttpInfo($employee_id, $shift_id, $model) + public function auEssTimeAndAttendanceAddShiftNoteAsyncWithHttpInfo($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceAddShiftNote'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shift_id, $model); + $request = $this->auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shift_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -17193,7 +18753,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17204,25 +18764,29 @@ function ($exception) { * * @param int $employee_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceAddShiftNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shift_id, $model) + public function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceAddShiftNote'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceAddShiftNote' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling auEssTimeAndAttendanceAddShiftNote' ); } + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -17230,6 +18794,7 @@ protected function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shif ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/shift/{shiftId}/notes'; $formParams = []; $queryParams = []; @@ -17238,6 +18803,7 @@ protected function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shif $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -17255,56 +18821,42 @@ protected function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shif ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17325,10 +18877,11 @@ protected function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shif $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17340,15 +18893,16 @@ protected function auEssTimeAndAttendanceAddShiftNoteRequest($employee_id, $shif * Clock Out Employee * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceClockOffEmployee($employee_id, $request) + public function auEssTimeAndAttendanceClockOffEmployee($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'][0]) { - $this->auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, $request); + $this->auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, $request, $contentType); } /** @@ -17357,16 +18911,16 @@ public function auEssTimeAndAttendanceClockOffEmployee($employee_id, $request) * Clock Out Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -17375,9 +18929,16 @@ public function auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17388,11 +18949,11 @@ public function auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -17411,14 +18972,15 @@ public function auEssTimeAndAttendanceClockOffEmployeeWithHttpInfo($employee_id, * Clock Out Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceClockOffEmployeeAsync($employee_id, $request) + public function auEssTimeAndAttendanceClockOffEmployeeAsync($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'][0]) { - return $this->auEssTimeAndAttendanceClockOffEmployeeAsyncWithHttpInfo($employee_id, $request) + return $this->auEssTimeAndAttendanceClockOffEmployeeAsyncWithHttpInfo($employee_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -17432,15 +18994,16 @@ function ($response) { * Clock Out Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceClockOffEmployeeAsyncWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceClockOffEmployeeAsyncWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -17459,7 +19022,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17469,19 +19032,22 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceClockOffEmployee' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $request) + public function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOffEmployee'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceClockOffEmployee' ); } + // verify the required parameter 'request' is set if ($request === null || (is_array($request) && count($request) === 0)) { throw new \InvalidArgumentException( @@ -17489,6 +19055,7 @@ protected function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $ ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/clockoff'; $formParams = []; $queryParams = []; @@ -17497,6 +19064,7 @@ protected function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -17506,56 +19074,42 @@ protected function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $ ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17576,10 +19130,11 @@ protected function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17591,15 +19146,16 @@ protected function auEssTimeAndAttendanceClockOffEmployeeRequest($employee_id, $ * Clock In Employee * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model model (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOn'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function auEssTimeAndAttendanceClockOn($employee_id, $model) + public function auEssTimeAndAttendanceClockOn($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOn'][0]) { - list($response) = $this->auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model); + list($response) = $this->auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -17609,16 +19165,16 @@ public function auEssTimeAndAttendanceClockOn($employee_id, $model) * Clock In Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOn'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model) + public function auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOn'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->auEssTimeAndAttendanceClockOnRequest($employee_id, $model); + $request = $this->auEssTimeAndAttendanceClockOnRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -17627,9 +19183,16 @@ public function auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17640,19 +19203,37 @@ public function auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17669,7 +19250,7 @@ public function auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -17685,14 +19266,15 @@ public function auEssTimeAndAttendanceClockOnWithHttpInfo($employee_id, $model) * Clock In Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceClockOnAsync($employee_id, $model) + public function auEssTimeAndAttendanceClockOnAsync($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOn'][0]) { - return $this->auEssTimeAndAttendanceClockOnAsyncWithHttpInfo($employee_id, $model) + return $this->auEssTimeAndAttendanceClockOnAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -17706,25 +19288,25 @@ function ($response) { * Clock In Employee * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceClockOnAsyncWithHttpInfo($employee_id, $model) + public function auEssTimeAndAttendanceClockOnAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOn'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->auEssTimeAndAttendanceClockOnRequest($employee_id, $model); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->auEssTimeAndAttendanceClockOnRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17747,7 +19329,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17757,19 +19339,22 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceClockOn' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceClockOnRequest($employee_id, $model) + public function auEssTimeAndAttendanceClockOnRequest($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceClockOn'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceClockOn' ); } + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -17777,6 +19362,7 @@ protected function auEssTimeAndAttendanceClockOnRequest($employee_id, $model) ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/clockon'; $formParams = []; $queryParams = []; @@ -17785,6 +19371,7 @@ protected function auEssTimeAndAttendanceClockOnRequest($employee_id, $model) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -17794,56 +19381,42 @@ protected function auEssTimeAndAttendanceClockOnRequest($employee_id, $model) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17864,10 +19437,11 @@ protected function auEssTimeAndAttendanceClockOnRequest($employee_id, $model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17879,15 +19453,16 @@ protected function auEssTimeAndAttendanceClockOnRequest($employee_id, $model) * Discard current shift * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceDiscardCurrentShift($employee_id, $request) + public function auEssTimeAndAttendanceDiscardCurrentShift($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'][0]) { - $this->auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_id, $request); + $this->auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_id, $request, $contentType); } /** @@ -17896,16 +19471,16 @@ public function auEssTimeAndAttendanceDiscardCurrentShift($employee_id, $request * Discard current shift * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -17914,9 +19489,16 @@ public function auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17927,11 +19509,11 @@ public function auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -17950,14 +19532,15 @@ public function auEssTimeAndAttendanceDiscardCurrentShiftWithHttpInfo($employee_ * Discard current shift * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceDiscardCurrentShiftAsync($employee_id, $request) + public function auEssTimeAndAttendanceDiscardCurrentShiftAsync($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'][0]) { - return $this->auEssTimeAndAttendanceDiscardCurrentShiftAsyncWithHttpInfo($employee_id, $request) + return $this->auEssTimeAndAttendanceDiscardCurrentShiftAsyncWithHttpInfo($employee_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -17971,15 +19554,16 @@ function ($response) { * Discard current shift * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceDiscardCurrentShiftAsyncWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceDiscardCurrentShiftAsyncWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -17998,7 +19582,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18008,19 +19592,22 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceDiscardCurrentShift' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id, $request) + public function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceDiscardCurrentShift'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceDiscardCurrentShift' ); } + // verify the required parameter 'request' is set if ($request === null || (is_array($request) && count($request) === 0)) { throw new \InvalidArgumentException( @@ -18028,6 +19615,7 @@ protected function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/discard'; $formParams = []; $queryParams = []; @@ -18036,6 +19624,7 @@ protected function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -18045,56 +19634,42 @@ protected function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18115,10 +19690,11 @@ protected function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18130,15 +19706,16 @@ protected function auEssTimeAndAttendanceDiscardCurrentShiftRequest($employee_id * End Break * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request request (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceEndShiftBreak($employee_id, $request) + public function auEssTimeAndAttendanceEndShiftBreak($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'][0]) { - $this->auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $request); + $this->auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $request, $contentType); } /** @@ -18147,16 +19724,16 @@ public function auEssTimeAndAttendanceEndShiftBreak($employee_id, $request) * End Break * * @param int $employee_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -18165,9 +19742,16 @@ public function auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $r } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18178,11 +19762,11 @@ public function auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $r sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -18201,14 +19785,15 @@ public function auEssTimeAndAttendanceEndShiftBreakWithHttpInfo($employee_id, $r * End Break * * @param int $employee_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceEndShiftBreakAsync($employee_id, $request) + public function auEssTimeAndAttendanceEndShiftBreakAsync($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'][0]) { - return $this->auEssTimeAndAttendanceEndShiftBreakAsyncWithHttpInfo($employee_id, $request) + return $this->auEssTimeAndAttendanceEndShiftBreakAsyncWithHttpInfo($employee_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -18222,15 +19807,16 @@ function ($response) { * End Break * * @param int $employee_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceEndShiftBreakAsyncWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceEndShiftBreakAsyncWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -18249,7 +19835,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18259,19 +19845,22 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceEndShiftBreak' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $request) + public function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceEndShiftBreak'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceEndShiftBreak' ); } + // verify the required parameter 'request' is set if ($request === null || (is_array($request) && count($request) === 0)) { throw new \InvalidArgumentException( @@ -18279,6 +19868,7 @@ protected function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $req ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/endbreak'; $formParams = []; $queryParams = []; @@ -18287,6 +19877,7 @@ protected function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $req $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -18296,56 +19887,42 @@ protected function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $req ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18366,10 +19943,11 @@ protected function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $req $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18381,14 +19959,15 @@ protected function auEssTimeAndAttendanceEndShiftBreakRequest($employee_id, $req * Get Lookup Data * * @param int $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetLookupData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel */ - public function auEssTimeAndAttendanceGetLookupData($employee_id) + public function auEssTimeAndAttendanceGetLookupData($employee_id, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetLookupData'][0]) { - list($response) = $this->auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id); + list($response) = $this->auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id, $contentType); return $response; } @@ -18398,15 +19977,15 @@ public function auEssTimeAndAttendanceGetLookupData($employee_id) * Get Lookup Data * * @param int $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetLookupData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id) + public function auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetLookupData'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel'; - $request = $this->auEssTimeAndAttendanceGetLookupDataRequest($employee_id); + $request = $this->auEssTimeAndAttendanceGetLookupDataRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -18415,9 +19994,16 @@ public function auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18428,19 +20014,37 @@ public function auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18457,7 +20061,7 @@ public function auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel', + '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -18473,13 +20077,14 @@ public function auEssTimeAndAttendanceGetLookupDataWithHttpInfo($employee_id) * Get Lookup Data * * @param int $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceGetLookupDataAsync($employee_id) + public function auEssTimeAndAttendanceGetLookupDataAsync($employee_id, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetLookupData'][0]) { - return $this->auEssTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($employee_id) + return $this->auEssTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -18493,24 +20098,24 @@ function ($response) { * Get Lookup Data * * @param int $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($employee_id) + public function auEssTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetLookupData'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel'; - $request = $this->auEssTimeAndAttendanceGetLookupDataRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel'; + $request = $this->auEssTimeAndAttendanceGetLookupDataRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18533,7 +20138,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18543,12 +20148,14 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceGetLookupData' * * @param int $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceGetLookupDataRequest($employee_id) + public function auEssTimeAndAttendanceGetLookupDataRequest($employee_id, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetLookupData'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -18556,6 +20163,7 @@ protected function auEssTimeAndAttendanceGetLookupDataRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/lookupdata'; $formParams = []; $queryParams = []; @@ -18564,6 +20172,7 @@ protected function auEssTimeAndAttendanceGetLookupDataRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -18573,53 +20182,35 @@ protected function auEssTimeAndAttendanceGetLookupDataRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18640,10 +20231,11 @@ protected function auEssTimeAndAttendanceGetLookupDataRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18656,18 +20248,19 @@ protected function auEssTimeAndAttendanceGetLookupDataRequest($employee_id) * * @param int $employee_id employee_id (required) * @param int $shift_id shift_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id model_employee_id (optional) + * @param bool $model_is_admin_initiated model_is_admin_initiated (optional) + * @param string $model_type model_type (optional) + * @param string $model_visibility model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceGetShiftNotes($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function auEssTimeAndAttendanceGetShiftNotes($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'][0]) { - $this->auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $this->auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); } /** @@ -18677,19 +20270,19 @@ public function auEssTimeAndAttendanceGetShiftNotes($employee_id, $shift_id, $mo * * @param int $employee_id (required) * @param int $shift_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $request = $this->auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); try { $options = $this->createHttpClientOption(); @@ -18698,9 +20291,16 @@ public function auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $s } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18711,11 +20311,11 @@ public function auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $s sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -18735,17 +20335,18 @@ public function auEssTimeAndAttendanceGetShiftNotesWithHttpInfo($employee_id, $s * * @param int $employee_id (required) * @param int $shift_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceGetShiftNotesAsync($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function auEssTimeAndAttendanceGetShiftNotesAsync($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'][0]) { - return $this->auEssTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility) + return $this->auEssTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType) ->then( function ($response) { return $response[0]; @@ -18760,18 +20361,19 @@ function ($response) { * * @param int $employee_id (required) * @param int $shift_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function auEssTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $request = $this->auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shift_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -18790,7 +20392,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18801,22 +20403,25 @@ function ($exception) { * * @param int $employee_id (required) * @param int $shift_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shift_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShiftNotes'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceGetShiftNotes' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( @@ -18824,6 +20429,11 @@ protected function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shi ); } + + + + + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/shift/{shiftId}/notes'; $formParams = []; $queryParams = []; @@ -18832,21 +20442,42 @@ protected function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shi $multipart = false; // query params - if ($model_employee_id !== null) { - $queryParams['model.employeeId'] = ObjectSerializer::toQueryValue($model_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employee_id, + 'model.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_is_admin_initiated !== null) { - $queryParams['model.isAdminInitiated'] = ObjectSerializer::toQueryValue($model_is_admin_initiated); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_is_admin_initiated, + 'model.isAdminInitiated', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_type !== null) { - $queryParams['model.type'] = ObjectSerializer::toQueryValue($model_type); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_type, + 'model.type', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_visibility !== null) { - $queryParams['model.visibility'] = ObjectSerializer::toQueryValue($model_visibility); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_visibility, + 'model.visibility', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -18865,53 +20496,35 @@ protected function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shi ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18932,10 +20545,11 @@ protected function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18947,15 +20561,16 @@ protected function auEssTimeAndAttendanceGetShiftNotesRequest($employee_id, $shi * Shifts * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\GetShiftsModel $model model (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimeAndAttendanceShiftModel[] + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[] */ - public function auEssTimeAndAttendanceGetShifts($employee_id, $model) + public function auEssTimeAndAttendanceGetShifts($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShifts'][0]) { - list($response) = $this->auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model); + list($response) = $this->auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model, $contentType); return $response; } @@ -18965,16 +20580,16 @@ public function auEssTimeAndAttendanceGetShifts($employee_id, $model) * Shifts * * @param int $employee_id (required) - * @param \Swagger\Client\Model\GetShiftsModel $model (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimeAndAttendanceShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model) + public function auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]'; - $request = $this->auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model); + $request = $this->auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -18983,9 +20598,16 @@ public function auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18996,19 +20618,37 @@ public function auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19025,7 +20665,7 @@ public function auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]', + '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -19041,14 +20681,15 @@ public function auEssTimeAndAttendanceGetShiftsWithHttpInfo($employee_id, $model * Shifts * * @param int $employee_id (required) - * @param \Swagger\Client\Model\GetShiftsModel $model (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceGetShiftsAsync($employee_id, $model) + public function auEssTimeAndAttendanceGetShiftsAsync($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShifts'][0]) { - return $this->auEssTimeAndAttendanceGetShiftsAsyncWithHttpInfo($employee_id, $model) + return $this->auEssTimeAndAttendanceGetShiftsAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -19062,25 +20703,25 @@ function ($response) { * Shifts * * @param int $employee_id (required) - * @param \Swagger\Client\Model\GetShiftsModel $model (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceGetShiftsAsyncWithHttpInfo($employee_id, $model) + public function auEssTimeAndAttendanceGetShiftsAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]'; - $request = $this->auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model); + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]'; + $request = $this->auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19103,7 +20744,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19113,19 +20754,22 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceGetShifts' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\GetShiftsModel $model (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceGetShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model) + public function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceGetShifts'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceGetShifts' ); } + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -19133,6 +20777,7 @@ protected function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model) ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/shifts'; $formParams = []; $queryParams = []; @@ -19141,6 +20786,7 @@ protected function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -19150,56 +20796,42 @@ protected function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -19220,10 +20852,11 @@ protected function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -19235,16 +20868,17 @@ protected function auEssTimeAndAttendanceGetShiftsRequest($employee_id, $model) * Mark Shift Notes Read * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model model (required) * @param string $shift_id shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceMarkShiftNotesRead($employee_id, $model, $shift_id) + public function auEssTimeAndAttendanceMarkShiftNotesRead($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'][0]) { - $this->auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_id, $model, $shift_id); + $this->auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_id, $shift_id, $model, $contentType); } /** @@ -19253,17 +20887,17 @@ public function auEssTimeAndAttendanceMarkShiftNotesRead($employee_id, $model, $ * Mark Shift Notes Read * * @param int $employee_id (required) - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_id, $model, $shift_id) + public function auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $model, $shift_id); + $request = $this->auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $shift_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -19272,9 +20906,16 @@ public function auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -19285,11 +20926,11 @@ public function auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -19308,15 +20949,16 @@ public function auEssTimeAndAttendanceMarkShiftNotesReadWithHttpInfo($employee_i * Mark Shift Notes Read * * @param int $employee_id (required) - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceMarkShiftNotesReadAsync($employee_id, $model, $shift_id) + public function auEssTimeAndAttendanceMarkShiftNotesReadAsync($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'][0]) { - return $this->auEssTimeAndAttendanceMarkShiftNotesReadAsyncWithHttpInfo($employee_id, $model, $shift_id) + return $this->auEssTimeAndAttendanceMarkShiftNotesReadAsyncWithHttpInfo($employee_id, $shift_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -19330,16 +20972,17 @@ function ($response) { * Mark Shift Notes Read * * @param int $employee_id (required) - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceMarkShiftNotesReadAsyncWithHttpInfo($employee_id, $model, $shift_id) + public function auEssTimeAndAttendanceMarkShiftNotesReadAsyncWithHttpInfo($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $model, $shift_id); + $request = $this->auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $shift_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -19358,7 +21001,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19368,26 +21011,23 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceMarkShiftNotesRead' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $model, $shift_id) + public function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $shift_id, $model, string $contentType = self::contentTypes['auEssTimeAndAttendanceMarkShiftNotesRead'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceMarkShiftNotesRead' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auEssTimeAndAttendanceMarkShiftNotesRead' - ); - } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( @@ -19395,6 +21035,14 @@ protected function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auEssTimeAndAttendanceMarkShiftNotesRead' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/shift/{shiftId}/notes/read-state'; $formParams = []; $queryParams = []; @@ -19403,6 +21051,7 @@ protected function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -19420,56 +21069,42 @@ protected function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -19490,10 +21125,11 @@ protected function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -19505,15 +21141,16 @@ protected function auEssTimeAndAttendanceMarkShiftNotesReadRequest($employee_id, * Start Break * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request request (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimeAndAttendanceStartShiftBreak($employee_id, $request) + public function auEssTimeAndAttendanceStartShiftBreak($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'][0]) { - $this->auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, $request); + $this->auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, $request, $contentType); } /** @@ -19522,16 +21159,16 @@ public function auEssTimeAndAttendanceStartShiftBreak($employee_id, $request) * Start Break * * @param int $employee_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'][0]) { - $returnType = ''; - $request = $this->auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -19540,9 +21177,16 @@ public function auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -19553,11 +21197,11 @@ public function auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -19576,14 +21220,15 @@ public function auEssTimeAndAttendanceStartShiftBreakWithHttpInfo($employee_id, * Start Break * * @param int $employee_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceStartShiftBreakAsync($employee_id, $request) + public function auEssTimeAndAttendanceStartShiftBreakAsync($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'][0]) { - return $this->auEssTimeAndAttendanceStartShiftBreakAsyncWithHttpInfo($employee_id, $request) + return $this->auEssTimeAndAttendanceStartShiftBreakAsyncWithHttpInfo($employee_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -19597,15 +21242,16 @@ function ($response) { * Start Break * * @param int $employee_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimeAndAttendanceStartShiftBreakAsyncWithHttpInfo($employee_id, $request) + public function auEssTimeAndAttendanceStartShiftBreakAsyncWithHttpInfo($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'][0]) { $returnType = ''; - $request = $this->auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $request); + $request = $this->auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -19624,7 +21270,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19634,19 +21280,22 @@ function ($exception) { * Create request for operation 'auEssTimeAndAttendanceStartShiftBreak' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $request) + public function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $request, string $contentType = self::contentTypes['auEssTimeAndAttendanceStartShiftBreak'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimeAndAttendanceStartShiftBreak' ); } + // verify the required parameter 'request' is set if ($request === null || (is_array($request) && count($request) === 0)) { throw new \InvalidArgumentException( @@ -19654,6 +21303,7 @@ protected function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $r ); } + $resourcePath = '/api/v2/ess/{employeeId}/timeandattendance/startbreak'; $formParams = []; $queryParams = []; @@ -19662,6 +21312,7 @@ protected function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $r $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -19671,56 +21322,42 @@ protected function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $r ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -19741,10 +21378,11 @@ protected function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $r $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -19758,14 +21396,15 @@ protected function auEssTimeAndAttendanceStartShiftBreakRequest($employee_id, $r * @param string $employee_id employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssTimesheetDataModel + * @return \OpenAPI\Client\Model\AuEssTimesheetDataModel */ - public function auEssTimesheetData($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetData($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetData'][0]) { - list($response) = $this->auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, $filter_to_date); + list($response) = $this->auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType); return $response; } @@ -19777,15 +21416,15 @@ public function auEssTimesheetData($employee_id, $filter_from_date, $filter_to_d * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssTimesheetDataModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssTimesheetDataModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetData'][0]) { - $returnType = '\Swagger\Client\Model\AuEssTimesheetDataModel'; - $request = $this->auEssTimesheetDataRequest($employee_id, $filter_from_date, $filter_to_date); + $request = $this->auEssTimesheetDataRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -19794,9 +21433,16 @@ public function auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -19807,19 +21453,37 @@ public function auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssTimesheetDataModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssTimesheetDataModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssTimesheetDataModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssTimesheetDataModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19836,7 +21500,7 @@ public function auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssTimesheetDataModel', + '\OpenAPI\Client\Model\AuEssTimesheetDataModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -19854,13 +21518,14 @@ public function auEssTimesheetDataWithHttpInfo($employee_id, $filter_from_date, * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetDataAsync($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetDataAsync($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetData'][0]) { - return $this->auEssTimesheetDataAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + return $this->auEssTimesheetDataAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -19876,24 +21541,24 @@ function ($response) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetDataAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetDataAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetData'][0]) { - $returnType = '\Swagger\Client\Model\AuEssTimesheetDataModel'; - $request = $this->auEssTimesheetDataRequest($employee_id, $filter_from_date, $filter_to_date); + $returnType = '\OpenAPI\Client\Model\AuEssTimesheetDataModel'; + $request = $this->auEssTimesheetDataRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19916,7 +21581,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19928,24 +21593,28 @@ function ($exception) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimesheetDataRequest($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetDataRequest($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetData'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimesheetData' ); } + // verify the required parameter 'filter_from_date' is set if ($filter_from_date === null || (is_array($filter_from_date) && count($filter_from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $filter_from_date when calling auEssTimesheetData' ); } + // verify the required parameter 'filter_to_date' is set if ($filter_to_date === null || (is_array($filter_to_date) && count($filter_to_date) === 0)) { throw new \InvalidArgumentException( @@ -19953,6 +21622,7 @@ protected function auEssTimesheetDataRequest($employee_id, $filter_from_date, $f ); } + $resourcePath = '/api/v2/ess/{employeeId}/timesheet/data'; $formParams = []; $queryParams = []; @@ -19961,13 +21631,24 @@ protected function auEssTimesheetDataRequest($employee_id, $filter_from_date, $f $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -19978,53 +21659,35 @@ protected function auEssTimesheetDataRequest($employee_id, $filter_from_date, $f ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20045,10 +21708,11 @@ protected function auEssTimesheetDataRequest($employee_id, $filter_from_date, $f $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20061,14 +21725,15 @@ protected function auEssTimesheetDataRequest($employee_id, $filter_from_date, $f * * @param int $timesheet_id timesheet_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimesheetDelete($timesheet_id, $employee_id) + public function auEssTimesheetDelete($timesheet_id, $employee_id, string $contentType = self::contentTypes['auEssTimesheetDelete'][0]) { - $this->auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id); + $this->auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id, $contentType); } /** @@ -20078,15 +21743,15 @@ public function auEssTimesheetDelete($timesheet_id, $employee_id) * * @param int $timesheet_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id) + public function auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id, string $contentType = self::contentTypes['auEssTimesheetDelete'][0]) { - $returnType = ''; - $request = $this->auEssTimesheetDeleteRequest($timesheet_id, $employee_id); + $request = $this->auEssTimesheetDeleteRequest($timesheet_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -20095,9 +21760,16 @@ public function auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20108,11 +21780,11 @@ public function auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -20132,13 +21804,14 @@ public function auEssTimesheetDeleteWithHttpInfo($timesheet_id, $employee_id) * * @param int $timesheet_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetDeleteAsync($timesheet_id, $employee_id) + public function auEssTimesheetDeleteAsync($timesheet_id, $employee_id, string $contentType = self::contentTypes['auEssTimesheetDelete'][0]) { - return $this->auEssTimesheetDeleteAsyncWithHttpInfo($timesheet_id, $employee_id) + return $this->auEssTimesheetDeleteAsyncWithHttpInfo($timesheet_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -20153,14 +21826,15 @@ function ($response) { * * @param int $timesheet_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetDeleteAsyncWithHttpInfo($timesheet_id, $employee_id) + public function auEssTimesheetDeleteAsyncWithHttpInfo($timesheet_id, $employee_id, string $contentType = self::contentTypes['auEssTimesheetDelete'][0]) { $returnType = ''; - $request = $this->auEssTimesheetDeleteRequest($timesheet_id, $employee_id); + $request = $this->auEssTimesheetDeleteRequest($timesheet_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -20179,7 +21853,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -20190,18 +21864,21 @@ function ($exception) { * * @param int $timesheet_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimesheetDeleteRequest($timesheet_id, $employee_id) + public function auEssTimesheetDeleteRequest($timesheet_id, $employee_id, string $contentType = self::contentTypes['auEssTimesheetDelete'][0]) { + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auEssTimesheetDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -20209,6 +21886,7 @@ protected function auEssTimesheetDeleteRequest($timesheet_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/timesheet/{timesheetId}'; $formParams = []; $queryParams = []; @@ -20217,6 +21895,7 @@ protected function auEssTimesheetDeleteRequest($timesheet_id, $employee_id) $multipart = false; + // path params if ($timesheet_id !== null) { $resourcePath = str_replace( @@ -20234,53 +21913,35 @@ protected function auEssTimesheetDeleteRequest($timesheet_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20301,10 +21962,11 @@ protected function auEssTimesheetDeleteRequest($timesheet_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20316,16 +21978,17 @@ protected function auEssTimesheetDeleteRequest($timesheet_id, $employee_id) * Edit Timesheet * * @param int $timesheet_id timesheet_id (required) - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet timesheet (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetEdit'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimesheetEdit($timesheet_id, $timesheet, $employee_id) + public function auEssTimesheetEdit($timesheet_id, $employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetEdit'][0]) { - $this->auEssTimesheetEditWithHttpInfo($timesheet_id, $timesheet, $employee_id); + $this->auEssTimesheetEditWithHttpInfo($timesheet_id, $employee_id, $timesheet, $contentType); } /** @@ -20334,17 +21997,17 @@ public function auEssTimesheetEdit($timesheet_id, $timesheet, $employee_id) * Edit Timesheet * * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetEdit'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimesheetEditWithHttpInfo($timesheet_id, $timesheet, $employee_id) + public function auEssTimesheetEditWithHttpInfo($timesheet_id, $employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetEdit'][0]) { - $returnType = ''; - $request = $this->auEssTimesheetEditRequest($timesheet_id, $timesheet, $employee_id); + $request = $this->auEssTimesheetEditRequest($timesheet_id, $employee_id, $timesheet, $contentType); try { $options = $this->createHttpClientOption(); @@ -20353,9 +22016,16 @@ public function auEssTimesheetEditWithHttpInfo($timesheet_id, $timesheet, $emplo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20366,11 +22036,11 @@ public function auEssTimesheetEditWithHttpInfo($timesheet_id, $timesheet, $emplo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -20389,15 +22059,16 @@ public function auEssTimesheetEditWithHttpInfo($timesheet_id, $timesheet, $emplo * Edit Timesheet * * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetEditAsync($timesheet_id, $timesheet, $employee_id) + public function auEssTimesheetEditAsync($timesheet_id, $employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetEdit'][0]) { - return $this->auEssTimesheetEditAsyncWithHttpInfo($timesheet_id, $timesheet, $employee_id) + return $this->auEssTimesheetEditAsyncWithHttpInfo($timesheet_id, $employee_id, $timesheet, $contentType) ->then( function ($response) { return $response[0]; @@ -20411,16 +22082,17 @@ function ($response) { * Edit Timesheet * * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetEditAsyncWithHttpInfo($timesheet_id, $timesheet, $employee_id) + public function auEssTimesheetEditAsyncWithHttpInfo($timesheet_id, $employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetEdit'][0]) { $returnType = ''; - $request = $this->auEssTimesheetEditRequest($timesheet_id, $timesheet, $employee_id); + $request = $this->auEssTimesheetEditRequest($timesheet_id, $employee_id, $timesheet, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -20439,7 +22111,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -20449,26 +22121,23 @@ function ($exception) { * Create request for operation 'auEssTimesheetEdit' * * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimesheetEditRequest($timesheet_id, $timesheet, $employee_id) + public function auEssTimesheetEditRequest($timesheet_id, $employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetEdit'][0]) { + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auEssTimesheetEdit' ); } - // verify the required parameter 'timesheet' is set - if ($timesheet === null || (is_array($timesheet) && count($timesheet) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timesheet when calling auEssTimesheetEdit' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -20476,6 +22145,14 @@ protected function auEssTimesheetEditRequest($timesheet_id, $timesheet, $employe ); } + // verify the required parameter 'timesheet' is set + if ($timesheet === null || (is_array($timesheet) && count($timesheet) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $timesheet when calling auEssTimesheetEdit' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/timesheet/{timesheetId}'; $formParams = []; $queryParams = []; @@ -20484,6 +22161,7 @@ protected function auEssTimesheetEditRequest($timesheet_id, $timesheet, $employe $multipart = false; + // path params if ($timesheet_id !== null) { $resourcePath = str_replace( @@ -20501,56 +22179,42 @@ protected function auEssTimesheetEditRequest($timesheet_id, $timesheet, $employe ); } - // body params - $_tempBody = null; - if (isset($timesheet)) { - $_tempBody = $timesheet; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($timesheet)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($timesheet)); + } else { + $httpBody = $timesheet; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20571,10 +22235,11 @@ protected function auEssTimesheetEditRequest($timesheet_id, $timesheet, $employe $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20588,14 +22253,15 @@ protected function auEssTimesheetEditRequest($timesheet_id, $timesheet, $employe * @param string $employee_id employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssTimesheetModel[] + * @return \OpenAPI\Client\Model\EssTimesheetModel[] */ - public function auEssTimesheetList($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetList($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetList'][0]) { - list($response) = $this->auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, $filter_to_date); + list($response) = $this->auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType); return $response; } @@ -20607,15 +22273,15 @@ public function auEssTimesheetList($employee_id, $filter_from_date, $filter_to_d * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssTimesheetModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssTimesheetModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetList'][0]) { - $returnType = '\Swagger\Client\Model\EssTimesheetModel[]'; - $request = $this->auEssTimesheetListRequest($employee_id, $filter_from_date, $filter_to_date); + $request = $this->auEssTimesheetListRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -20624,9 +22290,16 @@ public function auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20637,19 +22310,37 @@ public function auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssTimesheetModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssTimesheetModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssTimesheetModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssTimesheetModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -20666,7 +22357,7 @@ public function auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssTimesheetModel[]', + '\OpenAPI\Client\Model\EssTimesheetModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -20684,13 +22375,14 @@ public function auEssTimesheetListWithHttpInfo($employee_id, $filter_from_date, * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetListAsync($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetListAsync($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetList'][0]) { - return $this->auEssTimesheetListAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + return $this->auEssTimesheetListAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -20706,24 +22398,24 @@ function ($response) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetListAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetListAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetList'][0]) { - $returnType = '\Swagger\Client\Model\EssTimesheetModel[]'; - $request = $this->auEssTimesheetListRequest($employee_id, $filter_from_date, $filter_to_date); + $returnType = '\OpenAPI\Client\Model\EssTimesheetModel[]'; + $request = $this->auEssTimesheetListRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -20746,7 +22438,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -20758,24 +22450,28 @@ function ($exception) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimesheetListRequest($employee_id, $filter_from_date, $filter_to_date) + public function auEssTimesheetListRequest($employee_id, $filter_from_date, $filter_to_date, string $contentType = self::contentTypes['auEssTimesheetList'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auEssTimesheetList' ); } + // verify the required parameter 'filter_from_date' is set if ($filter_from_date === null || (is_array($filter_from_date) && count($filter_from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $filter_from_date when calling auEssTimesheetList' ); } + // verify the required parameter 'filter_to_date' is set if ($filter_to_date === null || (is_array($filter_to_date) && count($filter_to_date) === 0)) { throw new \InvalidArgumentException( @@ -20783,6 +22479,7 @@ protected function auEssTimesheetListRequest($employee_id, $filter_from_date, $f ); } + $resourcePath = '/api/v2/ess/{employeeId}/timesheet'; $formParams = []; $queryParams = []; @@ -20791,13 +22488,24 @@ protected function auEssTimesheetListRequest($employee_id, $filter_from_date, $f $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -20808,53 +22516,35 @@ protected function auEssTimesheetListRequest($employee_id, $filter_from_date, $f ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20875,10 +22565,11 @@ protected function auEssTimesheetListRequest($employee_id, $filter_from_date, $f $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20889,16 +22580,17 @@ protected function auEssTimesheetListRequest($employee_id, $filter_from_date, $f * * Submit or Update Timesheet * - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet timesheet (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetSave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEssTimesheetSave($timesheet, $employee_id) + public function auEssTimesheetSave($employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetSave'][0]) { - $this->auEssTimesheetSaveWithHttpInfo($timesheet, $employee_id); + $this->auEssTimesheetSaveWithHttpInfo($employee_id, $timesheet, $contentType); } /** @@ -20906,17 +22598,17 @@ public function auEssTimesheetSave($timesheet, $employee_id) * * Submit or Update Timesheet * - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetSave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEssTimesheetSaveWithHttpInfo($timesheet, $employee_id) + public function auEssTimesheetSaveWithHttpInfo($employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetSave'][0]) { - $returnType = ''; - $request = $this->auEssTimesheetSaveRequest($timesheet, $employee_id); + $request = $this->auEssTimesheetSaveRequest($employee_id, $timesheet, $contentType); try { $options = $this->createHttpClientOption(); @@ -20925,9 +22617,16 @@ public function auEssTimesheetSaveWithHttpInfo($timesheet, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20938,11 +22637,11 @@ public function auEssTimesheetSaveWithHttpInfo($timesheet, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -20960,15 +22659,16 @@ public function auEssTimesheetSaveWithHttpInfo($timesheet, $employee_id) * * Submit or Update Timesheet * - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetSave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetSaveAsync($timesheet, $employee_id) + public function auEssTimesheetSaveAsync($employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetSave'][0]) { - return $this->auEssTimesheetSaveAsyncWithHttpInfo($timesheet, $employee_id) + return $this->auEssTimesheetSaveAsyncWithHttpInfo($employee_id, $timesheet, $contentType) ->then( function ($response) { return $response[0]; @@ -20981,16 +22681,17 @@ function ($response) { * * Submit or Update Timesheet * - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetSave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEssTimesheetSaveAsyncWithHttpInfo($timesheet, $employee_id) + public function auEssTimesheetSaveAsyncWithHttpInfo($employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetSave'][0]) { $returnType = ''; - $request = $this->auEssTimesheetSaveRequest($timesheet, $employee_id); + $request = $this->auEssTimesheetSaveRequest($employee_id, $timesheet, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -21009,7 +22710,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21018,20 +22719,16 @@ function ($exception) { /** * Create request for operation 'auEssTimesheetSave' * - * @param \Swagger\Client\Model\EssTimesheetModel $timesheet (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssTimesheetModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEssTimesheetSave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEssTimesheetSaveRequest($timesheet, $employee_id) + public function auEssTimesheetSaveRequest($employee_id, $timesheet, string $contentType = self::contentTypes['auEssTimesheetSave'][0]) { - // verify the required parameter 'timesheet' is set - if ($timesheet === null || (is_array($timesheet) && count($timesheet) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timesheet when calling auEssTimesheetSave' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -21039,6 +22736,14 @@ protected function auEssTimesheetSaveRequest($timesheet, $employee_id) ); } + // verify the required parameter 'timesheet' is set + if ($timesheet === null || (is_array($timesheet) && count($timesheet) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $timesheet when calling auEssTimesheetSave' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/timesheet'; $formParams = []; $queryParams = []; @@ -21047,6 +22752,7 @@ protected function auEssTimesheetSaveRequest($timesheet, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -21056,56 +22762,42 @@ protected function auEssTimesheetSaveRequest($timesheet, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($timesheet)) { - $_tempBody = $timesheet; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($timesheet)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($timesheet)); + } else { + $httpBody = $timesheet; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21126,10 +22818,11 @@ protected function auEssTimesheetSaveRequest($timesheet, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21140,15 +22833,16 @@ protected function auEssTimesheetSaveRequest($timesheet, $employee_id) * * Register Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenRegister'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essDeviceTokenRegister($model) + public function essDeviceTokenRegister($model, string $contentType = self::contentTypes['essDeviceTokenRegister'][0]) { - $this->essDeviceTokenRegisterWithHttpInfo($model); + $this->essDeviceTokenRegisterWithHttpInfo($model, $contentType); } /** @@ -21156,16 +22850,16 @@ public function essDeviceTokenRegister($model) * * Register Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenRegister'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essDeviceTokenRegisterWithHttpInfo($model) + public function essDeviceTokenRegisterWithHttpInfo($model, string $contentType = self::contentTypes['essDeviceTokenRegister'][0]) { - $returnType = ''; - $request = $this->essDeviceTokenRegisterRequest($model); + $request = $this->essDeviceTokenRegisterRequest($model, $contentType); try { $options = $this->createHttpClientOption(); @@ -21174,9 +22868,16 @@ public function essDeviceTokenRegisterWithHttpInfo($model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21187,11 +22888,11 @@ public function essDeviceTokenRegisterWithHttpInfo($model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -21209,14 +22910,15 @@ public function essDeviceTokenRegisterWithHttpInfo($model) * * Register Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenRegister'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essDeviceTokenRegisterAsync($model) + public function essDeviceTokenRegisterAsync($model, string $contentType = self::contentTypes['essDeviceTokenRegister'][0]) { - return $this->essDeviceTokenRegisterAsyncWithHttpInfo($model) + return $this->essDeviceTokenRegisterAsyncWithHttpInfo($model, $contentType) ->then( function ($response) { return $response[0]; @@ -21229,15 +22931,16 @@ function ($response) { * * Register Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenRegister'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essDeviceTokenRegisterAsyncWithHttpInfo($model) + public function essDeviceTokenRegisterAsyncWithHttpInfo($model, string $contentType = self::contentTypes['essDeviceTokenRegister'][0]) { $returnType = ''; - $request = $this->essDeviceTokenRegisterRequest($model); + $request = $this->essDeviceTokenRegisterRequest($model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -21256,7 +22959,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21265,13 +22968,15 @@ function ($exception) { /** * Create request for operation 'essDeviceTokenRegister' * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenRegister'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essDeviceTokenRegisterRequest($model) + public function essDeviceTokenRegisterRequest($model, string $contentType = self::contentTypes['essDeviceTokenRegister'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -21279,6 +22984,7 @@ protected function essDeviceTokenRegisterRequest($model) ); } + $resourcePath = '/api/v2/ess/devicetoken/register'; $formParams = []; $queryParams = []; @@ -21288,56 +22994,43 @@ protected function essDeviceTokenRegisterRequest($model) - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21358,10 +23051,11 @@ protected function essDeviceTokenRegisterRequest($model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21372,15 +23066,16 @@ protected function essDeviceTokenRegisterRequest($model) * * Unregister Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenUnregister'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essDeviceTokenUnregister($model) + public function essDeviceTokenUnregister($model, string $contentType = self::contentTypes['essDeviceTokenUnregister'][0]) { - $this->essDeviceTokenUnregisterWithHttpInfo($model); + $this->essDeviceTokenUnregisterWithHttpInfo($model, $contentType); } /** @@ -21388,16 +23083,16 @@ public function essDeviceTokenUnregister($model) * * Unregister Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenUnregister'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essDeviceTokenUnregisterWithHttpInfo($model) + public function essDeviceTokenUnregisterWithHttpInfo($model, string $contentType = self::contentTypes['essDeviceTokenUnregister'][0]) { - $returnType = ''; - $request = $this->essDeviceTokenUnregisterRequest($model); + $request = $this->essDeviceTokenUnregisterRequest($model, $contentType); try { $options = $this->createHttpClientOption(); @@ -21406,9 +23101,16 @@ public function essDeviceTokenUnregisterWithHttpInfo($model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21419,11 +23121,11 @@ public function essDeviceTokenUnregisterWithHttpInfo($model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -21441,14 +23143,15 @@ public function essDeviceTokenUnregisterWithHttpInfo($model) * * Unregister Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenUnregister'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essDeviceTokenUnregisterAsync($model) + public function essDeviceTokenUnregisterAsync($model, string $contentType = self::contentTypes['essDeviceTokenUnregister'][0]) { - return $this->essDeviceTokenUnregisterAsyncWithHttpInfo($model) + return $this->essDeviceTokenUnregisterAsyncWithHttpInfo($model, $contentType) ->then( function ($response) { return $response[0]; @@ -21461,15 +23164,16 @@ function ($response) { * * Unregister Device Token * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenUnregister'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essDeviceTokenUnregisterAsyncWithHttpInfo($model) + public function essDeviceTokenUnregisterAsyncWithHttpInfo($model, string $contentType = self::contentTypes['essDeviceTokenUnregister'][0]) { $returnType = ''; - $request = $this->essDeviceTokenUnregisterRequest($model); + $request = $this->essDeviceTokenUnregisterRequest($model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -21488,7 +23192,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21497,13 +23201,15 @@ function ($exception) { /** * Create request for operation 'essDeviceTokenUnregister' * - * @param \Swagger\Client\Model\DeviceTokenModel $model (required) + * @param \OpenAPI\Client\Model\DeviceTokenModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essDeviceTokenUnregister'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essDeviceTokenUnregisterRequest($model) + public function essDeviceTokenUnregisterRequest($model, string $contentType = self::contentTypes['essDeviceTokenUnregister'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -21511,6 +23217,7 @@ protected function essDeviceTokenUnregisterRequest($model) ); } + $resourcePath = '/api/v2/ess/devicetoken/unregister'; $formParams = []; $queryParams = []; @@ -21520,56 +23227,43 @@ protected function essDeviceTokenUnregisterRequest($model) - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21590,10 +23284,11 @@ protected function essDeviceTokenUnregisterRequest($model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21606,14 +23301,15 @@ protected function essDeviceTokenUnregisterRequest($model) * * @param int $expense_request_id expense_request_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCancelExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssExpenseRequestResponseModel + * @return \OpenAPI\Client\Model\EssExpenseRequestResponseModel */ - public function essExpenseCancelExpenseRequest($expense_request_id, $employee_id) + public function essExpenseCancelExpenseRequest($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseCancelExpenseRequest'][0]) { - list($response) = $this->essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, $employee_id); + list($response) = $this->essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, $employee_id, $contentType); return $response; } @@ -21624,15 +23320,15 @@ public function essExpenseCancelExpenseRequest($expense_request_id, $employee_id * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCancelExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssExpenseRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssExpenseRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, $employee_id) + public function essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseCancelExpenseRequest'][0]) { - $returnType = '\Swagger\Client\Model\EssExpenseRequestResponseModel'; - $request = $this->essExpenseCancelExpenseRequestRequest($expense_request_id, $employee_id); + $request = $this->essExpenseCancelExpenseRequestRequest($expense_request_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -21641,9 +23337,16 @@ public function essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21654,19 +23357,37 @@ public function essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssExpenseRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssExpenseRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssExpenseRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssExpenseRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -21683,7 +23404,7 @@ public function essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssExpenseRequestResponseModel', + '\OpenAPI\Client\Model\EssExpenseRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -21700,13 +23421,14 @@ public function essExpenseCancelExpenseRequestWithHttpInfo($expense_request_id, * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCancelExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseCancelExpenseRequestAsync($expense_request_id, $employee_id) + public function essExpenseCancelExpenseRequestAsync($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseCancelExpenseRequest'][0]) { - return $this->essExpenseCancelExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id) + return $this->essExpenseCancelExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -21721,24 +23443,24 @@ function ($response) { * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCancelExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseCancelExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id) + public function essExpenseCancelExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseCancelExpenseRequest'][0]) { - $returnType = '\Swagger\Client\Model\EssExpenseRequestResponseModel'; - $request = $this->essExpenseCancelExpenseRequestRequest($expense_request_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssExpenseRequestResponseModel'; + $request = $this->essExpenseCancelExpenseRequestRequest($expense_request_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -21761,7 +23483,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21772,18 +23494,21 @@ function ($exception) { * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCancelExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseCancelExpenseRequestRequest($expense_request_id, $employee_id) + public function essExpenseCancelExpenseRequestRequest($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseCancelExpenseRequest'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling essExpenseCancelExpenseRequest' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -21791,6 +23516,7 @@ protected function essExpenseCancelExpenseRequestRequest($expense_request_id, $e ); } + $resourcePath = '/api/v2/ess/{employeeId}/expense/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -21799,6 +23525,7 @@ protected function essExpenseCancelExpenseRequestRequest($expense_request_id, $e $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -21816,53 +23543,35 @@ protected function essExpenseCancelExpenseRequestRequest($expense_request_id, $e ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21883,10 +23592,11 @@ protected function essExpenseCancelExpenseRequestRequest($expense_request_id, $e $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21897,16 +23607,17 @@ protected function essExpenseCancelExpenseRequestRequest($expense_request_id, $e * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCreateExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essExpenseCreateExpenseRequest($model, $employee_id) + public function essExpenseCreateExpenseRequest($employee_id, $model, string $contentType = self::contentTypes['essExpenseCreateExpenseRequest'][0]) { - $this->essExpenseCreateExpenseRequestWithHttpInfo($model, $employee_id); + $this->essExpenseCreateExpenseRequestWithHttpInfo($employee_id, $model, $contentType); } /** @@ -21914,17 +23625,17 @@ public function essExpenseCreateExpenseRequest($model, $employee_id) * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCreateExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseCreateExpenseRequestWithHttpInfo($model, $employee_id) + public function essExpenseCreateExpenseRequestWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['essExpenseCreateExpenseRequest'][0]) { - $returnType = ''; - $request = $this->essExpenseCreateExpenseRequestRequest($model, $employee_id); + $request = $this->essExpenseCreateExpenseRequestRequest($employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -21933,9 +23644,16 @@ public function essExpenseCreateExpenseRequestWithHttpInfo($model, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21946,11 +23664,11 @@ public function essExpenseCreateExpenseRequestWithHttpInfo($model, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -21968,15 +23686,16 @@ public function essExpenseCreateExpenseRequestWithHttpInfo($model, $employee_id) * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCreateExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseCreateExpenseRequestAsync($model, $employee_id) + public function essExpenseCreateExpenseRequestAsync($employee_id, $model, string $contentType = self::contentTypes['essExpenseCreateExpenseRequest'][0]) { - return $this->essExpenseCreateExpenseRequestAsyncWithHttpInfo($model, $employee_id) + return $this->essExpenseCreateExpenseRequestAsyncWithHttpInfo($employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -21989,16 +23708,17 @@ function ($response) { * * Create Expense Request * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCreateExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseCreateExpenseRequestAsyncWithHttpInfo($model, $employee_id) + public function essExpenseCreateExpenseRequestAsyncWithHttpInfo($employee_id, $model, string $contentType = self::contentTypes['essExpenseCreateExpenseRequest'][0]) { $returnType = ''; - $request = $this->essExpenseCreateExpenseRequestRequest($model, $employee_id); + $request = $this->essExpenseCreateExpenseRequestRequest($employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -22017,7 +23737,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22026,20 +23746,16 @@ function ($exception) { /** * Create request for operation 'essExpenseCreateExpenseRequest' * - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseCreateExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseCreateExpenseRequestRequest($model, $employee_id) - { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling essExpenseCreateExpenseRequest' - ); - } + public function essExpenseCreateExpenseRequestRequest($employee_id, $model, string $contentType = self::contentTypes['essExpenseCreateExpenseRequest'][0]) + { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -22047,6 +23763,14 @@ protected function essExpenseCreateExpenseRequestRequest($model, $employee_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling essExpenseCreateExpenseRequest' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/expense'; $formParams = []; $queryParams = []; @@ -22055,6 +23779,7 @@ protected function essExpenseCreateExpenseRequestRequest($model, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -22064,56 +23789,42 @@ protected function essExpenseCreateExpenseRequestRequest($model, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22134,10 +23845,11 @@ protected function essExpenseCreateExpenseRequestRequest($model, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -22149,14 +23861,15 @@ protected function essExpenseCreateExpenseRequestRequest($model, $employee_id) * Get Expense Categories * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseExpenseCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ExpenseCategoryResponseModel[] + * @return \OpenAPI\Client\Model\ExpenseCategoryResponseModel[] */ - public function essExpenseExpenseCategories($employee_id) + public function essExpenseExpenseCategories($employee_id, string $contentType = self::contentTypes['essExpenseExpenseCategories'][0]) { - list($response) = $this->essExpenseExpenseCategoriesWithHttpInfo($employee_id); + list($response) = $this->essExpenseExpenseCategoriesWithHttpInfo($employee_id, $contentType); return $response; } @@ -22166,15 +23879,15 @@ public function essExpenseExpenseCategories($employee_id) * Get Expense Categories * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseExpenseCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ExpenseCategoryResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ExpenseCategoryResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseExpenseCategoriesWithHttpInfo($employee_id) + public function essExpenseExpenseCategoriesWithHttpInfo($employee_id, string $contentType = self::contentTypes['essExpenseExpenseCategories'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseCategoryResponseModel[]'; - $request = $this->essExpenseExpenseCategoriesRequest($employee_id); + $request = $this->essExpenseExpenseCategoriesRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -22183,9 +23896,16 @@ public function essExpenseExpenseCategoriesWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -22196,19 +23916,37 @@ public function essExpenseExpenseCategoriesWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22225,7 +23963,7 @@ public function essExpenseExpenseCategoriesWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ExpenseCategoryResponseModel[]', + '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -22241,13 +23979,14 @@ public function essExpenseExpenseCategoriesWithHttpInfo($employee_id) * Get Expense Categories * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseExpenseCategoriesAsync($employee_id) + public function essExpenseExpenseCategoriesAsync($employee_id, string $contentType = self::contentTypes['essExpenseExpenseCategories'][0]) { - return $this->essExpenseExpenseCategoriesAsyncWithHttpInfo($employee_id) + return $this->essExpenseExpenseCategoriesAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -22261,24 +24000,24 @@ function ($response) { * Get Expense Categories * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseExpenseCategoriesAsyncWithHttpInfo($employee_id) + public function essExpenseExpenseCategoriesAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essExpenseExpenseCategories'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseCategoryResponseModel[]'; - $request = $this->essExpenseExpenseCategoriesRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]'; + $request = $this->essExpenseExpenseCategoriesRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22301,7 +24040,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22311,12 +24050,14 @@ function ($exception) { * Create request for operation 'essExpenseExpenseCategories' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseExpenseCategoriesRequest($employee_id) + public function essExpenseExpenseCategoriesRequest($employee_id, string $contentType = self::contentTypes['essExpenseExpenseCategories'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -22324,6 +24065,7 @@ protected function essExpenseExpenseCategoriesRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/expense/categories'; $formParams = []; $queryParams = []; @@ -22332,6 +24074,7 @@ protected function essExpenseExpenseCategoriesRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -22341,53 +24084,35 @@ protected function essExpenseExpenseCategoriesRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22408,10 +24133,11 @@ protected function essExpenseExpenseCategoriesRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -22424,14 +24150,15 @@ protected function essExpenseExpenseCategoriesRequest($employee_id) * * @param int $expense_request_id expense_request_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssExpenseRequestResponseModel + * @return \OpenAPI\Client\Model\EssExpenseRequestResponseModel */ - public function essExpenseGetExpenseRequest($expense_request_id, $employee_id) + public function essExpenseGetExpenseRequest($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseGetExpenseRequest'][0]) { - list($response) = $this->essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $employee_id); + list($response) = $this->essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $employee_id, $contentType); return $response; } @@ -22442,15 +24169,15 @@ public function essExpenseGetExpenseRequest($expense_request_id, $employee_id) * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssExpenseRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssExpenseRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $employee_id) + public function essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseGetExpenseRequest'][0]) { - $returnType = '\Swagger\Client\Model\EssExpenseRequestResponseModel'; - $request = $this->essExpenseGetExpenseRequestRequest($expense_request_id, $employee_id); + $request = $this->essExpenseGetExpenseRequestRequest($expense_request_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -22459,9 +24186,16 @@ public function essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $em } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -22472,19 +24206,37 @@ public function essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $em sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssExpenseRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssExpenseRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssExpenseRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssExpenseRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22501,7 +24253,7 @@ public function essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $em case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssExpenseRequestResponseModel', + '\OpenAPI\Client\Model\EssExpenseRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -22518,13 +24270,14 @@ public function essExpenseGetExpenseRequestWithHttpInfo($expense_request_id, $em * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseGetExpenseRequestAsync($expense_request_id, $employee_id) + public function essExpenseGetExpenseRequestAsync($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseGetExpenseRequest'][0]) { - return $this->essExpenseGetExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id) + return $this->essExpenseGetExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -22539,24 +24292,24 @@ function ($response) { * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseGetExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id) + public function essExpenseGetExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseGetExpenseRequest'][0]) { - $returnType = '\Swagger\Client\Model\EssExpenseRequestResponseModel'; - $request = $this->essExpenseGetExpenseRequestRequest($expense_request_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssExpenseRequestResponseModel'; + $request = $this->essExpenseGetExpenseRequestRequest($expense_request_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22579,7 +24332,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22590,18 +24343,21 @@ function ($exception) { * * @param int $expense_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseGetExpenseRequestRequest($expense_request_id, $employee_id) + public function essExpenseGetExpenseRequestRequest($expense_request_id, $employee_id, string $contentType = self::contentTypes['essExpenseGetExpenseRequest'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling essExpenseGetExpenseRequest' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -22609,6 +24365,7 @@ protected function essExpenseGetExpenseRequestRequest($expense_request_id, $empl ); } + $resourcePath = '/api/v2/ess/{employeeId}/expense/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -22617,6 +24374,7 @@ protected function essExpenseGetExpenseRequestRequest($expense_request_id, $empl $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -22634,53 +24392,35 @@ protected function essExpenseGetExpenseRequestRequest($expense_request_id, $empl ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22701,10 +24441,11 @@ protected function essExpenseGetExpenseRequestRequest($expense_request_id, $empl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -22718,14 +24459,15 @@ protected function essExpenseGetExpenseRequestRequest($expense_request_id, $empl * @param string $employee_id employee_id (required) * @param int $current_page current_page (optional, default to 1) * @param int $page_size page_size (optional, default to 100) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssExpenseRequestResponseModel[] + * @return \OpenAPI\Client\Model\EssExpenseRequestResponseModel[] */ - public function essExpenseGetExpenseRequests($employee_id, $current_page = '1', $page_size = '100') + public function essExpenseGetExpenseRequests($employee_id, $current_page = 1, $page_size = 100, string $contentType = self::contentTypes['essExpenseGetExpenseRequests'][0]) { - list($response) = $this->essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_page, $page_size); + list($response) = $this->essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_page, $page_size, $contentType); return $response; } @@ -22737,15 +24479,15 @@ public function essExpenseGetExpenseRequests($employee_id, $current_page = '1', * @param string $employee_id (required) * @param int $current_page (optional, default to 1) * @param int $page_size (optional, default to 100) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssExpenseRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssExpenseRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_page = '1', $page_size = '100') + public function essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_page = 1, $page_size = 100, string $contentType = self::contentTypes['essExpenseGetExpenseRequests'][0]) { - $returnType = '\Swagger\Client\Model\EssExpenseRequestResponseModel[]'; - $request = $this->essExpenseGetExpenseRequestsRequest($employee_id, $current_page, $page_size); + $request = $this->essExpenseGetExpenseRequestsRequest($employee_id, $current_page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); @@ -22754,9 +24496,16 @@ public function essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -22767,19 +24516,37 @@ public function essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssExpenseRequestResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssExpenseRequestResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssExpenseRequestResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssExpenseRequestResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22796,7 +24563,7 @@ public function essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssExpenseRequestResponseModel[]', + '\OpenAPI\Client\Model\EssExpenseRequestResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -22814,13 +24581,14 @@ public function essExpenseGetExpenseRequestsWithHttpInfo($employee_id, $current_ * @param string $employee_id (required) * @param int $current_page (optional, default to 1) * @param int $page_size (optional, default to 100) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseGetExpenseRequestsAsync($employee_id, $current_page = '1', $page_size = '100') + public function essExpenseGetExpenseRequestsAsync($employee_id, $current_page = 1, $page_size = 100, string $contentType = self::contentTypes['essExpenseGetExpenseRequests'][0]) { - return $this->essExpenseGetExpenseRequestsAsyncWithHttpInfo($employee_id, $current_page, $page_size) + return $this->essExpenseGetExpenseRequestsAsyncWithHttpInfo($employee_id, $current_page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -22836,24 +24604,24 @@ function ($response) { * @param string $employee_id (required) * @param int $current_page (optional, default to 1) * @param int $page_size (optional, default to 100) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseGetExpenseRequestsAsyncWithHttpInfo($employee_id, $current_page = '1', $page_size = '100') + public function essExpenseGetExpenseRequestsAsyncWithHttpInfo($employee_id, $current_page = 1, $page_size = 100, string $contentType = self::contentTypes['essExpenseGetExpenseRequests'][0]) { - $returnType = '\Swagger\Client\Model\EssExpenseRequestResponseModel[]'; - $request = $this->essExpenseGetExpenseRequestsRequest($employee_id, $current_page, $page_size); + $returnType = '\OpenAPI\Client\Model\EssExpenseRequestResponseModel[]'; + $request = $this->essExpenseGetExpenseRequestsRequest($employee_id, $current_page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22876,7 +24644,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22888,12 +24656,14 @@ function ($exception) { * @param string $employee_id (required) * @param int $current_page (optional, default to 1) * @param int $page_size (optional, default to 100) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseGetExpenseRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseGetExpenseRequestsRequest($employee_id, $current_page = '1', $page_size = '100') + public function essExpenseGetExpenseRequestsRequest($employee_id, $current_page = 1, $page_size = 100, string $contentType = self::contentTypes['essExpenseGetExpenseRequests'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -22901,6 +24671,9 @@ protected function essExpenseGetExpenseRequestsRequest($employee_id, $current_pa ); } + + + $resourcePath = '/api/v2/ess/{employeeId}/expense'; $formParams = []; $queryParams = []; @@ -22909,13 +24682,24 @@ protected function essExpenseGetExpenseRequestsRequest($employee_id, $current_pa $multipart = false; // query params - if ($current_page !== null) { - $queryParams['currentPage'] = ObjectSerializer::toQueryValue($current_page); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $current_page, + 'currentPage', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - $queryParams['pageSize'] = ObjectSerializer::toQueryValue($page_size); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -22926,53 +24710,35 @@ protected function essExpenseGetExpenseRequestsRequest($employee_id, $current_pa ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22993,10 +24759,11 @@ protected function essExpenseGetExpenseRequestsRequest($employee_id, $current_pa $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23008,14 +24775,15 @@ protected function essExpenseGetExpenseRequestsRequest($employee_id, $current_pa * Get Expense Payment Summary * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseSummary'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeExpensePaymentSummaryModel[] + * @return \OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[] */ - public function essExpenseSummary($employee_id) + public function essExpenseSummary($employee_id, string $contentType = self::contentTypes['essExpenseSummary'][0]) { - list($response) = $this->essExpenseSummaryWithHttpInfo($employee_id); + list($response) = $this->essExpenseSummaryWithHttpInfo($employee_id, $contentType); return $response; } @@ -23025,15 +24793,15 @@ public function essExpenseSummary($employee_id) * Get Expense Payment Summary * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseSummary'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeExpensePaymentSummaryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseSummaryWithHttpInfo($employee_id) + public function essExpenseSummaryWithHttpInfo($employee_id, string $contentType = self::contentTypes['essExpenseSummary'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpensePaymentSummaryModel[]'; - $request = $this->essExpenseSummaryRequest($employee_id); + $request = $this->essExpenseSummaryRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23042,9 +24810,16 @@ public function essExpenseSummaryWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23055,19 +24830,37 @@ public function essExpenseSummaryWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23084,7 +24877,7 @@ public function essExpenseSummaryWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeExpensePaymentSummaryModel[]', + '\OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -23100,13 +24893,14 @@ public function essExpenseSummaryWithHttpInfo($employee_id) * Get Expense Payment Summary * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseSummaryAsync($employee_id) + public function essExpenseSummaryAsync($employee_id, string $contentType = self::contentTypes['essExpenseSummary'][0]) { - return $this->essExpenseSummaryAsyncWithHttpInfo($employee_id) + return $this->essExpenseSummaryAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23120,24 +24914,24 @@ function ($response) { * Get Expense Payment Summary * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseSummaryAsyncWithHttpInfo($employee_id) + public function essExpenseSummaryAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essExpenseSummary'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeExpensePaymentSummaryModel[]'; - $request = $this->essExpenseSummaryRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EmployeeExpensePaymentSummaryModel[]'; + $request = $this->essExpenseSummaryRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23160,7 +24954,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23170,12 +24964,14 @@ function ($exception) { * Create request for operation 'essExpenseSummary' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseSummaryRequest($employee_id) + public function essExpenseSummaryRequest($employee_id, string $contentType = self::contentTypes['essExpenseSummary'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -23183,6 +24979,7 @@ protected function essExpenseSummaryRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/expense/summary'; $formParams = []; $queryParams = []; @@ -23191,6 +24988,7 @@ protected function essExpenseSummaryRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -23200,53 +24998,35 @@ protected function essExpenseSummaryRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23267,10 +25047,11 @@ protected function essExpenseSummaryRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23282,14 +25063,15 @@ protected function essExpenseSummaryRequest($employee_id) * Get Tax Codes * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseTaxCodes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\JournalServiceTaxCode[] + * @return \OpenAPI\Client\Model\JournalServiceTaxCode[] */ - public function essExpenseTaxCodes($employee_id) + public function essExpenseTaxCodes($employee_id, string $contentType = self::contentTypes['essExpenseTaxCodes'][0]) { - list($response) = $this->essExpenseTaxCodesWithHttpInfo($employee_id); + list($response) = $this->essExpenseTaxCodesWithHttpInfo($employee_id, $contentType); return $response; } @@ -23299,15 +25081,15 @@ public function essExpenseTaxCodes($employee_id) * Get Tax Codes * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseTaxCodes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\JournalServiceTaxCode[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\JournalServiceTaxCode[], HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseTaxCodesWithHttpInfo($employee_id) + public function essExpenseTaxCodesWithHttpInfo($employee_id, string $contentType = self::contentTypes['essExpenseTaxCodes'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceTaxCode[]'; - $request = $this->essExpenseTaxCodesRequest($employee_id); + $request = $this->essExpenseTaxCodesRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23316,9 +25098,16 @@ public function essExpenseTaxCodesWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23329,19 +25118,37 @@ public function essExpenseTaxCodesWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JournalServiceTaxCode[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JournalServiceTaxCode[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JournalServiceTaxCode[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JournalServiceTaxCode[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23358,7 +25165,7 @@ public function essExpenseTaxCodesWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\JournalServiceTaxCode[]', + '\OpenAPI\Client\Model\JournalServiceTaxCode[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -23374,13 +25181,14 @@ public function essExpenseTaxCodesWithHttpInfo($employee_id) * Get Tax Codes * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseTaxCodesAsync($employee_id) + public function essExpenseTaxCodesAsync($employee_id, string $contentType = self::contentTypes['essExpenseTaxCodes'][0]) { - return $this->essExpenseTaxCodesAsyncWithHttpInfo($employee_id) + return $this->essExpenseTaxCodesAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23394,24 +25202,24 @@ function ($response) { * Get Tax Codes * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseTaxCodesAsyncWithHttpInfo($employee_id) + public function essExpenseTaxCodesAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essExpenseTaxCodes'][0]) { - $returnType = '\Swagger\Client\Model\JournalServiceTaxCode[]'; - $request = $this->essExpenseTaxCodesRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\JournalServiceTaxCode[]'; + $request = $this->essExpenseTaxCodesRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23434,7 +25242,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23444,12 +25252,14 @@ function ($exception) { * Create request for operation 'essExpenseTaxCodes' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseTaxCodesRequest($employee_id) + public function essExpenseTaxCodesRequest($employee_id, string $contentType = self::contentTypes['essExpenseTaxCodes'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -23457,6 +25267,7 @@ protected function essExpenseTaxCodesRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/expense/taxcodes'; $formParams = []; $queryParams = []; @@ -23465,6 +25276,7 @@ protected function essExpenseTaxCodesRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -23474,53 +25286,35 @@ protected function essExpenseTaxCodesRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23541,10 +25335,11 @@ protected function essExpenseTaxCodesRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23556,16 +25351,17 @@ protected function essExpenseTaxCodesRequest($employee_id) * Update Expense Request * * @param int $expense_request_id expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model model (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUpdateExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essExpenseUpdateExpenseRequest($expense_request_id, $model, $employee_id) + public function essExpenseUpdateExpenseRequest($expense_request_id, $employee_id, $model, string $contentType = self::contentTypes['essExpenseUpdateExpenseRequest'][0]) { - $this->essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, $model, $employee_id); + $this->essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, $employee_id, $model, $contentType); } /** @@ -23574,17 +25370,17 @@ public function essExpenseUpdateExpenseRequest($expense_request_id, $model, $emp * Update Expense Request * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUpdateExpenseRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, $model, $employee_id) + public function essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, $employee_id, $model, string $contentType = self::contentTypes['essExpenseUpdateExpenseRequest'][0]) { - $returnType = ''; - $request = $this->essExpenseUpdateExpenseRequestRequest($expense_request_id, $model, $employee_id); + $request = $this->essExpenseUpdateExpenseRequestRequest($expense_request_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -23593,9 +25389,16 @@ public function essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23606,11 +25409,11 @@ public function essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -23629,15 +25432,16 @@ public function essExpenseUpdateExpenseRequestWithHttpInfo($expense_request_id, * Update Expense Request * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUpdateExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseUpdateExpenseRequestAsync($expense_request_id, $model, $employee_id) + public function essExpenseUpdateExpenseRequestAsync($expense_request_id, $employee_id, $model, string $contentType = self::contentTypes['essExpenseUpdateExpenseRequest'][0]) { - return $this->essExpenseUpdateExpenseRequestAsyncWithHttpInfo($expense_request_id, $model, $employee_id) + return $this->essExpenseUpdateExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -23651,16 +25455,17 @@ function ($response) { * Update Expense Request * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUpdateExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseUpdateExpenseRequestAsyncWithHttpInfo($expense_request_id, $model, $employee_id) + public function essExpenseUpdateExpenseRequestAsyncWithHttpInfo($expense_request_id, $employee_id, $model, string $contentType = self::contentTypes['essExpenseUpdateExpenseRequest'][0]) { $returnType = ''; - $request = $this->essExpenseUpdateExpenseRequestRequest($expense_request_id, $model, $employee_id); + $request = $this->essExpenseUpdateExpenseRequestRequest($expense_request_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -23679,7 +25484,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23689,26 +25494,23 @@ function ($exception) { * Create request for operation 'essExpenseUpdateExpenseRequest' * * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $model (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUpdateExpenseRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseUpdateExpenseRequestRequest($expense_request_id, $model, $employee_id) + public function essExpenseUpdateExpenseRequestRequest($expense_request_id, $employee_id, $model, string $contentType = self::contentTypes['essExpenseUpdateExpenseRequest'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling essExpenseUpdateExpenseRequest' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling essExpenseUpdateExpenseRequest' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -23716,6 +25518,14 @@ protected function essExpenseUpdateExpenseRequestRequest($expense_request_id, $m ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling essExpenseUpdateExpenseRequest' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/expense/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -23724,6 +25534,7 @@ protected function essExpenseUpdateExpenseRequestRequest($expense_request_id, $m $multipart = false; + // path params if ($expense_request_id !== null) { $resourcePath = str_replace( @@ -23741,56 +25552,42 @@ protected function essExpenseUpdateExpenseRequestRequest($expense_request_id, $m ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23811,10 +25608,11 @@ protected function essExpenseUpdateExpenseRequestRequest($expense_request_id, $m $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23828,14 +25626,15 @@ protected function essExpenseUpdateExpenseRequestRequest($expense_request_id, $m * @param int $expense_request_id expense_request_id (required) * @param string $file_name file_name (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function essExpenseUploadAttachment($expense_request_id, $file_name, $employee_id) + public function essExpenseUploadAttachment($expense_request_id, $file_name, $employee_id, string $contentType = self::contentTypes['essExpenseUploadAttachment'][0]) { - list($response) = $this->essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $file_name, $employee_id); + list($response) = $this->essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $file_name, $employee_id, $contentType); return $response; } @@ -23847,15 +25646,15 @@ public function essExpenseUploadAttachment($expense_request_id, $file_name, $emp * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $file_name, $employee_id) + public function essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $file_name, $employee_id, string $contentType = self::contentTypes['essExpenseUploadAttachment'][0]) { - $returnType = 'object'; - $request = $this->essExpenseUploadAttachmentRequest($expense_request_id, $file_name, $employee_id); + $request = $this->essExpenseUploadAttachmentRequest($expense_request_id, $file_name, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23864,9 +25663,16 @@ public function essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $fil } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23877,19 +25683,37 @@ public function essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $fil sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23924,13 +25748,14 @@ public function essExpenseUploadAttachmentWithHttpInfo($expense_request_id, $fil * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseUploadAttachmentAsync($expense_request_id, $file_name, $employee_id) + public function essExpenseUploadAttachmentAsync($expense_request_id, $file_name, $employee_id, string $contentType = self::contentTypes['essExpenseUploadAttachment'][0]) { - return $this->essExpenseUploadAttachmentAsyncWithHttpInfo($expense_request_id, $file_name, $employee_id) + return $this->essExpenseUploadAttachmentAsyncWithHttpInfo($expense_request_id, $file_name, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23946,24 +25771,24 @@ function ($response) { * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essExpenseUploadAttachmentAsyncWithHttpInfo($expense_request_id, $file_name, $employee_id) + public function essExpenseUploadAttachmentAsyncWithHttpInfo($expense_request_id, $file_name, $employee_id, string $contentType = self::contentTypes['essExpenseUploadAttachment'][0]) { $returnType = 'object'; - $request = $this->essExpenseUploadAttachmentRequest($expense_request_id, $file_name, $employee_id); + $request = $this->essExpenseUploadAttachmentRequest($expense_request_id, $file_name, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23986,7 +25811,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23998,24 +25823,28 @@ function ($exception) { * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essExpenseUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essExpenseUploadAttachmentRequest($expense_request_id, $file_name, $employee_id) + public function essExpenseUploadAttachmentRequest($expense_request_id, $file_name, $employee_id, string $contentType = self::contentTypes['essExpenseUploadAttachment'][0]) { + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling essExpenseUploadAttachment' ); } + // verify the required parameter 'file_name' is set if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $file_name when calling essExpenseUploadAttachment' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -24023,6 +25852,7 @@ protected function essExpenseUploadAttachmentRequest($expense_request_id, $file_ ); } + $resourcePath = '/api/v2/ess/{employeeId}/expense/{expenseRequestId}/attachment'; $formParams = []; $queryParams = []; @@ -24031,9 +25861,15 @@ protected function essExpenseUploadAttachmentRequest($expense_request_id, $file_ $multipart = false; // query params - if ($file_name !== null) { - $queryParams['fileName'] = ObjectSerializer::toQueryValue($file_name); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_name, + 'fileName', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($expense_request_id !== null) { @@ -24052,53 +25888,35 @@ protected function essExpenseUploadAttachmentRequest($expense_request_id, $file_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24119,10 +25937,11 @@ protected function essExpenseUploadAttachmentRequest($expense_request_id, $file_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24133,16 +25952,17 @@ protected function essExpenseUploadAttachmentRequest($expense_request_id, $file_ * * Create Leave Request * - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application leave_application (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveApplyForLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essLeaveApplyForLeave($leave_application, $employee_id) + public function essLeaveApplyForLeave($employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveApplyForLeave'][0]) { - $this->essLeaveApplyForLeaveWithHttpInfo($leave_application, $employee_id); + $this->essLeaveApplyForLeaveWithHttpInfo($employee_id, $leave_application, $contentType); } /** @@ -24150,17 +25970,17 @@ public function essLeaveApplyForLeave($leave_application, $employee_id) * * Create Leave Request * - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveApplyForLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveApplyForLeaveWithHttpInfo($leave_application, $employee_id) + public function essLeaveApplyForLeaveWithHttpInfo($employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveApplyForLeave'][0]) { - $returnType = ''; - $request = $this->essLeaveApplyForLeaveRequest($leave_application, $employee_id); + $request = $this->essLeaveApplyForLeaveRequest($employee_id, $leave_application, $contentType); try { $options = $this->createHttpClientOption(); @@ -24169,9 +25989,16 @@ public function essLeaveApplyForLeaveWithHttpInfo($leave_application, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24182,11 +26009,11 @@ public function essLeaveApplyForLeaveWithHttpInfo($leave_application, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -24204,15 +26031,16 @@ public function essLeaveApplyForLeaveWithHttpInfo($leave_application, $employee_ * * Create Leave Request * - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveApplyForLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveApplyForLeaveAsync($leave_application, $employee_id) + public function essLeaveApplyForLeaveAsync($employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveApplyForLeave'][0]) { - return $this->essLeaveApplyForLeaveAsyncWithHttpInfo($leave_application, $employee_id) + return $this->essLeaveApplyForLeaveAsyncWithHttpInfo($employee_id, $leave_application, $contentType) ->then( function ($response) { return $response[0]; @@ -24225,16 +26053,17 @@ function ($response) { * * Create Leave Request * - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveApplyForLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveApplyForLeaveAsyncWithHttpInfo($leave_application, $employee_id) + public function essLeaveApplyForLeaveAsyncWithHttpInfo($employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveApplyForLeave'][0]) { $returnType = ''; - $request = $this->essLeaveApplyForLeaveRequest($leave_application, $employee_id); + $request = $this->essLeaveApplyForLeaveRequest($employee_id, $leave_application, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -24253,7 +26082,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -24262,20 +26091,16 @@ function ($exception) { /** * Create request for operation 'essLeaveApplyForLeave' * - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function essLeaveApplyForLeaveRequest($leave_application, $employee_id) - { - // verify the required parameter 'leave_application' is set - if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_application when calling essLeaveApplyForLeave' - ); - } + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveApplyForLeave'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function essLeaveApplyForLeaveRequest($employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveApplyForLeave'][0]) + { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -24283,6 +26108,14 @@ protected function essLeaveApplyForLeaveRequest($leave_application, $employee_id ); } + // verify the required parameter 'leave_application' is set + if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_application when calling essLeaveApplyForLeave' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/leave'; $formParams = []; $queryParams = []; @@ -24291,6 +26124,7 @@ protected function essLeaveApplyForLeaveRequest($leave_application, $employee_id $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -24300,56 +26134,42 @@ protected function essLeaveApplyForLeaveRequest($leave_application, $employee_id ); } - // body params - $_tempBody = null; - if (isset($leave_application)) { - $_tempBody = $leave_application; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_application)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_application)); + } else { + $httpBody = $leave_application; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24370,10 +26190,11 @@ protected function essLeaveApplyForLeaveRequest($leave_application, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24386,14 +26207,15 @@ protected function essLeaveApplyForLeaveRequest($leave_application, $employee_id * * @param string $employee_id employee_id (required) * @param \DateTime $as_at_date as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveBalances'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LeaveBalanceModel[] + * @return \OpenAPI\Client\Model\LeaveBalanceModel[] */ - public function essLeaveBalances($employee_id, $as_at_date = null) + public function essLeaveBalances($employee_id, $as_at_date = null, string $contentType = self::contentTypes['essLeaveBalances'][0]) { - list($response) = $this->essLeaveBalancesWithHttpInfo($employee_id, $as_at_date); + list($response) = $this->essLeaveBalancesWithHttpInfo($employee_id, $as_at_date, $contentType); return $response; } @@ -24404,15 +26226,15 @@ public function essLeaveBalances($employee_id, $as_at_date = null) * * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveBalances'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LeaveBalanceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LeaveBalanceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveBalancesWithHttpInfo($employee_id, $as_at_date = null) + public function essLeaveBalancesWithHttpInfo($employee_id, $as_at_date = null, string $contentType = self::contentTypes['essLeaveBalances'][0]) { - $returnType = '\Swagger\Client\Model\LeaveBalanceModel[]'; - $request = $this->essLeaveBalancesRequest($employee_id, $as_at_date); + $request = $this->essLeaveBalancesRequest($employee_id, $as_at_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -24421,9 +26243,16 @@ public function essLeaveBalancesWithHttpInfo($employee_id, $as_at_date = null) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24434,19 +26263,37 @@ public function essLeaveBalancesWithHttpInfo($employee_id, $as_at_date = null) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LeaveBalanceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LeaveBalanceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LeaveBalanceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LeaveBalanceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24463,7 +26310,7 @@ public function essLeaveBalancesWithHttpInfo($employee_id, $as_at_date = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LeaveBalanceModel[]', + '\OpenAPI\Client\Model\LeaveBalanceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -24480,13 +26327,14 @@ public function essLeaveBalancesWithHttpInfo($employee_id, $as_at_date = null) * * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveBalancesAsync($employee_id, $as_at_date = null) + public function essLeaveBalancesAsync($employee_id, $as_at_date = null, string $contentType = self::contentTypes['essLeaveBalances'][0]) { - return $this->essLeaveBalancesAsyncWithHttpInfo($employee_id, $as_at_date) + return $this->essLeaveBalancesAsyncWithHttpInfo($employee_id, $as_at_date, $contentType) ->then( function ($response) { return $response[0]; @@ -24501,24 +26349,24 @@ function ($response) { * * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveBalancesAsyncWithHttpInfo($employee_id, $as_at_date = null) + public function essLeaveBalancesAsyncWithHttpInfo($employee_id, $as_at_date = null, string $contentType = self::contentTypes['essLeaveBalances'][0]) { - $returnType = '\Swagger\Client\Model\LeaveBalanceModel[]'; - $request = $this->essLeaveBalancesRequest($employee_id, $as_at_date); + $returnType = '\OpenAPI\Client\Model\LeaveBalanceModel[]'; + $request = $this->essLeaveBalancesRequest($employee_id, $as_at_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24541,7 +26389,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -24552,12 +26400,14 @@ function ($exception) { * * @param string $employee_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveBalancesRequest($employee_id, $as_at_date = null) + public function essLeaveBalancesRequest($employee_id, $as_at_date = null, string $contentType = self::contentTypes['essLeaveBalances'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -24565,6 +26415,8 @@ protected function essLeaveBalancesRequest($employee_id, $as_at_date = null) ); } + + $resourcePath = '/api/v2/ess/{employeeId}/leave/balances'; $formParams = []; $queryParams = []; @@ -24573,9 +26425,15 @@ protected function essLeaveBalancesRequest($employee_id, $as_at_date = null) $multipart = false; // query params - if ($as_at_date !== null) { - $queryParams['asAtDate'] = ObjectSerializer::toQueryValue($as_at_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $as_at_date, + 'asAtDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -24586,53 +26444,35 @@ protected function essLeaveBalancesRequest($employee_id, $as_at_date = null) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24653,10 +26493,11 @@ protected function essLeaveBalancesRequest($employee_id, $as_at_date = null) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24669,14 +26510,15 @@ protected function essLeaveBalancesRequest($employee_id, $as_at_date = null) * * @param int $leave_request_id leave_request_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveCancel'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essLeaveCancel($leave_request_id, $employee_id) + public function essLeaveCancel($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveCancel'][0]) { - $this->essLeaveCancelWithHttpInfo($leave_request_id, $employee_id); + $this->essLeaveCancelWithHttpInfo($leave_request_id, $employee_id, $contentType); } /** @@ -24686,15 +26528,15 @@ public function essLeaveCancel($leave_request_id, $employee_id) * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveCancel'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveCancelWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveCancelWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveCancel'][0]) { - $returnType = ''; - $request = $this->essLeaveCancelRequest($leave_request_id, $employee_id); + $request = $this->essLeaveCancelRequest($leave_request_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -24703,9 +26545,16 @@ public function essLeaveCancelWithHttpInfo($leave_request_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24716,11 +26565,11 @@ public function essLeaveCancelWithHttpInfo($leave_request_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -24740,13 +26589,14 @@ public function essLeaveCancelWithHttpInfo($leave_request_id, $employee_id) * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveCancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveCancelAsync($leave_request_id, $employee_id) + public function essLeaveCancelAsync($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveCancel'][0]) { - return $this->essLeaveCancelAsyncWithHttpInfo($leave_request_id, $employee_id) + return $this->essLeaveCancelAsyncWithHttpInfo($leave_request_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -24761,14 +26611,15 @@ function ($response) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveCancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveCancelAsyncWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveCancelAsyncWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveCancel'][0]) { $returnType = ''; - $request = $this->essLeaveCancelRequest($leave_request_id, $employee_id); + $request = $this->essLeaveCancelRequest($leave_request_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -24787,7 +26638,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -24798,18 +26649,21 @@ function ($exception) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveCancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveCancelRequest($leave_request_id, $employee_id) + public function essLeaveCancelRequest($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveCancel'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling essLeaveCancel' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -24817,6 +26671,7 @@ protected function essLeaveCancelRequest($leave_request_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/leave/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -24825,6 +26680,7 @@ protected function essLeaveCancelRequest($leave_request_id, $employee_id) $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -24842,53 +26698,35 @@ protected function essLeaveCancelRequest($leave_request_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24909,10 +26747,11 @@ protected function essLeaveCancelRequest($leave_request_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24925,14 +26764,15 @@ protected function essLeaveCancelRequest($leave_request_id, $employee_id) * * @param int $leave_request_id leave_request_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveDeleteAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essLeaveDeleteAttachment($leave_request_id, $employee_id) + public function essLeaveDeleteAttachment($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveDeleteAttachment'][0]) { - $this->essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employee_id); + $this->essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employee_id, $contentType); } /** @@ -24942,15 +26782,15 @@ public function essLeaveDeleteAttachment($leave_request_id, $employee_id) * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveDeleteAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveDeleteAttachment'][0]) { - $returnType = ''; - $request = $this->essLeaveDeleteAttachmentRequest($leave_request_id, $employee_id); + $request = $this->essLeaveDeleteAttachmentRequest($leave_request_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -24959,9 +26799,16 @@ public function essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24972,11 +26819,11 @@ public function essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -24996,13 +26843,14 @@ public function essLeaveDeleteAttachmentWithHttpInfo($leave_request_id, $employe * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveDeleteAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveDeleteAttachmentAsync($leave_request_id, $employee_id) + public function essLeaveDeleteAttachmentAsync($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveDeleteAttachment'][0]) { - return $this->essLeaveDeleteAttachmentAsyncWithHttpInfo($leave_request_id, $employee_id) + return $this->essLeaveDeleteAttachmentAsyncWithHttpInfo($leave_request_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -25017,14 +26865,15 @@ function ($response) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveDeleteAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveDeleteAttachmentAsyncWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveDeleteAttachmentAsyncWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveDeleteAttachment'][0]) { $returnType = ''; - $request = $this->essLeaveDeleteAttachmentRequest($leave_request_id, $employee_id); + $request = $this->essLeaveDeleteAttachmentRequest($leave_request_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -25043,7 +26892,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25054,18 +26903,21 @@ function ($exception) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveDeleteAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_id) + public function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveDeleteAttachment'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling essLeaveDeleteAttachment' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -25073,6 +26925,7 @@ protected function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_ ); } + $resourcePath = '/api/v2/ess/{employeeId}/leave/{leaveRequestId}/attachment'; $formParams = []; $queryParams = []; @@ -25081,6 +26934,7 @@ protected function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_ $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -25098,53 +26952,35 @@ protected function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -25165,10 +27001,11 @@ protected function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -25180,16 +27017,17 @@ protected function essLeaveDeleteAttachmentRequest($leave_request_id, $employee_ * Update Leave Request * * @param int $leave_request_id leave_request_id (required) - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application leave_application (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEditLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essLeaveEditLeave($leave_request_id, $leave_application, $employee_id) + public function essLeaveEditLeave($leave_request_id, $employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveEditLeave'][0]) { - $this->essLeaveEditLeaveWithHttpInfo($leave_request_id, $leave_application, $employee_id); + $this->essLeaveEditLeaveWithHttpInfo($leave_request_id, $employee_id, $leave_application, $contentType); } /** @@ -25198,17 +27036,17 @@ public function essLeaveEditLeave($leave_request_id, $leave_application, $employ * Update Leave Request * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEditLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveEditLeaveWithHttpInfo($leave_request_id, $leave_application, $employee_id) + public function essLeaveEditLeaveWithHttpInfo($leave_request_id, $employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveEditLeave'][0]) { - $returnType = ''; - $request = $this->essLeaveEditLeaveRequest($leave_request_id, $leave_application, $employee_id); + $request = $this->essLeaveEditLeaveRequest($leave_request_id, $employee_id, $leave_application, $contentType); try { $options = $this->createHttpClientOption(); @@ -25217,9 +27055,16 @@ public function essLeaveEditLeaveWithHttpInfo($leave_request_id, $leave_applicat } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25230,11 +27075,11 @@ public function essLeaveEditLeaveWithHttpInfo($leave_request_id, $leave_applicat sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -25253,15 +27098,16 @@ public function essLeaveEditLeaveWithHttpInfo($leave_request_id, $leave_applicat * Update Leave Request * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEditLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveEditLeaveAsync($leave_request_id, $leave_application, $employee_id) + public function essLeaveEditLeaveAsync($leave_request_id, $employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveEditLeave'][0]) { - return $this->essLeaveEditLeaveAsyncWithHttpInfo($leave_request_id, $leave_application, $employee_id) + return $this->essLeaveEditLeaveAsyncWithHttpInfo($leave_request_id, $employee_id, $leave_application, $contentType) ->then( function ($response) { return $response[0]; @@ -25275,16 +27121,17 @@ function ($response) { * Update Leave Request * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEditLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveEditLeaveAsyncWithHttpInfo($leave_request_id, $leave_application, $employee_id) + public function essLeaveEditLeaveAsyncWithHttpInfo($leave_request_id, $employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveEditLeave'][0]) { $returnType = ''; - $request = $this->essLeaveEditLeaveRequest($leave_request_id, $leave_application, $employee_id); + $request = $this->essLeaveEditLeaveRequest($leave_request_id, $employee_id, $leave_application, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -25303,7 +27150,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25313,26 +27160,23 @@ function ($exception) { * Create request for operation 'essLeaveEditLeave' * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\LeaveApplicationWithAttachmentModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEditLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveEditLeaveRequest($leave_request_id, $leave_application, $employee_id) + public function essLeaveEditLeaveRequest($leave_request_id, $employee_id, $leave_application, string $contentType = self::contentTypes['essLeaveEditLeave'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling essLeaveEditLeave' ); } - // verify the required parameter 'leave_application' is set - if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_application when calling essLeaveEditLeave' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -25340,6 +27184,14 @@ protected function essLeaveEditLeaveRequest($leave_request_id, $leave_applicatio ); } + // verify the required parameter 'leave_application' is set + if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_application when calling essLeaveEditLeave' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/leave/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -25348,6 +27200,7 @@ protected function essLeaveEditLeaveRequest($leave_request_id, $leave_applicatio $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -25365,56 +27218,42 @@ protected function essLeaveEditLeaveRequest($leave_request_id, $leave_applicatio ); } - // body params - $_tempBody = null; - if (isset($leave_application)) { - $_tempBody = $leave_application; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_application)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_application)); + } else { + $httpBody = $leave_application; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -25435,10 +27274,11 @@ protected function essLeaveEditLeaveRequest($leave_request_id, $leave_applicatio $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -25452,15 +27292,16 @@ protected function essLeaveEditLeaveRequest($leave_request_id, $leave_applicatio * @param string $employee_id employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) - * @param int $filter_leave_category_id (optional) + * @param int $filter_leave_category_id filter_leave_category_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEstimate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssLeaveEstimate + * @return \OpenAPI\Client\Model\EssLeaveEstimate */ - public function essLeaveEstimate($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null) + public function essLeaveEstimate($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null, string $contentType = self::contentTypes['essLeaveEstimate'][0]) { - list($response) = $this->essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id); + list($response) = $this->essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id, $contentType); return $response; } @@ -25472,16 +27313,16 @@ public function essLeaveEstimate($employee_id, $filter_from_date, $filter_to_dat * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) - * @param int $filter_leave_category_id (optional) + * @param int $filter_leave_category_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEstimate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssLeaveEstimate, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssLeaveEstimate, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null) + public function essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null, string $contentType = self::contentTypes['essLeaveEstimate'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveEstimate'; - $request = $this->essLeaveEstimateRequest($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id); + $request = $this->essLeaveEstimateRequest($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -25490,9 +27331,16 @@ public function essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $f } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25503,19 +27351,37 @@ public function essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $f sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssLeaveEstimate' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssLeaveEstimate' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssLeaveEstimate', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssLeaveEstimate'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25532,7 +27398,7 @@ public function essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $f case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssLeaveEstimate', + '\OpenAPI\Client\Model\EssLeaveEstimate', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -25550,14 +27416,15 @@ public function essLeaveEstimateWithHttpInfo($employee_id, $filter_from_date, $f * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) - * @param int $filter_leave_category_id (optional) + * @param int $filter_leave_category_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveEstimateAsync($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null) + public function essLeaveEstimateAsync($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null, string $contentType = self::contentTypes['essLeaveEstimate'][0]) { - return $this->essLeaveEstimateAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id) + return $this->essLeaveEstimateAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id, $contentType) ->then( function ($response) { return $response[0]; @@ -25573,25 +27440,25 @@ function ($response) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) - * @param int $filter_leave_category_id (optional) + * @param int $filter_leave_category_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveEstimateAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null) + public function essLeaveEstimateAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null, string $contentType = self::contentTypes['essLeaveEstimate'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveEstimate'; - $request = $this->essLeaveEstimateRequest($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id); + $returnType = '\OpenAPI\Client\Model\EssLeaveEstimate'; + $request = $this->essLeaveEstimateRequest($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25614,7 +27481,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25626,25 +27493,29 @@ function ($exception) { * @param string $employee_id (required) * @param \DateTime $filter_from_date Required (required) * @param \DateTime $filter_to_date Required (required) - * @param int $filter_leave_category_id (optional) + * @param int $filter_leave_category_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveEstimateRequest($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null) + public function essLeaveEstimateRequest($employee_id, $filter_from_date, $filter_to_date, $filter_leave_category_id = null, string $contentType = self::contentTypes['essLeaveEstimate'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling essLeaveEstimate' ); } + // verify the required parameter 'filter_from_date' is set if ($filter_from_date === null || (is_array($filter_from_date) && count($filter_from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $filter_from_date when calling essLeaveEstimate' ); } + // verify the required parameter 'filter_to_date' is set if ($filter_to_date === null || (is_array($filter_to_date) && count($filter_to_date) === 0)) { throw new \InvalidArgumentException( @@ -25652,6 +27523,8 @@ protected function essLeaveEstimateRequest($employee_id, $filter_from_date, $fil ); } + + $resourcePath = '/api/v2/ess/{employeeId}/leave/estimate'; $formParams = []; $queryParams = []; @@ -25660,17 +27533,33 @@ protected function essLeaveEstimateRequest($employee_id, $filter_from_date, $fil $multipart = false; // query params - if ($filter_leave_category_id !== null) { - $queryParams['filter.leaveCategoryId'] = ObjectSerializer::toQueryValue($filter_leave_category_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_leave_category_id, + 'filter.leaveCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -25681,53 +27570,35 @@ protected function essLeaveEstimateRequest($employee_id, $filter_from_date, $fil ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -25748,10 +27619,11 @@ protected function essLeaveEstimateRequest($employee_id, $filter_from_date, $fil $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -25763,14 +27635,15 @@ protected function essLeaveEstimateRequest($employee_id, $filter_from_date, $fil * Get Leave Categories * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\EssLeaveCategoryModel[] */ - public function essLeaveLeaveCategories($employee_id) + public function essLeaveLeaveCategories($employee_id, string $contentType = self::contentTypes['essLeaveLeaveCategories'][0]) { - list($response) = $this->essLeaveLeaveCategoriesWithHttpInfo($employee_id); + list($response) = $this->essLeaveLeaveCategoriesWithHttpInfo($employee_id, $contentType); return $response; } @@ -25780,15 +27653,15 @@ public function essLeaveLeaveCategories($employee_id) * Get Leave Categories * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveLeaveCategoriesWithHttpInfo($employee_id) + public function essLeaveLeaveCategoriesWithHttpInfo($employee_id, string $contentType = self::contentTypes['essLeaveLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveCategoryModel[]'; - $request = $this->essLeaveLeaveCategoriesRequest($employee_id); + $request = $this->essLeaveLeaveCategoriesRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -25797,9 +27670,16 @@ public function essLeaveLeaveCategoriesWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25810,19 +27690,37 @@ public function essLeaveLeaveCategoriesWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssLeaveCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssLeaveCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssLeaveCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssLeaveCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25839,7 +27737,7 @@ public function essLeaveLeaveCategoriesWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssLeaveCategoryModel[]', + '\OpenAPI\Client\Model\EssLeaveCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -25855,13 +27753,14 @@ public function essLeaveLeaveCategoriesWithHttpInfo($employee_id) * Get Leave Categories * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveLeaveCategoriesAsync($employee_id) + public function essLeaveLeaveCategoriesAsync($employee_id, string $contentType = self::contentTypes['essLeaveLeaveCategories'][0]) { - return $this->essLeaveLeaveCategoriesAsyncWithHttpInfo($employee_id) + return $this->essLeaveLeaveCategoriesAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -25875,24 +27774,24 @@ function ($response) { * Get Leave Categories * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveLeaveCategoriesAsyncWithHttpInfo($employee_id) + public function essLeaveLeaveCategoriesAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essLeaveLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveCategoryModel[]'; - $request = $this->essLeaveLeaveCategoriesRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EssLeaveCategoryModel[]'; + $request = $this->essLeaveLeaveCategoriesRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25915,7 +27814,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25925,12 +27824,14 @@ function ($exception) { * Create request for operation 'essLeaveLeaveCategories' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveLeaveCategoriesRequest($employee_id) + public function essLeaveLeaveCategoriesRequest($employee_id, string $contentType = self::contentTypes['essLeaveLeaveCategories'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -25938,6 +27839,7 @@ protected function essLeaveLeaveCategoriesRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/leave/leavecategories'; $formParams = []; $queryParams = []; @@ -25946,6 +27848,7 @@ protected function essLeaveLeaveCategoriesRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -25955,53 +27858,35 @@ protected function essLeaveLeaveCategoriesRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26022,10 +27907,11 @@ protected function essLeaveLeaveCategoriesRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26038,14 +27924,15 @@ protected function essLeaveLeaveCategoriesRequest($employee_id) * * @param int $leave_request_id leave_request_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssLeaveRequestModel + * @return \OpenAPI\Client\Model\EssLeaveRequestModel */ - public function essLeaveLeaveRequest($leave_request_id, $employee_id) + public function essLeaveLeaveRequest($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveLeaveRequest'][0]) { - list($response) = $this->essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id); + list($response) = $this->essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id, $contentType); return $response; } @@ -26056,15 +27943,15 @@ public function essLeaveLeaveRequest($leave_request_id, $employee_id) * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveLeaveRequest'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveRequestModel'; - $request = $this->essLeaveLeaveRequestRequest($leave_request_id, $employee_id); + $request = $this->essLeaveLeaveRequestRequest($leave_request_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -26073,9 +27960,16 @@ public function essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26086,19 +27980,37 @@ public function essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26115,7 +28027,7 @@ public function essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssLeaveRequestModel', + '\OpenAPI\Client\Model\EssLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -26132,13 +28044,14 @@ public function essLeaveLeaveRequestWithHttpInfo($leave_request_id, $employee_id * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveLeaveRequestAsync($leave_request_id, $employee_id) + public function essLeaveLeaveRequestAsync($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveLeaveRequest'][0]) { - return $this->essLeaveLeaveRequestAsyncWithHttpInfo($leave_request_id, $employee_id) + return $this->essLeaveLeaveRequestAsyncWithHttpInfo($leave_request_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -26153,24 +28066,24 @@ function ($response) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveLeaveRequestAsyncWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveLeaveRequestAsyncWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveLeaveRequest'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveRequestModel'; - $request = $this->essLeaveLeaveRequestRequest($leave_request_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssLeaveRequestModel'; + $request = $this->essLeaveLeaveRequestRequest($leave_request_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26193,7 +28106,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -26204,18 +28117,21 @@ function ($exception) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveLeaveRequestRequest($leave_request_id, $employee_id) + public function essLeaveLeaveRequestRequest($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveLeaveRequest'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling essLeaveLeaveRequest' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -26223,6 +28139,7 @@ protected function essLeaveLeaveRequestRequest($leave_request_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/leave/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -26231,6 +28148,7 @@ protected function essLeaveLeaveRequestRequest($leave_request_id, $employee_id) $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -26248,53 +28166,35 @@ protected function essLeaveLeaveRequestRequest($leave_request_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26315,10 +28215,11 @@ protected function essLeaveLeaveRequestRequest($leave_request_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26330,18 +28231,19 @@ protected function essLeaveLeaveRequestRequest($leave_request_id, $employee_id) * List Leave Requests * * @param string $employee_id employee_id (required) - * @param bool $filter_show_other_employees (optional) - * @param bool $filter_approved_only (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param bool $filter_show_other_employees filter_show_other_employees (optional) + * @param bool $filter_approved_only filter_approved_only (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssLeaveRequestModel[] + * @return \OpenAPI\Client\Model\EssLeaveRequestModel[] */ - public function essLeaveLeaveRequests($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null) + public function essLeaveLeaveRequests($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essLeaveLeaveRequests'][0]) { - list($response) = $this->essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date); + list($response) = $this->essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date, $contentType); return $response; } @@ -26351,19 +28253,19 @@ public function essLeaveLeaveRequests($employee_id, $filter_show_other_employees * List Leave Requests * * @param string $employee_id (required) - * @param bool $filter_show_other_employees (optional) - * @param bool $filter_approved_only (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param bool $filter_show_other_employees (optional) + * @param bool $filter_approved_only (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null) + public function essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essLeaveLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveRequestModel[]'; - $request = $this->essLeaveLeaveRequestsRequest($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date); + $request = $this->essLeaveLeaveRequestsRequest($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -26372,9 +28274,16 @@ public function essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_oth } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26385,19 +28294,37 @@ public function essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_oth sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssLeaveRequestModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssLeaveRequestModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssLeaveRequestModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssLeaveRequestModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26414,7 +28341,7 @@ public function essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_oth case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssLeaveRequestModel[]', + '\OpenAPI\Client\Model\EssLeaveRequestModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -26430,17 +28357,18 @@ public function essLeaveLeaveRequestsWithHttpInfo($employee_id, $filter_show_oth * List Leave Requests * * @param string $employee_id (required) - * @param bool $filter_show_other_employees (optional) - * @param bool $filter_approved_only (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param bool $filter_show_other_employees (optional) + * @param bool $filter_approved_only (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveLeaveRequestsAsync($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null) + public function essLeaveLeaveRequestsAsync($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essLeaveLeaveRequests'][0]) { - return $this->essLeaveLeaveRequestsAsyncWithHttpInfo($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date) + return $this->essLeaveLeaveRequestsAsyncWithHttpInfo($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -26454,28 +28382,28 @@ function ($response) { * List Leave Requests * * @param string $employee_id (required) - * @param bool $filter_show_other_employees (optional) - * @param bool $filter_approved_only (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param bool $filter_show_other_employees (optional) + * @param bool $filter_approved_only (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveLeaveRequestsAsyncWithHttpInfo($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null) + public function essLeaveLeaveRequestsAsyncWithHttpInfo($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essLeaveLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\EssLeaveRequestModel[]'; - $request = $this->essLeaveLeaveRequestsRequest($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date); + $returnType = '\OpenAPI\Client\Model\EssLeaveRequestModel[]'; + $request = $this->essLeaveLeaveRequestsRequest($employee_id, $filter_show_other_employees, $filter_approved_only, $filter_from_date, $filter_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26498,7 +28426,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -26508,16 +28436,18 @@ function ($exception) { * Create request for operation 'essLeaveLeaveRequests' * * @param string $employee_id (required) - * @param bool $filter_show_other_employees (optional) - * @param bool $filter_approved_only (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param bool $filter_show_other_employees (optional) + * @param bool $filter_approved_only (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null) + public function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other_employees = null, $filter_approved_only = null, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essLeaveLeaveRequests'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -26525,6 +28455,11 @@ protected function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other ); } + + + + + $resourcePath = '/api/v2/ess/{employeeId}/leave'; $formParams = []; $queryParams = []; @@ -26533,21 +28468,42 @@ protected function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other $multipart = false; // query params - if ($filter_show_other_employees !== null) { - $queryParams['filter.showOtherEmployees'] = ObjectSerializer::toQueryValue($filter_show_other_employees); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_show_other_employees, + 'filter.showOtherEmployees', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_approved_only !== null) { - $queryParams['filter.approvedOnly'] = ObjectSerializer::toQueryValue($filter_approved_only); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_approved_only, + 'filter.approvedOnly', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -26558,53 +28514,35 @@ protected function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other ); } - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } - + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); + // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26625,10 +28563,11 @@ protected function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26641,14 +28580,15 @@ protected function essLeaveLeaveRequestsRequest($employee_id, $filter_show_other * * @param int $leave_request_id leave_request_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveUpload'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function essLeaveUpload($leave_request_id, $employee_id) + public function essLeaveUpload($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveUpload'][0]) { - list($response) = $this->essLeaveUploadWithHttpInfo($leave_request_id, $employee_id); + list($response) = $this->essLeaveUploadWithHttpInfo($leave_request_id, $employee_id, $contentType); return $response; } @@ -26659,15 +28599,15 @@ public function essLeaveUpload($leave_request_id, $employee_id) * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveUpload'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function essLeaveUploadWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveUploadWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveUpload'][0]) { - $returnType = 'object'; - $request = $this->essLeaveUploadRequest($leave_request_id, $employee_id); + $request = $this->essLeaveUploadRequest($leave_request_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -26676,9 +28616,16 @@ public function essLeaveUploadWithHttpInfo($leave_request_id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26689,19 +28636,37 @@ public function essLeaveUploadWithHttpInfo($leave_request_id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26735,13 +28700,14 @@ public function essLeaveUploadWithHttpInfo($leave_request_id, $employee_id) * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveUpload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveUploadAsync($leave_request_id, $employee_id) + public function essLeaveUploadAsync($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveUpload'][0]) { - return $this->essLeaveUploadAsyncWithHttpInfo($leave_request_id, $employee_id) + return $this->essLeaveUploadAsyncWithHttpInfo($leave_request_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -26756,24 +28722,24 @@ function ($response) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveUpload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essLeaveUploadAsyncWithHttpInfo($leave_request_id, $employee_id) + public function essLeaveUploadAsyncWithHttpInfo($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveUpload'][0]) { $returnType = 'object'; - $request = $this->essLeaveUploadRequest($leave_request_id, $employee_id); + $request = $this->essLeaveUploadRequest($leave_request_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26796,7 +28762,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -26807,18 +28773,21 @@ function ($exception) { * * @param int $leave_request_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essLeaveUpload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essLeaveUploadRequest($leave_request_id, $employee_id) + public function essLeaveUploadRequest($leave_request_id, $employee_id, string $contentType = self::contentTypes['essLeaveUpload'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling essLeaveUpload' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -26826,6 +28795,7 @@ protected function essLeaveUploadRequest($leave_request_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/leave/{leaveRequestId}/attachment'; $formParams = []; $queryParams = []; @@ -26834,6 +28804,7 @@ protected function essLeaveUploadRequest($leave_request_id, $employee_id) $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -26851,53 +28822,35 @@ protected function essLeaveUploadRequest($leave_request_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26918,10 +28871,11 @@ protected function essLeaveUploadRequest($leave_request_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26933,14 +28887,15 @@ protected function essLeaveUploadRequest($leave_request_id, $employee_id) * Delete Employee Profile Image * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essProfileImageDelete($employee_id) + public function essProfileImageDelete($employee_id, string $contentType = self::contentTypes['essProfileImageDelete'][0]) { - $this->essProfileImageDeleteWithHttpInfo($employee_id); + $this->essProfileImageDeleteWithHttpInfo($employee_id, $contentType); } /** @@ -26949,15 +28904,15 @@ public function essProfileImageDelete($employee_id) * Delete Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essProfileImageDeleteWithHttpInfo($employee_id) + public function essProfileImageDeleteWithHttpInfo($employee_id, string $contentType = self::contentTypes['essProfileImageDelete'][0]) { - $returnType = ''; - $request = $this->essProfileImageDeleteRequest($employee_id); + $request = $this->essProfileImageDeleteRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -26966,9 +28921,16 @@ public function essProfileImageDeleteWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26979,11 +28941,11 @@ public function essProfileImageDeleteWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -27002,13 +28964,14 @@ public function essProfileImageDeleteWithHttpInfo($employee_id) * Delete Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essProfileImageDeleteAsync($employee_id) + public function essProfileImageDeleteAsync($employee_id, string $contentType = self::contentTypes['essProfileImageDelete'][0]) { - return $this->essProfileImageDeleteAsyncWithHttpInfo($employee_id) + return $this->essProfileImageDeleteAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -27022,14 +28985,15 @@ function ($response) { * Delete Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essProfileImageDeleteAsyncWithHttpInfo($employee_id) + public function essProfileImageDeleteAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essProfileImageDelete'][0]) { $returnType = ''; - $request = $this->essProfileImageDeleteRequest($employee_id); + $request = $this->essProfileImageDeleteRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -27048,7 +29012,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27058,12 +29022,14 @@ function ($exception) { * Create request for operation 'essProfileImageDelete' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essProfileImageDeleteRequest($employee_id) + public function essProfileImageDeleteRequest($employee_id, string $contentType = self::contentTypes['essProfileImageDelete'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -27071,6 +29037,7 @@ protected function essProfileImageDeleteRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/profileimage'; $formParams = []; $queryParams = []; @@ -27079,6 +29046,7 @@ protected function essProfileImageDeleteRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -27088,53 +29056,35 @@ protected function essProfileImageDeleteRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27155,10 +29105,11 @@ protected function essProfileImageDeleteRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27170,14 +29121,15 @@ protected function essProfileImageDeleteRequest($employee_id) * Get Employee Profile Image * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageGetImage'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essProfileImageGetImage($employee_id) + public function essProfileImageGetImage($employee_id, string $contentType = self::contentTypes['essProfileImageGetImage'][0]) { - $this->essProfileImageGetImageWithHttpInfo($employee_id); + $this->essProfileImageGetImageWithHttpInfo($employee_id, $contentType); } /** @@ -27186,15 +29138,15 @@ public function essProfileImageGetImage($employee_id) * Get Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageGetImage'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essProfileImageGetImageWithHttpInfo($employee_id) + public function essProfileImageGetImageWithHttpInfo($employee_id, string $contentType = self::contentTypes['essProfileImageGetImage'][0]) { - $returnType = ''; - $request = $this->essProfileImageGetImageRequest($employee_id); + $request = $this->essProfileImageGetImageRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -27203,9 +29155,16 @@ public function essProfileImageGetImageWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27216,11 +29175,11 @@ public function essProfileImageGetImageWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -27239,13 +29198,14 @@ public function essProfileImageGetImageWithHttpInfo($employee_id) * Get Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageGetImage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essProfileImageGetImageAsync($employee_id) + public function essProfileImageGetImageAsync($employee_id, string $contentType = self::contentTypes['essProfileImageGetImage'][0]) { - return $this->essProfileImageGetImageAsyncWithHttpInfo($employee_id) + return $this->essProfileImageGetImageAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -27259,14 +29219,15 @@ function ($response) { * Get Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageGetImage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essProfileImageGetImageAsyncWithHttpInfo($employee_id) + public function essProfileImageGetImageAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essProfileImageGetImage'][0]) { $returnType = ''; - $request = $this->essProfileImageGetImageRequest($employee_id); + $request = $this->essProfileImageGetImageRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -27285,7 +29246,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27295,12 +29256,14 @@ function ($exception) { * Create request for operation 'essProfileImageGetImage' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImageGetImage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essProfileImageGetImageRequest($employee_id) + public function essProfileImageGetImageRequest($employee_id, string $contentType = self::contentTypes['essProfileImageGetImage'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -27308,6 +29271,7 @@ protected function essProfileImageGetImageRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/profileimage'; $formParams = []; $queryParams = []; @@ -27316,6 +29280,7 @@ protected function essProfileImageGetImageRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -27325,53 +29290,35 @@ protected function essProfileImageGetImageRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27392,10 +29339,11 @@ protected function essProfileImageGetImageRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27407,14 +29355,15 @@ protected function essProfileImageGetImageRequest($employee_id) * Set Employee Profile Image * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImagePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ProfileImageMetadata + * @return \OpenAPI\Client\Model\ProfileImageMetadata */ - public function essProfileImagePost($employee_id) + public function essProfileImagePost($employee_id, string $contentType = self::contentTypes['essProfileImagePost'][0]) { - list($response) = $this->essProfileImagePostWithHttpInfo($employee_id); + list($response) = $this->essProfileImagePostWithHttpInfo($employee_id, $contentType); return $response; } @@ -27424,15 +29373,15 @@ public function essProfileImagePost($employee_id) * Set Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImagePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ProfileImageMetadata, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ProfileImageMetadata, HTTP status code, HTTP response headers (array of strings) */ - public function essProfileImagePostWithHttpInfo($employee_id) + public function essProfileImagePostWithHttpInfo($employee_id, string $contentType = self::contentTypes['essProfileImagePost'][0]) { - $returnType = '\Swagger\Client\Model\ProfileImageMetadata'; - $request = $this->essProfileImagePostRequest($employee_id); + $request = $this->essProfileImagePostRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -27441,9 +29390,16 @@ public function essProfileImagePostWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27454,19 +29410,37 @@ public function essProfileImagePostWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ProfileImageMetadata' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProfileImageMetadata' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProfileImageMetadata', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProfileImageMetadata'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27483,7 +29457,7 @@ public function essProfileImagePostWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ProfileImageMetadata', + '\OpenAPI\Client\Model\ProfileImageMetadata', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -27499,13 +29473,14 @@ public function essProfileImagePostWithHttpInfo($employee_id) * Set Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essProfileImagePostAsync($employee_id) + public function essProfileImagePostAsync($employee_id, string $contentType = self::contentTypes['essProfileImagePost'][0]) { - return $this->essProfileImagePostAsyncWithHttpInfo($employee_id) + return $this->essProfileImagePostAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -27519,24 +29494,24 @@ function ($response) { * Set Employee Profile Image * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essProfileImagePostAsyncWithHttpInfo($employee_id) + public function essProfileImagePostAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essProfileImagePost'][0]) { - $returnType = '\Swagger\Client\Model\ProfileImageMetadata'; - $request = $this->essProfileImagePostRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\ProfileImageMetadata'; + $request = $this->essProfileImagePostRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27559,7 +29534,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27569,12 +29544,14 @@ function ($exception) { * Create request for operation 'essProfileImagePost' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essProfileImagePostRequest($employee_id) + public function essProfileImagePostRequest($employee_id, string $contentType = self::contentTypes['essProfileImagePost'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -27582,6 +29559,7 @@ protected function essProfileImagePostRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/profileimage'; $formParams = []; $queryParams = []; @@ -27590,6 +29568,7 @@ protected function essProfileImagePostRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -27599,53 +29578,35 @@ protected function essProfileImagePostRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27666,10 +29627,11 @@ protected function essProfileImagePostRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27682,14 +29644,15 @@ protected function essProfileImagePostRequest($employee_id) * * @param int $id id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essQualificationDelete($id, $employee_id) + public function essQualificationDelete($id, $employee_id, string $contentType = self::contentTypes['essQualificationDelete'][0]) { - $this->essQualificationDeleteWithHttpInfo($id, $employee_id); + $this->essQualificationDeleteWithHttpInfo($id, $employee_id, $contentType); } /** @@ -27699,15 +29662,15 @@ public function essQualificationDelete($id, $employee_id) * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationDeleteWithHttpInfo($id, $employee_id) + public function essQualificationDeleteWithHttpInfo($id, $employee_id, string $contentType = self::contentTypes['essQualificationDelete'][0]) { - $returnType = ''; - $request = $this->essQualificationDeleteRequest($id, $employee_id); + $request = $this->essQualificationDeleteRequest($id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -27716,9 +29679,16 @@ public function essQualificationDeleteWithHttpInfo($id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27729,11 +29699,11 @@ public function essQualificationDeleteWithHttpInfo($id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -27753,13 +29723,14 @@ public function essQualificationDeleteWithHttpInfo($id, $employee_id) * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationDeleteAsync($id, $employee_id) + public function essQualificationDeleteAsync($id, $employee_id, string $contentType = self::contentTypes['essQualificationDelete'][0]) { - return $this->essQualificationDeleteAsyncWithHttpInfo($id, $employee_id) + return $this->essQualificationDeleteAsyncWithHttpInfo($id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -27774,14 +29745,15 @@ function ($response) { * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationDeleteAsyncWithHttpInfo($id, $employee_id) + public function essQualificationDeleteAsyncWithHttpInfo($id, $employee_id, string $contentType = self::contentTypes['essQualificationDelete'][0]) { $returnType = ''; - $request = $this->essQualificationDeleteRequest($id, $employee_id); + $request = $this->essQualificationDeleteRequest($id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -27800,7 +29772,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27811,18 +29783,21 @@ function ($exception) { * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationDeleteRequest($id, $employee_id) + public function essQualificationDeleteRequest($id, $employee_id, string $contentType = self::contentTypes['essQualificationDelete'][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 essQualificationDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -27830,6 +29805,7 @@ protected function essQualificationDeleteRequest($id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -27838,6 +29814,7 @@ protected function essQualificationDeleteRequest($id, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -27855,53 +29832,35 @@ protected function essQualificationDeleteRequest($id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27922,10 +29881,11 @@ protected function essQualificationDeleteRequest($id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27939,14 +29899,15 @@ protected function essQualificationDeleteRequest($id, $employee_id) * @param int $employee_qualification_id employee_qualification_id (required) * @param int $document_id document_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDeleteAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essQualificationDeleteAttachment($employee_qualification_id, $document_id, $employee_id) + public function essQualificationDeleteAttachment($employee_qualification_id, $document_id, $employee_id, string $contentType = self::contentTypes['essQualificationDeleteAttachment'][0]) { - $this->essQualificationDeleteAttachmentWithHttpInfo($employee_qualification_id, $document_id, $employee_id); + $this->essQualificationDeleteAttachmentWithHttpInfo($employee_qualification_id, $document_id, $employee_id, $contentType); } /** @@ -27957,15 +29918,15 @@ public function essQualificationDeleteAttachment($employee_qualification_id, $do * @param int $employee_qualification_id (required) * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDeleteAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationDeleteAttachmentWithHttpInfo($employee_qualification_id, $document_id, $employee_id) + public function essQualificationDeleteAttachmentWithHttpInfo($employee_qualification_id, $document_id, $employee_id, string $contentType = self::contentTypes['essQualificationDeleteAttachment'][0]) { - $returnType = ''; - $request = $this->essQualificationDeleteAttachmentRequest($employee_qualification_id, $document_id, $employee_id); + $request = $this->essQualificationDeleteAttachmentRequest($employee_qualification_id, $document_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -27974,9 +29935,16 @@ public function essQualificationDeleteAttachmentWithHttpInfo($employee_qualifica } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27987,11 +29955,11 @@ public function essQualificationDeleteAttachmentWithHttpInfo($employee_qualifica sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -28012,13 +29980,14 @@ public function essQualificationDeleteAttachmentWithHttpInfo($employee_qualifica * @param int $employee_qualification_id (required) * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDeleteAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationDeleteAttachmentAsync($employee_qualification_id, $document_id, $employee_id) + public function essQualificationDeleteAttachmentAsync($employee_qualification_id, $document_id, $employee_id, string $contentType = self::contentTypes['essQualificationDeleteAttachment'][0]) { - return $this->essQualificationDeleteAttachmentAsyncWithHttpInfo($employee_qualification_id, $document_id, $employee_id) + return $this->essQualificationDeleteAttachmentAsyncWithHttpInfo($employee_qualification_id, $document_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -28034,14 +30003,15 @@ function ($response) { * @param int $employee_qualification_id (required) * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDeleteAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationDeleteAttachmentAsyncWithHttpInfo($employee_qualification_id, $document_id, $employee_id) + public function essQualificationDeleteAttachmentAsyncWithHttpInfo($employee_qualification_id, $document_id, $employee_id, string $contentType = self::contentTypes['essQualificationDeleteAttachment'][0]) { $returnType = ''; - $request = $this->essQualificationDeleteAttachmentRequest($employee_qualification_id, $document_id, $employee_id); + $request = $this->essQualificationDeleteAttachmentRequest($employee_qualification_id, $document_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -28060,7 +30030,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -28072,24 +30042,28 @@ function ($exception) { * @param int $employee_qualification_id (required) * @param int $document_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationDeleteAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationDeleteAttachmentRequest($employee_qualification_id, $document_id, $employee_id) + public function essQualificationDeleteAttachmentRequest($employee_qualification_id, $document_id, $employee_id, string $contentType = self::contentTypes['essQualificationDeleteAttachment'][0]) { + // verify the required parameter 'employee_qualification_id' is set if ($employee_qualification_id === null || (is_array($employee_qualification_id) && count($employee_qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_qualification_id when calling essQualificationDeleteAttachment' ); } + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling essQualificationDeleteAttachment' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -28097,6 +30071,7 @@ protected function essQualificationDeleteAttachmentRequest($employee_qualificati ); } + $resourcePath = '/api/v2/ess/{employeeId}/qualification/{employeeQualificationId}/attachment/{documentId}'; $formParams = []; $queryParams = []; @@ -28105,6 +30080,7 @@ protected function essQualificationDeleteAttachmentRequest($employee_qualificati $multipart = false; + // path params if ($employee_qualification_id !== null) { $resourcePath = str_replace( @@ -28130,53 +30106,35 @@ protected function essQualificationDeleteAttachmentRequest($employee_qualificati ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -28197,10 +30155,11 @@ protected function essQualificationDeleteAttachmentRequest($employee_qualificati $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -28213,14 +30172,15 @@ protected function essQualificationDeleteAttachmentRequest($employee_qualificati * * @param int $id id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssEmployeeQualificationModel + * @return \OpenAPI\Client\Model\EssEmployeeQualificationModel */ - public function essQualificationGet($id, $employee_id) + public function essQualificationGet($id, $employee_id, string $contentType = self::contentTypes['essQualificationGet'][0]) { - list($response) = $this->essQualificationGetWithHttpInfo($id, $employee_id); + list($response) = $this->essQualificationGetWithHttpInfo($id, $employee_id, $contentType); return $response; } @@ -28231,15 +30191,15 @@ public function essQualificationGet($id, $employee_id) * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssEmployeeQualificationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssEmployeeQualificationModel, HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationGetWithHttpInfo($id, $employee_id) + public function essQualificationGetWithHttpInfo($id, $employee_id, string $contentType = self::contentTypes['essQualificationGet'][0]) { - $returnType = '\Swagger\Client\Model\EssEmployeeQualificationModel'; - $request = $this->essQualificationGetRequest($id, $employee_id); + $request = $this->essQualificationGetRequest($id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -28248,9 +30208,16 @@ public function essQualificationGetWithHttpInfo($id, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -28261,19 +30228,37 @@ public function essQualificationGetWithHttpInfo($id, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssEmployeeQualificationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssEmployeeQualificationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssEmployeeQualificationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssEmployeeQualificationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -28290,7 +30275,7 @@ public function essQualificationGetWithHttpInfo($id, $employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssEmployeeQualificationModel', + '\OpenAPI\Client\Model\EssEmployeeQualificationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -28307,13 +30292,14 @@ public function essQualificationGetWithHttpInfo($id, $employee_id) * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationGetAsync($id, $employee_id) + public function essQualificationGetAsync($id, $employee_id, string $contentType = self::contentTypes['essQualificationGet'][0]) { - return $this->essQualificationGetAsyncWithHttpInfo($id, $employee_id) + return $this->essQualificationGetAsyncWithHttpInfo($id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -28328,24 +30314,24 @@ function ($response) { * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationGetAsyncWithHttpInfo($id, $employee_id) + public function essQualificationGetAsyncWithHttpInfo($id, $employee_id, string $contentType = self::contentTypes['essQualificationGet'][0]) { - $returnType = '\Swagger\Client\Model\EssEmployeeQualificationModel'; - $request = $this->essQualificationGetRequest($id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssEmployeeQualificationModel'; + $request = $this->essQualificationGetRequest($id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -28368,7 +30354,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -28379,18 +30365,21 @@ function ($exception) { * * @param int $id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationGetRequest($id, $employee_id) + public function essQualificationGetRequest($id, $employee_id, string $contentType = self::contentTypes['essQualificationGet'][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 essQualificationGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -28398,6 +30387,7 @@ protected function essQualificationGetRequest($id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -28406,6 +30396,7 @@ protected function essQualificationGetRequest($id, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -28423,53 +30414,35 @@ protected function essQualificationGetRequest($id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -28490,10 +30463,11 @@ protected function essQualificationGetRequest($id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -28505,14 +30479,15 @@ protected function essQualificationGetRequest($id, $employee_id) * Get Qualifications for Employee * * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGetQualifications'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssEmployeeQualificationModel[] + * @return \OpenAPI\Client\Model\EssEmployeeQualificationModel[] */ - public function essQualificationGetQualifications($employee_id) + public function essQualificationGetQualifications($employee_id, string $contentType = self::contentTypes['essQualificationGetQualifications'][0]) { - list($response) = $this->essQualificationGetQualificationsWithHttpInfo($employee_id); + list($response) = $this->essQualificationGetQualificationsWithHttpInfo($employee_id, $contentType); return $response; } @@ -28522,15 +30497,15 @@ public function essQualificationGetQualifications($employee_id) * Get Qualifications for Employee * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGetQualifications'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssEmployeeQualificationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssEmployeeQualificationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationGetQualificationsWithHttpInfo($employee_id) + public function essQualificationGetQualificationsWithHttpInfo($employee_id, string $contentType = self::contentTypes['essQualificationGetQualifications'][0]) { - $returnType = '\Swagger\Client\Model\EssEmployeeQualificationModel[]'; - $request = $this->essQualificationGetQualificationsRequest($employee_id); + $request = $this->essQualificationGetQualificationsRequest($employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -28539,9 +30514,16 @@ public function essQualificationGetQualificationsWithHttpInfo($employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -28552,19 +30534,37 @@ public function essQualificationGetQualificationsWithHttpInfo($employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssEmployeeQualificationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssEmployeeQualificationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssEmployeeQualificationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssEmployeeQualificationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -28581,7 +30581,7 @@ public function essQualificationGetQualificationsWithHttpInfo($employee_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssEmployeeQualificationModel[]', + '\OpenAPI\Client\Model\EssEmployeeQualificationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -28597,13 +30597,14 @@ public function essQualificationGetQualificationsWithHttpInfo($employee_id) * Get Qualifications for Employee * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationGetQualificationsAsync($employee_id) + public function essQualificationGetQualificationsAsync($employee_id, string $contentType = self::contentTypes['essQualificationGetQualifications'][0]) { - return $this->essQualificationGetQualificationsAsyncWithHttpInfo($employee_id) + return $this->essQualificationGetQualificationsAsyncWithHttpInfo($employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -28617,24 +30618,24 @@ function ($response) { * Get Qualifications for Employee * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationGetQualificationsAsyncWithHttpInfo($employee_id) + public function essQualificationGetQualificationsAsyncWithHttpInfo($employee_id, string $contentType = self::contentTypes['essQualificationGetQualifications'][0]) { - $returnType = '\Swagger\Client\Model\EssEmployeeQualificationModel[]'; - $request = $this->essQualificationGetQualificationsRequest($employee_id); + $returnType = '\OpenAPI\Client\Model\EssEmployeeQualificationModel[]'; + $request = $this->essQualificationGetQualificationsRequest($employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -28657,7 +30658,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -28667,12 +30668,14 @@ function ($exception) { * Create request for operation 'essQualificationGetQualifications' * * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationGetQualificationsRequest($employee_id) + public function essQualificationGetQualificationsRequest($employee_id, string $contentType = self::contentTypes['essQualificationGetQualifications'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -28680,6 +30683,7 @@ protected function essQualificationGetQualificationsRequest($employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/qualification'; $formParams = []; $queryParams = []; @@ -28688,6 +30692,7 @@ protected function essQualificationGetQualificationsRequest($employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -28697,53 +30702,35 @@ protected function essQualificationGetQualificationsRequest($employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -28764,10 +30751,11 @@ protected function essQualificationGetQualificationsRequest($employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -28778,16 +30766,17 @@ protected function essQualificationGetQualificationsRequest($employee_id) * * Add Employee Qualification * - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification qualification (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essQualificationPost($qualification, $employee_id) + public function essQualificationPost($employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPost'][0]) { - $this->essQualificationPostWithHttpInfo($qualification, $employee_id); + $this->essQualificationPostWithHttpInfo($employee_id, $qualification, $contentType); } /** @@ -28795,17 +30784,17 @@ public function essQualificationPost($qualification, $employee_id) * * Add Employee Qualification * - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationPostWithHttpInfo($qualification, $employee_id) + public function essQualificationPostWithHttpInfo($employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPost'][0]) { - $returnType = ''; - $request = $this->essQualificationPostRequest($qualification, $employee_id); + $request = $this->essQualificationPostRequest($employee_id, $qualification, $contentType); try { $options = $this->createHttpClientOption(); @@ -28814,9 +30803,16 @@ public function essQualificationPostWithHttpInfo($qualification, $employee_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -28827,11 +30823,11 @@ public function essQualificationPostWithHttpInfo($qualification, $employee_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -28849,15 +30845,16 @@ public function essQualificationPostWithHttpInfo($qualification, $employee_id) * * Add Employee Qualification * - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationPostAsync($qualification, $employee_id) + public function essQualificationPostAsync($employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPost'][0]) { - return $this->essQualificationPostAsyncWithHttpInfo($qualification, $employee_id) + return $this->essQualificationPostAsyncWithHttpInfo($employee_id, $qualification, $contentType) ->then( function ($response) { return $response[0]; @@ -28870,16 +30867,17 @@ function ($response) { * * Add Employee Qualification * - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationPostAsyncWithHttpInfo($qualification, $employee_id) + public function essQualificationPostAsyncWithHttpInfo($employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPost'][0]) { $returnType = ''; - $request = $this->essQualificationPostRequest($qualification, $employee_id); + $request = $this->essQualificationPostRequest($employee_id, $qualification, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -28898,7 +30896,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -28907,20 +30905,16 @@ function ($exception) { /** * Create request for operation 'essQualificationPost' * - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationPostRequest($qualification, $employee_id) + public function essQualificationPostRequest($employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPost'][0]) { - // verify the required parameter 'qualification' is set - if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $qualification when calling essQualificationPost' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -28928,6 +30922,14 @@ protected function essQualificationPostRequest($qualification, $employee_id) ); } + // verify the required parameter 'qualification' is set + if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $qualification when calling essQualificationPost' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/qualification'; $formParams = []; $queryParams = []; @@ -28936,6 +30938,7 @@ protected function essQualificationPostRequest($qualification, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -28945,56 +30948,42 @@ protected function essQualificationPostRequest($qualification, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($qualification)) { - $_tempBody = $qualification; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($qualification)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($qualification)); + } else { + $httpBody = $qualification; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -29015,10 +31004,11 @@ protected function essQualificationPostRequest($qualification, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -29030,16 +31020,17 @@ protected function essQualificationPostRequest($qualification, $employee_id) * Update Employee Qualification * * @param int $id id (required) - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification qualification (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essQualificationPut($id, $qualification, $employee_id) + public function essQualificationPut($id, $employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPut'][0]) { - $this->essQualificationPutWithHttpInfo($id, $qualification, $employee_id); + $this->essQualificationPutWithHttpInfo($id, $employee_id, $qualification, $contentType); } /** @@ -29048,17 +31039,17 @@ public function essQualificationPut($id, $qualification, $employee_id) * Update Employee Qualification * * @param int $id (required) - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationPutWithHttpInfo($id, $qualification, $employee_id) + public function essQualificationPutWithHttpInfo($id, $employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPut'][0]) { - $returnType = ''; - $request = $this->essQualificationPutRequest($id, $qualification, $employee_id); + $request = $this->essQualificationPutRequest($id, $employee_id, $qualification, $contentType); try { $options = $this->createHttpClientOption(); @@ -29067,9 +31058,16 @@ public function essQualificationPutWithHttpInfo($id, $qualification, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -29080,11 +31078,11 @@ public function essQualificationPutWithHttpInfo($id, $qualification, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -29103,15 +31101,16 @@ public function essQualificationPutWithHttpInfo($id, $qualification, $employee_i * Update Employee Qualification * * @param int $id (required) - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationPutAsync($id, $qualification, $employee_id) + public function essQualificationPutAsync($id, $employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPut'][0]) { - return $this->essQualificationPutAsyncWithHttpInfo($id, $qualification, $employee_id) + return $this->essQualificationPutAsyncWithHttpInfo($id, $employee_id, $qualification, $contentType) ->then( function ($response) { return $response[0]; @@ -29125,16 +31124,17 @@ function ($response) { * Update Employee Qualification * * @param int $id (required) - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationPutAsyncWithHttpInfo($id, $qualification, $employee_id) + public function essQualificationPutAsyncWithHttpInfo($id, $employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPut'][0]) { $returnType = ''; - $request = $this->essQualificationPutRequest($id, $qualification, $employee_id); + $request = $this->essQualificationPutRequest($id, $employee_id, $qualification, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -29153,7 +31153,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -29163,26 +31163,23 @@ function ($exception) { * Create request for operation 'essQualificationPut' * * @param int $id (required) - * @param \Swagger\Client\Model\EssEmployeeQualificationModel $qualification (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\EssEmployeeQualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationPutRequest($id, $qualification, $employee_id) + public function essQualificationPutRequest($id, $employee_id, $qualification, string $contentType = self::contentTypes['essQualificationPut'][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 essQualificationPut' ); } - // verify the required parameter 'qualification' is set - if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $qualification when calling essQualificationPut' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -29190,6 +31187,14 @@ protected function essQualificationPutRequest($id, $qualification, $employee_id) ); } + // verify the required parameter 'qualification' is set + if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $qualification when calling essQualificationPut' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -29198,6 +31203,7 @@ protected function essQualificationPutRequest($id, $qualification, $employee_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -29215,56 +31221,42 @@ protected function essQualificationPutRequest($id, $qualification, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($qualification)) { - $_tempBody = $qualification; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($qualification)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($qualification)); + } else { + $httpBody = $qualification; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -29285,10 +31277,11 @@ protected function essQualificationPutRequest($id, $qualification, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -29302,14 +31295,15 @@ protected function essQualificationPutRequest($id, $qualification, $employee_id) * @param int $employee_qualification_id employee_qualification_id (required) * @param string $file_name file_name (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function essQualificationUploadAttachment($employee_qualification_id, $file_name, $employee_id) + public function essQualificationUploadAttachment($employee_qualification_id, $file_name, $employee_id, string $contentType = self::contentTypes['essQualificationUploadAttachment'][0]) { - list($response) = $this->essQualificationUploadAttachmentWithHttpInfo($employee_qualification_id, $file_name, $employee_id); + list($response) = $this->essQualificationUploadAttachmentWithHttpInfo($employee_qualification_id, $file_name, $employee_id, $contentType); return $response; } @@ -29321,15 +31315,15 @@ public function essQualificationUploadAttachment($employee_qualification_id, $fi * @param int $employee_qualification_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function essQualificationUploadAttachmentWithHttpInfo($employee_qualification_id, $file_name, $employee_id) + public function essQualificationUploadAttachmentWithHttpInfo($employee_qualification_id, $file_name, $employee_id, string $contentType = self::contentTypes['essQualificationUploadAttachment'][0]) { - $returnType = 'object'; - $request = $this->essQualificationUploadAttachmentRequest($employee_qualification_id, $file_name, $employee_id); + $request = $this->essQualificationUploadAttachmentRequest($employee_qualification_id, $file_name, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -29338,9 +31332,16 @@ public function essQualificationUploadAttachmentWithHttpInfo($employee_qualifica } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -29351,19 +31352,37 @@ public function essQualificationUploadAttachmentWithHttpInfo($employee_qualifica sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -29398,13 +31417,14 @@ public function essQualificationUploadAttachmentWithHttpInfo($employee_qualifica * @param int $employee_qualification_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationUploadAttachmentAsync($employee_qualification_id, $file_name, $employee_id) + public function essQualificationUploadAttachmentAsync($employee_qualification_id, $file_name, $employee_id, string $contentType = self::contentTypes['essQualificationUploadAttachment'][0]) { - return $this->essQualificationUploadAttachmentAsyncWithHttpInfo($employee_qualification_id, $file_name, $employee_id) + return $this->essQualificationUploadAttachmentAsyncWithHttpInfo($employee_qualification_id, $file_name, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -29420,24 +31440,24 @@ function ($response) { * @param int $employee_qualification_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essQualificationUploadAttachmentAsyncWithHttpInfo($employee_qualification_id, $file_name, $employee_id) + public function essQualificationUploadAttachmentAsyncWithHttpInfo($employee_qualification_id, $file_name, $employee_id, string $contentType = self::contentTypes['essQualificationUploadAttachment'][0]) { $returnType = 'object'; - $request = $this->essQualificationUploadAttachmentRequest($employee_qualification_id, $file_name, $employee_id); + $request = $this->essQualificationUploadAttachmentRequest($employee_qualification_id, $file_name, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -29460,7 +31480,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -29472,24 +31492,28 @@ function ($exception) { * @param int $employee_qualification_id (required) * @param string $file_name (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essQualificationUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essQualificationUploadAttachmentRequest($employee_qualification_id, $file_name, $employee_id) + public function essQualificationUploadAttachmentRequest($employee_qualification_id, $file_name, $employee_id, string $contentType = self::contentTypes['essQualificationUploadAttachment'][0]) { + // verify the required parameter 'employee_qualification_id' is set if ($employee_qualification_id === null || (is_array($employee_qualification_id) && count($employee_qualification_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_qualification_id when calling essQualificationUploadAttachment' ); } + // verify the required parameter 'file_name' is set if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $file_name when calling essQualificationUploadAttachment' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -29497,6 +31521,7 @@ protected function essQualificationUploadAttachmentRequest($employee_qualificati ); } + $resourcePath = '/api/v2/ess/{employeeId}/qualification/{employeeQualificationId}/attachment'; $formParams = []; $queryParams = []; @@ -29505,9 +31530,15 @@ protected function essQualificationUploadAttachmentRequest($employee_qualificati $multipart = false; // query params - if ($file_name !== null) { - $queryParams['fileName'] = ObjectSerializer::toQueryValue($file_name); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_name, + 'fileName', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_qualification_id !== null) { @@ -29526,53 +31557,35 @@ protected function essQualificationUploadAttachmentRequest($employee_qualificati ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -29593,10 +31606,11 @@ protected function essQualificationUploadAttachmentRequest($employee_qualificati $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -29607,14 +31621,15 @@ protected function essQualificationUploadAttachmentRequest($employee_qualificati * * Get Employees * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AvailableEmployeeModel[] + * @return \OpenAPI\Client\Model\AvailableEmployeeModel[] */ - public function essSecurityEmployees() + public function essSecurityEmployees(string $contentType = self::contentTypes['essSecurityEmployees'][0]) { - list($response) = $this->essSecurityEmployeesWithHttpInfo(); + list($response) = $this->essSecurityEmployeesWithHttpInfo($contentType); return $response; } @@ -29623,15 +31638,15 @@ public function essSecurityEmployees() * * Get Employees * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AvailableEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AvailableEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essSecurityEmployeesWithHttpInfo() + public function essSecurityEmployeesWithHttpInfo(string $contentType = self::contentTypes['essSecurityEmployees'][0]) { - $returnType = '\Swagger\Client\Model\AvailableEmployeeModel[]'; - $request = $this->essSecurityEmployeesRequest(); + $request = $this->essSecurityEmployeesRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -29640,9 +31655,16 @@ public function essSecurityEmployeesWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -29653,19 +31675,37 @@ public function essSecurityEmployeesWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AvailableEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AvailableEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AvailableEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AvailableEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -29682,7 +31722,7 @@ public function essSecurityEmployeesWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AvailableEmployeeModel[]', + '\OpenAPI\Client\Model\AvailableEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -29697,13 +31737,14 @@ public function essSecurityEmployeesWithHttpInfo() * * Get Employees * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essSecurityEmployeesAsync() + public function essSecurityEmployeesAsync(string $contentType = self::contentTypes['essSecurityEmployees'][0]) { - return $this->essSecurityEmployeesAsyncWithHttpInfo() + return $this->essSecurityEmployeesAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -29716,24 +31757,24 @@ function ($response) { * * Get Employees * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essSecurityEmployeesAsyncWithHttpInfo() + public function essSecurityEmployeesAsyncWithHttpInfo(string $contentType = self::contentTypes['essSecurityEmployees'][0]) { - $returnType = '\Swagger\Client\Model\AvailableEmployeeModel[]'; - $request = $this->essSecurityEmployeesRequest(); + $returnType = '\OpenAPI\Client\Model\AvailableEmployeeModel[]'; + $request = $this->essSecurityEmployeesRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -29756,7 +31797,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -29765,13 +31806,15 @@ function ($exception) { /** * Create request for operation 'essSecurityEmployees' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essSecurityEmployeesRequest() + public function essSecurityEmployeesRequest(string $contentType = self::contentTypes['essSecurityEmployees'][0]) { + $resourcePath = '/api/v2/ess/security/employees'; $formParams = []; $queryParams = []; @@ -29781,53 +31824,36 @@ protected function essSecurityEmployeesRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -29848,10 +31874,11 @@ protected function essSecurityEmployeesRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -29862,15 +31889,16 @@ protected function essSecurityEmployeesRequest() * * Recover Forgotten Password * - * @param \Swagger\Client\Model\RecoverPasswordModel $model model (required) + * @param \OpenAPI\Client\Model\RecoverPasswordModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityForgottenPassword'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essSecurityForgottenPassword($model) + public function essSecurityForgottenPassword($model, string $contentType = self::contentTypes['essSecurityForgottenPassword'][0]) { - $this->essSecurityForgottenPasswordWithHttpInfo($model); + $this->essSecurityForgottenPasswordWithHttpInfo($model, $contentType); } /** @@ -29878,16 +31906,16 @@ public function essSecurityForgottenPassword($model) * * Recover Forgotten Password * - * @param \Swagger\Client\Model\RecoverPasswordModel $model (required) + * @param \OpenAPI\Client\Model\RecoverPasswordModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityForgottenPassword'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essSecurityForgottenPasswordWithHttpInfo($model) + public function essSecurityForgottenPasswordWithHttpInfo($model, string $contentType = self::contentTypes['essSecurityForgottenPassword'][0]) { - $returnType = ''; - $request = $this->essSecurityForgottenPasswordRequest($model); + $request = $this->essSecurityForgottenPasswordRequest($model, $contentType); try { $options = $this->createHttpClientOption(); @@ -29896,9 +31924,16 @@ public function essSecurityForgottenPasswordWithHttpInfo($model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -29909,11 +31944,11 @@ public function essSecurityForgottenPasswordWithHttpInfo($model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -29931,14 +31966,15 @@ public function essSecurityForgottenPasswordWithHttpInfo($model) * * Recover Forgotten Password * - * @param \Swagger\Client\Model\RecoverPasswordModel $model (required) + * @param \OpenAPI\Client\Model\RecoverPasswordModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityForgottenPassword'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essSecurityForgottenPasswordAsync($model) + public function essSecurityForgottenPasswordAsync($model, string $contentType = self::contentTypes['essSecurityForgottenPassword'][0]) { - return $this->essSecurityForgottenPasswordAsyncWithHttpInfo($model) + return $this->essSecurityForgottenPasswordAsyncWithHttpInfo($model, $contentType) ->then( function ($response) { return $response[0]; @@ -29951,15 +31987,16 @@ function ($response) { * * Recover Forgotten Password * - * @param \Swagger\Client\Model\RecoverPasswordModel $model (required) + * @param \OpenAPI\Client\Model\RecoverPasswordModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityForgottenPassword'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essSecurityForgottenPasswordAsyncWithHttpInfo($model) + public function essSecurityForgottenPasswordAsyncWithHttpInfo($model, string $contentType = self::contentTypes['essSecurityForgottenPassword'][0]) { $returnType = ''; - $request = $this->essSecurityForgottenPasswordRequest($model); + $request = $this->essSecurityForgottenPasswordRequest($model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -29978,7 +32015,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -29987,13 +32024,15 @@ function ($exception) { /** * Create request for operation 'essSecurityForgottenPassword' * - * @param \Swagger\Client\Model\RecoverPasswordModel $model (required) + * @param \OpenAPI\Client\Model\RecoverPasswordModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essSecurityForgottenPassword'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essSecurityForgottenPasswordRequest($model) + public function essSecurityForgottenPasswordRequest($model, string $contentType = self::contentTypes['essSecurityForgottenPassword'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -30001,6 +32040,7 @@ protected function essSecurityForgottenPasswordRequest($model) ); } + $resourcePath = '/api/v2/ess/security/forgottenpassword'; $formParams = []; $queryParams = []; @@ -30010,56 +32050,43 @@ protected function essSecurityForgottenPasswordRequest($model) - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -30080,10 +32107,11 @@ protected function essSecurityForgottenPasswordRequest($model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -30094,16 +32122,17 @@ protected function essSecurityForgottenPasswordRequest($model) * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability unavailability (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityCreate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssUnavailabilityModel + * @return \OpenAPI\Client\Model\EssUnavailabilityModel */ - public function essUnavailabilityCreate($unavailability, $employee_id) + public function essUnavailabilityCreate($employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilityCreate'][0]) { - list($response) = $this->essUnavailabilityCreateWithHttpInfo($unavailability, $employee_id); + list($response) = $this->essUnavailabilityCreateWithHttpInfo($employee_id, $unavailability, $contentType); return $response; } @@ -30112,17 +32141,17 @@ public function essUnavailabilityCreate($unavailability, $employee_id) * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityCreate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function essUnavailabilityCreateWithHttpInfo($unavailability, $employee_id) + public function essUnavailabilityCreateWithHttpInfo($employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilityCreate'][0]) { - $returnType = '\Swagger\Client\Model\EssUnavailabilityModel'; - $request = $this->essUnavailabilityCreateRequest($unavailability, $employee_id); + $request = $this->essUnavailabilityCreateRequest($employee_id, $unavailability, $contentType); try { $options = $this->createHttpClientOption(); @@ -30131,9 +32160,16 @@ public function essUnavailabilityCreateWithHttpInfo($unavailability, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -30144,19 +32180,37 @@ public function essUnavailabilityCreateWithHttpInfo($unavailability, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssUnavailabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssUnavailabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssUnavailabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssUnavailabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -30173,7 +32227,7 @@ public function essUnavailabilityCreateWithHttpInfo($unavailability, $employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssUnavailabilityModel', + '\OpenAPI\Client\Model\EssUnavailabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -30188,15 +32242,16 @@ public function essUnavailabilityCreateWithHttpInfo($unavailability, $employee_i * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityCreateAsync($unavailability, $employee_id) + public function essUnavailabilityCreateAsync($employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilityCreate'][0]) { - return $this->essUnavailabilityCreateAsyncWithHttpInfo($unavailability, $employee_id) + return $this->essUnavailabilityCreateAsyncWithHttpInfo($employee_id, $unavailability, $contentType) ->then( function ($response) { return $response[0]; @@ -30209,26 +32264,26 @@ function ($response) { * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityCreateAsyncWithHttpInfo($unavailability, $employee_id) + public function essUnavailabilityCreateAsyncWithHttpInfo($employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilityCreate'][0]) { - $returnType = '\Swagger\Client\Model\EssUnavailabilityModel'; - $request = $this->essUnavailabilityCreateRequest($unavailability, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssUnavailabilityModel'; + $request = $this->essUnavailabilityCreateRequest($employee_id, $unavailability, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -30251,7 +32306,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -30260,20 +32315,16 @@ function ($exception) { /** * Create request for operation 'essUnavailabilityCreate' * - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essUnavailabilityCreateRequest($unavailability, $employee_id) + public function essUnavailabilityCreateRequest($employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilityCreate'][0]) { - // verify the required parameter 'unavailability' is set - if ($unavailability === null || (is_array($unavailability) && count($unavailability) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $unavailability when calling essUnavailabilityCreate' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -30281,6 +32332,14 @@ protected function essUnavailabilityCreateRequest($unavailability, $employee_id) ); } + // verify the required parameter 'unavailability' is set + if ($unavailability === null || (is_array($unavailability) && count($unavailability) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $unavailability when calling essUnavailabilityCreate' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/unavailability'; $formParams = []; $queryParams = []; @@ -30289,6 +32348,7 @@ protected function essUnavailabilityCreateRequest($unavailability, $employee_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -30298,56 +32358,42 @@ protected function essUnavailabilityCreateRequest($unavailability, $employee_id) ); } - // body params - $_tempBody = null; - if (isset($unavailability)) { - $_tempBody = $unavailability; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($unavailability)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unavailability)); + } else { + $httpBody = $unavailability; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -30368,10 +32414,11 @@ protected function essUnavailabilityCreateRequest($unavailability, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -30384,14 +32431,15 @@ protected function essUnavailabilityCreateRequest($unavailability, $employee_id) * * @param int $unavailability_id unavailability_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essUnavailabilityDelete($unavailability_id, $employee_id) + public function essUnavailabilityDelete($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityDelete'][0]) { - $this->essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employee_id); + $this->essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employee_id, $contentType); } /** @@ -30401,15 +32449,15 @@ public function essUnavailabilityDelete($unavailability_id, $employee_id) * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employee_id) + public function essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityDelete'][0]) { - $returnType = ''; - $request = $this->essUnavailabilityDeleteRequest($unavailability_id, $employee_id); + $request = $this->essUnavailabilityDeleteRequest($unavailability_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -30418,9 +32466,16 @@ public function essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -30431,11 +32486,11 @@ public function essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -30455,13 +32510,14 @@ public function essUnavailabilityDeleteWithHttpInfo($unavailability_id, $employe * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityDeleteAsync($unavailability_id, $employee_id) + public function essUnavailabilityDeleteAsync($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityDelete'][0]) { - return $this->essUnavailabilityDeleteAsyncWithHttpInfo($unavailability_id, $employee_id) + return $this->essUnavailabilityDeleteAsyncWithHttpInfo($unavailability_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -30476,14 +32532,15 @@ function ($response) { * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityDeleteAsyncWithHttpInfo($unavailability_id, $employee_id) + public function essUnavailabilityDeleteAsyncWithHttpInfo($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityDelete'][0]) { $returnType = ''; - $request = $this->essUnavailabilityDeleteRequest($unavailability_id, $employee_id); + $request = $this->essUnavailabilityDeleteRequest($unavailability_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -30502,7 +32559,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -30513,18 +32570,21 @@ function ($exception) { * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essUnavailabilityDeleteRequest($unavailability_id, $employee_id) + public function essUnavailabilityDeleteRequest($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityDelete'][0]) { + // verify the required parameter 'unavailability_id' is set if ($unavailability_id === null || (is_array($unavailability_id) && count($unavailability_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $unavailability_id when calling essUnavailabilityDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -30532,6 +32592,7 @@ protected function essUnavailabilityDeleteRequest($unavailability_id, $employee_ ); } + $resourcePath = '/api/v2/ess/{employeeId}/unavailability/{unavailabilityId}'; $formParams = []; $queryParams = []; @@ -30540,6 +32601,7 @@ protected function essUnavailabilityDeleteRequest($unavailability_id, $employee_ $multipart = false; + // path params if ($unavailability_id !== null) { $resourcePath = str_replace( @@ -30557,53 +32619,35 @@ protected function essUnavailabilityDeleteRequest($unavailability_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -30624,10 +32668,11 @@ protected function essUnavailabilityDeleteRequest($unavailability_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -30640,14 +32685,15 @@ protected function essUnavailabilityDeleteRequest($unavailability_id, $employee_ * * @param int $unavailability_id unavailability_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssUnavailabilityModel + * @return \OpenAPI\Client\Model\EssUnavailabilityModel */ - public function essUnavailabilityGet($unavailability_id, $employee_id) + public function essUnavailabilityGet($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityGet'][0]) { - list($response) = $this->essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_id); + list($response) = $this->essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_id, $contentType); return $response; } @@ -30658,15 +32704,15 @@ public function essUnavailabilityGet($unavailability_id, $employee_id) * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_id) + public function essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\EssUnavailabilityModel'; - $request = $this->essUnavailabilityGetRequest($unavailability_id, $employee_id); + $request = $this->essUnavailabilityGetRequest($unavailability_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -30675,9 +32721,16 @@ public function essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -30688,19 +32741,37 @@ public function essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssUnavailabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssUnavailabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssUnavailabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssUnavailabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -30717,7 +32788,7 @@ public function essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssUnavailabilityModel', + '\OpenAPI\Client\Model\EssUnavailabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -30734,13 +32805,14 @@ public function essUnavailabilityGetWithHttpInfo($unavailability_id, $employee_i * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityGetAsync($unavailability_id, $employee_id) + public function essUnavailabilityGetAsync($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityGet'][0]) { - return $this->essUnavailabilityGetAsyncWithHttpInfo($unavailability_id, $employee_id) + return $this->essUnavailabilityGetAsyncWithHttpInfo($unavailability_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -30755,24 +32827,24 @@ function ($response) { * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityGetAsyncWithHttpInfo($unavailability_id, $employee_id) + public function essUnavailabilityGetAsyncWithHttpInfo($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\EssUnavailabilityModel'; - $request = $this->essUnavailabilityGetRequest($unavailability_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\EssUnavailabilityModel'; + $request = $this->essUnavailabilityGetRequest($unavailability_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -30795,7 +32867,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -30806,18 +32878,21 @@ function ($exception) { * * @param int $unavailability_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essUnavailabilityGetRequest($unavailability_id, $employee_id) + public function essUnavailabilityGetRequest($unavailability_id, $employee_id, string $contentType = self::contentTypes['essUnavailabilityGet'][0]) { + // verify the required parameter 'unavailability_id' is set if ($unavailability_id === null || (is_array($unavailability_id) && count($unavailability_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $unavailability_id when calling essUnavailabilityGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -30825,6 +32900,7 @@ protected function essUnavailabilityGetRequest($unavailability_id, $employee_id) ); } + $resourcePath = '/api/v2/ess/{employeeId}/unavailability/{unavailabilityId}'; $formParams = []; $queryParams = []; @@ -30833,6 +32909,7 @@ protected function essUnavailabilityGetRequest($unavailability_id, $employee_id) $multipart = false; + // path params if ($unavailability_id !== null) { $resourcePath = str_replace( @@ -30850,53 +32927,35 @@ protected function essUnavailabilityGetRequest($unavailability_id, $employee_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -30917,10 +32976,11 @@ protected function essUnavailabilityGetRequest($unavailability_id, $employee_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -30932,16 +32992,17 @@ protected function essUnavailabilityGetRequest($unavailability_id, $employee_id) * List Unavailabilities * * @param string $employee_id employee_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EssUnavailabilityModel[] + * @return \OpenAPI\Client\Model\EssUnavailabilityModel[] */ - public function essUnavailabilityList($employee_id, $filter_from_date = null, $filter_to_date = null) + public function essUnavailabilityList($employee_id, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essUnavailabilityList'][0]) { - list($response) = $this->essUnavailabilityListWithHttpInfo($employee_id, $filter_from_date, $filter_to_date); + list($response) = $this->essUnavailabilityListWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType); return $response; } @@ -30951,17 +33012,17 @@ public function essUnavailabilityList($employee_id, $filter_from_date = null, $f * List Unavailabilities * * @param string $employee_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityList'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EssUnavailabilityModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EssUnavailabilityModel[], HTTP status code, HTTP response headers (array of strings) */ - public function essUnavailabilityListWithHttpInfo($employee_id, $filter_from_date = null, $filter_to_date = null) + public function essUnavailabilityListWithHttpInfo($employee_id, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essUnavailabilityList'][0]) { - $returnType = '\Swagger\Client\Model\EssUnavailabilityModel[]'; - $request = $this->essUnavailabilityListRequest($employee_id, $filter_from_date, $filter_to_date); + $request = $this->essUnavailabilityListRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -30970,9 +33031,16 @@ public function essUnavailabilityListWithHttpInfo($employee_id, $filter_from_dat } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -30983,19 +33051,37 @@ public function essUnavailabilityListWithHttpInfo($employee_id, $filter_from_dat sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EssUnavailabilityModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EssUnavailabilityModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EssUnavailabilityModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EssUnavailabilityModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -31012,7 +33098,7 @@ public function essUnavailabilityListWithHttpInfo($employee_id, $filter_from_dat case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EssUnavailabilityModel[]', + '\OpenAPI\Client\Model\EssUnavailabilityModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -31028,15 +33114,16 @@ public function essUnavailabilityListWithHttpInfo($employee_id, $filter_from_dat * List Unavailabilities * * @param string $employee_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityListAsync($employee_id, $filter_from_date = null, $filter_to_date = null) + public function essUnavailabilityListAsync($employee_id, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essUnavailabilityList'][0]) { - return $this->essUnavailabilityListAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date) + return $this->essUnavailabilityListAsyncWithHttpInfo($employee_id, $filter_from_date, $filter_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -31050,26 +33137,26 @@ function ($response) { * List Unavailabilities * * @param string $employee_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilityListAsyncWithHttpInfo($employee_id, $filter_from_date = null, $filter_to_date = null) + public function essUnavailabilityListAsyncWithHttpInfo($employee_id, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essUnavailabilityList'][0]) { - $returnType = '\Swagger\Client\Model\EssUnavailabilityModel[]'; - $request = $this->essUnavailabilityListRequest($employee_id, $filter_from_date, $filter_to_date); + $returnType = '\OpenAPI\Client\Model\EssUnavailabilityModel[]'; + $request = $this->essUnavailabilityListRequest($employee_id, $filter_from_date, $filter_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -31092,7 +33179,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -31102,14 +33189,16 @@ function ($exception) { * Create request for operation 'essUnavailabilityList' * * @param string $employee_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilityList'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essUnavailabilityListRequest($employee_id, $filter_from_date = null, $filter_to_date = null) + public function essUnavailabilityListRequest($employee_id, $filter_from_date = null, $filter_to_date = null, string $contentType = self::contentTypes['essUnavailabilityList'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -31117,6 +33206,9 @@ protected function essUnavailabilityListRequest($employee_id, $filter_from_date ); } + + + $resourcePath = '/api/v2/ess/{employeeId}/unavailability'; $formParams = []; $queryParams = []; @@ -31125,13 +33217,24 @@ protected function essUnavailabilityListRequest($employee_id, $filter_from_date $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -31142,53 +33245,35 @@ protected function essUnavailabilityListRequest($employee_id, $filter_from_date ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -31209,10 +33294,11 @@ protected function essUnavailabilityListRequest($employee_id, $filter_from_date $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -31224,16 +33310,17 @@ protected function essUnavailabilityListRequest($employee_id, $filter_from_date * Update Unavailability * * @param int $unavailability_id unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability unavailability (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilitySave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function essUnavailabilitySave($unavailability_id, $unavailability, $employee_id) + public function essUnavailabilitySave($unavailability_id, $employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilitySave'][0]) { - $this->essUnavailabilitySaveWithHttpInfo($unavailability_id, $unavailability, $employee_id); + $this->essUnavailabilitySaveWithHttpInfo($unavailability_id, $employee_id, $unavailability, $contentType); } /** @@ -31242,17 +33329,17 @@ public function essUnavailabilitySave($unavailability_id, $unavailability, $empl * Update Unavailability * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilitySave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function essUnavailabilitySaveWithHttpInfo($unavailability_id, $unavailability, $employee_id) + public function essUnavailabilitySaveWithHttpInfo($unavailability_id, $employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilitySave'][0]) { - $returnType = ''; - $request = $this->essUnavailabilitySaveRequest($unavailability_id, $unavailability, $employee_id); + $request = $this->essUnavailabilitySaveRequest($unavailability_id, $employee_id, $unavailability, $contentType); try { $options = $this->createHttpClientOption(); @@ -31261,9 +33348,16 @@ public function essUnavailabilitySaveWithHttpInfo($unavailability_id, $unavailab } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -31274,11 +33368,11 @@ public function essUnavailabilitySaveWithHttpInfo($unavailability_id, $unavailab sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -31297,15 +33391,16 @@ public function essUnavailabilitySaveWithHttpInfo($unavailability_id, $unavailab * Update Unavailability * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilitySave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilitySaveAsync($unavailability_id, $unavailability, $employee_id) + public function essUnavailabilitySaveAsync($unavailability_id, $employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilitySave'][0]) { - return $this->essUnavailabilitySaveAsyncWithHttpInfo($unavailability_id, $unavailability, $employee_id) + return $this->essUnavailabilitySaveAsyncWithHttpInfo($unavailability_id, $employee_id, $unavailability, $contentType) ->then( function ($response) { return $response[0]; @@ -31319,16 +33414,17 @@ function ($response) { * Update Unavailability * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilitySave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function essUnavailabilitySaveAsyncWithHttpInfo($unavailability_id, $unavailability, $employee_id) + public function essUnavailabilitySaveAsyncWithHttpInfo($unavailability_id, $employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilitySave'][0]) { $returnType = ''; - $request = $this->essUnavailabilitySaveRequest($unavailability_id, $unavailability, $employee_id); + $request = $this->essUnavailabilitySaveRequest($unavailability_id, $employee_id, $unavailability, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -31347,7 +33443,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -31357,26 +33453,23 @@ function ($exception) { * Create request for operation 'essUnavailabilitySave' * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $unavailability (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $unavailability (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['essUnavailabilitySave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function essUnavailabilitySaveRequest($unavailability_id, $unavailability, $employee_id) + public function essUnavailabilitySaveRequest($unavailability_id, $employee_id, $unavailability, string $contentType = self::contentTypes['essUnavailabilitySave'][0]) { + // verify the required parameter 'unavailability_id' is set if ($unavailability_id === null || (is_array($unavailability_id) && count($unavailability_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $unavailability_id when calling essUnavailabilitySave' ); } - // verify the required parameter 'unavailability' is set - if ($unavailability === null || (is_array($unavailability) && count($unavailability) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $unavailability when calling essUnavailabilitySave' - ); - } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -31384,6 +33477,14 @@ protected function essUnavailabilitySaveRequest($unavailability_id, $unavailabil ); } + // verify the required parameter 'unavailability' is set + if ($unavailability === null || (is_array($unavailability) && count($unavailability) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $unavailability when calling essUnavailabilitySave' + ); + } + + $resourcePath = '/api/v2/ess/{employeeId}/unavailability/{unavailabilityId}'; $formParams = []; $queryParams = []; @@ -31392,6 +33493,7 @@ protected function essUnavailabilitySaveRequest($unavailability_id, $unavailabil $multipart = false; + // path params if ($unavailability_id !== null) { $resourcePath = str_replace( @@ -31409,56 +33511,42 @@ protected function essUnavailabilitySaveRequest($unavailability_id, $unavailabil ); } - // body params - $_tempBody = null; - if (isset($unavailability)) { - $_tempBody = $unavailability; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($unavailability)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unavailability)); + } else { + $httpBody = $unavailability; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -31479,10 +33567,11 @@ protected function essUnavailabilitySaveRequest($unavailability_id, $unavailabil $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/InvoicesApi.php b/src/lib/Api/InvoicesApi.php index 86df87a..93b6ee8 100644 --- a/src/lib/Api/InvoicesApi.php +++ b/src/lib/Api/InvoicesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'invoiceGetBrandInvoiceExcelById' => [ + 'application/json', + ], + 'invoiceGetBrandInvoicePdfById' => [ + 'application/json', + ], + 'invoiceGetBrandInvoices' => [ + 'application/json', + ], + 'invoiceGetBusinessInvoiceById' => [ + 'application/json', + ], + 'invoiceGetBusinessInvoicePdfById' => [ + 'application/json', + ], + 'invoiceGetBusinessInvoices' => [ + 'application/json', + ], + 'invoiceGetResellerInvoiceById' => [ + 'application/json', + ], + 'invoiceGetResellerInvoiceExcelById' => [ + 'application/json', + ], + 'invoiceGetResellerInvoicePdfById' => [ + 'application/json', + ], + 'invoiceGetResellerInvoices' => [ + '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 + 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; } /** @@ -94,14 +159,15 @@ public function getConfig() * * @param int $id id (required) * @param int $brand_id brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\InvoiceModel + * @return \OpenAPI\Client\Model\InvoiceModel */ - public function invoiceGetBrandInvoiceById($id, $brand_id) + public function invoiceGetBrandInvoiceById($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceById'][0]) { - list($response) = $this->invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id); + list($response) = $this->invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id, $contentType); return $response; } @@ -112,15 +178,15 @@ public function invoiceGetBrandInvoiceById($id, $brand_id) * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\InvoiceModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\InvoiceModel, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id) + public function invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceById'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel'; - $request = $this->invoiceGetBrandInvoiceByIdRequest($id, $brand_id); + $request = $this->invoiceGetBrandInvoiceByIdRequest($id, $brand_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,9 +195,16 @@ public function invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -142,19 +215,37 @@ public function invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\InvoiceModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InvoiceModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InvoiceModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InvoiceModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -171,7 +262,7 @@ public function invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\InvoiceModel', + '\OpenAPI\Client\Model\InvoiceModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -188,13 +279,14 @@ public function invoiceGetBrandInvoiceByIdWithHttpInfo($id, $brand_id) * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoiceByIdAsync($id, $brand_id) + public function invoiceGetBrandInvoiceByIdAsync($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceById'][0]) { - return $this->invoiceGetBrandInvoiceByIdAsyncWithHttpInfo($id, $brand_id) + return $this->invoiceGetBrandInvoiceByIdAsyncWithHttpInfo($id, $brand_id, $contentType) ->then( function ($response) { return $response[0]; @@ -209,24 +301,24 @@ function ($response) { * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoiceByIdAsyncWithHttpInfo($id, $brand_id) + public function invoiceGetBrandInvoiceByIdAsyncWithHttpInfo($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceById'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel'; - $request = $this->invoiceGetBrandInvoiceByIdRequest($id, $brand_id); + $returnType = '\OpenAPI\Client\Model\InvoiceModel'; + $request = $this->invoiceGetBrandInvoiceByIdRequest($id, $brand_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -249,7 +341,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -260,18 +352,21 @@ function ($exception) { * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBrandInvoiceByIdRequest($id, $brand_id) + public function invoiceGetBrandInvoiceByIdRequest($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceById'][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 invoiceGetBrandInvoiceById' ); } + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -279,6 +374,7 @@ protected function invoiceGetBrandInvoiceByIdRequest($id, $brand_id) ); } + $resourcePath = '/api/v2/brand/{brandId}/Invoice/{id}'; $formParams = []; $queryParams = []; @@ -287,6 +383,7 @@ protected function invoiceGetBrandInvoiceByIdRequest($id, $brand_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -304,53 +401,35 @@ protected function invoiceGetBrandInvoiceByIdRequest($id, $brand_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -371,10 +450,11 @@ protected function invoiceGetBrandInvoiceByIdRequest($id, $brand_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -387,14 +467,15 @@ protected function invoiceGetBrandInvoiceByIdRequest($id, $brand_id) * * @param int $id id (required) * @param int $brand_id brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceExcelById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function invoiceGetBrandInvoiceExcelById($id, $brand_id) + public function invoiceGetBrandInvoiceExcelById($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceExcelById'][0]) { - list($response) = $this->invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id); + list($response) = $this->invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id, $contentType); return $response; } @@ -405,15 +486,15 @@ public function invoiceGetBrandInvoiceExcelById($id, $brand_id) * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceExcelById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id) + public function invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceExcelById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id); + $request = $this->invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -422,9 +503,16 @@ public function invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -435,19 +523,37 @@ public function invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -464,7 +570,7 @@ public function invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -481,13 +587,14 @@ public function invoiceGetBrandInvoiceExcelByIdWithHttpInfo($id, $brand_id) * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceExcelById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoiceExcelByIdAsync($id, $brand_id) + public function invoiceGetBrandInvoiceExcelByIdAsync($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceExcelById'][0]) { - return $this->invoiceGetBrandInvoiceExcelByIdAsyncWithHttpInfo($id, $brand_id) + return $this->invoiceGetBrandInvoiceExcelByIdAsyncWithHttpInfo($id, $brand_id, $contentType) ->then( function ($response) { return $response[0]; @@ -502,24 +609,24 @@ function ($response) { * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceExcelById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoiceExcelByIdAsyncWithHttpInfo($id, $brand_id) + public function invoiceGetBrandInvoiceExcelByIdAsyncWithHttpInfo($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceExcelById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -542,7 +649,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -553,18 +660,21 @@ function ($exception) { * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoiceExcelById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id) + public function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoiceExcelById'][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 invoiceGetBrandInvoiceExcelById' ); } + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -572,6 +682,7 @@ protected function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id) ); } + $resourcePath = '/api/v2/brand/{brandId}/Invoice/{id}/excel'; $formParams = []; $queryParams = []; @@ -580,6 +691,7 @@ protected function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -597,53 +709,35 @@ protected function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -664,10 +758,11 @@ protected function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -680,14 +775,15 @@ protected function invoiceGetBrandInvoiceExcelByIdRequest($id, $brand_id) * * @param int $id id (required) * @param int $brand_id brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoicePdfById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function invoiceGetBrandInvoicePdfById($id, $brand_id) + public function invoiceGetBrandInvoicePdfById($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoicePdfById'][0]) { - list($response) = $this->invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id); + list($response) = $this->invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id, $contentType); return $response; } @@ -698,15 +794,15 @@ public function invoiceGetBrandInvoicePdfById($id, $brand_id) * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoicePdfById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id) + public function invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoicePdfById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id); + $request = $this->invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -715,9 +811,16 @@ public function invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -728,19 +831,37 @@ public function invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -757,7 +878,7 @@ public function invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -774,13 +895,14 @@ public function invoiceGetBrandInvoicePdfByIdWithHttpInfo($id, $brand_id) * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoicePdfByIdAsync($id, $brand_id) + public function invoiceGetBrandInvoicePdfByIdAsync($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoicePdfById'][0]) { - return $this->invoiceGetBrandInvoicePdfByIdAsyncWithHttpInfo($id, $brand_id) + return $this->invoiceGetBrandInvoicePdfByIdAsyncWithHttpInfo($id, $brand_id, $contentType) ->then( function ($response) { return $response[0]; @@ -795,24 +917,24 @@ function ($response) { * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoicePdfByIdAsyncWithHttpInfo($id, $brand_id) + public function invoiceGetBrandInvoicePdfByIdAsyncWithHttpInfo($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoicePdfById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -835,7 +957,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -846,18 +968,21 @@ function ($exception) { * * @param int $id (required) * @param int $brand_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id) + public function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id, string $contentType = self::contentTypes['invoiceGetBrandInvoicePdfById'][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 invoiceGetBrandInvoicePdfById' ); } + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -865,6 +990,7 @@ protected function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id) ); } + $resourcePath = '/api/v2/brand/{brandId}/Invoice/{id}/pdf'; $formParams = []; $queryParams = []; @@ -873,6 +999,7 @@ protected function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -890,53 +1017,35 @@ protected function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -957,10 +1066,11 @@ protected function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -972,16 +1082,17 @@ protected function invoiceGetBrandInvoicePdfByIdRequest($id, $brand_id) * Get Brand Invoices * * @param int $brand_id brand_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date options_from_date (optional) + * @param \DateTime $options_to_date options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\InvoiceModel[] + * @return \OpenAPI\Client\Model\InvoiceModel[] */ - public function invoiceGetBrandInvoices($brand_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBrandInvoices($brand_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBrandInvoices'][0]) { - list($response) = $this->invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_date, $options_to_date); + list($response) = $this->invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_date, $options_to_date, $contentType); return $response; } @@ -991,17 +1102,17 @@ public function invoiceGetBrandInvoices($brand_id, $options_from_date = null, $o * Get Brand Invoices * * @param int $brand_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\InvoiceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\InvoiceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBrandInvoices'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel[]'; - $request = $this->invoiceGetBrandInvoicesRequest($brand_id, $options_from_date, $options_to_date); + $request = $this->invoiceGetBrandInvoicesRequest($brand_id, $options_from_date, $options_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -1010,9 +1121,16 @@ public function invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_dat } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1023,19 +1141,37 @@ public function invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_dat sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\InvoiceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InvoiceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InvoiceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InvoiceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1052,7 +1188,7 @@ public function invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_dat case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\InvoiceModel[]', + '\OpenAPI\Client\Model\InvoiceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1068,15 +1204,16 @@ public function invoiceGetBrandInvoicesWithHttpInfo($brand_id, $options_from_dat * Get Brand Invoices * * @param int $brand_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoicesAsync($brand_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBrandInvoicesAsync($brand_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBrandInvoices'][0]) { - return $this->invoiceGetBrandInvoicesAsyncWithHttpInfo($brand_id, $options_from_date, $options_to_date) + return $this->invoiceGetBrandInvoicesAsyncWithHttpInfo($brand_id, $options_from_date, $options_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -1090,26 +1227,26 @@ function ($response) { * Get Brand Invoices * * @param int $brand_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBrandInvoicesAsyncWithHttpInfo($brand_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBrandInvoicesAsyncWithHttpInfo($brand_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBrandInvoices'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel[]'; - $request = $this->invoiceGetBrandInvoicesRequest($brand_id, $options_from_date, $options_to_date); + $returnType = '\OpenAPI\Client\Model\InvoiceModel[]'; + $request = $this->invoiceGetBrandInvoicesRequest($brand_id, $options_from_date, $options_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1132,7 +1269,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1142,14 +1279,16 @@ function ($exception) { * Create request for operation 'invoiceGetBrandInvoices' * * @param int $brand_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBrandInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBrandInvoices'][0]) { + // verify the required parameter 'brand_id' is set if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) { throw new \InvalidArgumentException( @@ -1157,6 +1296,9 @@ protected function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date ); } + + + $resourcePath = '/api/v2/brand/{brandId}/Invoice'; $formParams = []; $queryParams = []; @@ -1165,13 +1307,24 @@ protected function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date $multipart = false; // query params - if ($options_from_date !== null) { - $queryParams['options.fromDate'] = ObjectSerializer::toQueryValue($options_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $options_from_date, + 'options.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($options_to_date !== null) { - $queryParams['options.toDate'] = ObjectSerializer::toQueryValue($options_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $options_to_date, + 'options.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($brand_id !== null) { @@ -1182,53 +1335,35 @@ protected function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1249,10 +1384,11 @@ protected function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1265,14 +1401,15 @@ protected function invoiceGetBrandInvoicesRequest($brand_id, $options_from_date * * @param int $id id (required) * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoiceById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\InvoiceModel + * @return \OpenAPI\Client\Model\InvoiceModel */ - public function invoiceGetBusinessInvoiceById($id, $business_id) + public function invoiceGetBusinessInvoiceById($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoiceById'][0]) { - list($response) = $this->invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id); + list($response) = $this->invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -1283,15 +1420,15 @@ public function invoiceGetBusinessInvoiceById($id, $business_id) * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoiceById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\InvoiceModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\InvoiceModel, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id) + public function invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoiceById'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel'; - $request = $this->invoiceGetBusinessInvoiceByIdRequest($id, $business_id); + $request = $this->invoiceGetBusinessInvoiceByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1300,9 +1437,16 @@ public function invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1313,19 +1457,37 @@ public function invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\InvoiceModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InvoiceModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InvoiceModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InvoiceModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1342,7 +1504,7 @@ public function invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\InvoiceModel', + '\OpenAPI\Client\Model\InvoiceModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1359,13 +1521,14 @@ public function invoiceGetBusinessInvoiceByIdWithHttpInfo($id, $business_id) * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBusinessInvoiceByIdAsync($id, $business_id) + public function invoiceGetBusinessInvoiceByIdAsync($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoiceById'][0]) { - return $this->invoiceGetBusinessInvoiceByIdAsyncWithHttpInfo($id, $business_id) + return $this->invoiceGetBusinessInvoiceByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1380,24 +1543,24 @@ function ($response) { * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBusinessInvoiceByIdAsyncWithHttpInfo($id, $business_id) + public function invoiceGetBusinessInvoiceByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoiceById'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel'; - $request = $this->invoiceGetBusinessInvoiceByIdRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\InvoiceModel'; + $request = $this->invoiceGetBusinessInvoiceByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1420,7 +1583,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1431,18 +1594,21 @@ function ($exception) { * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBusinessInvoiceByIdRequest($id, $business_id) + public function invoiceGetBusinessInvoiceByIdRequest($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoiceById'][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 invoiceGetBusinessInvoiceById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1450,6 +1616,7 @@ protected function invoiceGetBusinessInvoiceByIdRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/Invoice/{id}'; $formParams = []; $queryParams = []; @@ -1458,6 +1625,7 @@ protected function invoiceGetBusinessInvoiceByIdRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1475,53 +1643,35 @@ protected function invoiceGetBusinessInvoiceByIdRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1542,10 +1692,11 @@ protected function invoiceGetBusinessInvoiceByIdRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1558,14 +1709,15 @@ protected function invoiceGetBusinessInvoiceByIdRequest($id, $business_id) * * @param int $id id (required) * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoicePdfById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function invoiceGetBusinessInvoicePdfById($id, $business_id) + public function invoiceGetBusinessInvoicePdfById($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoicePdfById'][0]) { - list($response) = $this->invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id); + list($response) = $this->invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -1576,15 +1728,15 @@ public function invoiceGetBusinessInvoicePdfById($id, $business_id) * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoicePdfById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id) + public function invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoicePdfById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id); + $request = $this->invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1593,9 +1745,16 @@ public function invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1606,19 +1765,37 @@ public function invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1635,7 +1812,7 @@ public function invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1652,13 +1829,14 @@ public function invoiceGetBusinessInvoicePdfByIdWithHttpInfo($id, $business_id) * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBusinessInvoicePdfByIdAsync($id, $business_id) + public function invoiceGetBusinessInvoicePdfByIdAsync($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoicePdfById'][0]) { - return $this->invoiceGetBusinessInvoicePdfByIdAsyncWithHttpInfo($id, $business_id) + return $this->invoiceGetBusinessInvoicePdfByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1673,24 +1851,24 @@ function ($response) { * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBusinessInvoicePdfByIdAsyncWithHttpInfo($id, $business_id) + public function invoiceGetBusinessInvoicePdfByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoicePdfById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1713,7 +1891,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1724,18 +1902,21 @@ function ($exception) { * * @param int $id (required) * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id) + public function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id, string $contentType = self::contentTypes['invoiceGetBusinessInvoicePdfById'][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 invoiceGetBusinessInvoicePdfById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1743,6 +1924,7 @@ protected function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/Invoice/{id}/pdf'; $formParams = []; $queryParams = []; @@ -1751,6 +1933,7 @@ protected function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1768,53 +1951,35 @@ protected function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1835,10 +2000,11 @@ protected function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1850,16 +2016,17 @@ protected function invoiceGetBusinessInvoicePdfByIdRequest($id, $business_id) * Get Business Invoices * * @param int $business_id business_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date options_from_date (optional) + * @param \DateTime $options_to_date options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\InvoiceModel[] + * @return \OpenAPI\Client\Model\InvoiceModel[] */ - public function invoiceGetBusinessInvoices($business_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBusinessInvoices($business_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBusinessInvoices'][0]) { - list($response) = $this->invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_from_date, $options_to_date); + list($response) = $this->invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_from_date, $options_to_date, $contentType); return $response; } @@ -1869,17 +2036,17 @@ public function invoiceGetBusinessInvoices($business_id, $options_from_date = nu * Get Business Invoices * * @param int $business_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\InvoiceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\InvoiceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBusinessInvoices'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel[]'; - $request = $this->invoiceGetBusinessInvoicesRequest($business_id, $options_from_date, $options_to_date); + $request = $this->invoiceGetBusinessInvoicesRequest($business_id, $options_from_date, $options_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -1888,9 +2055,16 @@ public function invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_fr } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1901,19 +2075,37 @@ public function invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_fr sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\InvoiceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InvoiceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InvoiceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InvoiceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1930,7 +2122,7 @@ public function invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_fr case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\InvoiceModel[]', + '\OpenAPI\Client\Model\InvoiceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1946,15 +2138,16 @@ public function invoiceGetBusinessInvoicesWithHttpInfo($business_id, $options_fr * Get Business Invoices * * @param int $business_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBusinessInvoicesAsync($business_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBusinessInvoicesAsync($business_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBusinessInvoices'][0]) { - return $this->invoiceGetBusinessInvoicesAsyncWithHttpInfo($business_id, $options_from_date, $options_to_date) + return $this->invoiceGetBusinessInvoicesAsyncWithHttpInfo($business_id, $options_from_date, $options_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -1968,26 +2161,26 @@ function ($response) { * Get Business Invoices * * @param int $business_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetBusinessInvoicesAsyncWithHttpInfo($business_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBusinessInvoicesAsyncWithHttpInfo($business_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBusinessInvoices'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel[]'; - $request = $this->invoiceGetBusinessInvoicesRequest($business_id, $options_from_date, $options_to_date); + $returnType = '\OpenAPI\Client\Model\InvoiceModel[]'; + $request = $this->invoiceGetBusinessInvoicesRequest($business_id, $options_from_date, $options_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2010,7 +2203,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2020,14 +2213,16 @@ function ($exception) { * Create request for operation 'invoiceGetBusinessInvoices' * * @param int $business_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetBusinessInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetBusinessInvoicesRequest($business_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetBusinessInvoicesRequest($business_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetBusinessInvoices'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2035,6 +2230,9 @@ protected function invoiceGetBusinessInvoicesRequest($business_id, $options_from ); } + + + $resourcePath = '/api/v2/business/{businessId}/Invoice'; $formParams = []; $queryParams = []; @@ -2043,13 +2241,24 @@ protected function invoiceGetBusinessInvoicesRequest($business_id, $options_from $multipart = false; // query params - if ($options_from_date !== null) { - $queryParams['options.fromDate'] = ObjectSerializer::toQueryValue($options_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $options_from_date, + 'options.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($options_to_date !== null) { - $queryParams['options.toDate'] = ObjectSerializer::toQueryValue($options_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $options_to_date, + 'options.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -2060,53 +2269,35 @@ protected function invoiceGetBusinessInvoicesRequest($business_id, $options_from ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2127,10 +2318,11 @@ protected function invoiceGetBusinessInvoicesRequest($business_id, $options_from $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2143,14 +2335,15 @@ protected function invoiceGetBusinessInvoicesRequest($business_id, $options_from * * @param int $id id (required) * @param int $reseller_id reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\InvoiceModel + * @return \OpenAPI\Client\Model\InvoiceModel */ - public function invoiceGetResellerInvoiceById($id, $reseller_id) + public function invoiceGetResellerInvoiceById($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceById'][0]) { - list($response) = $this->invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id); + list($response) = $this->invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id, $contentType); return $response; } @@ -2161,15 +2354,15 @@ public function invoiceGetResellerInvoiceById($id, $reseller_id) * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\InvoiceModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\InvoiceModel, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id) + public function invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceById'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel'; - $request = $this->invoiceGetResellerInvoiceByIdRequest($id, $reseller_id); + $request = $this->invoiceGetResellerInvoiceByIdRequest($id, $reseller_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2178,9 +2371,16 @@ public function invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2191,19 +2391,37 @@ public function invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\InvoiceModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InvoiceModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InvoiceModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InvoiceModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2220,7 +2438,7 @@ public function invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\InvoiceModel', + '\OpenAPI\Client\Model\InvoiceModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2237,13 +2455,14 @@ public function invoiceGetResellerInvoiceByIdWithHttpInfo($id, $reseller_id) * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoiceByIdAsync($id, $reseller_id) + public function invoiceGetResellerInvoiceByIdAsync($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceById'][0]) { - return $this->invoiceGetResellerInvoiceByIdAsyncWithHttpInfo($id, $reseller_id) + return $this->invoiceGetResellerInvoiceByIdAsyncWithHttpInfo($id, $reseller_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2258,24 +2477,24 @@ function ($response) { * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoiceByIdAsyncWithHttpInfo($id, $reseller_id) + public function invoiceGetResellerInvoiceByIdAsyncWithHttpInfo($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceById'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel'; - $request = $this->invoiceGetResellerInvoiceByIdRequest($id, $reseller_id); + $returnType = '\OpenAPI\Client\Model\InvoiceModel'; + $request = $this->invoiceGetResellerInvoiceByIdRequest($id, $reseller_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2298,7 +2517,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2309,18 +2528,21 @@ function ($exception) { * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id) + public function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceById'][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 invoiceGetResellerInvoiceById' ); } + // verify the required parameter 'reseller_id' is set if ($reseller_id === null || (is_array($reseller_id) && count($reseller_id) === 0)) { throw new \InvalidArgumentException( @@ -2328,6 +2550,7 @@ protected function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id) ); } + $resourcePath = '/api/v2/reseller/{resellerId}/Invoice/{id}'; $formParams = []; $queryParams = []; @@ -2336,6 +2559,7 @@ protected function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2353,53 +2577,35 @@ protected function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2420,10 +2626,11 @@ protected function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2436,14 +2643,15 @@ protected function invoiceGetResellerInvoiceByIdRequest($id, $reseller_id) * * @param int $id id (required) * @param int $reseller_id reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceExcelById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function invoiceGetResellerInvoiceExcelById($id, $reseller_id) + public function invoiceGetResellerInvoiceExcelById($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceExcelById'][0]) { - list($response) = $this->invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id); + list($response) = $this->invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id, $contentType); return $response; } @@ -2454,15 +2662,15 @@ public function invoiceGetResellerInvoiceExcelById($id, $reseller_id) * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceExcelById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id) + public function invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceExcelById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id); + $request = $this->invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2471,9 +2679,16 @@ public function invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2484,19 +2699,37 @@ public function invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2513,7 +2746,7 @@ public function invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2530,13 +2763,14 @@ public function invoiceGetResellerInvoiceExcelByIdWithHttpInfo($id, $reseller_id * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceExcelById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoiceExcelByIdAsync($id, $reseller_id) + public function invoiceGetResellerInvoiceExcelByIdAsync($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceExcelById'][0]) { - return $this->invoiceGetResellerInvoiceExcelByIdAsyncWithHttpInfo($id, $reseller_id) + return $this->invoiceGetResellerInvoiceExcelByIdAsyncWithHttpInfo($id, $reseller_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2551,24 +2785,24 @@ function ($response) { * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceExcelById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoiceExcelByIdAsyncWithHttpInfo($id, $reseller_id) + public function invoiceGetResellerInvoiceExcelByIdAsyncWithHttpInfo($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceExcelById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2591,7 +2825,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2602,18 +2836,21 @@ function ($exception) { * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoiceExcelById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id) + public function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoiceExcelById'][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 invoiceGetResellerInvoiceExcelById' ); } + // verify the required parameter 'reseller_id' is set if ($reseller_id === null || (is_array($reseller_id) && count($reseller_id) === 0)) { throw new \InvalidArgumentException( @@ -2621,6 +2858,7 @@ protected function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id) ); } + $resourcePath = '/api/v2/reseller/{resellerId}/Invoice/{id}/excel'; $formParams = []; $queryParams = []; @@ -2629,6 +2867,7 @@ protected function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2646,53 +2885,35 @@ protected function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2713,10 +2934,11 @@ protected function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2729,14 +2951,15 @@ protected function invoiceGetResellerInvoiceExcelByIdRequest($id, $reseller_id) * * @param int $id id (required) * @param int $reseller_id reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoicePdfById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function invoiceGetResellerInvoicePdfById($id, $reseller_id) + public function invoiceGetResellerInvoicePdfById($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoicePdfById'][0]) { - list($response) = $this->invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id); + list($response) = $this->invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id, $contentType); return $response; } @@ -2747,15 +2970,15 @@ public function invoiceGetResellerInvoicePdfById($id, $reseller_id) * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoicePdfById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id) + public function invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoicePdfById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id); + $request = $this->invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2764,9 +2987,16 @@ public function invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2777,19 +3007,37 @@ public function invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2806,7 +3054,7 @@ public function invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2823,13 +3071,14 @@ public function invoiceGetResellerInvoicePdfByIdWithHttpInfo($id, $reseller_id) * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoicePdfByIdAsync($id, $reseller_id) + public function invoiceGetResellerInvoicePdfByIdAsync($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoicePdfById'][0]) { - return $this->invoiceGetResellerInvoicePdfByIdAsyncWithHttpInfo($id, $reseller_id) + return $this->invoiceGetResellerInvoicePdfByIdAsyncWithHttpInfo($id, $reseller_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2844,24 +3093,24 @@ function ($response) { * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoicePdfByIdAsyncWithHttpInfo($id, $reseller_id) + public function invoiceGetResellerInvoicePdfByIdAsyncWithHttpInfo($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoicePdfById'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2884,7 +3133,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2895,18 +3144,21 @@ function ($exception) { * * @param int $id (required) * @param int $reseller_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoicePdfById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id) + public function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id, string $contentType = self::contentTypes['invoiceGetResellerInvoicePdfById'][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 invoiceGetResellerInvoicePdfById' ); } + // verify the required parameter 'reseller_id' is set if ($reseller_id === null || (is_array($reseller_id) && count($reseller_id) === 0)) { throw new \InvalidArgumentException( @@ -2914,6 +3166,7 @@ protected function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id) ); } + $resourcePath = '/api/v2/reseller/{resellerId}/Invoice/{id}/pdf'; $formParams = []; $queryParams = []; @@ -2922,6 +3175,7 @@ protected function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2939,53 +3193,35 @@ protected function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3006,10 +3242,11 @@ protected function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3021,16 +3258,17 @@ protected function invoiceGetResellerInvoicePdfByIdRequest($id, $reseller_id) * Get Reseller Invoices * * @param int $reseller_id reseller_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date options_from_date (optional) + * @param \DateTime $options_to_date options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\InvoiceModel[] + * @return \OpenAPI\Client\Model\InvoiceModel[] */ - public function invoiceGetResellerInvoices($reseller_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetResellerInvoices($reseller_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetResellerInvoices'][0]) { - list($response) = $this->invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_from_date, $options_to_date); + list($response) = $this->invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_from_date, $options_to_date, $contentType); return $response; } @@ -3040,17 +3278,17 @@ public function invoiceGetResellerInvoices($reseller_id, $options_from_date = nu * Get Reseller Invoices * * @param int $reseller_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoices'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\InvoiceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\InvoiceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetResellerInvoices'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel[]'; - $request = $this->invoiceGetResellerInvoicesRequest($reseller_id, $options_from_date, $options_to_date); + $request = $this->invoiceGetResellerInvoicesRequest($reseller_id, $options_from_date, $options_to_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -3059,9 +3297,16 @@ public function invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_fr } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3072,19 +3317,37 @@ public function invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_fr sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\InvoiceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\InvoiceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InvoiceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\InvoiceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3101,7 +3364,7 @@ public function invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_fr case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\InvoiceModel[]', + '\OpenAPI\Client\Model\InvoiceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3117,15 +3380,16 @@ public function invoiceGetResellerInvoicesWithHttpInfo($reseller_id, $options_fr * Get Reseller Invoices * * @param int $reseller_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoicesAsync($reseller_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetResellerInvoicesAsync($reseller_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetResellerInvoices'][0]) { - return $this->invoiceGetResellerInvoicesAsyncWithHttpInfo($reseller_id, $options_from_date, $options_to_date) + return $this->invoiceGetResellerInvoicesAsyncWithHttpInfo($reseller_id, $options_from_date, $options_to_date, $contentType) ->then( function ($response) { return $response[0]; @@ -3139,26 +3403,26 @@ function ($response) { * Get Reseller Invoices * * @param int $reseller_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function invoiceGetResellerInvoicesAsyncWithHttpInfo($reseller_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetResellerInvoicesAsyncWithHttpInfo($reseller_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetResellerInvoices'][0]) { - $returnType = '\Swagger\Client\Model\InvoiceModel[]'; - $request = $this->invoiceGetResellerInvoicesRequest($reseller_id, $options_from_date, $options_to_date); + $returnType = '\OpenAPI\Client\Model\InvoiceModel[]'; + $request = $this->invoiceGetResellerInvoicesRequest($reseller_id, $options_from_date, $options_to_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3181,7 +3445,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3191,14 +3455,16 @@ function ($exception) { * Create request for operation 'invoiceGetResellerInvoices' * * @param int $reseller_id (required) - * @param \DateTime $options_from_date (optional) - * @param \DateTime $options_to_date (optional) + * @param \DateTime $options_from_date (optional) + * @param \DateTime $options_to_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['invoiceGetResellerInvoices'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function invoiceGetResellerInvoicesRequest($reseller_id, $options_from_date = null, $options_to_date = null) + public function invoiceGetResellerInvoicesRequest($reseller_id, $options_from_date = null, $options_to_date = null, string $contentType = self::contentTypes['invoiceGetResellerInvoices'][0]) { + // verify the required parameter 'reseller_id' is set if ($reseller_id === null || (is_array($reseller_id) && count($reseller_id) === 0)) { throw new \InvalidArgumentException( @@ -3206,6 +3472,9 @@ protected function invoiceGetResellerInvoicesRequest($reseller_id, $options_from ); } + + + $resourcePath = '/api/v2/reseller/{resellerId}/Invoice'; $formParams = []; $queryParams = []; @@ -3214,13 +3483,24 @@ protected function invoiceGetResellerInvoicesRequest($reseller_id, $options_from $multipart = false; // query params - if ($options_from_date !== null) { - $queryParams['options.fromDate'] = ObjectSerializer::toQueryValue($options_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $options_from_date, + 'options.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($options_to_date !== null) { - $queryParams['options.toDate'] = ObjectSerializer::toQueryValue($options_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $options_to_date, + 'options.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($reseller_id !== null) { @@ -3231,53 +3511,35 @@ protected function invoiceGetResellerInvoicesRequest($reseller_id, $options_from ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3298,10 +3560,11 @@ protected function invoiceGetResellerInvoicesRequest($reseller_id, $options_from $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/LeaveAllowanceApi.php b/src/lib/Api/LeaveAllowanceApi.php index 6f0ce8a..8239565 100644 --- a/src/lib/Api/LeaveAllowanceApi.php +++ b/src/lib/Api/LeaveAllowanceApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auEmployeeLeaveAllowanceTemplateGet' => [ + 'application/json', + ], + 'auLeaveAllowanceTemplateDelete' => [ + 'application/json', + ], + 'auLeaveAllowanceTemplateGet' => [ + 'application/json', + ], + 'auLeaveAllowanceTemplateGetLeaveAllowanceTemplates' => [ + 'application/json', + ], + 'auLeaveAllowanceTemplatePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auLeaveAllowanceTemplatePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate' => [ + 'application/json', + ], + 'auLeaveAllowancesGet' => [ + 'application/json', + ], + 'auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId' => [ + 'application/json', + ], + 'auLeaveAllowancesPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +172,15 @@ public function getConfig() * @param int $leave_allowance_template_id leave_allowance_template_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate($leave_allowance_template_id, $business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate($leave_allowance_template_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'][0]) { - $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id); + $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id, $contentType); } /** @@ -113,15 +191,15 @@ public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate($le * @param int $leave_allowance_template_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'][0]) { - $returnType = ''; - $request = $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateRequest($leave_allowance_template_id, $business_id, $employee_id); + $request = $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateRequest($leave_allowance_template_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -130,9 +208,16 @@ public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWith } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -143,11 +228,11 @@ public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWith sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -168,13 +253,14 @@ public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateWith * @param int $leave_allowance_template_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateAsync($leave_allowance_template_id, $business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateAsync($leave_allowance_template_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'][0]) { - return $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateAsyncWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id) + return $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateAsyncWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -190,14 +276,15 @@ function ($response) { * @param int $leave_allowance_template_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateAsyncWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateAsyncWithHttpInfo($leave_allowance_template_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'][0]) { $returnType = ''; - $request = $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateRequest($leave_allowance_template_id, $business_id, $employee_id); + $request = $this->auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateRequest($leave_allowance_template_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -216,7 +303,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -228,24 +315,28 @@ function ($exception) { * @param int $leave_allowance_template_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateRequest($leave_allowance_template_id, $business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateRequest($leave_allowance_template_id, $business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate'][0]) { + // verify the required parameter 'leave_allowance_template_id' is set if ($leave_allowance_template_id === null || (is_array($leave_allowance_template_id) && count($leave_allowance_template_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_allowance_template_id when calling auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplate' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -253,6 +344,7 @@ protected function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateR ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaveallowancetemplate/assign/{leaveAllowanceTemplateId}'; $formParams = []; $queryParams = []; @@ -261,6 +353,7 @@ protected function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateR $multipart = false; + // path params if ($leave_allowance_template_id !== null) { $resourcePath = str_replace( @@ -286,53 +379,35 @@ protected function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateR ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -353,10 +428,11 @@ protected function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateR $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -369,14 +445,15 @@ protected function auEmployeeLeaveAllowanceTemplateAssignLeaveAllowanceTemplateR * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceTemplateModel + * @return \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel */ - public function auEmployeeLeaveAllowanceTemplateGet($business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateGet($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'][0]) { - list($response) = $this->auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $employee_id); + list($response) = $this->auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -387,15 +464,15 @@ public function auEmployeeLeaveAllowanceTemplateGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $employee_id); + $request = $this->auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -404,9 +481,16 @@ public function auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -417,19 +501,37 @@ public function auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -446,7 +548,7 @@ public function auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $e case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel', + '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -463,13 +565,14 @@ public function auEmployeeLeaveAllowanceTemplateGetWithHttpInfo($business_id, $e * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowanceTemplateGetAsync($business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'][0]) { - return $this->auEmployeeLeaveAllowanceTemplateGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->auEmployeeLeaveAllowanceTemplateGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -484,24 +587,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auEmployeeLeaveAllowanceTemplateGetAsyncWithHttpInfo($business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; + $request = $this->auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -524,7 +627,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -535,18 +638,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $employee_id) + public function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['auEmployeeLeaveAllowanceTemplateGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auEmployeeLeaveAllowanceTemplateGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -554,6 +660,7 @@ protected function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $emp ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaveallowancetemplate'; $formParams = []; $queryParams = []; @@ -562,6 +669,7 @@ protected function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $emp $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -579,53 +687,35 @@ protected function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $emp ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -646,10 +736,11 @@ protected function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $emp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -662,14 +753,15 @@ protected function auEmployeeLeaveAllowanceTemplateGetRequest($business_id, $emp * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auLeaveAllowanceTemplateDelete($id, $business_id) + public function auLeaveAllowanceTemplateDelete($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateDelete'][0]) { - $this->auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id); + $this->auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -679,15 +771,15 @@ public function auLeaveAllowanceTemplateDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id) + public function auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateDelete'][0]) { - $returnType = ''; - $request = $this->auLeaveAllowanceTemplateDeleteRequest($id, $business_id); + $request = $this->auLeaveAllowanceTemplateDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -696,9 +788,16 @@ public function auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -709,11 +808,11 @@ public function auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -733,13 +832,14 @@ public function auLeaveAllowanceTemplateDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateDeleteAsync($id, $business_id) + public function auLeaveAllowanceTemplateDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateDelete'][0]) { - return $this->auLeaveAllowanceTemplateDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auLeaveAllowanceTemplateDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -754,14 +854,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateDeleteAsyncWithHttpInfo($id, $business_id) + public function auLeaveAllowanceTemplateDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateDelete'][0]) { $returnType = ''; - $request = $this->auLeaveAllowanceTemplateDeleteRequest($id, $business_id); + $request = $this->auLeaveAllowanceTemplateDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -780,7 +881,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -791,18 +892,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowanceTemplateDeleteRequest($id, $business_id) + public function auLeaveAllowanceTemplateDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateDelete'][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 auLeaveAllowanceTemplateDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -810,6 +914,7 @@ protected function auLeaveAllowanceTemplateDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/leaveallowancetemplate/{id}'; $formParams = []; $queryParams = []; @@ -818,6 +923,7 @@ protected function auLeaveAllowanceTemplateDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -835,53 +941,35 @@ protected function auLeaveAllowanceTemplateDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -902,10 +990,11 @@ protected function auLeaveAllowanceTemplateDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -918,14 +1007,15 @@ protected function auLeaveAllowanceTemplateDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceTemplateModel + * @return \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel */ - public function auLeaveAllowanceTemplateGet($id, $business_id) + public function auLeaveAllowanceTemplateGet($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGet'][0]) { - list($response) = $this->auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id); + list($response) = $this->auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -936,15 +1026,15 @@ public function auLeaveAllowanceTemplateGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id) + public function auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auLeaveAllowanceTemplateGetRequest($id, $business_id); + $request = $this->auLeaveAllowanceTemplateGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -953,9 +1043,16 @@ public function auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -966,19 +1063,37 @@ public function auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -995,7 +1110,7 @@ public function auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel', + '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1012,13 +1127,14 @@ public function auLeaveAllowanceTemplateGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateGetAsync($id, $business_id) + public function auLeaveAllowanceTemplateGetAsync($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGet'][0]) { - return $this->auLeaveAllowanceTemplateGetAsyncWithHttpInfo($id, $business_id) + return $this->auLeaveAllowanceTemplateGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1033,24 +1149,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateGetAsyncWithHttpInfo($id, $business_id) + public function auLeaveAllowanceTemplateGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auLeaveAllowanceTemplateGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; + $request = $this->auLeaveAllowanceTemplateGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1073,7 +1189,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1084,18 +1200,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowanceTemplateGetRequest($id, $business_id) + public function auLeaveAllowanceTemplateGetRequest($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGet'][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 auLeaveAllowanceTemplateGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1103,6 +1222,7 @@ protected function auLeaveAllowanceTemplateGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/leaveallowancetemplate/{id}'; $formParams = []; $queryParams = []; @@ -1111,6 +1231,7 @@ protected function auLeaveAllowanceTemplateGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1128,53 +1249,35 @@ protected function auLeaveAllowanceTemplateGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1195,10 +1298,11 @@ protected function auLeaveAllowanceTemplateGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1210,18 +1314,20 @@ protected function auLeaveAllowanceTemplateGetRequest($id, $business_id) * List Leave Allowance Templates * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceTemplateModel[] + * @return \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[] */ - public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplates($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplates($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'][0]) { - list($response) = $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -1231,19 +1337,20 @@ public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplates($business_id, * List Leave Allowance Templates * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceTemplateModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel[]'; - $request = $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -1252,9 +1359,16 @@ public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1265,19 +1379,37 @@ public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1294,7 +1426,7 @@ public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel[]', + '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1310,17 +1442,19 @@ public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesWithHttpInfo($ * List Leave Allowance Templates * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'][0]) { - return $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -1334,28 +1468,29 @@ function ($response) { * List Leave Allowance Templates * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel[]'; - $request = $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel[]'; + $request = $this->auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1378,7 +1513,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1388,16 +1523,19 @@ function ($exception) { * Create request for operation 'auLeaveAllowanceTemplateGetLeaveAllowanceTemplates' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveAllowanceTemplateGetLeaveAllowanceTemplates'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1405,6 +1543,12 @@ protected function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($bu ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/leaveallowancetemplate'; $formParams = []; $queryParams = []; @@ -1413,20 +1557,45 @@ protected function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($bu $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -1438,53 +1607,35 @@ protected function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($bu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1505,10 +1656,11 @@ protected function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($bu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1519,16 +1671,17 @@ protected function auLeaveAllowanceTemplateGetLeaveAllowanceTemplatesRequest($bu * * Create Leave Allowance Template * - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template leave_allowance_template (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceTemplateModel + * @return \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel */ - public function auLeaveAllowanceTemplatePost($leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePost($business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePost'][0]) { - list($response) = $this->auLeaveAllowanceTemplatePostWithHttpInfo($leave_allowance_template, $business_id); + list($response) = $this->auLeaveAllowanceTemplatePostWithHttpInfo($business_id, $leave_allowance_template, $contentType); return $response; } @@ -1537,17 +1690,17 @@ public function auLeaveAllowanceTemplatePost($leave_allowance_template, $busines * * Create Leave Allowance Template * - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowanceTemplatePostWithHttpInfo($leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePostWithHttpInfo($business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePost'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auLeaveAllowanceTemplatePostRequest($leave_allowance_template, $business_id); + $request = $this->auLeaveAllowanceTemplatePostRequest($business_id, $leave_allowance_template, $contentType); try { $options = $this->createHttpClientOption(); @@ -1556,9 +1709,16 @@ public function auLeaveAllowanceTemplatePostWithHttpInfo($leave_allowance_templa } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1569,19 +1729,37 @@ public function auLeaveAllowanceTemplatePostWithHttpInfo($leave_allowance_templa sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1598,7 +1776,7 @@ public function auLeaveAllowanceTemplatePostWithHttpInfo($leave_allowance_templa case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel', + '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1613,15 +1791,16 @@ public function auLeaveAllowanceTemplatePostWithHttpInfo($leave_allowance_templa * * Create Leave Allowance Template * - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplatePostAsync($leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePostAsync($business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePost'][0]) { - return $this->auLeaveAllowanceTemplatePostAsyncWithHttpInfo($leave_allowance_template, $business_id) + return $this->auLeaveAllowanceTemplatePostAsyncWithHttpInfo($business_id, $leave_allowance_template, $contentType) ->then( function ($response) { return $response[0]; @@ -1634,26 +1813,26 @@ function ($response) { * * Create Leave Allowance Template * - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplatePostAsyncWithHttpInfo($leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePostAsyncWithHttpInfo($business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePost'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auLeaveAllowanceTemplatePostRequest($leave_allowance_template, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; + $request = $this->auLeaveAllowanceTemplatePostRequest($business_id, $leave_allowance_template, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1676,7 +1855,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1685,20 +1864,16 @@ function ($exception) { /** * Create request for operation 'auLeaveAllowanceTemplatePost' * - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowanceTemplatePostRequest($leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePostRequest($business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePost'][0]) { - // verify the required parameter 'leave_allowance_template' is set - if ($leave_allowance_template === null || (is_array($leave_allowance_template) && count($leave_allowance_template) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_allowance_template when calling auLeaveAllowanceTemplatePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1706,6 +1881,14 @@ protected function auLeaveAllowanceTemplatePostRequest($leave_allowance_template ); } + // verify the required parameter 'leave_allowance_template' is set + if ($leave_allowance_template === null || (is_array($leave_allowance_template) && count($leave_allowance_template) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_allowance_template when calling auLeaveAllowanceTemplatePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/leaveallowancetemplate'; $formParams = []; $queryParams = []; @@ -1714,6 +1897,7 @@ protected function auLeaveAllowanceTemplatePostRequest($leave_allowance_template $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1723,56 +1907,42 @@ protected function auLeaveAllowanceTemplatePostRequest($leave_allowance_template ); } - // body params - $_tempBody = null; - if (isset($leave_allowance_template)) { - $_tempBody = $leave_allowance_template; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_allowance_template)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_allowance_template)); + } else { + $httpBody = $leave_allowance_template; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1793,10 +1963,11 @@ protected function auLeaveAllowanceTemplatePostRequest($leave_allowance_template $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1808,16 +1979,17 @@ protected function auLeaveAllowanceTemplatePostRequest($leave_allowance_template * Update Leave Allowance Template * * @param int $id id (required) - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template leave_allowance_template (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceTemplateModel + * @return \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel */ - public function auLeaveAllowanceTemplatePut($id, $leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePut($id, $business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePut'][0]) { - list($response) = $this->auLeaveAllowanceTemplatePutWithHttpInfo($id, $leave_allowance_template, $business_id); + list($response) = $this->auLeaveAllowanceTemplatePutWithHttpInfo($id, $business_id, $leave_allowance_template, $contentType); return $response; } @@ -1827,17 +1999,17 @@ public function auLeaveAllowanceTemplatePut($id, $leave_allowance_template, $bus * Update Leave Allowance Template * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowanceTemplatePutWithHttpInfo($id, $leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePutWithHttpInfo($id, $business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePut'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_template, $business_id); + $request = $this->auLeaveAllowanceTemplatePutRequest($id, $business_id, $leave_allowance_template, $contentType); try { $options = $this->createHttpClientOption(); @@ -1846,9 +2018,16 @@ public function auLeaveAllowanceTemplatePutWithHttpInfo($id, $leave_allowance_te } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1859,19 +2038,37 @@ public function auLeaveAllowanceTemplatePutWithHttpInfo($id, $leave_allowance_te sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1888,7 +2085,7 @@ public function auLeaveAllowanceTemplatePutWithHttpInfo($id, $leave_allowance_te case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel', + '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1904,15 +2101,16 @@ public function auLeaveAllowanceTemplatePutWithHttpInfo($id, $leave_allowance_te * Update Leave Allowance Template * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplatePutAsync($id, $leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePutAsync($id, $business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePut'][0]) { - return $this->auLeaveAllowanceTemplatePutAsyncWithHttpInfo($id, $leave_allowance_template, $business_id) + return $this->auLeaveAllowanceTemplatePutAsyncWithHttpInfo($id, $business_id, $leave_allowance_template, $contentType) ->then( function ($response) { return $response[0]; @@ -1926,26 +2124,26 @@ function ($response) { * Update Leave Allowance Template * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplatePutAsyncWithHttpInfo($id, $leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePutAsyncWithHttpInfo($id, $business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePut'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceTemplateModel'; - $request = $this->auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_template, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel'; + $request = $this->auLeaveAllowanceTemplatePutRequest($id, $business_id, $leave_allowance_template, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1968,7 +2166,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1978,26 +2176,23 @@ function ($exception) { * Create request for operation 'auLeaveAllowanceTemplatePut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateModel $leave_allowance_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplatePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_template, $business_id) + public function auLeaveAllowanceTemplatePutRequest($id, $business_id, $leave_allowance_template, string $contentType = self::contentTypes['auLeaveAllowanceTemplatePut'][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 auLeaveAllowanceTemplatePut' ); } - // verify the required parameter 'leave_allowance_template' is set - if ($leave_allowance_template === null || (is_array($leave_allowance_template) && count($leave_allowance_template) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_allowance_template when calling auLeaveAllowanceTemplatePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2005,6 +2200,14 @@ protected function auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_temp ); } + // verify the required parameter 'leave_allowance_template' is set + if ($leave_allowance_template === null || (is_array($leave_allowance_template) && count($leave_allowance_template) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_allowance_template when calling auLeaveAllowanceTemplatePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/leaveallowancetemplate/{id}'; $formParams = []; $queryParams = []; @@ -2013,6 +2216,7 @@ protected function auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_temp $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2030,56 +2234,42 @@ protected function auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_temp ); } - // body params - $_tempBody = null; - if (isset($leave_allowance_template)) { - $_tempBody = $leave_allowance_template; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_allowance_template)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_allowance_template)); + } else { + $httpBody = $leave_allowance_template; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2100,10 +2290,11 @@ protected function auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_temp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2116,14 +2307,15 @@ protected function auLeaveAllowanceTemplatePutRequest($id, $leave_allowance_temp * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate($id, $business_id) + public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'][0]) { - $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInfo($id, $business_id); + $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInfo($id, $business_id, $contentType); } /** @@ -2133,15 +2325,15 @@ public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate($id, $busi * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInfo($id, $business_id) + public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'][0]) { - $returnType = ''; - $request = $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest($id, $business_id); + $request = $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2150,9 +2342,16 @@ public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInf } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2163,11 +2362,11 @@ public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInf sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2187,13 +2386,14 @@ public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateWithHttpInf * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateAsync($id, $business_id) + public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateAsync($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'][0]) { - return $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateAsyncWithHttpInfo($id, $business_id) + return $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2208,14 +2408,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateAsyncWithHttpInfo($id, $business_id) + public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'][0]) { $returnType = ''; - $request = $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest($id, $business_id); + $request = $this->auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2234,7 +2435,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2245,18 +2446,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest($id, $business_id) + public function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest($id, $business_id, string $contentType = self::contentTypes['auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate'][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 auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2264,6 +2468,7 @@ protected function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest( ); } + $resourcePath = '/api/v2/business/{businessId}/leaveallowancetemplate/reapply/{id}'; $formParams = []; $queryParams = []; @@ -2272,6 +2477,7 @@ protected function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest( $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -2289,53 +2495,35 @@ protected function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest( ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2356,10 +2544,11 @@ protected function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest( $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2371,14 +2560,15 @@ protected function auLeaveAllowanceTemplateReapplyLeaveAllowanceTemplateRequest( * Get Leave Allowances for All Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]] + * @return array */ - public function auLeaveAllowancesGet($business_id) + public function auLeaveAllowancesGet($business_id, string $contentType = self::contentTypes['auLeaveAllowancesGet'][0]) { - list($response) = $this->auLeaveAllowancesGetWithHttpInfo($business_id); + list($response) = $this->auLeaveAllowancesGetWithHttpInfo($business_id, $contentType); return $response; } @@ -2388,15 +2578,15 @@ public function auLeaveAllowancesGet($business_id) * Get Leave Allowances for All Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]], HTTP status code, HTTP response headers (array of strings) + * @return array of array, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowancesGetWithHttpInfo($business_id) + public function auLeaveAllowancesGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auLeaveAllowancesGet'][0]) { - $returnType = 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]'; - $request = $this->auLeaveAllowancesGetRequest($business_id); + $request = $this->auLeaveAllowancesGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2405,9 +2595,16 @@ public function auLeaveAllowancesGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2418,19 +2615,37 @@ public function auLeaveAllowancesGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('array' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('array' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'array', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'array'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2447,7 +2662,7 @@ public function auLeaveAllowancesGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]', + 'array', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2463,13 +2678,14 @@ public function auLeaveAllowancesGetWithHttpInfo($business_id) * Get Leave Allowances for All Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowancesGetAsync($business_id) + public function auLeaveAllowancesGetAsync($business_id, string $contentType = self::contentTypes['auLeaveAllowancesGet'][0]) { - return $this->auLeaveAllowancesGetAsyncWithHttpInfo($business_id) + return $this->auLeaveAllowancesGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2483,24 +2699,24 @@ function ($response) { * Get Leave Allowances for All Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowancesGetAsyncWithHttpInfo($business_id) + public function auLeaveAllowancesGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auLeaveAllowancesGet'][0]) { - $returnType = 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]'; - $request = $this->auLeaveAllowancesGetRequest($business_id); + $returnType = 'array'; + $request = $this->auLeaveAllowancesGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2523,7 +2739,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2533,12 +2749,14 @@ function ($exception) { * Create request for operation 'auLeaveAllowancesGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowancesGetRequest($business_id) + public function auLeaveAllowancesGetRequest($business_id, string $contentType = self::contentTypes['auLeaveAllowancesGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2546,6 +2764,7 @@ protected function auLeaveAllowancesGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/leaveallowances'; $formParams = []; $queryParams = []; @@ -2554,6 +2773,7 @@ protected function auLeaveAllowancesGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2563,53 +2783,35 @@ protected function auLeaveAllowancesGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2630,10 +2832,11 @@ protected function auLeaveAllowancesGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2646,14 +2849,15 @@ protected function auLeaveAllowancesGetRequest($business_id) * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]] + * @return array */ - public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId($employee_id, $business_id) + public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId($employee_id, $business_id, string $contentType = self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'][0]) { - list($response) = $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdWithHttpInfo($employee_id, $business_id); + list($response) = $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdWithHttpInfo($employee_id, $business_id, $contentType); return $response; } @@ -2664,15 +2868,15 @@ public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEm * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]], HTTP status code, HTTP response headers (array of strings) + * @return array of array, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdWithHttpInfo($employee_id, $business_id) + public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'][0]) { - $returnType = 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]'; - $request = $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdRequest($employee_id, $business_id); + $request = $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2681,9 +2885,16 @@ public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEm } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2694,19 +2905,37 @@ public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEm sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('array' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('array' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'array', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'array'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2723,7 +2952,7 @@ public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEm case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]', + 'array', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2740,13 +2969,14 @@ public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEm * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdAsync($employee_id, $business_id) + public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdAsync($employee_id, $business_id, string $contentType = self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'][0]) { - return $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdAsyncWithHttpInfo($employee_id, $business_id) + return $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2761,24 +2991,24 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdAsyncWithHttpInfo($employee_id, $business_id) + public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'][0]) { - $returnType = 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]'; - $request = $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdRequest($employee_id, $business_id); + $returnType = 'array'; + $request = $this->auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2801,7 +3031,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2812,18 +3042,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdRequest($employee_id, $business_id) + public function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeIdRequest($employee_id, $business_id, string $contentType = self::contentTypes['auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2831,6 +3064,7 @@ protected function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesB ); } + $resourcePath = '/api/v2/business/{businessId}/leaveallowances/{employeeId}'; $formParams = []; $queryParams = []; @@ -2839,6 +3073,7 @@ protected function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesB $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -2856,53 +3091,35 @@ protected function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesB ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2923,10 +3140,11 @@ protected function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesB $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2937,16 +3155,17 @@ protected function auLeaveAllowancesGetApiV2BusinessByBusinessIdLeaveallowancesB * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowancesRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowancesRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveAllowanceModel + * @return \OpenAPI\Client\Model\AuLeaveAllowanceModel */ - public function auLeaveAllowancesPut($request, $business_id) + public function auLeaveAllowancesPut($business_id, $request, string $contentType = self::contentTypes['auLeaveAllowancesPut'][0]) { - list($response) = $this->auLeaveAllowancesPutWithHttpInfo($request, $business_id); + list($response) = $this->auLeaveAllowancesPutWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -2955,17 +3174,17 @@ public function auLeaveAllowancesPut($request, $business_id) * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowancesRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowancesRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveAllowanceModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveAllowanceModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveAllowancesPutWithHttpInfo($request, $business_id) + public function auLeaveAllowancesPutWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auLeaveAllowancesPut'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceModel'; - $request = $this->auLeaveAllowancesPutRequest($request, $business_id); + $request = $this->auLeaveAllowancesPutRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2974,9 +3193,16 @@ public function auLeaveAllowancesPutWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2987,19 +3213,37 @@ public function auLeaveAllowancesPutWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveAllowanceModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveAllowanceModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveAllowanceModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3016,7 +3260,7 @@ public function auLeaveAllowancesPutWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveAllowanceModel', + '\OpenAPI\Client\Model\AuLeaveAllowanceModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3031,15 +3275,16 @@ public function auLeaveAllowancesPutWithHttpInfo($request, $business_id) * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowancesRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowancesRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowancesPutAsync($request, $business_id) + public function auLeaveAllowancesPutAsync($business_id, $request, string $contentType = self::contentTypes['auLeaveAllowancesPut'][0]) { - return $this->auLeaveAllowancesPutAsyncWithHttpInfo($request, $business_id) + return $this->auLeaveAllowancesPutAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -3052,26 +3297,26 @@ function ($response) { * * Set Leave Allowances * - * @param \Swagger\Client\Model\AuLeaveAllowancesRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowancesRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveAllowancesPutAsyncWithHttpInfo($request, $business_id) + public function auLeaveAllowancesPutAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auLeaveAllowancesPut'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveAllowanceModel'; - $request = $this->auLeaveAllowancesPutRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveAllowanceModel'; + $request = $this->auLeaveAllowancesPutRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3094,7 +3339,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3103,20 +3348,16 @@ function ($exception) { /** * Create request for operation 'auLeaveAllowancesPut' * - * @param \Swagger\Client\Model\AuLeaveAllowancesRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveAllowancesRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveAllowancesPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveAllowancesPutRequest($request, $business_id) + public function auLeaveAllowancesPutRequest($business_id, $request, string $contentType = self::contentTypes['auLeaveAllowancesPut'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auLeaveAllowancesPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3124,6 +3365,14 @@ protected function auLeaveAllowancesPutRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auLeaveAllowancesPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/leaveallowances'; $formParams = []; $queryParams = []; @@ -3132,6 +3381,7 @@ protected function auLeaveAllowancesPutRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3141,56 +3391,42 @@ protected function auLeaveAllowancesPutRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3211,10 +3447,11 @@ protected function auLeaveAllowancesPutRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/LeaveCategoriesApi.php b/src/lib/Api/LeaveCategoriesApi.php index 52477ac..d0a580a 100644 --- a/src/lib/Api/LeaveCategoriesApi.php +++ b/src/lib/Api/LeaveCategoriesApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auLeaveCategoryGet' => [ + 'application/json', + ], + 'auLeaveCategoryGetLeaveCategories' => [ + 'application/json', + ], + 'auLeaveCategoryPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auLeaveCategoryPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auLeaveCategoryDelete($id, $business_id) + public function auLeaveCategoryDelete($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryDelete'][0]) { - $this->auLeaveCategoryDeleteWithHttpInfo($id, $business_id); + $this->auLeaveCategoryDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auLeaveCategoryDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveCategoryDeleteWithHttpInfo($id, $business_id) + public function auLeaveCategoryDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryDelete'][0]) { - $returnType = ''; - $request = $this->auLeaveCategoryDeleteRequest($id, $business_id); + $request = $this->auLeaveCategoryDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auLeaveCategoryDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auLeaveCategoryDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auLeaveCategoryDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryDeleteAsync($id, $business_id) + public function auLeaveCategoryDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryDelete'][0]) { - return $this->auLeaveCategoryDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auLeaveCategoryDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryDeleteAsyncWithHttpInfo($id, $business_id) + public function auLeaveCategoryDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryDelete'][0]) { $returnType = ''; - $request = $this->auLeaveCategoryDeleteRequest($id, $business_id); + $request = $this->auLeaveCategoryDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveCategoryDeleteRequest($id, $business_id) + public function auLeaveCategoryDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryDelete'][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 auLeaveCategoryDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auLeaveCategoryDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/leavecategory/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auLeaveCategoryDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auLeaveCategoryDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auLeaveCategoryDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auLeaveCategoryDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveCategoryModel + * @return \OpenAPI\Client\Model\AuLeaveCategoryModel */ - public function auLeaveCategoryGet($id, $business_id) + public function auLeaveCategoryGet($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryGet'][0]) { - list($response) = $this->auLeaveCategoryGetWithHttpInfo($id, $business_id); + list($response) = $this->auLeaveCategoryGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auLeaveCategoryGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveCategoryGetWithHttpInfo($id, $business_id) + public function auLeaveCategoryGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel'; - $request = $this->auLeaveCategoryGetRequest($id, $business_id); + $request = $this->auLeaveCategoryGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auLeaveCategoryGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auLeaveCategoryGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auLeaveCategoryGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveCategoryModel', + '\OpenAPI\Client\Model\AuLeaveCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auLeaveCategoryGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryGetAsync($id, $business_id) + public function auLeaveCategoryGetAsync($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryGet'][0]) { - return $this->auLeaveCategoryGetAsyncWithHttpInfo($id, $business_id) + return $this->auLeaveCategoryGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryGetAsyncWithHttpInfo($id, $business_id) + public function auLeaveCategoryGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel'; - $request = $this->auLeaveCategoryGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel'; + $request = $this->auLeaveCategoryGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveCategoryGetRequest($id, $business_id) + public function auLeaveCategoryGetRequest($id, $business_id, string $contentType = self::contentTypes['auLeaveCategoryGet'][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 auLeaveCategoryGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auLeaveCategoryGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/leavecategory/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auLeaveCategoryGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auLeaveCategoryGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auLeaveCategoryGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auLeaveCategoryGetRequest($id, $business_id) * List Leave Categories * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGetLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\AuLeaveCategoryModel[] */ - public function auLeaveCategoryGetLeaveCategories($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveCategoryGetLeaveCategories($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveCategoryGetLeaveCategories'][0]) { - list($response) = $this->auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auLeaveCategoryGetLeaveCategories($business_id, $filter = null, * List Leave Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGetLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveCategoryGetLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel[]'; - $request = $this->auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auLeaveCategoryGetLeaveCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $fil } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $fil sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $fil case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveCategoryModel[]', + '\OpenAPI\Client\Model\AuLeaveCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auLeaveCategoryGetLeaveCategoriesWithHttpInfo($business_id, $fil * List Leave Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryGetLeaveCategoriesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveCategoryGetLeaveCategoriesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveCategoryGetLeaveCategories'][0]) { - return $this->auLeaveCategoryGetLeaveCategoriesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auLeaveCategoryGetLeaveCategoriesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Leave Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryGetLeaveCategoriesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveCategoryGetLeaveCategoriesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveCategoryGetLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel[]'; - $request = $this->auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel[]'; + $request = $this->auLeaveCategoryGetLeaveCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auLeaveCategoryGetLeaveCategories' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLeaveCategoryGetLeaveCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filte ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/leavecategory'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filte $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filte ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filte $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auLeaveCategoryGetLeaveCategoriesRequest($business_id, $filte * * Create Leave Category * - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category leave_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveCategoryModel + * @return \OpenAPI\Client\Model\AuLeaveCategoryModel */ - public function auLeaveCategoryPost($leave_category, $business_id) + public function auLeaveCategoryPost($business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPost'][0]) { - list($response) = $this->auLeaveCategoryPostWithHttpInfo($leave_category, $business_id); + list($response) = $this->auLeaveCategoryPostWithHttpInfo($business_id, $leave_category, $contentType); return $response; } @@ -969,17 +1086,17 @@ public function auLeaveCategoryPost($leave_category, $business_id) * * Create Leave Category * - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveCategoryPostWithHttpInfo($leave_category, $business_id) + public function auLeaveCategoryPostWithHttpInfo($business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel'; - $request = $this->auLeaveCategoryPostRequest($leave_category, $business_id); + $request = $this->auLeaveCategoryPostRequest($business_id, $leave_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1105,16 @@ public function auLeaveCategoryPostWithHttpInfo($leave_category, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1125,37 @@ public function auLeaveCategoryPostWithHttpInfo($leave_category, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1172,7 @@ public function auLeaveCategoryPostWithHttpInfo($leave_category, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveCategoryModel', + '\OpenAPI\Client\Model\AuLeaveCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1187,16 @@ public function auLeaveCategoryPostWithHttpInfo($leave_category, $business_id) * * Create Leave Category * - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryPostAsync($leave_category, $business_id) + public function auLeaveCategoryPostAsync($business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPost'][0]) { - return $this->auLeaveCategoryPostAsyncWithHttpInfo($leave_category, $business_id) + return $this->auLeaveCategoryPostAsyncWithHttpInfo($business_id, $leave_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1209,26 @@ function ($response) { * * Create Leave Category * - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryPostAsyncWithHttpInfo($leave_category, $business_id) + public function auLeaveCategoryPostAsyncWithHttpInfo($business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel'; - $request = $this->auLeaveCategoryPostRequest($leave_category, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel'; + $request = $this->auLeaveCategoryPostRequest($business_id, $leave_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1260,16 @@ function ($exception) { /** * Create request for operation 'auLeaveCategoryPost' * - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveCategoryPostRequest($leave_category, $business_id) + public function auLeaveCategoryPostRequest($business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPost'][0]) { - // verify the required parameter 'leave_category' is set - if ($leave_category === null || (is_array($leave_category) && count($leave_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_category when calling auLeaveCategoryPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1277,14 @@ protected function auLeaveCategoryPostRequest($leave_category, $business_id) ); } + // verify the required parameter 'leave_category' is set + if ($leave_category === null || (is_array($leave_category) && count($leave_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_category when calling auLeaveCategoryPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/leavecategory'; $formParams = []; $queryParams = []; @@ -1146,6 +1293,7 @@ protected function auLeaveCategoryPostRequest($leave_category, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1303,42 @@ protected function auLeaveCategoryPostRequest($leave_category, $business_id) ); } - // body params - $_tempBody = null; - if (isset($leave_category)) { - $_tempBody = $leave_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_category)); + } else { + $httpBody = $leave_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1359,11 @@ protected function auLeaveCategoryPostRequest($leave_category, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1375,17 @@ protected function auLeaveCategoryPostRequest($leave_category, $business_id) * Update Leave Category * * @param int $id id (required) - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category leave_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveCategoryModel + * @return \OpenAPI\Client\Model\AuLeaveCategoryModel */ - public function auLeaveCategoryPut($id, $leave_category, $business_id) + public function auLeaveCategoryPut($id, $business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPut'][0]) { - list($response) = $this->auLeaveCategoryPutWithHttpInfo($id, $leave_category, $business_id); + list($response) = $this->auLeaveCategoryPutWithHttpInfo($id, $business_id, $leave_category, $contentType); return $response; } @@ -1259,17 +1395,17 @@ public function auLeaveCategoryPut($id, $leave_category, $business_id) * Update Leave Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLeaveCategoryPutWithHttpInfo($id, $leave_category, $business_id) + public function auLeaveCategoryPutWithHttpInfo($id, $business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPut'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel'; - $request = $this->auLeaveCategoryPutRequest($id, $leave_category, $business_id); + $request = $this->auLeaveCategoryPutRequest($id, $business_id, $leave_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1414,16 @@ public function auLeaveCategoryPutWithHttpInfo($id, $leave_category, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1434,37 @@ public function auLeaveCategoryPutWithHttpInfo($id, $leave_category, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1481,7 @@ public function auLeaveCategoryPutWithHttpInfo($id, $leave_category, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveCategoryModel', + '\OpenAPI\Client\Model\AuLeaveCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1497,16 @@ public function auLeaveCategoryPutWithHttpInfo($id, $leave_category, $business_i * Update Leave Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryPutAsync($id, $leave_category, $business_id) + public function auLeaveCategoryPutAsync($id, $business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPut'][0]) { - return $this->auLeaveCategoryPutAsyncWithHttpInfo($id, $leave_category, $business_id) + return $this->auLeaveCategoryPutAsyncWithHttpInfo($id, $business_id, $leave_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1520,26 @@ function ($response) { * Update Leave Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLeaveCategoryPutAsyncWithHttpInfo($id, $leave_category, $business_id) + public function auLeaveCategoryPutAsyncWithHttpInfo($id, $business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPut'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveCategoryModel'; - $request = $this->auLeaveCategoryPutRequest($id, $leave_category, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveCategoryModel'; + $request = $this->auLeaveCategoryPutRequest($id, $business_id, $leave_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1572,23 @@ function ($exception) { * Create request for operation 'auLeaveCategoryPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuLeaveCategoryModel $leave_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLeaveCategoryModel $leave_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLeaveCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLeaveCategoryPutRequest($id, $leave_category, $business_id) + public function auLeaveCategoryPutRequest($id, $business_id, $leave_category, string $contentType = self::contentTypes['auLeaveCategoryPut'][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 auLeaveCategoryPut' ); } - // verify the required parameter 'leave_category' is set - if ($leave_category === null || (is_array($leave_category) && count($leave_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_category when calling auLeaveCategoryPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1596,14 @@ protected function auLeaveCategoryPutRequest($id, $leave_category, $business_id) ); } + // verify the required parameter 'leave_category' is set + if ($leave_category === null || (is_array($leave_category) && count($leave_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_category when calling auLeaveCategoryPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/leavecategory/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1612,7 @@ protected function auLeaveCategoryPutRequest($id, $leave_category, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1630,42 @@ protected function auLeaveCategoryPutRequest($id, $leave_category, $business_id) ); } - // body params - $_tempBody = null; - if (isset($leave_category)) { - $_tempBody = $leave_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_category)); + } else { + $httpBody = $leave_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1686,11 @@ protected function auLeaveCategoryPutRequest($id, $leave_category, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/LeaveRequestsApi.php b/src/lib/Api/LeaveRequestsApi.php index a5b14c7..9d371c5 100644 --- a/src/lib/Api/LeaveRequestsApi.php +++ b/src/lib/Api/LeaveRequestsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auHoursLeaveRequestApprove' => [ + 'application/json', + ], + 'auHoursLeaveRequestDecline' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auHoursLeaveRequestDelete' => [ + 'application/json', + ], + 'auHoursLeaveRequestEstimate' => [ + 'application/json', + ], + 'auHoursLeaveRequestGet' => [ + 'application/json', + ], + 'auHoursLeaveRequestGetLeaveRequests' => [ + 'application/json', + ], + 'auHoursLeaveRequestPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auHoursLeaveRequestPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -93,22 +171,23 @@ public function getConfig() * List Leave Requests * * @param int $business_id business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param string $filter_status filter_status (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param int $filter_leave_category_id filter_leave_category_id (optional) + * @param int $filter_location_id filter_location_id (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param string $filter_group_by filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel[] + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel[] */ - public function auBusinessHoursLeaveRequestListLeaveRequests($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function auBusinessHoursLeaveRequestListLeaveRequests($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'][0]) { - list($response) = $this->auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave); + list($response) = $this->auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType); return $response; } @@ -118,23 +197,23 @@ public function auBusinessHoursLeaveRequestListLeaveRequests($business_id, $filt * List Leave Requests * * @param int $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel[]'; - $request = $this->auBusinessHoursLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave); + $request = $this->auBusinessHoursLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType); try { $options = $this->createHttpClientOption(); @@ -143,9 +222,16 @@ public function auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -156,19 +242,37 @@ public function auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -185,7 +289,7 @@ public function auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel[]', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -201,21 +305,22 @@ public function auBusinessHoursLeaveRequestListLeaveRequestsWithHttpInfo($busine * List Leave Requests * * @param int $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessHoursLeaveRequestListLeaveRequestsAsync($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function auBusinessHoursLeaveRequestListLeaveRequestsAsync($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'][0]) { - return $this->auBusinessHoursLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave) + return $this->auBusinessHoursLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType) ->then( function ($response) { return $response[0]; @@ -229,32 +334,32 @@ function ($response) { * List Leave Requests * * @param int $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auBusinessHoursLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function auBusinessHoursLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel[]'; - $request = $this->auBusinessHoursLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]'; + $request = $this->auBusinessHoursLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -277,7 +382,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -287,20 +392,22 @@ function ($exception) { * Create request for operation 'auBusinessHoursLeaveRequestListLeaveRequests' * * @param int $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['auBusinessHoursLeaveRequestListLeaveRequests'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -308,6 +415,15 @@ protected function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business ); } + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/leaverequest'; $formParams = []; $queryParams = []; @@ -316,37 +432,78 @@ protected function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business $multipart = false; // query params - if ($filter_status !== null) { - $queryParams['filter.status'] = ObjectSerializer::toQueryValue($filter_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_status, + 'filter.status', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_leave_category_id !== null) { - $queryParams['filter.leaveCategoryId'] = ObjectSerializer::toQueryValue($filter_leave_category_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_leave_category_id, + 'filter.leaveCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_group_by !== null) { - $queryParams['filter.groupBy'] = ObjectSerializer::toQueryValue($filter_group_by); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_group_by, + 'filter.groupBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_restrict_overlapping_leave !== null) { - $queryParams['filter.restrictOverlappingLeave'] = ObjectSerializer::toQueryValue($filter_restrict_overlapping_leave); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_restrict_overlapping_leave, + 'filter.restrictOverlappingLeave', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -357,53 +514,35 @@ protected function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -424,10 +563,11 @@ protected function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -441,14 +581,15 @@ protected function auBusinessHoursLeaveRequestListLeaveRequestsRequest($business * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel */ - public function auHoursLeaveRequestApprove($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestApprove($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestApprove'][0]) { - list($response) = $this->auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -460,15 +601,15 @@ public function auHoursLeaveRequestApprove($employee_id, $leave_request_id, $bus * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestApprove'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id); + $request = $this->auHoursLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -477,9 +618,16 @@ public function auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_requ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -490,19 +638,37 @@ public function auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_requ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -519,7 +685,7 @@ public function auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_requ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -537,13 +703,14 @@ public function auHoursLeaveRequestApproveWithHttpInfo($employee_id, $leave_requ * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestApproveAsync($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestApproveAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestApprove'][0]) { - return $this->auHoursLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->auHoursLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -559,24 +726,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestApprove'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; + $request = $this->auHoursLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -599,7 +766,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -611,24 +778,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestApprove'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auHoursLeaveRequestApprove' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling auHoursLeaveRequestApprove' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -636,6 +807,7 @@ protected function auHoursLeaveRequestApproveRequest($employee_id, $leave_reques ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest/{leaveRequestId}/approve'; $formParams = []; $queryParams = []; @@ -644,6 +816,7 @@ protected function auHoursLeaveRequestApproveRequest($employee_id, $leave_reques $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -669,53 +842,35 @@ protected function auHoursLeaveRequestApproveRequest($employee_id, $leave_reques ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -736,10 +891,11 @@ protected function auHoursLeaveRequestApproveRequest($employee_id, $leave_reques $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -752,16 +908,17 @@ protected function auHoursLeaveRequestApproveRequest($employee_id, $leave_reques * * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) - * @param \Swagger\Client\Model\DeclineLeaveRequest $decline decline (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\DeclineLeaveRequest $decline decline (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel */ - public function auHoursLeaveRequestDecline($employee_id, $leave_request_id, $decline, $business_id) + public function auHoursLeaveRequestDecline($employee_id, $leave_request_id, $business_id, $decline, string $contentType = self::contentTypes['auHoursLeaveRequestDecline'][0]) { - list($response) = $this->auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $decline, $business_id); + list($response) = $this->auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline, $contentType); return $response; } @@ -772,17 +929,17 @@ public function auHoursLeaveRequestDecline($employee_id, $leave_request_id, $dec * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineLeaveRequest $decline (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineLeaveRequest $decline (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $decline, $business_id) + public function auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline, string $contentType = self::contentTypes['auHoursLeaveRequestDecline'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestDeclineRequest($employee_id, $leave_request_id, $decline, $business_id); + $request = $this->auHoursLeaveRequestDeclineRequest($employee_id, $leave_request_id, $business_id, $decline, $contentType); try { $options = $this->createHttpClientOption(); @@ -791,9 +948,16 @@ public function auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_requ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -804,19 +968,37 @@ public function auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_requ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -833,7 +1015,7 @@ public function auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_requ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -850,15 +1032,16 @@ public function auHoursLeaveRequestDeclineWithHttpInfo($employee_id, $leave_requ * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineLeaveRequest $decline (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineLeaveRequest $decline (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestDeclineAsync($employee_id, $leave_request_id, $decline, $business_id) + public function auHoursLeaveRequestDeclineAsync($employee_id, $leave_request_id, $business_id, $decline, string $contentType = self::contentTypes['auHoursLeaveRequestDecline'][0]) { - return $this->auHoursLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $decline, $business_id) + return $this->auHoursLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline, $contentType) ->then( function ($response) { return $response[0]; @@ -873,26 +1056,26 @@ function ($response) { * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineLeaveRequest $decline (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineLeaveRequest $decline (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $decline, $business_id) + public function auHoursLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline, string $contentType = self::contentTypes['auHoursLeaveRequestDecline'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestDeclineRequest($employee_id, $leave_request_id, $decline, $business_id); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; + $request = $this->auHoursLeaveRequestDeclineRequest($employee_id, $leave_request_id, $business_id, $decline, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -915,7 +1098,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -926,32 +1109,30 @@ function ($exception) { * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineLeaveRequest $decline (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineLeaveRequest $decline (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestDeclineRequest($employee_id, $leave_request_id, $decline, $business_id) + public function auHoursLeaveRequestDeclineRequest($employee_id, $leave_request_id, $business_id, $decline, string $contentType = self::contentTypes['auHoursLeaveRequestDecline'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auHoursLeaveRequestDecline' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling auHoursLeaveRequestDecline' ); } - // verify the required parameter 'decline' is set - if ($decline === null || (is_array($decline) && count($decline) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $decline when calling auHoursLeaveRequestDecline' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -959,6 +1140,14 @@ protected function auHoursLeaveRequestDeclineRequest($employee_id, $leave_reques ); } + // verify the required parameter 'decline' is set + if ($decline === null || (is_array($decline) && count($decline) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $decline when calling auHoursLeaveRequestDecline' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest/{leaveRequestId}/decline'; $formParams = []; $queryParams = []; @@ -967,6 +1156,7 @@ protected function auHoursLeaveRequestDeclineRequest($employee_id, $leave_reques $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -992,56 +1182,42 @@ protected function auHoursLeaveRequestDeclineRequest($employee_id, $leave_reques ); } - // body params - $_tempBody = null; - if (isset($decline)) { - $_tempBody = $decline; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($decline)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($decline)); + } else { + $httpBody = $decline; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1062,10 +1238,11 @@ protected function auHoursLeaveRequestDeclineRequest($employee_id, $leave_reques $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1079,14 +1256,15 @@ protected function auHoursLeaveRequestDeclineRequest($employee_id, $leave_reques * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel */ - public function auHoursLeaveRequestDelete($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestDelete($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestDelete'][0]) { - list($response) = $this->auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -1098,15 +1276,15 @@ public function auHoursLeaveRequestDelete($employee_id, $leave_request_id, $busi * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestDelete'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id); + $request = $this->auHoursLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1115,9 +1293,16 @@ public function auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_reque } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1128,19 +1313,37 @@ public function auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_reque sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1157,7 +1360,7 @@ public function auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_reque case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1175,13 +1378,14 @@ public function auHoursLeaveRequestDeleteWithHttpInfo($employee_id, $leave_reque * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestDeleteAsync($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestDeleteAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestDelete'][0]) { - return $this->auHoursLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->auHoursLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1197,24 +1401,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestDelete'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; + $request = $this->auHoursLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1237,7 +1441,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1249,24 +1453,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestDelete'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auHoursLeaveRequestDelete' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling auHoursLeaveRequestDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1274,6 +1482,7 @@ protected function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -1282,6 +1491,7 @@ protected function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1307,53 +1517,35 @@ protected function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1374,10 +1566,11 @@ protected function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1393,14 +1586,15 @@ protected function auHoursLeaveRequestDeleteRequest($employee_id, $leave_request * @param \DateTime $to_date to_date (required) * @param string $employee_id employee_id (required) * @param int $leave_category_id leave_category_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestEstimate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveEstimateModel + * @return \OpenAPI\Client\Model\HourLeaveEstimateModel */ - public function auHoursLeaveRequestEstimate($business_id, $from_date, $to_date, $employee_id, $leave_category_id = '0') + public function auHoursLeaveRequestEstimate($business_id, $from_date, $to_date, $employee_id, $leave_category_id = 0, string $contentType = self::contentTypes['auHoursLeaveRequestEstimate'][0]) { - list($response) = $this->auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id); + list($response) = $this->auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id, $contentType); return $response; } @@ -1414,15 +1608,15 @@ public function auHoursLeaveRequestEstimate($business_id, $from_date, $to_date, * @param \DateTime $to_date (required) * @param string $employee_id (required) * @param int $leave_category_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestEstimate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveEstimateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveEstimateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id = '0') + public function auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id = 0, string $contentType = self::contentTypes['auHoursLeaveRequestEstimate'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveEstimateModel'; - $request = $this->auHoursLeaveRequestEstimateRequest($business_id, $from_date, $to_date, $employee_id, $leave_category_id); + $request = $this->auHoursLeaveRequestEstimateRequest($business_id, $from_date, $to_date, $employee_id, $leave_category_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1431,9 +1625,16 @@ public function auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1444,19 +1645,37 @@ public function auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveEstimateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveEstimateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveEstimateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveEstimateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1473,7 +1692,7 @@ public function auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveEstimateModel', + '\OpenAPI\Client\Model\HourLeaveEstimateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1493,13 +1712,14 @@ public function auHoursLeaveRequestEstimateWithHttpInfo($business_id, $from_date * @param \DateTime $to_date (required) * @param string $employee_id (required) * @param int $leave_category_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestEstimateAsync($business_id, $from_date, $to_date, $employee_id, $leave_category_id = '0') + public function auHoursLeaveRequestEstimateAsync($business_id, $from_date, $to_date, $employee_id, $leave_category_id = 0, string $contentType = self::contentTypes['auHoursLeaveRequestEstimate'][0]) { - return $this->auHoursLeaveRequestEstimateAsyncWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id) + return $this->auHoursLeaveRequestEstimateAsyncWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1517,24 +1737,24 @@ function ($response) { * @param \DateTime $to_date (required) * @param string $employee_id (required) * @param int $leave_category_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestEstimateAsyncWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id = '0') + public function auHoursLeaveRequestEstimateAsyncWithHttpInfo($business_id, $from_date, $to_date, $employee_id, $leave_category_id = 0, string $contentType = self::contentTypes['auHoursLeaveRequestEstimate'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveEstimateModel'; - $request = $this->auHoursLeaveRequestEstimateRequest($business_id, $from_date, $to_date, $employee_id, $leave_category_id); + $returnType = '\OpenAPI\Client\Model\HourLeaveEstimateModel'; + $request = $this->auHoursLeaveRequestEstimateRequest($business_id, $from_date, $to_date, $employee_id, $leave_category_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1557,7 +1777,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1571,30 +1791,35 @@ function ($exception) { * @param \DateTime $to_date (required) * @param string $employee_id (required) * @param int $leave_category_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestEstimateRequest($business_id, $from_date, $to_date, $employee_id, $leave_category_id = '0') + public function auHoursLeaveRequestEstimateRequest($business_id, $from_date, $to_date, $employee_id, $leave_category_id = 0, string $contentType = self::contentTypes['auHoursLeaveRequestEstimate'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auHoursLeaveRequestEstimate' ); } + // verify the required parameter 'from_date' is set if ($from_date === null || (is_array($from_date) && count($from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $from_date when calling auHoursLeaveRequestEstimate' ); } + // verify the required parameter 'to_date' is set if ($to_date === null || (is_array($to_date) && count($to_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $to_date when calling auHoursLeaveRequestEstimate' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -1602,6 +1827,8 @@ protected function auHoursLeaveRequestEstimateRequest($business_id, $from_date, ); } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest/estimate'; $formParams = []; $queryParams = []; @@ -1610,17 +1837,33 @@ protected function auHoursLeaveRequestEstimateRequest($business_id, $from_date, $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($leave_category_id !== null) { - $queryParams['leaveCategoryId'] = ObjectSerializer::toQueryValue($leave_category_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $leave_category_id, + 'leaveCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1639,53 +1882,35 @@ protected function auHoursLeaveRequestEstimateRequest($business_id, $from_date, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1706,10 +1931,11 @@ protected function auHoursLeaveRequestEstimateRequest($business_id, $from_date, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1723,14 +1949,15 @@ protected function auHoursLeaveRequestEstimateRequest($business_id, $from_date, * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel */ - public function auHoursLeaveRequestGet($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestGet($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestGet'][0]) { - list($response) = $this->auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -1742,15 +1969,15 @@ public function auHoursLeaveRequestGet($employee_id, $leave_request_id, $busines * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestGet'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id); + $request = $this->auHoursLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1759,9 +1986,16 @@ public function auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1772,19 +2006,37 @@ public function auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1801,7 +2053,7 @@ public function auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1819,13 +2071,14 @@ public function auHoursLeaveRequestGetWithHttpInfo($employee_id, $leave_request_ * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestGetAsync($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestGetAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestGet'][0]) { - return $this->auHoursLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->auHoursLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1841,24 +2094,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestGet'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; + $request = $this->auHoursLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1881,7 +2134,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1893,24 +2146,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id) + public function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['auHoursLeaveRequestGet'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auHoursLeaveRequestGet' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling auHoursLeaveRequestGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1918,6 +2175,7 @@ protected function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -1926,6 +2184,7 @@ protected function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1951,53 +2210,35 @@ protected function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2018,10 +2259,11 @@ protected function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2034,18 +2276,20 @@ protected function auHoursLeaveRequestGetRequest($employee_id, $leave_request_id * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGetLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel[] + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel[] */ - public function auHoursLeaveRequestGetLeaveRequests($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auHoursLeaveRequestGetLeaveRequests($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auHoursLeaveRequestGetLeaveRequests'][0]) { - list($response) = $this->auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -2056,19 +2300,20 @@ public function auHoursLeaveRequestGetLeaveRequests($business_id, $employee_id, * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGetLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auHoursLeaveRequestGetLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel[]'; - $request = $this->auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -2077,9 +2322,16 @@ public function auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $e } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2090,19 +2342,37 @@ public function auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $e sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2119,7 +2389,7 @@ public function auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $e case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel[]', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2136,17 +2406,19 @@ public function auHoursLeaveRequestGetLeaveRequestsWithHttpInfo($business_id, $e * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGetLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestGetLeaveRequestsAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auHoursLeaveRequestGetLeaveRequestsAsync($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auHoursLeaveRequestGetLeaveRequests'][0]) { - return $this->auHoursLeaveRequestGetLeaveRequestsAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->auHoursLeaveRequestGetLeaveRequestsAsyncWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -2161,28 +2433,29 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGetLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestGetLeaveRequestsAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auHoursLeaveRequestGetLeaveRequestsAsyncWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auHoursLeaveRequestGetLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel[]'; - $request = $this->auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel[]'; + $request = $this->auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2205,7 +2478,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2216,22 +2489,26 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestGetLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auHoursLeaveRequestGetLeaveRequests'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auHoursLeaveRequestGetLeaveRequests' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2239,6 +2516,12 @@ protected function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $emp ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest'; $formParams = []; $queryParams = []; @@ -2247,20 +2530,45 @@ protected function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $emp $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -2280,53 +2588,35 @@ protected function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $emp ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2347,10 +2637,11 @@ protected function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $emp $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2361,17 +2652,18 @@ protected function auHoursLeaveRequestGetLeaveRequestsRequest($business_id, $emp * * Create Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\HourLeaveRequestResponseModel + * @return \OpenAPI\Client\Model\HourLeaveRequestResponseModel */ - public function auHoursLeaveRequestPost($model, $business_id, $employee_id) + public function auHoursLeaveRequestPost($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPost'][0]) { - list($response) = $this->auHoursLeaveRequestPostWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->auHoursLeaveRequestPostWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -2380,18 +2672,18 @@ public function auHoursLeaveRequestPost($model, $business_id, $employee_id) * * Create Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\HourLeaveRequestResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestPostWithHttpInfo($model, $business_id, $employee_id) + public function auHoursLeaveRequestPostWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPost'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestPostRequest($model, $business_id, $employee_id); + $request = $this->auHoursLeaveRequestPostRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2400,9 +2692,16 @@ public function auHoursLeaveRequestPostWithHttpInfo($model, $business_id, $emplo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2413,19 +2712,37 @@ public function auHoursLeaveRequestPostWithHttpInfo($model, $business_id, $emplo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\HourLeaveRequestResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2442,7 +2759,7 @@ public function auHoursLeaveRequestPostWithHttpInfo($model, $business_id, $emplo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\HourLeaveRequestResponseModel', + '\OpenAPI\Client\Model\HourLeaveRequestResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2457,16 +2774,17 @@ public function auHoursLeaveRequestPostWithHttpInfo($model, $business_id, $emplo * * Create Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestPostAsync($model, $business_id, $employee_id) + public function auHoursLeaveRequestPostAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPost'][0]) { - return $this->auHoursLeaveRequestPostAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->auHoursLeaveRequestPostAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2479,27 +2797,27 @@ function ($response) { * * Create Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestPostAsyncWithHttpInfo($model, $business_id, $employee_id) + public function auHoursLeaveRequestPostAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPost'][0]) { - $returnType = '\Swagger\Client\Model\HourLeaveRequestResponseModel'; - $request = $this->auHoursLeaveRequestPostRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\HourLeaveRequestResponseModel'; + $request = $this->auHoursLeaveRequestPostRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2522,7 +2840,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2531,27 +2849,24 @@ function ($exception) { /** * Create request for operation 'auHoursLeaveRequestPost' * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestPostRequest($model, $business_id, $employee_id) + public function auHoursLeaveRequestPostRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auHoursLeaveRequestPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auHoursLeaveRequestPost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2559,6 +2874,14 @@ protected function auHoursLeaveRequestPostRequest($model, $business_id, $employe ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auHoursLeaveRequestPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest'; $formParams = []; $queryParams = []; @@ -2567,6 +2890,7 @@ protected function auHoursLeaveRequestPostRequest($model, $business_id, $employe $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2584,56 +2908,42 @@ protected function auHoursLeaveRequestPostRequest($model, $business_id, $employe ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2654,10 +2964,11 @@ protected function auHoursLeaveRequestPostRequest($model, $business_id, $employe $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2668,17 +2979,18 @@ protected function auHoursLeaveRequestPostRequest($model, $business_id, $employe * * Update Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auHoursLeaveRequestPut($model, $business_id, $employee_id) + public function auHoursLeaveRequestPut($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPut'][0]) { - $this->auHoursLeaveRequestPutWithHttpInfo($model, $business_id, $employee_id); + $this->auHoursLeaveRequestPutWithHttpInfo($business_id, $employee_id, $model, $contentType); } /** @@ -2686,18 +2998,18 @@ public function auHoursLeaveRequestPut($model, $business_id, $employee_id) * * Update Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestPutWithHttpInfo($model, $business_id, $employee_id) + public function auHoursLeaveRequestPutWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPut'][0]) { - $returnType = ''; - $request = $this->auHoursLeaveRequestPutRequest($model, $business_id, $employee_id); + $request = $this->auHoursLeaveRequestPutRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2706,9 +3018,16 @@ public function auHoursLeaveRequestPutWithHttpInfo($model, $business_id, $employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2719,11 +3038,11 @@ public function auHoursLeaveRequestPutWithHttpInfo($model, $business_id, $employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2741,16 +3060,17 @@ public function auHoursLeaveRequestPutWithHttpInfo($model, $business_id, $employ * * Update Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestPutAsync($model, $business_id, $employee_id) + public function auHoursLeaveRequestPutAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPut'][0]) { - return $this->auHoursLeaveRequestPutAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->auHoursLeaveRequestPutAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2763,17 +3083,18 @@ function ($response) { * * Update Leave Request * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestPutAsyncWithHttpInfo($model, $business_id, $employee_id) + public function auHoursLeaveRequestPutAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPut'][0]) { $returnType = ''; - $request = $this->auHoursLeaveRequestPutRequest($model, $business_id, $employee_id); + $request = $this->auHoursLeaveRequestPutRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2792,7 +3113,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2801,27 +3122,24 @@ function ($exception) { /** * Create request for operation 'auHoursLeaveRequestPut' * - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestPutRequest($model, $business_id, $employee_id) + public function auHoursLeaveRequestPutRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPut'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auHoursLeaveRequestPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auHoursLeaveRequestPut' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -2829,6 +3147,14 @@ protected function auHoursLeaveRequestPutRequest($model, $business_id, $employee ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auHoursLeaveRequestPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest'; $formParams = []; $queryParams = []; @@ -2837,6 +3163,7 @@ protected function auHoursLeaveRequestPutRequest($model, $business_id, $employee $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2854,56 +3181,42 @@ protected function auHoursLeaveRequestPutRequest($model, $business_id, $employee ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2924,10 +3237,11 @@ protected function auHoursLeaveRequestPutRequest($model, $business_id, $employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2939,17 +3253,18 @@ protected function auHoursLeaveRequestPutRequest($model, $business_id, $employee * Update Leave Request * * @param int $leave_request_id leave_request_id (required) - * @param \Swagger\Client\Model\HourLeaveRequestModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId($leave_request_id, $model, $business_id, $employee_id) + public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId($leave_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'][0]) { - $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdWithHttpInfo($leave_request_id, $model, $business_id, $employee_id); + $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdWithHttpInfo($leave_request_id, $business_id, $employee_id, $model, $contentType); } /** @@ -2958,18 +3273,18 @@ public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmploye * Update Leave Request * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdWithHttpInfo($leave_request_id, $model, $business_id, $employee_id) + public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdWithHttpInfo($leave_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'][0]) { - $returnType = ''; - $request = $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdRequest($leave_request_id, $model, $business_id, $employee_id); + $request = $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdRequest($leave_request_id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2978,9 +3293,16 @@ public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmploye } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2991,11 +3313,11 @@ public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmploye sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3014,16 +3336,17 @@ public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmploye * Update Leave Request * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdAsync($leave_request_id, $model, $business_id, $employee_id) + public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdAsync($leave_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'][0]) { - return $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdAsyncWithHttpInfo($leave_request_id, $model, $business_id, $employee_id) + return $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdAsyncWithHttpInfo($leave_request_id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3037,17 +3360,18 @@ function ($response) { * Update Leave Request * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdAsyncWithHttpInfo($leave_request_id, $model, $business_id, $employee_id) + public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdAsyncWithHttpInfo($leave_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'][0]) { $returnType = ''; - $request = $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdRequest($leave_request_id, $model, $business_id, $employee_id); + $request = $this->auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdRequest($leave_request_id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3066,7 +3390,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3076,33 +3400,31 @@ function ($exception) { * Create request for operation 'auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId' * * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\HourLeaveRequestModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\HourLeaveRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdRequest($leave_request_id, $model, $business_id, $employee_id) + public function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestIdRequest($leave_request_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3110,6 +3432,14 @@ protected function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmpl ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmployeeIdLeaverequestByLeaveRequestId' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/leaverequest/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -3118,6 +3448,7 @@ protected function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmpl $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -3143,56 +3474,42 @@ protected function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmpl ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3213,10 +3530,11 @@ protected function auHoursLeaveRequestPutApiV2BusinessByBusinessIdEmployeeByEmpl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/LocationApi.php b/src/lib/Api/LocationApi.php index 7e129b3..f2215c1 100644 --- a/src/lib/Api/LocationApi.php +++ b/src/lib/Api/LocationApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auLocationGet' => [ + 'application/json', + ], + 'auLocationGetEmployeeLocations' => [ + 'application/json', + ], + 'auLocationGetLocations' => [ + 'application/json', + ], + 'auLocationPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auLocationPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +152,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auLocationDelete($id, $business_id) + public function auLocationDelete($id, $business_id, string $contentType = self::contentTypes['auLocationDelete'][0]) { - $this->auLocationDeleteWithHttpInfo($id, $business_id); + $this->auLocationDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +170,15 @@ public function auLocationDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auLocationDeleteWithHttpInfo($id, $business_id) + public function auLocationDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLocationDelete'][0]) { - $returnType = ''; - $request = $this->auLocationDeleteRequest($id, $business_id); + $request = $this->auLocationDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +187,16 @@ public function auLocationDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +207,11 @@ public function auLocationDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +231,14 @@ public function auLocationDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationDeleteAsync($id, $business_id) + public function auLocationDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auLocationDelete'][0]) { - return $this->auLocationDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auLocationDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +253,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationDeleteAsyncWithHttpInfo($id, $business_id) + public function auLocationDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLocationDelete'][0]) { $returnType = ''; - $request = $this->auLocationDeleteRequest($id, $business_id); + $request = $this->auLocationDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +280,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +291,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLocationDeleteRequest($id, $business_id) + public function auLocationDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auLocationDelete'][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 auLocationDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +313,7 @@ protected function auLocationDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/location/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +322,7 @@ protected function auLocationDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +340,35 @@ protected function auLocationDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +389,11 @@ protected function auLocationDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +406,15 @@ protected function auLocationDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSingleLocationModel + * @return \OpenAPI\Client\Model\AuSingleLocationModel */ - public function auLocationGet($id, $business_id) + public function auLocationGet($id, $business_id, string $contentType = self::contentTypes['auLocationGet'][0]) { - list($response) = $this->auLocationGetWithHttpInfo($id, $business_id); + list($response) = $this->auLocationGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +425,15 @@ public function auLocationGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSingleLocationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSingleLocationModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLocationGetWithHttpInfo($id, $business_id) + public function auLocationGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLocationGet'][0]) { - $returnType = '\Swagger\Client\Model\AuSingleLocationModel'; - $request = $this->auLocationGetRequest($id, $business_id); + $request = $this->auLocationGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +442,16 @@ public function auLocationGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +462,37 @@ public function auLocationGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSingleLocationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSingleLocationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSingleLocationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSingleLocationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +509,7 @@ public function auLocationGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSingleLocationModel', + '\OpenAPI\Client\Model\AuSingleLocationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +526,14 @@ public function auLocationGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationGetAsync($id, $business_id) + public function auLocationGetAsync($id, $business_id, string $contentType = self::contentTypes['auLocationGet'][0]) { - return $this->auLocationGetAsyncWithHttpInfo($id, $business_id) + return $this->auLocationGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +548,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationGetAsyncWithHttpInfo($id, $business_id) + public function auLocationGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auLocationGet'][0]) { - $returnType = '\Swagger\Client\Model\AuSingleLocationModel'; - $request = $this->auLocationGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuSingleLocationModel'; + $request = $this->auLocationGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +588,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +599,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLocationGetRequest($id, $business_id) + public function auLocationGetRequest($id, $business_id, string $contentType = self::contentTypes['auLocationGet'][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 auLocationGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +621,7 @@ protected function auLocationGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/location/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +630,7 @@ protected function auLocationGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +648,35 @@ protected function auLocationGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +697,11 @@ protected function auLocationGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -643,18 +714,20 @@ protected function auLocationGetRequest($id, $business_id) * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetEmployeeLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLocationModel[] + * @return \OpenAPI\Client\Model\AuLocationModel[] */ - public function auLocationGetEmployeeLocations($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetEmployeeLocations($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetEmployeeLocations'][0]) { - list($response) = $this->auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -665,19 +738,20 @@ public function auLocationGetEmployeeLocations($business_id, $employee_id, $filt * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetEmployeeLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetEmployeeLocations'][0]) { - $returnType = '\Swagger\Client\Model\AuLocationModel[]'; - $request = $this->auLocationGetEmployeeLocationsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->auLocationGetEmployeeLocationsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -686,9 +760,16 @@ public function auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -699,19 +780,37 @@ public function auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -728,7 +827,7 @@ public function auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLocationModel[]', + '\OpenAPI\Client\Model\AuLocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -745,17 +844,19 @@ public function auLocationGetEmployeeLocationsWithHttpInfo($business_id, $employ * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetEmployeeLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationGetEmployeeLocationsAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetEmployeeLocationsAsync($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetEmployeeLocations'][0]) { - return $this->auLocationGetEmployeeLocationsAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->auLocationGetEmployeeLocationsAsyncWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -770,28 +871,29 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetEmployeeLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationGetEmployeeLocationsAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetEmployeeLocationsAsyncWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetEmployeeLocations'][0]) { - $returnType = '\Swagger\Client\Model\AuLocationModel[]'; - $request = $this->auLocationGetEmployeeLocationsRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuLocationModel[]'; + $request = $this->auLocationGetEmployeeLocationsRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -814,7 +916,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -825,22 +927,26 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetEmployeeLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLocationGetEmployeeLocationsRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetEmployeeLocationsRequest($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetEmployeeLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auLocationGetEmployeeLocations' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -848,6 +954,12 @@ protected function auLocationGetEmployeeLocationsRequest($business_id, $employee ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/location'; $formParams = []; $queryParams = []; @@ -856,20 +968,45 @@ protected function auLocationGetEmployeeLocationsRequest($business_id, $employee $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -889,53 +1026,35 @@ protected function auLocationGetEmployeeLocationsRequest($business_id, $employee ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -956,10 +1075,11 @@ protected function auLocationGetEmployeeLocationsRequest($business_id, $employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -971,18 +1091,20 @@ protected function auLocationGetEmployeeLocationsRequest($business_id, $employee * List Business Locations * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLocationModel[] + * @return \OpenAPI\Client\Model\AuLocationModel[] */ - public function auLocationGetLocations($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetLocations($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetLocations'][0]) { - list($response) = $this->auLocationGetLocationsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auLocationGetLocationsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -992,19 +1114,20 @@ public function auLocationGetLocations($business_id, $filter = null, $orderby = * List Business Locations * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auLocationGetLocationsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetLocationsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\AuLocationModel[]'; - $request = $this->auLocationGetLocationsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auLocationGetLocationsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -1013,9 +1136,16 @@ public function auLocationGetLocationsWithHttpInfo($business_id, $filter = null, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1026,19 +1156,37 @@ public function auLocationGetLocationsWithHttpInfo($business_id, $filter = null, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1055,7 +1203,7 @@ public function auLocationGetLocationsWithHttpInfo($business_id, $filter = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLocationModel[]', + '\OpenAPI\Client\Model\AuLocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1071,17 +1219,19 @@ public function auLocationGetLocationsWithHttpInfo($business_id, $filter = null, * List Business Locations * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationGetLocationsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetLocationsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetLocations'][0]) { - return $this->auLocationGetLocationsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auLocationGetLocationsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -1095,28 +1245,29 @@ function ($response) { * List Business Locations * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationGetLocationsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetLocationsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\AuLocationModel[]'; - $request = $this->auLocationGetLocationsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuLocationModel[]'; + $request = $this->auLocationGetLocationsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1139,7 +1290,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1149,16 +1300,19 @@ function ($exception) { * Create request for operation 'auLocationGetLocations' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLocationGetLocationsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auLocationGetLocationsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auLocationGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1166,6 +1320,12 @@ protected function auLocationGetLocationsRequest($business_id, $filter = null, $ ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/location'; $formParams = []; $queryParams = []; @@ -1174,20 +1334,45 @@ protected function auLocationGetLocationsRequest($business_id, $filter = null, $ $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -1199,53 +1384,35 @@ protected function auLocationGetLocationsRequest($business_id, $filter = null, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1266,10 +1433,11 @@ protected function auLocationGetLocationsRequest($business_id, $filter = null, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1280,16 +1448,17 @@ protected function auLocationGetLocationsRequest($business_id, $filter = null, $ * * Create Location * - * @param \Swagger\Client\Model\AuLocationModel $location location (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLocationModel + * @return \OpenAPI\Client\Model\AuLocationModel */ - public function auLocationPost($location, $business_id) + public function auLocationPost($business_id, $location, string $contentType = self::contentTypes['auLocationPost'][0]) { - list($response) = $this->auLocationPostWithHttpInfo($location, $business_id); + list($response) = $this->auLocationPostWithHttpInfo($business_id, $location, $contentType); return $response; } @@ -1298,17 +1467,17 @@ public function auLocationPost($location, $business_id) * * Create Location * - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLocationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLocationModel, HTTP status code, HTTP response headers (array of strings) */ - public function auLocationPostWithHttpInfo($location, $business_id) + public function auLocationPostWithHttpInfo($business_id, $location, string $contentType = self::contentTypes['auLocationPost'][0]) { - $returnType = '\Swagger\Client\Model\AuLocationModel'; - $request = $this->auLocationPostRequest($location, $business_id); + $request = $this->auLocationPostRequest($business_id, $location, $contentType); try { $options = $this->createHttpClientOption(); @@ -1317,9 +1486,16 @@ public function auLocationPostWithHttpInfo($location, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1330,19 +1506,37 @@ public function auLocationPostWithHttpInfo($location, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLocationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLocationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLocationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLocationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1359,7 +1553,7 @@ public function auLocationPostWithHttpInfo($location, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLocationModel', + '\OpenAPI\Client\Model\AuLocationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1374,15 +1568,16 @@ public function auLocationPostWithHttpInfo($location, $business_id) * * Create Location * - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationPostAsync($location, $business_id) + public function auLocationPostAsync($business_id, $location, string $contentType = self::contentTypes['auLocationPost'][0]) { - return $this->auLocationPostAsyncWithHttpInfo($location, $business_id) + return $this->auLocationPostAsyncWithHttpInfo($business_id, $location, $contentType) ->then( function ($response) { return $response[0]; @@ -1395,26 +1590,26 @@ function ($response) { * * Create Location * - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationPostAsyncWithHttpInfo($location, $business_id) + public function auLocationPostAsyncWithHttpInfo($business_id, $location, string $contentType = self::contentTypes['auLocationPost'][0]) { - $returnType = '\Swagger\Client\Model\AuLocationModel'; - $request = $this->auLocationPostRequest($location, $business_id); + $returnType = '\OpenAPI\Client\Model\AuLocationModel'; + $request = $this->auLocationPostRequest($business_id, $location, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1437,7 +1632,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1446,20 +1641,16 @@ function ($exception) { /** * Create request for operation 'auLocationPost' * - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLocationPostRequest($location, $business_id) + public function auLocationPostRequest($business_id, $location, string $contentType = self::contentTypes['auLocationPost'][0]) { - // verify the required parameter 'location' is set - if ($location === null || (is_array($location) && count($location) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $location when calling auLocationPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1467,6 +1658,14 @@ protected function auLocationPostRequest($location, $business_id) ); } + // verify the required parameter 'location' is set + if ($location === null || (is_array($location) && count($location) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $location when calling auLocationPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/location'; $formParams = []; $queryParams = []; @@ -1475,6 +1674,7 @@ protected function auLocationPostRequest($location, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1484,56 +1684,42 @@ protected function auLocationPostRequest($location, $business_id) ); } - // body params - $_tempBody = null; - if (isset($location)) { - $_tempBody = $location; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($location)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($location)); + } else { + $httpBody = $location; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1554,10 +1740,11 @@ protected function auLocationPostRequest($location, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1569,16 +1756,17 @@ protected function auLocationPostRequest($location, $business_id) * Update Location * * @param int $id id (required) - * @param \Swagger\Client\Model\AuLocationModel $location location (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auLocationPut($id, $location, $business_id) + public function auLocationPut($id, $business_id, $location, string $contentType = self::contentTypes['auLocationPut'][0]) { - $this->auLocationPutWithHttpInfo($id, $location, $business_id); + $this->auLocationPutWithHttpInfo($id, $business_id, $location, $contentType); } /** @@ -1587,17 +1775,17 @@ public function auLocationPut($id, $location, $business_id) * Update Location * * @param int $id (required) - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auLocationPutWithHttpInfo($id, $location, $business_id) + public function auLocationPutWithHttpInfo($id, $business_id, $location, string $contentType = self::contentTypes['auLocationPut'][0]) { - $returnType = ''; - $request = $this->auLocationPutRequest($id, $location, $business_id); + $request = $this->auLocationPutRequest($id, $business_id, $location, $contentType); try { $options = $this->createHttpClientOption(); @@ -1606,9 +1794,16 @@ public function auLocationPutWithHttpInfo($id, $location, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1619,11 +1814,11 @@ public function auLocationPutWithHttpInfo($id, $location, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1642,15 +1837,16 @@ public function auLocationPutWithHttpInfo($id, $location, $business_id) * Update Location * * @param int $id (required) - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationPutAsync($id, $location, $business_id) + public function auLocationPutAsync($id, $business_id, $location, string $contentType = self::contentTypes['auLocationPut'][0]) { - return $this->auLocationPutAsyncWithHttpInfo($id, $location, $business_id) + return $this->auLocationPutAsyncWithHttpInfo($id, $business_id, $location, $contentType) ->then( function ($response) { return $response[0]; @@ -1664,16 +1860,17 @@ function ($response) { * Update Location * * @param int $id (required) - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auLocationPutAsyncWithHttpInfo($id, $location, $business_id) + public function auLocationPutAsyncWithHttpInfo($id, $business_id, $location, string $contentType = self::contentTypes['auLocationPut'][0]) { $returnType = ''; - $request = $this->auLocationPutRequest($id, $location, $business_id); + $request = $this->auLocationPutRequest($id, $business_id, $location, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1692,7 +1889,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1702,26 +1899,23 @@ function ($exception) { * Create request for operation 'auLocationPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuLocationModel $location (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuLocationModel $location (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auLocationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auLocationPutRequest($id, $location, $business_id) + public function auLocationPutRequest($id, $business_id, $location, string $contentType = self::contentTypes['auLocationPut'][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 auLocationPut' ); } - // verify the required parameter 'location' is set - if ($location === null || (is_array($location) && count($location) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $location when calling auLocationPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1729,6 +1923,14 @@ protected function auLocationPutRequest($id, $location, $business_id) ); } + // verify the required parameter 'location' is set + if ($location === null || (is_array($location) && count($location) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $location when calling auLocationPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/location/{id}'; $formParams = []; $queryParams = []; @@ -1737,6 +1939,7 @@ protected function auLocationPutRequest($id, $location, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1754,56 +1957,42 @@ protected function auLocationPutRequest($id, $location, $business_id) ); } - // body params - $_tempBody = null; - if (isset($location)) { - $_tempBody = $location; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($location)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($location)); + } else { + $httpBody = $location; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1824,10 +2013,11 @@ protected function auLocationPutRequest($id, $location, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/LookupDataApi.php b/src/lib/Api/LookupDataApi.php index 97889c5..8d1ab42 100644 --- a/src/lib/Api/LookupDataApi.php +++ b/src/lib/Api/LookupDataApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'lookupDataEmployeeGroupPermissions' => [ + 'application/json', + ], + 'lookupDataGenders' => [ + 'application/json', + ], + 'lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones' => [ + 'application/json', + ], + 'lookupDataIndustries' => [ + 'application/json', + ], + 'lookupDataReports' => [ + 'application/json', + ], + 'lookupDataTimeZones' => [ + '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 + 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; } /** @@ -92,14 +145,15 @@ public function getConfig() * * List countries * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataCountries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NameIdPair[] + * @return \OpenAPI\Client\Model\NameIdPair[] */ - public function lookupDataCountries() + public function lookupDataCountries(string $contentType = self::contentTypes['lookupDataCountries'][0]) { - list($response) = $this->lookupDataCountriesWithHttpInfo(); + list($response) = $this->lookupDataCountriesWithHttpInfo($contentType); return $response; } @@ -108,15 +162,15 @@ public function lookupDataCountries() * * List countries * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataCountries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataCountriesWithHttpInfo() + public function lookupDataCountriesWithHttpInfo(string $contentType = self::contentTypes['lookupDataCountries'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataCountriesRequest(); + $request = $this->lookupDataCountriesRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -125,9 +179,16 @@ public function lookupDataCountriesWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -138,19 +199,37 @@ public function lookupDataCountriesWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NameIdPair[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NameIdPair[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NameIdPair[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -167,7 +246,7 @@ public function lookupDataCountriesWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NameIdPair[]', + '\OpenAPI\Client\Model\NameIdPair[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -182,13 +261,14 @@ public function lookupDataCountriesWithHttpInfo() * * List countries * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataCountries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataCountriesAsync() + public function lookupDataCountriesAsync(string $contentType = self::contentTypes['lookupDataCountries'][0]) { - return $this->lookupDataCountriesAsyncWithHttpInfo() + return $this->lookupDataCountriesAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -201,24 +281,24 @@ function ($response) { * * List countries * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataCountries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataCountriesAsyncWithHttpInfo() + public function lookupDataCountriesAsyncWithHttpInfo(string $contentType = self::contentTypes['lookupDataCountries'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataCountriesRequest(); + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; + $request = $this->lookupDataCountriesRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -241,7 +321,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -250,13 +330,15 @@ function ($exception) { /** * Create request for operation 'lookupDataCountries' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataCountries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataCountriesRequest() + public function lookupDataCountriesRequest(string $contentType = self::contentTypes['lookupDataCountries'][0]) { + $resourcePath = '/api/v2/lookupdata/countries'; $formParams = []; $queryParams = []; @@ -266,53 +348,36 @@ protected function lookupDataCountriesRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -333,10 +398,11 @@ protected function lookupDataCountriesRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -347,14 +413,15 @@ protected function lookupDataCountriesRequest() * * List Employee Group Permission Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataEmployeeGroupPermissions'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NameIdPair[] + * @return \OpenAPI\Client\Model\NameIdPair[] */ - public function lookupDataEmployeeGroupPermissions() + public function lookupDataEmployeeGroupPermissions(string $contentType = self::contentTypes['lookupDataEmployeeGroupPermissions'][0]) { - list($response) = $this->lookupDataEmployeeGroupPermissionsWithHttpInfo(); + list($response) = $this->lookupDataEmployeeGroupPermissionsWithHttpInfo($contentType); return $response; } @@ -363,15 +430,15 @@ public function lookupDataEmployeeGroupPermissions() * * List Employee Group Permission Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataEmployeeGroupPermissions'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataEmployeeGroupPermissionsWithHttpInfo() + public function lookupDataEmployeeGroupPermissionsWithHttpInfo(string $contentType = self::contentTypes['lookupDataEmployeeGroupPermissions'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataEmployeeGroupPermissionsRequest(); + $request = $this->lookupDataEmployeeGroupPermissionsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -380,9 +447,16 @@ public function lookupDataEmployeeGroupPermissionsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -393,19 +467,37 @@ public function lookupDataEmployeeGroupPermissionsWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NameIdPair[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NameIdPair[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NameIdPair[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -422,7 +514,7 @@ public function lookupDataEmployeeGroupPermissionsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NameIdPair[]', + '\OpenAPI\Client\Model\NameIdPair[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -437,13 +529,14 @@ public function lookupDataEmployeeGroupPermissionsWithHttpInfo() * * List Employee Group Permission Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataEmployeeGroupPermissions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataEmployeeGroupPermissionsAsync() + public function lookupDataEmployeeGroupPermissionsAsync(string $contentType = self::contentTypes['lookupDataEmployeeGroupPermissions'][0]) { - return $this->lookupDataEmployeeGroupPermissionsAsyncWithHttpInfo() + return $this->lookupDataEmployeeGroupPermissionsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -456,24 +549,24 @@ function ($response) { * * List Employee Group Permission Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataEmployeeGroupPermissions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataEmployeeGroupPermissionsAsyncWithHttpInfo() + public function lookupDataEmployeeGroupPermissionsAsyncWithHttpInfo(string $contentType = self::contentTypes['lookupDataEmployeeGroupPermissions'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataEmployeeGroupPermissionsRequest(); + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; + $request = $this->lookupDataEmployeeGroupPermissionsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -496,7 +589,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -505,13 +598,15 @@ function ($exception) { /** * Create request for operation 'lookupDataEmployeeGroupPermissions' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataEmployeeGroupPermissions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataEmployeeGroupPermissionsRequest() + public function lookupDataEmployeeGroupPermissionsRequest(string $contentType = self::contentTypes['lookupDataEmployeeGroupPermissions'][0]) { + $resourcePath = '/api/v2/lookupdata/employeegrouppermissions'; $formParams = []; $queryParams = []; @@ -521,53 +616,36 @@ protected function lookupDataEmployeeGroupPermissionsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -588,10 +666,11 @@ protected function lookupDataEmployeeGroupPermissionsRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -602,14 +681,15 @@ protected function lookupDataEmployeeGroupPermissionsRequest() * * List gender options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGenders'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string[] */ - public function lookupDataGenders() + public function lookupDataGenders(string $contentType = self::contentTypes['lookupDataGenders'][0]) { - list($response) = $this->lookupDataGendersWithHttpInfo(); + list($response) = $this->lookupDataGendersWithHttpInfo($contentType); return $response; } @@ -618,15 +698,15 @@ public function lookupDataGenders() * * List gender options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGenders'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataGendersWithHttpInfo() + public function lookupDataGendersWithHttpInfo(string $contentType = self::contentTypes['lookupDataGenders'][0]) { - $returnType = 'string[]'; - $request = $this->lookupDataGendersRequest(); + $request = $this->lookupDataGendersRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -635,9 +715,16 @@ public function lookupDataGendersWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -648,19 +735,37 @@ public function lookupDataGendersWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $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 = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -692,13 +797,14 @@ public function lookupDataGendersWithHttpInfo() * * List gender options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGenders'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataGendersAsync() + public function lookupDataGendersAsync(string $contentType = self::contentTypes['lookupDataGenders'][0]) { - return $this->lookupDataGendersAsyncWithHttpInfo() + return $this->lookupDataGendersAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -711,24 +817,24 @@ function ($response) { * * List gender options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGenders'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataGendersAsyncWithHttpInfo() + public function lookupDataGendersAsyncWithHttpInfo(string $contentType = self::contentTypes['lookupDataGenders'][0]) { $returnType = 'string[]'; - $request = $this->lookupDataGendersRequest(); + $request = $this->lookupDataGendersRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -751,7 +857,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -760,13 +866,15 @@ function ($exception) { /** * Create request for operation 'lookupDataGenders' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGenders'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataGendersRequest() + public function lookupDataGendersRequest(string $contentType = self::contentTypes['lookupDataGenders'][0]) { + $resourcePath = '/api/v2/lookupdata/genders'; $formParams = []; $queryParams = []; @@ -776,53 +884,36 @@ protected function lookupDataGendersRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -843,10 +934,11 @@ protected function lookupDataGendersRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -858,14 +950,15 @@ protected function lookupDataGendersRequest() * List Time Zone Types * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NameIdPair[] + * @return \OpenAPI\Client\Model\NameIdPair[] */ - public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones($business_id) + public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones($business_id, string $contentType = self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'][0]) { - list($response) = $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHttpInfo($business_id); + list($response) = $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHttpInfo($business_id, $contentType); return $response; } @@ -875,15 +968,15 @@ public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones($busin * List Time Zone Types * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHttpInfo($business_id) + public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHttpInfo($business_id, string $contentType = self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequest($business_id); + $request = $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -892,9 +985,16 @@ public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHtt } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -905,19 +1005,37 @@ public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHtt sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NameIdPair[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NameIdPair[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NameIdPair[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -934,7 +1052,7 @@ public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHtt case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NameIdPair[]', + '\OpenAPI\Client\Model\NameIdPair[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -950,13 +1068,14 @@ public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesWithHtt * List Time Zone Types * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesAsync($business_id) + public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesAsync($business_id, string $contentType = self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'][0]) { - return $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesAsyncWithHttpInfo($business_id) + return $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -970,24 +1089,24 @@ function ($response) { * List Time Zone Types * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesAsyncWithHttpInfo($business_id) + public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; + $request = $this->lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1010,7 +1129,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1020,12 +1139,14 @@ function ($exception) { * Create request for operation 'lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequest($business_id) + public function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequest($business_id, string $contentType = self::contentTypes['lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezones'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1033,6 +1154,7 @@ protected function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequ ); } + $resourcePath = '/api/v2/business/{businessId}/lookupdata/timezones'; $formParams = []; $queryParams = []; @@ -1041,6 +1163,7 @@ protected function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1050,53 +1173,35 @@ protected function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1117,10 +1222,11 @@ protected function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1131,14 +1237,15 @@ protected function lookupDataGetApiV2BusinessByBusinessIdLookupdataTimezonesRequ * * List industry options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataIndustries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string[] */ - public function lookupDataIndustries() + public function lookupDataIndustries(string $contentType = self::contentTypes['lookupDataIndustries'][0]) { - list($response) = $this->lookupDataIndustriesWithHttpInfo(); + list($response) = $this->lookupDataIndustriesWithHttpInfo($contentType); return $response; } @@ -1147,15 +1254,15 @@ public function lookupDataIndustries() * * List industry options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataIndustries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataIndustriesWithHttpInfo() + public function lookupDataIndustriesWithHttpInfo(string $contentType = self::contentTypes['lookupDataIndustries'][0]) { - $returnType = 'string[]'; - $request = $this->lookupDataIndustriesRequest(); + $request = $this->lookupDataIndustriesRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1164,9 +1271,16 @@ public function lookupDataIndustriesWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1177,19 +1291,37 @@ public function lookupDataIndustriesWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $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 = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1221,13 +1353,14 @@ public function lookupDataIndustriesWithHttpInfo() * * List industry options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataIndustries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataIndustriesAsync() + public function lookupDataIndustriesAsync(string $contentType = self::contentTypes['lookupDataIndustries'][0]) { - return $this->lookupDataIndustriesAsyncWithHttpInfo() + return $this->lookupDataIndustriesAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1240,24 +1373,24 @@ function ($response) { * * List industry options * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataIndustries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataIndustriesAsyncWithHttpInfo() + public function lookupDataIndustriesAsyncWithHttpInfo(string $contentType = self::contentTypes['lookupDataIndustries'][0]) { $returnType = 'string[]'; - $request = $this->lookupDataIndustriesRequest(); + $request = $this->lookupDataIndustriesRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1280,7 +1413,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1289,13 +1422,15 @@ function ($exception) { /** * Create request for operation 'lookupDataIndustries' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataIndustries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataIndustriesRequest() + public function lookupDataIndustriesRequest(string $contentType = self::contentTypes['lookupDataIndustries'][0]) { + $resourcePath = '/api/v2/lookupdata/industries'; $formParams = []; $queryParams = []; @@ -1305,53 +1440,36 @@ protected function lookupDataIndustriesRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1372,10 +1490,11 @@ protected function lookupDataIndustriesRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1386,14 +1505,15 @@ protected function lookupDataIndustriesRequest() * * List Report Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataReports'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NameIdPair[] + * @return \OpenAPI\Client\Model\NameIdPair[] */ - public function lookupDataReports() + public function lookupDataReports(string $contentType = self::contentTypes['lookupDataReports'][0]) { - list($response) = $this->lookupDataReportsWithHttpInfo(); + list($response) = $this->lookupDataReportsWithHttpInfo($contentType); return $response; } @@ -1402,15 +1522,15 @@ public function lookupDataReports() * * List Report Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataReports'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataReportsWithHttpInfo() + public function lookupDataReportsWithHttpInfo(string $contentType = self::contentTypes['lookupDataReports'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataReportsRequest(); + $request = $this->lookupDataReportsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1419,9 +1539,16 @@ public function lookupDataReportsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1432,19 +1559,37 @@ public function lookupDataReportsWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NameIdPair[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NameIdPair[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NameIdPair[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1461,7 +1606,7 @@ public function lookupDataReportsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NameIdPair[]', + '\OpenAPI\Client\Model\NameIdPair[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1476,13 +1621,14 @@ public function lookupDataReportsWithHttpInfo() * * List Report Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataReports'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataReportsAsync() + public function lookupDataReportsAsync(string $contentType = self::contentTypes['lookupDataReports'][0]) { - return $this->lookupDataReportsAsyncWithHttpInfo() + return $this->lookupDataReportsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1495,24 +1641,24 @@ function ($response) { * * List Report Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataReports'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataReportsAsyncWithHttpInfo() + public function lookupDataReportsAsyncWithHttpInfo(string $contentType = self::contentTypes['lookupDataReports'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataReportsRequest(); + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; + $request = $this->lookupDataReportsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1535,7 +1681,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1544,13 +1690,15 @@ function ($exception) { /** * Create request for operation 'lookupDataReports' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataReports'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataReportsRequest() + public function lookupDataReportsRequest(string $contentType = self::contentTypes['lookupDataReports'][0]) { + $resourcePath = '/api/v2/lookupdata/reports'; $formParams = []; $queryParams = []; @@ -1560,53 +1708,36 @@ protected function lookupDataReportsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1627,10 +1758,11 @@ protected function lookupDataReportsRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1641,14 +1773,15 @@ protected function lookupDataReportsRequest() * * List Time Zone Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataTimeZones'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NameIdPair[] + * @return \OpenAPI\Client\Model\NameIdPair[] */ - public function lookupDataTimeZones() + public function lookupDataTimeZones(string $contentType = self::contentTypes['lookupDataTimeZones'][0]) { - list($response) = $this->lookupDataTimeZonesWithHttpInfo(); + list($response) = $this->lookupDataTimeZonesWithHttpInfo($contentType); return $response; } @@ -1657,15 +1790,15 @@ public function lookupDataTimeZones() * * List Time Zone Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataTimeZones'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NameIdPair[], HTTP status code, HTTP response headers (array of strings) */ - public function lookupDataTimeZonesWithHttpInfo() + public function lookupDataTimeZonesWithHttpInfo(string $contentType = self::contentTypes['lookupDataTimeZones'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataTimeZonesRequest(); + $request = $this->lookupDataTimeZonesRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1674,9 +1807,16 @@ public function lookupDataTimeZonesWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1687,19 +1827,37 @@ public function lookupDataTimeZonesWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NameIdPair[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NameIdPair[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NameIdPair[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1716,7 +1874,7 @@ public function lookupDataTimeZonesWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NameIdPair[]', + '\OpenAPI\Client\Model\NameIdPair[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1731,13 +1889,14 @@ public function lookupDataTimeZonesWithHttpInfo() * * List Time Zone Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataTimeZones'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataTimeZonesAsync() + public function lookupDataTimeZonesAsync(string $contentType = self::contentTypes['lookupDataTimeZones'][0]) { - return $this->lookupDataTimeZonesAsyncWithHttpInfo() + return $this->lookupDataTimeZonesAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1750,24 +1909,24 @@ function ($response) { * * List Time Zone Types * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataTimeZones'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function lookupDataTimeZonesAsyncWithHttpInfo() + public function lookupDataTimeZonesAsyncWithHttpInfo(string $contentType = self::contentTypes['lookupDataTimeZones'][0]) { - $returnType = '\Swagger\Client\Model\NameIdPair[]'; - $request = $this->lookupDataTimeZonesRequest(); + $returnType = '\OpenAPI\Client\Model\NameIdPair[]'; + $request = $this->lookupDataTimeZonesRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1790,7 +1949,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1799,13 +1958,15 @@ function ($exception) { /** * Create request for operation 'lookupDataTimeZones' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDataTimeZones'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function lookupDataTimeZonesRequest() + public function lookupDataTimeZonesRequest(string $contentType = self::contentTypes['lookupDataTimeZones'][0]) { + $resourcePath = '/api/v2/lookupdata/timezones'; $formParams = []; $queryParams = []; @@ -1815,53 +1976,36 @@ protected function lookupDataTimeZonesRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1882,10 +2026,11 @@ protected function lookupDataTimeZonesRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/ManagerApi.php b/src/lib/Api/ManagerApi.php index 7ecccfd..699ee27 100644 --- a/src/lib/Api/ManagerApi.php +++ b/src/lib/Api/ManagerApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerEmployeeTimesheetApprove' => [ + 'application/json', + ], + 'auManagerEmployeeTimesheetDelete' => [ + 'application/json', + ], + 'auManagerEmployeeTimesheetEdit' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerEmployeeTimesheetGet' => [ + 'application/json', + ], + 'auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId' => [ + 'application/json', + ], + 'auManagerEmployeeTimesheetReject' => [ + 'application/json', + ], + 'auManagerKioskPostIndividual' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerKioskPutIndividual' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerKioskPutIndividualComments' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerRosterShiftGet' => [ + 'application/json', + ], + 'auManagerRosterShiftGetLeaveEmployees' => [ + 'application/json', + ], + 'auManagerRosterShiftGetLocations' => [ + 'application/json', + ], + 'auManagerRosterShiftGetManageEmployees' => [ + 'application/json', + ], + 'auManagerRosterShiftGetRoles' => [ + 'application/json', + ], + 'auManagerRosterShiftGetRosterShift' => [ + 'application/json', + ], + 'auManagerRosterShiftManageRosterData' => [ + 'application/json', + ], + 'auManagerRosterShiftMatchingClockOffRosterShift' => [ + 'application/json', + ], + 'auManagerRosterShiftMatchingClockOnRosterShift' => [ + 'application/json', + ], + 'auManagerRosterShiftNearbyRosterShifts' => [ + 'application/json', + ], + 'auManagerRosterShiftPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerRosterShiftPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerRosterShiftStubShiftTimesheets' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerSecurityBusinesses' => [ + 'application/json', + ], + 'auManagerTimeAndAttendanceGetLookupData' => [ + 'application/json', + ], + 'auManagerTimeAndAttendanceShifts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerTimesheetPostIndividual' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auManagerTimesheetPutIndividual' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceAddNote' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceChangePin' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceCheckId' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceCheckPin' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceClockOff' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceClockOn' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceDeleteNote' => [ + 'application/json', + ], + 'genericManagerTimeAndAttendanceDiscardShift' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceEmailReset' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceEndBreak' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceGetShiftNotes' => [ + 'application/json', + ], + 'genericManagerTimeAndAttendanceGetStaff' => [ + 'application/json', + ], + 'genericManagerTimeAndAttendanceMarkNotesRead' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendancePostStaff' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceSmsReset' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimeAndAttendanceStartBreak' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericManagerTimesheetGet' => [ + 'application/json', + ], + 'genericManagerTimesheetGetEmployeeGroups' => [ + 'application/json', + ], + 'genericManagerTimesheetGetLocations' => [ + 'application/json', + ], + 'genericManagerTimesheetGetTimesheetEmployees' => [ + 'application/json', + ], + 'managerDocumentDownload' => [ + 'application/json', + ], + 'managerEmployeeExpenseApprove' => [ + 'application/json', + ], + 'managerEmployeeExpenseCreate' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeExpenseDecline' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeExpenseDelete' => [ + 'application/json', + ], + 'managerEmployeeExpenseEdit' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeExpenseGet' => [ + 'application/json', + ], + 'managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId' => [ + 'application/json', + ], + 'managerEmployeeExpenseUploadAttachment' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestApprove' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestAttachment' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestBalances' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestCreateLeave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeLeaveRequestDecline' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeLeaveRequestDelete' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestEstimate' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestGet' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestGetLeaveCategories' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestOverlappingLeave' => [ + 'application/json', + ], + 'managerEmployeeLeaveRequestUpdateLeave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeProfileImageDelete' => [ + 'application/json', + ], + 'managerEmployeeProfileImageGet' => [ + 'application/json', + ], + 'managerEmployeeProfileImagePost' => [ + 'application/json', + ], + 'managerEmployeeRosterShiftCreate' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerEmployeeRosterShiftDelete' => [ + 'application/json', + ], + 'managerEmployeeRosterShiftSave' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'managerExpenseGet' => [ + 'application/json', + ], + 'managerExpenseGetExpenseCategories' => [ + 'application/json', + ], + 'managerExpenseGetExpensesEmployees' => [ + 'application/json', + ], + 'managerExpenseGetLocations' => [ + 'application/json', + ], + 'managerExpenseGetTaxCodes' => [ + 'application/json', + ], + 'managerGetDashboard' => [ + 'application/json', + ], + 'managerGetEmployees' => [ + 'application/json', + ], + 'managerGetLocations' => [ + 'application/json', + ], + 'managerKioskGet' => [ + 'application/json', + ], + 'managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet' => [ + 'application/json', + ], + 'managerKioskKiosks' => [ + 'application/json', + ], + 'managerLeaveRequestGetLeaveCategories' => [ + 'application/json', + ], + 'managerLeaveRequestGetLeaveEmployees' => [ + 'application/json', + ], + 'managerLeaveRequestGetLocations' => [ + 'application/json', + ], + 'managerLeaveRequestListLeaveRequests' => [ + 'application/json', + ], + 'managerLeaveRequestOverlappingLeave' => [ + 'application/json', + ], + 'managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation' => [ + 'application/json', + ], + 'managerLocationGetLocations' => [ + 'application/json', + ], + 'managerRoundingRulesGetRoundingRules' => [ + 'application/json', + ], + 'managerRoundingRulesSetRoundingRules' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -92,16 +538,17 @@ public function getConfig() * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auManagerEmployeeOnboardingManagerInitiateSelfService($model, $business_id) + public function auManagerEmployeeOnboardingManagerInitiateSelfService($business_id, $model, string $contentType = self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'][0]) { - $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInfo($model, $business_id); + $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInfo($business_id, $model, $contentType); } /** @@ -109,17 +556,17 @@ public function auManagerEmployeeOnboardingManagerInitiateSelfService($model, $b * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInfo($model, $business_id) + public function auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'][0]) { - $returnType = ''; - $request = $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest($model, $business_id); + $request = $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +575,16 @@ public function auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInf } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +595,11 @@ public function auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInf sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -163,15 +617,16 @@ public function auManagerEmployeeOnboardingManagerInitiateSelfServiceWithHttpInf * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeOnboardingManagerInitiateSelfServiceAsync($model, $business_id) + public function auManagerEmployeeOnboardingManagerInitiateSelfServiceAsync($business_id, $model, string $contentType = self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'][0]) { - return $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceAsyncWithHttpInfo($model, $business_id) + return $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -184,16 +639,17 @@ function ($response) { * * Initiate Employee Self Setup * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeOnboardingManagerInitiateSelfServiceAsyncWithHttpInfo($model, $business_id) + public function auManagerEmployeeOnboardingManagerInitiateSelfServiceAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'][0]) { $returnType = ''; - $request = $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest($model, $business_id); + $request = $this->auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +668,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -221,20 +677,16 @@ function ($exception) { /** * Create request for operation 'auManagerEmployeeOnboardingManagerInitiateSelfService' * - * @param \Swagger\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuInitiateEmployeeOnboardingApiModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest($model, $business_id) + public function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest($business_id, $model, string $contentType = self::contentTypes['auManagerEmployeeOnboardingManagerInitiateSelfService'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auManagerEmployeeOnboardingManagerInitiateSelfService' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +694,14 @@ protected function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest( ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auManagerEmployeeOnboardingManagerInitiateSelfService' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/employeeonboarding/initiateselfservice'; $formParams = []; $queryParams = []; @@ -250,6 +710,7 @@ protected function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest( $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -259,56 +720,42 @@ protected function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest( ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -329,10 +776,11 @@ protected function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest( $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -346,14 +794,15 @@ protected function auManagerEmployeeOnboardingManagerInitiateSelfServiceRequest( * @param int $employee_id employee_id (required) * @param int $timesheet_id timesheet_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerTimesheetLineModel + * @return \OpenAPI\Client\Model\ManagerTimesheetLineModel */ - public function auManagerEmployeeTimesheetApprove($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetApprove($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetApprove'][0]) { - list($response) = $this->auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $timesheet_id, $business_id); + list($response) = $this->auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType); return $response; } @@ -365,15 +814,15 @@ public function auManagerEmployeeTimesheetApprove($employee_id, $timesheet_id, $ * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetApprove'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetApproveRequest($employee_id, $timesheet_id, $business_id); + $request = $this->auManagerEmployeeTimesheetApproveRequest($employee_id, $timesheet_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -382,9 +831,16 @@ public function auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $tim } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -395,19 +851,37 @@ public function auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $tim sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -424,7 +898,7 @@ public function auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $tim case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerTimesheetLineModel', + '\OpenAPI\Client\Model\ManagerTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -442,13 +916,14 @@ public function auManagerEmployeeTimesheetApproveWithHttpInfo($employee_id, $tim * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetApproveAsync($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetApproveAsync($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetApprove'][0]) { - return $this->auManagerEmployeeTimesheetApproveAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + return $this->auManagerEmployeeTimesheetApproveAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -464,24 +939,24 @@ function ($response) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetApproveAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetApproveAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetApprove'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetApproveRequest($employee_id, $timesheet_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; + $request = $this->auManagerEmployeeTimesheetApproveRequest($employee_id, $timesheet_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -504,7 +979,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,24 +991,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeTimesheetApproveRequest($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetApproveRequest($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetApprove'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerEmployeeTimesheetApprove' ); } + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auManagerEmployeeTimesheetApprove' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -541,6 +1020,7 @@ protected function auManagerEmployeeTimesheetApproveRequest($employee_id, $times ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/timesheet/{timesheetId}/approve'; $formParams = []; $queryParams = []; @@ -549,6 +1029,7 @@ protected function auManagerEmployeeTimesheetApproveRequest($employee_id, $times $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -574,53 +1055,35 @@ protected function auManagerEmployeeTimesheetApproveRequest($employee_id, $times ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -641,10 +1104,11 @@ protected function auManagerEmployeeTimesheetApproveRequest($employee_id, $times $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -658,14 +1122,15 @@ protected function auManagerEmployeeTimesheetApproveRequest($employee_id, $times * @param int $employee_id employee_id (required) * @param int $timesheet_id timesheet_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auManagerEmployeeTimesheetDelete($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetDelete($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetDelete'][0]) { - $this->auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $timesheet_id, $business_id); + $this->auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType); } /** @@ -676,15 +1141,15 @@ public function auManagerEmployeeTimesheetDelete($employee_id, $timesheet_id, $b * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetDelete'][0]) { - $returnType = ''; - $request = $this->auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesheet_id, $business_id); + $request = $this->auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesheet_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -693,9 +1158,16 @@ public function auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $time } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -706,11 +1178,11 @@ public function auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $time sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -731,13 +1203,14 @@ public function auManagerEmployeeTimesheetDeleteWithHttpInfo($employee_id, $time * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetDeleteAsync($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetDeleteAsync($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetDelete'][0]) { - return $this->auManagerEmployeeTimesheetDeleteAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + return $this->auManagerEmployeeTimesheetDeleteAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -753,14 +1226,15 @@ function ($response) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetDeleteAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetDeleteAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetDelete'][0]) { $returnType = ''; - $request = $this->auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesheet_id, $business_id); + $request = $this->auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesheet_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -779,7 +1253,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -791,24 +1265,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetDelete'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerEmployeeTimesheetDelete' ); } + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auManagerEmployeeTimesheetDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -816,6 +1294,7 @@ protected function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesh ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/timesheet/{timesheetId}'; $formParams = []; $queryParams = []; @@ -824,6 +1303,7 @@ protected function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesh $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -849,53 +1329,35 @@ protected function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesh ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -916,10 +1378,11 @@ protected function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesh $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -932,16 +1395,17 @@ protected function auManagerEmployeeTimesheetDeleteRequest($employee_id, $timesh * * @param int $employee_id employee_id (required) * @param int $timesheet_id timesheet_id (required) - * @param \Swagger\Client\Model\ManagerTimesheetSubmitModel $timesheet timesheet (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ManagerTimesheetSubmitModel $timesheet timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetEdit'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerTimesheetLineModel + * @return \OpenAPI\Client\Model\ManagerTimesheetLineModel */ - public function auManagerEmployeeTimesheetEdit($employee_id, $timesheet_id, $timesheet, $business_id) + public function auManagerEmployeeTimesheetEdit($employee_id, $timesheet_id, $business_id, $timesheet, string $contentType = self::contentTypes['auManagerEmployeeTimesheetEdit'][0]) { - list($response) = $this->auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesheet_id, $timesheet, $business_id); + list($response) = $this->auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesheet_id, $business_id, $timesheet, $contentType); return $response; } @@ -952,17 +1416,17 @@ public function auManagerEmployeeTimesheetEdit($employee_id, $timesheet_id, $tim * * @param int $employee_id (required) * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetEdit'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesheet_id, $timesheet, $business_id) + public function auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesheet_id, $business_id, $timesheet, string $contentType = self::contentTypes['auManagerEmployeeTimesheetEdit'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetEditRequest($employee_id, $timesheet_id, $timesheet, $business_id); + $request = $this->auManagerEmployeeTimesheetEditRequest($employee_id, $timesheet_id, $business_id, $timesheet, $contentType); try { $options = $this->createHttpClientOption(); @@ -971,9 +1435,16 @@ public function auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesh } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -984,19 +1455,37 @@ public function auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesh sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1013,7 +1502,7 @@ public function auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesh case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerTimesheetLineModel', + '\OpenAPI\Client\Model\ManagerTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1030,15 +1519,16 @@ public function auManagerEmployeeTimesheetEditWithHttpInfo($employee_id, $timesh * * @param int $employee_id (required) * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetEditAsync($employee_id, $timesheet_id, $timesheet, $business_id) + public function auManagerEmployeeTimesheetEditAsync($employee_id, $timesheet_id, $business_id, $timesheet, string $contentType = self::contentTypes['auManagerEmployeeTimesheetEdit'][0]) { - return $this->auManagerEmployeeTimesheetEditAsyncWithHttpInfo($employee_id, $timesheet_id, $timesheet, $business_id) + return $this->auManagerEmployeeTimesheetEditAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, $timesheet, $contentType) ->then( function ($response) { return $response[0]; @@ -1053,26 +1543,26 @@ function ($response) { * * @param int $employee_id (required) * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetEditAsyncWithHttpInfo($employee_id, $timesheet_id, $timesheet, $business_id) + public function auManagerEmployeeTimesheetEditAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, $timesheet, string $contentType = self::contentTypes['auManagerEmployeeTimesheetEdit'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetEditRequest($employee_id, $timesheet_id, $timesheet, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; + $request = $this->auManagerEmployeeTimesheetEditRequest($employee_id, $timesheet_id, $business_id, $timesheet, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1095,7 +1585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1106,32 +1596,30 @@ function ($exception) { * * @param int $employee_id (required) * @param int $timesheet_id (required) - * @param \Swagger\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerTimesheetSubmitModel $timesheet (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeTimesheetEditRequest($employee_id, $timesheet_id, $timesheet, $business_id) + public function auManagerEmployeeTimesheetEditRequest($employee_id, $timesheet_id, $business_id, $timesheet, string $contentType = self::contentTypes['auManagerEmployeeTimesheetEdit'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerEmployeeTimesheetEdit' ); } + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auManagerEmployeeTimesheetEdit' ); } - // verify the required parameter 'timesheet' is set - if ($timesheet === null || (is_array($timesheet) && count($timesheet) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $timesheet when calling auManagerEmployeeTimesheetEdit' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1139,6 +1627,14 @@ protected function auManagerEmployeeTimesheetEditRequest($employee_id, $timeshee ); } + // verify the required parameter 'timesheet' is set + if ($timesheet === null || (is_array($timesheet) && count($timesheet) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $timesheet when calling auManagerEmployeeTimesheetEdit' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/timesheet/{timesheetId}'; $formParams = []; $queryParams = []; @@ -1147,6 +1643,7 @@ protected function auManagerEmployeeTimesheetEditRequest($employee_id, $timeshee $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1172,56 +1669,42 @@ protected function auManagerEmployeeTimesheetEditRequest($employee_id, $timeshee ); } - // body params - $_tempBody = null; - if (isset($timesheet)) { - $_tempBody = $timesheet; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($timesheet)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($timesheet)); + } else { + $httpBody = $timesheet; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1242,10 +1725,11 @@ protected function auManagerEmployeeTimesheetEditRequest($employee_id, $timeshee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1258,14 +1742,15 @@ protected function auManagerEmployeeTimesheetEditRequest($employee_id, $timeshee * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimesheetReferenceData + * @return \OpenAPI\Client\Model\AuTimesheetReferenceData */ - public function auManagerEmployeeTimesheetGet($employee_id, $business_id) + public function auManagerEmployeeTimesheetGet($employee_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGet'][0]) { - list($response) = $this->auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $business_id); + list($response) = $this->auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $business_id, $contentType); return $response; } @@ -1276,15 +1761,15 @@ public function auManagerEmployeeTimesheetGet($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimesheetReferenceData, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimesheetReferenceData, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $business_id) + public function auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuTimesheetReferenceData'; - $request = $this->auManagerEmployeeTimesheetGetRequest($employee_id, $business_id); + $request = $this->auManagerEmployeeTimesheetGetRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1293,9 +1778,16 @@ public function auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1306,19 +1798,37 @@ public function auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimesheetReferenceData' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimesheetReferenceData' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimesheetReferenceData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimesheetReferenceData'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1335,7 +1845,7 @@ public function auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimesheetReferenceData', + '\OpenAPI\Client\Model\AuTimesheetReferenceData', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1352,13 +1862,14 @@ public function auManagerEmployeeTimesheetGetWithHttpInfo($employee_id, $busines * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetGetAsync($employee_id, $business_id) + public function auManagerEmployeeTimesheetGetAsync($employee_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGet'][0]) { - return $this->auManagerEmployeeTimesheetGetAsyncWithHttpInfo($employee_id, $business_id) + return $this->auManagerEmployeeTimesheetGetAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1373,24 +1884,24 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetGetAsyncWithHttpInfo($employee_id, $business_id) + public function auManagerEmployeeTimesheetGetAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuTimesheetReferenceData'; - $request = $this->auManagerEmployeeTimesheetGetRequest($employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuTimesheetReferenceData'; + $request = $this->auManagerEmployeeTimesheetGetRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1413,7 +1924,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1424,18 +1935,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeTimesheetGetRequest($employee_id, $business_id) + public function auManagerEmployeeTimesheetGetRequest($employee_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGet'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerEmployeeTimesheetGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1443,6 +1957,7 @@ protected function auManagerEmployeeTimesheetGetRequest($employee_id, $business_ ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/timesheet/reference'; $formParams = []; $queryParams = []; @@ -1451,6 +1966,7 @@ protected function auManagerEmployeeTimesheetGetRequest($employee_id, $business_ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1468,53 +1984,35 @@ protected function auManagerEmployeeTimesheetGetRequest($employee_id, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1535,10 +2033,11 @@ protected function auManagerEmployeeTimesheetGetRequest($employee_id, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1552,14 +2051,15 @@ protected function auManagerEmployeeTimesheetGetRequest($employee_id, $business_ * @param int $employee_id employee_id (required) * @param int $timesheet_id timesheet_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerTimesheetLineModel + * @return \OpenAPI\Client\Model\ManagerTimesheetLineModel */ - public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'][0]) { - list($response) = $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdWithHttpInfo($employee_id, $timesheet_id, $business_id); + list($response) = $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType); return $response; } @@ -1571,15 +2071,15 @@ public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByE * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdRequest($employee_id, $timesheet_id, $business_id); + $request = $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdRequest($employee_id, $timesheet_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1588,9 +2088,16 @@ public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByE } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1601,19 +2108,37 @@ public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByE sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1630,7 +2155,7 @@ public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByE case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerTimesheetLineModel', + '\OpenAPI\Client\Model\ManagerTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1648,13 +2173,14 @@ public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByE * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdAsync($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdAsync($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'][0]) { - return $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + return $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1670,24 +2196,24 @@ function ($response) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdRequest($employee_id, $timesheet_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; + $request = $this->auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdRequest($employee_id, $timesheet_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1710,7 +2236,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1722,24 +2248,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdRequest($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetIdRequest($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId' ); } + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManagerByEmployeeIdTimesheetByTimesheetId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1747,6 +2277,7 @@ protected function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManager ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/timesheet/{timesheetId}'; $formParams = []; $queryParams = []; @@ -1755,6 +2286,7 @@ protected function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManager $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -1780,53 +2312,35 @@ protected function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManager ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1847,10 +2361,11 @@ protected function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManager $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1864,14 +2379,15 @@ protected function auManagerEmployeeTimesheetGetApiV2BusinessByBusinessIdManager * @param int $employee_id employee_id (required) * @param int $timesheet_id timesheet_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetReject'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerTimesheetLineModel + * @return \OpenAPI\Client\Model\ManagerTimesheetLineModel */ - public function auManagerEmployeeTimesheetReject($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetReject($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetReject'][0]) { - list($response) = $this->auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $timesheet_id, $business_id); + list($response) = $this->auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType); return $response; } @@ -1883,15 +2399,15 @@ public function auManagerEmployeeTimesheetReject($employee_id, $timesheet_id, $b * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetReject'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetReject'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetRejectRequest($employee_id, $timesheet_id, $business_id); + $request = $this->auManagerEmployeeTimesheetRejectRequest($employee_id, $timesheet_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1900,9 +2416,16 @@ public function auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $time } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1913,19 +2436,37 @@ public function auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $time sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1942,7 +2483,7 @@ public function auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $time case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerTimesheetLineModel', + '\OpenAPI\Client\Model\ManagerTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1960,13 +2501,14 @@ public function auManagerEmployeeTimesheetRejectWithHttpInfo($employee_id, $time * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetReject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetRejectAsync($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetRejectAsync($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetReject'][0]) { - return $this->auManagerEmployeeTimesheetRejectAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + return $this->auManagerEmployeeTimesheetRejectAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1982,24 +2524,24 @@ function ($response) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetReject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerEmployeeTimesheetRejectAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetRejectAsyncWithHttpInfo($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetReject'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetLineModel'; - $request = $this->auManagerEmployeeTimesheetRejectRequest($employee_id, $timesheet_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetLineModel'; + $request = $this->auManagerEmployeeTimesheetRejectRequest($employee_id, $timesheet_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2022,7 +2564,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2034,24 +2576,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $timesheet_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerEmployeeTimesheetReject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesheet_id, $business_id) + public function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesheet_id, $business_id, string $contentType = self::contentTypes['auManagerEmployeeTimesheetReject'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerEmployeeTimesheetReject' ); } + // verify the required parameter 'timesheet_id' is set if ($timesheet_id === null || (is_array($timesheet_id) && count($timesheet_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_id when calling auManagerEmployeeTimesheetReject' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2059,6 +2605,7 @@ protected function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesh ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/timesheet/{timesheetId}/reject'; $formParams = []; $queryParams = []; @@ -2067,6 +2614,7 @@ protected function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesh $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -2092,53 +2640,35 @@ protected function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesh ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2159,10 +2689,11 @@ protected function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesh $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2173,16 +2704,17 @@ protected function auManagerEmployeeTimesheetRejectRequest($employee_id, $timesh * * Create kiosk timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPostIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auManagerKioskPostIndividual($request, $business_id) + public function auManagerKioskPostIndividual($business_id, $request, string $contentType = self::contentTypes['auManagerKioskPostIndividual'][0]) { - list($response) = $this->auManagerKioskPostIndividualWithHttpInfo($request, $business_id); + list($response) = $this->auManagerKioskPostIndividualWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -2191,17 +2723,17 @@ public function auManagerKioskPostIndividual($request, $business_id) * * Create kiosk timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPostIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerKioskPostIndividualWithHttpInfo($request, $business_id) + public function auManagerKioskPostIndividualWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auManagerKioskPostIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerKioskPostIndividualRequest($request, $business_id); + $request = $this->auManagerKioskPostIndividualRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2210,9 +2742,16 @@ public function auManagerKioskPostIndividualWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2223,19 +2762,37 @@ public function auManagerKioskPostIndividualWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2252,7 +2809,7 @@ public function auManagerKioskPostIndividualWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2267,15 +2824,16 @@ public function auManagerKioskPostIndividualWithHttpInfo($request, $business_id) * * Create kiosk timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerKioskPostIndividualAsync($request, $business_id) + public function auManagerKioskPostIndividualAsync($business_id, $request, string $contentType = self::contentTypes['auManagerKioskPostIndividual'][0]) { - return $this->auManagerKioskPostIndividualAsyncWithHttpInfo($request, $business_id) + return $this->auManagerKioskPostIndividualAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2288,26 +2846,26 @@ function ($response) { * * Create kiosk timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerKioskPostIndividualAsyncWithHttpInfo($request, $business_id) + public function auManagerKioskPostIndividualAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auManagerKioskPostIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerKioskPostIndividualRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auManagerKioskPostIndividualRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2330,7 +2888,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2339,27 +2897,31 @@ function ($exception) { /** * Create request for operation 'auManagerKioskPostIndividual' * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerKioskPostIndividualRequest($request, $business_id) + public function auManagerKioskPostIndividualRequest($business_id, $request, string $contentType = self::contentTypes['auManagerKioskPostIndividual'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { + + // verify the required parameter 'business_id' is set + if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auManagerKioskPostIndividual' + 'Missing the required parameter $business_id when calling auManagerKioskPostIndividual' ); } - // verify the required parameter 'business_id' is set - if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { + + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $business_id when calling auManagerKioskPostIndividual' + 'Missing the required parameter $request when calling auManagerKioskPostIndividual' ); } + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/timesheet'; $formParams = []; $queryParams = []; @@ -2368,6 +2930,7 @@ protected function auManagerKioskPostIndividualRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2377,56 +2940,42 @@ protected function auManagerKioskPostIndividualRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2447,10 +2996,11 @@ protected function auManagerKioskPostIndividualRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2462,16 +3012,17 @@ protected function auManagerKioskPostIndividualRequest($request, $business_id) * Update kiosk timesheet line * * @param int $timesheet_line_id timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auManagerKioskPutIndividual($timesheet_line_id, $request, $business_id) + public function auManagerKioskPutIndividual($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividual'][0]) { - list($response) = $this->auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $request, $business_id); + list($response) = $this->auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $business_id, $request, $contentType); return $response; } @@ -2481,17 +3032,17 @@ public function auManagerKioskPutIndividual($timesheet_line_id, $request, $busin * Update kiosk timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $request, $business_id) + public function auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerKioskPutIndividualRequest($timesheet_line_id, $request, $business_id); + $request = $this->auManagerKioskPutIndividualRequest($timesheet_line_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2500,9 +3051,16 @@ public function auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $req } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2513,19 +3071,37 @@ public function auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $req sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2542,7 +3118,7 @@ public function auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $req case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2558,15 +3134,16 @@ public function auManagerKioskPutIndividualWithHttpInfo($timesheet_line_id, $req * Update kiosk timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerKioskPutIndividualAsync($timesheet_line_id, $request, $business_id) + public function auManagerKioskPutIndividualAsync($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividual'][0]) { - return $this->auManagerKioskPutIndividualAsyncWithHttpInfo($timesheet_line_id, $request, $business_id) + return $this->auManagerKioskPutIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2580,26 +3157,26 @@ function ($response) { * Update kiosk timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerKioskPutIndividualAsyncWithHttpInfo($timesheet_line_id, $request, $business_id) + public function auManagerKioskPutIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerKioskPutIndividualRequest($timesheet_line_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auManagerKioskPutIndividualRequest($timesheet_line_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2622,7 +3199,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2632,26 +3209,23 @@ function ($exception) { * Create request for operation 'auManagerKioskPutIndividual' * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerKioskPutIndividualRequest($timesheet_line_id, $request, $business_id) + public function auManagerKioskPutIndividualRequest($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividual'][0]) { + // verify the required parameter 'timesheet_line_id' is set if ($timesheet_line_id === null || (is_array($timesheet_line_id) && count($timesheet_line_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_line_id when calling auManagerKioskPutIndividual' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auManagerKioskPutIndividual' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2659,6 +3233,14 @@ protected function auManagerKioskPutIndividualRequest($timesheet_line_id, $reque ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auManagerKioskPutIndividual' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/timesheet/{timesheetLineId}'; $formParams = []; $queryParams = []; @@ -2667,6 +3249,7 @@ protected function auManagerKioskPutIndividualRequest($timesheet_line_id, $reque $multipart = false; + // path params if ($timesheet_line_id !== null) { $resourcePath = str_replace( @@ -2684,56 +3267,42 @@ protected function auManagerKioskPutIndividualRequest($timesheet_line_id, $reque ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2754,10 +3323,11 @@ protected function auManagerKioskPutIndividualRequest($timesheet_line_id, $reque $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2768,17 +3338,18 @@ protected function auManagerKioskPutIndividualRequest($timesheet_line_id, $reque * * Update comments in a timesheet * - * @param \Swagger\Client\Model\TimesheetLineCommentsModel $request request (required) * @param string $business_id business_id (required) * @param string $timesheet_line_id timesheet_line_id (required) + * @param \OpenAPI\Client\Model\TimesheetLineCommentsModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividualComments'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auManagerKioskPutIndividualComments($request, $business_id, $timesheet_line_id) + public function auManagerKioskPutIndividualComments($business_id, $timesheet_line_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividualComments'][0]) { - list($response) = $this->auManagerKioskPutIndividualCommentsWithHttpInfo($request, $business_id, $timesheet_line_id); + list($response) = $this->auManagerKioskPutIndividualCommentsWithHttpInfo($business_id, $timesheet_line_id, $request, $contentType); return $response; } @@ -2787,18 +3358,18 @@ public function auManagerKioskPutIndividualComments($request, $business_id, $tim * * Update comments in a timesheet * - * @param \Swagger\Client\Model\TimesheetLineCommentsModel $request (required) * @param string $business_id (required) * @param string $timesheet_line_id (required) + * @param \OpenAPI\Client\Model\TimesheetLineCommentsModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividualComments'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerKioskPutIndividualCommentsWithHttpInfo($request, $business_id, $timesheet_line_id) + public function auManagerKioskPutIndividualCommentsWithHttpInfo($business_id, $timesheet_line_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividualComments'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerKioskPutIndividualCommentsRequest($request, $business_id, $timesheet_line_id); + $request = $this->auManagerKioskPutIndividualCommentsRequest($business_id, $timesheet_line_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2807,9 +3378,16 @@ public function auManagerKioskPutIndividualCommentsWithHttpInfo($request, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2820,19 +3398,37 @@ public function auManagerKioskPutIndividualCommentsWithHttpInfo($request, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2849,7 +3445,7 @@ public function auManagerKioskPutIndividualCommentsWithHttpInfo($request, $busin case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2864,16 +3460,17 @@ public function auManagerKioskPutIndividualCommentsWithHttpInfo($request, $busin * * Update comments in a timesheet * - * @param \Swagger\Client\Model\TimesheetLineCommentsModel $request (required) * @param string $business_id (required) * @param string $timesheet_line_id (required) + * @param \OpenAPI\Client\Model\TimesheetLineCommentsModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividualComments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerKioskPutIndividualCommentsAsync($request, $business_id, $timesheet_line_id) + public function auManagerKioskPutIndividualCommentsAsync($business_id, $timesheet_line_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividualComments'][0]) { - return $this->auManagerKioskPutIndividualCommentsAsyncWithHttpInfo($request, $business_id, $timesheet_line_id) + return $this->auManagerKioskPutIndividualCommentsAsyncWithHttpInfo($business_id, $timesheet_line_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2886,27 +3483,27 @@ function ($response) { * * Update comments in a timesheet * - * @param \Swagger\Client\Model\TimesheetLineCommentsModel $request (required) * @param string $business_id (required) * @param string $timesheet_line_id (required) + * @param \OpenAPI\Client\Model\TimesheetLineCommentsModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividualComments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerKioskPutIndividualCommentsAsyncWithHttpInfo($request, $business_id, $timesheet_line_id) + public function auManagerKioskPutIndividualCommentsAsyncWithHttpInfo($business_id, $timesheet_line_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividualComments'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerKioskPutIndividualCommentsRequest($request, $business_id, $timesheet_line_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auManagerKioskPutIndividualCommentsRequest($business_id, $timesheet_line_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2929,7 +3526,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2938,27 +3535,24 @@ function ($exception) { /** * Create request for operation 'auManagerKioskPutIndividualComments' * - * @param \Swagger\Client\Model\TimesheetLineCommentsModel $request (required) * @param string $business_id (required) * @param string $timesheet_line_id (required) + * @param \OpenAPI\Client\Model\TimesheetLineCommentsModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerKioskPutIndividualComments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerKioskPutIndividualCommentsRequest($request, $business_id, $timesheet_line_id) + public function auManagerKioskPutIndividualCommentsRequest($business_id, $timesheet_line_id, $request, string $contentType = self::contentTypes['auManagerKioskPutIndividualComments'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auManagerKioskPutIndividualComments' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auManagerKioskPutIndividualComments' ); } + // verify the required parameter 'timesheet_line_id' is set if ($timesheet_line_id === null || (is_array($timesheet_line_id) && count($timesheet_line_id) === 0)) { throw new \InvalidArgumentException( @@ -2966,6 +3560,14 @@ protected function auManagerKioskPutIndividualCommentsRequest($request, $busines ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auManagerKioskPutIndividualComments' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/timesheetcomments/{timesheetLineId}'; $formParams = []; $queryParams = []; @@ -2974,6 +3576,7 @@ protected function auManagerKioskPutIndividualCommentsRequest($request, $busines $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2991,56 +3594,42 @@ protected function auManagerKioskPutIndividualCommentsRequest($request, $busines ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3061,10 +3650,11 @@ protected function auManagerKioskPutIndividualCommentsRequest($request, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3076,30 +3666,31 @@ protected function auManagerKioskPutIndividualCommentsRequest($request, $busines * Get Roster Shifts * * @param string $business_id business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[] - */ - public function auManagerRosterShiftGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) - { - list($response) = $this->auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings); + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param string $filter_shift_status filter_shift_status (optional) + * @param string[] $filter_shift_statuses filter_shift_statuses (optional) + * @param string[] $filter_selected_locations filter_selected_locations (optional) + * @param string[] $filter_selected_employees filter_selected_employees (optional) + * @param string[] $filter_selected_roles filter_selected_roles (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param int $filter_location_id filter_location_id (optional) + * @param int $filter_employee_group_id filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size filter_page_size (optional) + * @param int $filter_current_page filter_current_page (optional) + * @param bool $filter_include_warnings filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[] + */ + public function auManagerRosterShiftGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auManagerRosterShiftGet'][0]) + { + list($response) = $this->auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType); return $response; } @@ -3109,31 +3700,31 @@ public function auManagerRosterShiftGet($business_id, $filter_from_date = null, * Get Roster Shifts * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auManagerRosterShiftGet'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; - $request = $this->auManagerRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings); + $request = $this->auManagerRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType); try { $options = $this->createHttpClientOption(); @@ -3142,9 +3733,16 @@ public function auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_d } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3155,19 +3753,37 @@ public function auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_d sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3184,7 +3800,7 @@ public function auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_d case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[]', + '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3200,29 +3816,30 @@ public function auManagerRosterShiftGetWithHttpInfo($business_id, $filter_from_d * Get Roster Shifts * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auManagerRosterShiftGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auManagerRosterShiftGet'][0]) { - return $this->auManagerRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings) + return $this->auManagerRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType) ->then( function ($response) { return $response[0]; @@ -3236,40 +3853,40 @@ function ($response) { * Get Roster Shifts * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auManagerRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auManagerRosterShiftGet'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; - $request = $this->auManagerRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; + $request = $this->auManagerRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3292,7 +3909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3302,28 +3919,30 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftGet' * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auManagerRosterShiftGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auManagerRosterShiftGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3331,6 +3950,23 @@ protected function auManagerRosterShiftGetRequest($business_id, $filter_from_dat ); } + + + + + + + + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift'; $formParams = []; $queryParams = []; @@ -3339,81 +3975,150 @@ protected function auManagerRosterShiftGetRequest($business_id, $filter_from_dat $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_shift_status !== null) { - $queryParams['filter.shiftStatus'] = ObjectSerializer::toQueryValue($filter_shift_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_shift_status, + 'filter.shiftStatus', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if (is_array($filter_shift_statuses)) { - $queryParams['filter.shiftStatuses'] = $filter_shift_statuses; - } else - if ($filter_shift_statuses !== null) { - $queryParams['filter.shiftStatuses'] = ObjectSerializer::toQueryValue($filter_shift_statuses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_shift_statuses, + 'filter.shiftStatuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($filter_selected_locations)) { - $queryParams['filter.selectedLocations'] = $filter_selected_locations; - } else - if ($filter_selected_locations !== null) { - $queryParams['filter.selectedLocations'] = ObjectSerializer::toQueryValue($filter_selected_locations); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_selected_locations, + 'filter.selectedLocations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($filter_selected_employees)) { - $queryParams['filter.selectedEmployees'] = $filter_selected_employees; - } else - if ($filter_selected_employees !== null) { - $queryParams['filter.selectedEmployees'] = ObjectSerializer::toQueryValue($filter_selected_employees); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_selected_employees, + 'filter.selectedEmployees', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($filter_selected_roles)) { - $queryParams['filter.selectedRoles'] = $filter_selected_roles; - } else - if ($filter_selected_roles !== null) { - $queryParams['filter.selectedRoles'] = ObjectSerializer::toQueryValue($filter_selected_roles); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_selected_roles, + 'filter.selectedRoles', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_group_id !== null) { - $queryParams['filter.employeeGroupId'] = ObjectSerializer::toQueryValue($filter_employee_group_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_group_id, + 'filter.employeeGroupId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_unassigned_shifts_only !== null) { - $queryParams['filter.unassignedShiftsOnly'] = ObjectSerializer::toQueryValue($filter_unassigned_shifts_only); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_unassigned_shifts_only, + 'filter.unassignedShiftsOnly', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_select_all_roles !== null) { - $queryParams['filter.selectAllRoles'] = ObjectSerializer::toQueryValue($filter_select_all_roles); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_select_all_roles, + 'filter.selectAllRoles', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_exclude_shifts_overlapping_from_date !== null) { - $queryParams['filter.excludeShiftsOverlappingFromDate'] = ObjectSerializer::toQueryValue($filter_exclude_shifts_overlapping_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_exclude_shifts_overlapping_from_date, + 'filter.excludeShiftsOverlappingFromDate', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_page_size !== null) { - $queryParams['filter.pageSize'] = ObjectSerializer::toQueryValue($filter_page_size); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_page_size, + 'filter.pageSize', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_current_page !== null) { - $queryParams['filter.currentPage'] = ObjectSerializer::toQueryValue($filter_current_page); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_current_page, + 'filter.currentPage', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_include_warnings !== null) { - $queryParams['filter.includeWarnings'] = ObjectSerializer::toQueryValue($filter_include_warnings); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_include_warnings, + 'filter.includeWarnings', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -3424,53 +4129,35 @@ protected function auManagerRosterShiftGetRequest($business_id, $filter_from_dat ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3491,10 +4178,11 @@ protected function auManagerRosterShiftGetRequest($business_id, $filter_from_dat $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3506,14 +4194,15 @@ protected function auManagerRosterShiftGetRequest($business_id, $filter_from_dat * List Roster Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLeaveEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerRosterEmployeeModel[] + * @return \OpenAPI\Client\Model\ManagerRosterEmployeeModel[] */ - public function auManagerRosterShiftGetLeaveEmployees($business_id) + public function auManagerRosterShiftGetLeaveEmployees($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLeaveEmployees'][0]) { - list($response) = $this->auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id); + list($response) = $this->auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id, $contentType); return $response; } @@ -3523,15 +4212,15 @@ public function auManagerRosterShiftGetLeaveEmployees($business_id) * List Roster Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLeaveEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerRosterEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerRosterEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id) + public function auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLeaveEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerRosterEmployeeModel[]'; - $request = $this->auManagerRosterShiftGetLeaveEmployeesRequest($business_id); + $request = $this->auManagerRosterShiftGetLeaveEmployeesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3540,9 +4229,16 @@ public function auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3553,19 +4249,37 @@ public function auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3582,7 +4296,7 @@ public function auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerRosterEmployeeModel[]', + '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3598,13 +4312,14 @@ public function auManagerRosterShiftGetLeaveEmployeesWithHttpInfo($business_id) * List Roster Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLeaveEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetLeaveEmployeesAsync($business_id) + public function auManagerRosterShiftGetLeaveEmployeesAsync($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLeaveEmployees'][0]) { - return $this->auManagerRosterShiftGetLeaveEmployeesAsyncWithHttpInfo($business_id) + return $this->auManagerRosterShiftGetLeaveEmployeesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3618,24 +4333,24 @@ function ($response) { * List Roster Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLeaveEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetLeaveEmployeesAsyncWithHttpInfo($business_id) + public function auManagerRosterShiftGetLeaveEmployeesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLeaveEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerRosterEmployeeModel[]'; - $request = $this->auManagerRosterShiftGetLeaveEmployeesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]'; + $request = $this->auManagerRosterShiftGetLeaveEmployeesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3658,7 +4373,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3668,12 +4383,14 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftGetLeaveEmployees' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLeaveEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftGetLeaveEmployeesRequest($business_id) + public function auManagerRosterShiftGetLeaveEmployeesRequest($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLeaveEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3681,6 +4398,7 @@ protected function auManagerRosterShiftGetLeaveEmployeesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/employees'; $formParams = []; $queryParams = []; @@ -3689,6 +4407,7 @@ protected function auManagerRosterShiftGetLeaveEmployeesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3698,53 +4417,35 @@ protected function auManagerRosterShiftGetLeaveEmployeesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3765,10 +4466,11 @@ protected function auManagerRosterShiftGetLeaveEmployeesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3780,14 +4482,15 @@ protected function auManagerRosterShiftGetLeaveEmployeesRequest($business_id) * List Roster Locations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function auManagerRosterShiftGetLocations($business_id) + public function auManagerRosterShiftGetLocations($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLocations'][0]) { - list($response) = $this->auManagerRosterShiftGetLocationsWithHttpInfo($business_id); + list($response) = $this->auManagerRosterShiftGetLocationsWithHttpInfo($business_id, $contentType); return $response; } @@ -3797,15 +4500,15 @@ public function auManagerRosterShiftGetLocations($business_id) * List Roster Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftGetLocationsWithHttpInfo($business_id) + public function auManagerRosterShiftGetLocationsWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->auManagerRosterShiftGetLocationsRequest($business_id); + $request = $this->auManagerRosterShiftGetLocationsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3814,9 +4517,16 @@ public function auManagerRosterShiftGetLocationsWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3827,19 +4537,37 @@ public function auManagerRosterShiftGetLocationsWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3856,7 +4584,7 @@ public function auManagerRosterShiftGetLocationsWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3872,13 +4600,14 @@ public function auManagerRosterShiftGetLocationsWithHttpInfo($business_id) * List Roster Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetLocationsAsync($business_id) + public function auManagerRosterShiftGetLocationsAsync($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLocations'][0]) { - return $this->auManagerRosterShiftGetLocationsAsyncWithHttpInfo($business_id) + return $this->auManagerRosterShiftGetLocationsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3892,24 +4621,24 @@ function ($response) { * List Roster Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetLocationsAsyncWithHttpInfo($business_id) + public function auManagerRosterShiftGetLocationsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->auManagerRosterShiftGetLocationsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->auManagerRosterShiftGetLocationsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3932,7 +4661,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3942,12 +4671,14 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftGetLocations' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftGetLocationsRequest($business_id) + public function auManagerRosterShiftGetLocationsRequest($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3955,6 +4686,7 @@ protected function auManagerRosterShiftGetLocationsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/locations'; $formParams = []; $queryParams = []; @@ -3963,6 +4695,7 @@ protected function auManagerRosterShiftGetLocationsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3972,53 +4705,35 @@ protected function auManagerRosterShiftGetLocationsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4039,10 +4754,11 @@ protected function auManagerRosterShiftGetLocationsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4054,14 +4770,15 @@ protected function auManagerRosterShiftGetLocationsRequest($business_id) * List Manager Roster Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetManageEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerRosterEmployeeModel[] + * @return \OpenAPI\Client\Model\ManagerRosterEmployeeModel[] */ - public function auManagerRosterShiftGetManageEmployees($business_id) + public function auManagerRosterShiftGetManageEmployees($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetManageEmployees'][0]) { - list($response) = $this->auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id); + list($response) = $this->auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id, $contentType); return $response; } @@ -4071,15 +4788,15 @@ public function auManagerRosterShiftGetManageEmployees($business_id) * List Manager Roster Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetManageEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerRosterEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerRosterEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id) + public function auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetManageEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerRosterEmployeeModel[]'; - $request = $this->auManagerRosterShiftGetManageEmployeesRequest($business_id); + $request = $this->auManagerRosterShiftGetManageEmployeesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4088,9 +4805,16 @@ public function auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4101,19 +4825,37 @@ public function auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4130,7 +4872,7 @@ public function auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerRosterEmployeeModel[]', + '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4146,13 +4888,14 @@ public function auManagerRosterShiftGetManageEmployeesWithHttpInfo($business_id) * List Manager Roster Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetManageEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetManageEmployeesAsync($business_id) + public function auManagerRosterShiftGetManageEmployeesAsync($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetManageEmployees'][0]) { - return $this->auManagerRosterShiftGetManageEmployeesAsyncWithHttpInfo($business_id) + return $this->auManagerRosterShiftGetManageEmployeesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4166,24 +4909,24 @@ function ($response) { * List Manager Roster Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetManageEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetManageEmployeesAsyncWithHttpInfo($business_id) + public function auManagerRosterShiftGetManageEmployeesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetManageEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerRosterEmployeeModel[]'; - $request = $this->auManagerRosterShiftGetManageEmployeesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerRosterEmployeeModel[]'; + $request = $this->auManagerRosterShiftGetManageEmployeesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4206,7 +4949,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4216,12 +4959,14 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftGetManageEmployees' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetManageEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftGetManageEmployeesRequest($business_id) + public function auManagerRosterShiftGetManageEmployeesRequest($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetManageEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4229,6 +4974,7 @@ protected function auManagerRosterShiftGetManageEmployeesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/manageemployees'; $formParams = []; $queryParams = []; @@ -4237,6 +4983,7 @@ protected function auManagerRosterShiftGetManageEmployeesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4246,53 +4993,35 @@ protected function auManagerRosterShiftGetManageEmployeesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4313,10 +5042,11 @@ protected function auManagerRosterShiftGetManageEmployeesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4328,14 +5058,15 @@ protected function auManagerRosterShiftGetManageEmployeesRequest($business_id) * Get the list of roles available * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRoles'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\RosterShiftRole[] + * @return \OpenAPI\Client\Model\RosterShiftRole[] */ - public function auManagerRosterShiftGetRoles($business_id) + public function auManagerRosterShiftGetRoles($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetRoles'][0]) { - list($response) = $this->auManagerRosterShiftGetRolesWithHttpInfo($business_id); + list($response) = $this->auManagerRosterShiftGetRolesWithHttpInfo($business_id, $contentType); return $response; } @@ -4345,15 +5076,15 @@ public function auManagerRosterShiftGetRoles($business_id) * Get the list of roles available * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRoles'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\RosterShiftRole[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\RosterShiftRole[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftGetRolesWithHttpInfo($business_id) + public function auManagerRosterShiftGetRolesWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetRoles'][0]) { - $returnType = '\Swagger\Client\Model\RosterShiftRole[]'; - $request = $this->auManagerRosterShiftGetRolesRequest($business_id); + $request = $this->auManagerRosterShiftGetRolesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4362,9 +5093,16 @@ public function auManagerRosterShiftGetRolesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4375,19 +5113,37 @@ public function auManagerRosterShiftGetRolesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\RosterShiftRole[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RosterShiftRole[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RosterShiftRole[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RosterShiftRole[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4404,7 +5160,7 @@ public function auManagerRosterShiftGetRolesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\RosterShiftRole[]', + '\OpenAPI\Client\Model\RosterShiftRole[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4420,13 +5176,14 @@ public function auManagerRosterShiftGetRolesWithHttpInfo($business_id) * Get the list of roles available * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRoles'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetRolesAsync($business_id) + public function auManagerRosterShiftGetRolesAsync($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetRoles'][0]) { - return $this->auManagerRosterShiftGetRolesAsyncWithHttpInfo($business_id) + return $this->auManagerRosterShiftGetRolesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4440,24 +5197,24 @@ function ($response) { * Get the list of roles available * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRoles'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetRolesAsyncWithHttpInfo($business_id) + public function auManagerRosterShiftGetRolesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetRoles'][0]) { - $returnType = '\Swagger\Client\Model\RosterShiftRole[]'; - $request = $this->auManagerRosterShiftGetRolesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\RosterShiftRole[]'; + $request = $this->auManagerRosterShiftGetRolesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4480,7 +5237,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4490,12 +5247,14 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftGetRoles' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRoles'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftGetRolesRequest($business_id) + public function auManagerRosterShiftGetRolesRequest($business_id, string $contentType = self::contentTypes['auManagerRosterShiftGetRoles'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4503,6 +5262,7 @@ protected function auManagerRosterShiftGetRolesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/roles'; $formParams = []; $queryParams = []; @@ -4511,6 +5271,7 @@ protected function auManagerRosterShiftGetRolesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4520,53 +5281,35 @@ protected function auManagerRosterShiftGetRolesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4587,10 +5330,11 @@ protected function auManagerRosterShiftGetRolesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4604,14 +5348,15 @@ protected function auManagerRosterShiftGetRolesRequest($business_id) * @param int $roster_shift_id roster_shift_id (required) * @param string $business_id business_id (required) * @param bool $include_costs include_costs (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuManagerRosterShiftModel + * @return \OpenAPI\Client\Model\AuManagerRosterShiftModel */ - public function auManagerRosterShiftGetRosterShift($roster_shift_id, $business_id, $include_costs = 'false') + public function auManagerRosterShiftGetRosterShift($roster_shift_id, $business_id, $include_costs = false, string $contentType = self::contentTypes['auManagerRosterShiftGetRosterShift'][0]) { - list($response) = $this->auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, $business_id, $include_costs); + list($response) = $this->auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, $business_id, $include_costs, $contentType); return $response; } @@ -4623,15 +5368,15 @@ public function auManagerRosterShiftGetRosterShift($roster_shift_id, $business_i * @param int $roster_shift_id (required) * @param string $business_id (required) * @param bool $include_costs (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuManagerRosterShiftModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuManagerRosterShiftModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, $business_id, $include_costs = 'false') + public function auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, $business_id, $include_costs = false, string $contentType = self::contentTypes['auManagerRosterShiftGetRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuManagerRosterShiftModel'; - $request = $this->auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $business_id, $include_costs); + $request = $this->auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $business_id, $include_costs, $contentType); try { $options = $this->createHttpClientOption(); @@ -4640,9 +5385,16 @@ public function auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4653,19 +5405,37 @@ public function auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuManagerRosterShiftModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuManagerRosterShiftModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuManagerRosterShiftModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuManagerRosterShiftModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4682,7 +5452,7 @@ public function auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuManagerRosterShiftModel', + '\OpenAPI\Client\Model\AuManagerRosterShiftModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4700,13 +5470,14 @@ public function auManagerRosterShiftGetRosterShiftWithHttpInfo($roster_shift_id, * @param int $roster_shift_id (required) * @param string $business_id (required) * @param bool $include_costs (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetRosterShiftAsync($roster_shift_id, $business_id, $include_costs = 'false') + public function auManagerRosterShiftGetRosterShiftAsync($roster_shift_id, $business_id, $include_costs = false, string $contentType = self::contentTypes['auManagerRosterShiftGetRosterShift'][0]) { - return $this->auManagerRosterShiftGetRosterShiftAsyncWithHttpInfo($roster_shift_id, $business_id, $include_costs) + return $this->auManagerRosterShiftGetRosterShiftAsyncWithHttpInfo($roster_shift_id, $business_id, $include_costs, $contentType) ->then( function ($response) { return $response[0]; @@ -4722,24 +5493,24 @@ function ($response) { * @param int $roster_shift_id (required) * @param string $business_id (required) * @param bool $include_costs (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftGetRosterShiftAsyncWithHttpInfo($roster_shift_id, $business_id, $include_costs = 'false') + public function auManagerRosterShiftGetRosterShiftAsyncWithHttpInfo($roster_shift_id, $business_id, $include_costs = false, string $contentType = self::contentTypes['auManagerRosterShiftGetRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuManagerRosterShiftModel'; - $request = $this->auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $business_id, $include_costs); + $returnType = '\OpenAPI\Client\Model\AuManagerRosterShiftModel'; + $request = $this->auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $business_id, $include_costs, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4762,7 +5533,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4774,18 +5545,21 @@ function ($exception) { * @param int $roster_shift_id (required) * @param string $business_id (required) * @param bool $include_costs (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftGetRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $business_id, $include_costs = 'false') + public function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $business_id, $include_costs = false, string $contentType = self::contentTypes['auManagerRosterShiftGetRosterShift'][0]) { + // verify the required parameter 'roster_shift_id' is set if ($roster_shift_id === null || (is_array($roster_shift_id) && count($roster_shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $roster_shift_id when calling auManagerRosterShiftGetRosterShift' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4793,6 +5567,8 @@ protected function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $ ); } + + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/{rosterShiftId}'; $formParams = []; $queryParams = []; @@ -4801,9 +5577,15 @@ protected function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $ $multipart = false; // query params - if ($include_costs !== null) { - $queryParams['includeCosts'] = ObjectSerializer::toQueryValue($include_costs); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_costs, + 'includeCosts', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($roster_shift_id !== null) { @@ -4822,53 +5604,35 @@ protected function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4889,10 +5653,11 @@ protected function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4904,20 +5669,21 @@ protected function auManagerRosterShiftGetRosterShiftRequest($roster_shift_id, $ * Manage Roster Data * * @param string $business_id business_id (required) - * @param \DateTime $filter_model_date (optional) - * @param int $filter_model_employee_id (optional) - * @param int $filter_model_location_id (optional) - * @param int $filter_model_role_id (optional) - * @param bool $filter_model_include_costs (optional) - * @param bool $filter_model_include_sub_locations (optional) + * @param \DateTime $filter_model_date filter_model_date (optional) + * @param int $filter_model_employee_id filter_model_employee_id (optional) + * @param int $filter_model_location_id filter_model_location_id (optional) + * @param int $filter_model_role_id filter_model_role_id (optional) + * @param bool $filter_model_include_costs filter_model_include_costs (optional) + * @param bool $filter_model_include_sub_locations filter_model_include_sub_locations (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftManageRosterData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuManagerRosterDataModel + * @return \OpenAPI\Client\Model\AuManagerRosterDataModel */ - public function auManagerRosterShiftManageRosterData($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null) + public function auManagerRosterShiftManageRosterData($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null, string $contentType = self::contentTypes['auManagerRosterShiftManageRosterData'][0]) { - list($response) = $this->auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations); + list($response) = $this->auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations, $contentType); return $response; } @@ -4927,21 +5693,21 @@ public function auManagerRosterShiftManageRosterData($business_id, $filter_model * Manage Roster Data * * @param string $business_id (required) - * @param \DateTime $filter_model_date (optional) - * @param int $filter_model_employee_id (optional) - * @param int $filter_model_location_id (optional) - * @param int $filter_model_role_id (optional) - * @param bool $filter_model_include_costs (optional) - * @param bool $filter_model_include_sub_locations (optional) + * @param \DateTime $filter_model_date (optional) + * @param int $filter_model_employee_id (optional) + * @param int $filter_model_location_id (optional) + * @param int $filter_model_role_id (optional) + * @param bool $filter_model_include_costs (optional) + * @param bool $filter_model_include_sub_locations (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftManageRosterData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuManagerRosterDataModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuManagerRosterDataModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null) + public function auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null, string $contentType = self::contentTypes['auManagerRosterShiftManageRosterData'][0]) { - $returnType = '\Swagger\Client\Model\AuManagerRosterDataModel'; - $request = $this->auManagerRosterShiftManageRosterDataRequest($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations); + $request = $this->auManagerRosterShiftManageRosterDataRequest($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations, $contentType); try { $options = $this->createHttpClientOption(); @@ -4950,9 +5716,16 @@ public function auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4963,19 +5736,37 @@ public function auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuManagerRosterDataModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuManagerRosterDataModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuManagerRosterDataModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuManagerRosterDataModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4992,7 +5783,7 @@ public function auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuManagerRosterDataModel', + '\OpenAPI\Client\Model\AuManagerRosterDataModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5008,19 +5799,20 @@ public function auManagerRosterShiftManageRosterDataWithHttpInfo($business_id, $ * Manage Roster Data * * @param string $business_id (required) - * @param \DateTime $filter_model_date (optional) - * @param int $filter_model_employee_id (optional) - * @param int $filter_model_location_id (optional) - * @param int $filter_model_role_id (optional) - * @param bool $filter_model_include_costs (optional) - * @param bool $filter_model_include_sub_locations (optional) + * @param \DateTime $filter_model_date (optional) + * @param int $filter_model_employee_id (optional) + * @param int $filter_model_location_id (optional) + * @param int $filter_model_role_id (optional) + * @param bool $filter_model_include_costs (optional) + * @param bool $filter_model_include_sub_locations (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftManageRosterData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftManageRosterDataAsync($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null) + public function auManagerRosterShiftManageRosterDataAsync($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null, string $contentType = self::contentTypes['auManagerRosterShiftManageRosterData'][0]) { - return $this->auManagerRosterShiftManageRosterDataAsyncWithHttpInfo($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations) + return $this->auManagerRosterShiftManageRosterDataAsyncWithHttpInfo($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations, $contentType) ->then( function ($response) { return $response[0]; @@ -5034,30 +5826,30 @@ function ($response) { * Manage Roster Data * * @param string $business_id (required) - * @param \DateTime $filter_model_date (optional) - * @param int $filter_model_employee_id (optional) - * @param int $filter_model_location_id (optional) - * @param int $filter_model_role_id (optional) - * @param bool $filter_model_include_costs (optional) - * @param bool $filter_model_include_sub_locations (optional) + * @param \DateTime $filter_model_date (optional) + * @param int $filter_model_employee_id (optional) + * @param int $filter_model_location_id (optional) + * @param int $filter_model_role_id (optional) + * @param bool $filter_model_include_costs (optional) + * @param bool $filter_model_include_sub_locations (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftManageRosterData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftManageRosterDataAsyncWithHttpInfo($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null) + public function auManagerRosterShiftManageRosterDataAsyncWithHttpInfo($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null, string $contentType = self::contentTypes['auManagerRosterShiftManageRosterData'][0]) { - $returnType = '\Swagger\Client\Model\AuManagerRosterDataModel'; - $request = $this->auManagerRosterShiftManageRosterDataRequest($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations); + $returnType = '\OpenAPI\Client\Model\AuManagerRosterDataModel'; + $request = $this->auManagerRosterShiftManageRosterDataRequest($business_id, $filter_model_date, $filter_model_employee_id, $filter_model_location_id, $filter_model_role_id, $filter_model_include_costs, $filter_model_include_sub_locations, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5080,7 +5872,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5090,18 +5882,20 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftManageRosterData' * * @param string $business_id (required) - * @param \DateTime $filter_model_date (optional) - * @param int $filter_model_employee_id (optional) - * @param int $filter_model_location_id (optional) - * @param int $filter_model_role_id (optional) - * @param bool $filter_model_include_costs (optional) - * @param bool $filter_model_include_sub_locations (optional) + * @param \DateTime $filter_model_date (optional) + * @param int $filter_model_employee_id (optional) + * @param int $filter_model_location_id (optional) + * @param int $filter_model_role_id (optional) + * @param bool $filter_model_include_costs (optional) + * @param bool $filter_model_include_sub_locations (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftManageRosterData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftManageRosterDataRequest($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null) + public function auManagerRosterShiftManageRosterDataRequest($business_id, $filter_model_date = null, $filter_model_employee_id = null, $filter_model_location_id = null, $filter_model_role_id = null, $filter_model_include_costs = null, $filter_model_include_sub_locations = null, string $contentType = self::contentTypes['auManagerRosterShiftManageRosterData'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5109,6 +5903,13 @@ protected function auManagerRosterShiftManageRosterDataRequest($business_id, $fi ); } + + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/manage'; $formParams = []; $queryParams = []; @@ -5117,29 +5918,60 @@ protected function auManagerRosterShiftManageRosterDataRequest($business_id, $fi $multipart = false; // query params - if ($filter_model_date !== null) { - $queryParams['filterModel.date'] = ObjectSerializer::toQueryValue($filter_model_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_model_date, + 'filterModel.date', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_model_employee_id !== null) { - $queryParams['filterModel.employeeId'] = ObjectSerializer::toQueryValue($filter_model_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_model_employee_id, + 'filterModel.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_model_location_id !== null) { - $queryParams['filterModel.locationId'] = ObjectSerializer::toQueryValue($filter_model_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_model_location_id, + 'filterModel.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_model_role_id !== null) { - $queryParams['filterModel.roleId'] = ObjectSerializer::toQueryValue($filter_model_role_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_model_role_id, + 'filterModel.roleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_model_include_costs !== null) { - $queryParams['filterModel.includeCosts'] = ObjectSerializer::toQueryValue($filter_model_include_costs); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_model_include_costs, + 'filterModel.includeCosts', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_model_include_sub_locations !== null) { - $queryParams['filterModel.includeSubLocations'] = ObjectSerializer::toQueryValue($filter_model_include_sub_locations); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_model_include_sub_locations, + 'filterModel.includeSubLocations', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -5150,53 +5982,35 @@ protected function auManagerRosterShiftManageRosterDataRequest($business_id, $fi ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5217,10 +6031,11 @@ protected function auManagerRosterShiftManageRosterDataRequest($business_id, $fi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5235,14 +6050,15 @@ protected function auManagerRosterShiftManageRosterDataRequest($business_id, $fi * @param int $kiosk_id kiosk_id (required) * @param \DateTime $date_utc date_utc (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftMatchingResultModel + * @return \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel */ - public function auManagerRosterShiftMatchingClockOffRosterShift($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOffRosterShift($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'][0]) { - list($response) = $this->auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id); + list($response) = $this->auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $response; } @@ -5255,15 +6071,15 @@ public function auManagerRosterShiftMatchingClockOffRosterShift($employee_id, $k * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auManagerRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $request = $this->auManagerRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5272,9 +6088,16 @@ public function auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($emp } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5285,19 +6108,37 @@ public function auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($emp sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5314,7 +6155,7 @@ public function auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($emp case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftMatchingResultModel', + '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5333,13 +6174,14 @@ public function auManagerRosterShiftMatchingClockOffRosterShiftWithHttpInfo($emp * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftMatchingClockOffRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOffRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'][0]) { - return $this->auManagerRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + return $this->auManagerRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5356,24 +6198,24 @@ function ($response) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auManagerRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; + $request = $this->auManagerRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5396,7 +6238,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5409,30 +6251,35 @@ function ($exception) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOffRosterShift'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerRosterShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling auManagerRosterShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'date_utc' is set if ($date_utc === null || (is_array($date_utc) && count($date_utc) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $date_utc when calling auManagerRosterShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5440,6 +6287,7 @@ protected function auManagerRosterShiftMatchingClockOffRosterShiftRequest($emplo ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/{employeeId}/matchingclockoff'; $formParams = []; $queryParams = []; @@ -5448,13 +6296,24 @@ protected function auManagerRosterShiftMatchingClockOffRosterShiftRequest($emplo $multipart = false; // query params - if ($kiosk_id !== null) { - $queryParams['kioskId'] = ObjectSerializer::toQueryValue($kiosk_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $kiosk_id, + 'kioskId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($date_utc !== null) { - $queryParams['dateUtc'] = ObjectSerializer::toQueryValue($date_utc); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $date_utc, + 'dateUtc', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -5473,53 +6332,35 @@ protected function auManagerRosterShiftMatchingClockOffRosterShiftRequest($emplo ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5540,10 +6381,11 @@ protected function auManagerRosterShiftMatchingClockOffRosterShiftRequest($emplo $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5558,14 +6400,15 @@ protected function auManagerRosterShiftMatchingClockOffRosterShiftRequest($emplo * @param int $kiosk_id kiosk_id (required) * @param \DateTime $date_utc date_utc (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftMatchingResultModel + * @return \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel */ - public function auManagerRosterShiftMatchingClockOnRosterShift($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOnRosterShift($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'][0]) { - list($response) = $this->auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id); + list($response) = $this->auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $response; } @@ -5578,15 +6421,15 @@ public function auManagerRosterShiftMatchingClockOnRosterShift($employee_id, $ki * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auManagerRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $request = $this->auManagerRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5595,9 +6438,16 @@ public function auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($empl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5608,19 +6458,37 @@ public function auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($empl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5637,7 +6505,7 @@ public function auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($empl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftMatchingResultModel', + '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5656,13 +6524,14 @@ public function auManagerRosterShiftMatchingClockOnRosterShiftWithHttpInfo($empl * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftMatchingClockOnRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOnRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'][0]) { - return $this->auManagerRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + return $this->auManagerRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5679,24 +6548,24 @@ function ($response) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auManagerRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; + $request = $this->auManagerRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5719,7 +6588,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5732,30 +6601,35 @@ function ($exception) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id) + public function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftMatchingClockOnRosterShift'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerRosterShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling auManagerRosterShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'date_utc' is set if ($date_utc === null || (is_array($date_utc) && count($date_utc) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $date_utc when calling auManagerRosterShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5763,6 +6637,7 @@ protected function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employ ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/{employeeId}/matchingclockon'; $formParams = []; $queryParams = []; @@ -5771,13 +6646,24 @@ protected function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employ $multipart = false; // query params - if ($kiosk_id !== null) { - $queryParams['kioskId'] = ObjectSerializer::toQueryValue($kiosk_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $kiosk_id, + 'kioskId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($date_utc !== null) { - $queryParams['dateUtc'] = ObjectSerializer::toQueryValue($date_utc); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $date_utc, + 'dateUtc', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -5796,53 +6682,35 @@ protected function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5863,10 +6731,11 @@ protected function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5880,14 +6749,15 @@ protected function auManagerRosterShiftMatchingClockOnRosterShiftRequest($employ * @param int $employee_id employee_id (required) * @param \DateTime $local_time local_time (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftNearbyRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[] */ - public function auManagerRosterShiftNearbyRosterShifts($employee_id, $local_time, $business_id) + public function auManagerRosterShiftNearbyRosterShifts($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftNearbyRosterShifts'][0]) { - list($response) = $this->auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id); + list($response) = $this->auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id, $contentType); return $response; } @@ -5899,15 +6769,15 @@ public function auManagerRosterShiftNearbyRosterShifts($employee_id, $local_time * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftNearbyRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id) + public function auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftNearbyRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id); + $request = $this->auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5916,9 +6786,16 @@ public function auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5929,19 +6806,37 @@ public function auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5958,7 +6853,7 @@ public function auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftModel[]', + '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5976,13 +6871,14 @@ public function auManagerRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftNearbyRosterShiftsAsync($employee_id, $local_time, $business_id) + public function auManagerRosterShiftNearbyRosterShiftsAsync($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftNearbyRosterShifts'][0]) { - return $this->auManagerRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id) + return $this->auManagerRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5998,24 +6894,24 @@ function ($response) { * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id) + public function auManagerRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftNearbyRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; + $request = $this->auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6038,7 +6934,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6050,24 +6946,28 @@ function ($exception) { * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id) + public function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auManagerRosterShiftNearbyRosterShifts'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerRosterShiftNearbyRosterShifts' ); } + // verify the required parameter 'local_time' is set if ($local_time === null || (is_array($local_time) && count($local_time) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $local_time when calling auManagerRosterShiftNearbyRosterShifts' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6075,6 +6975,7 @@ protected function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/{employeeId}/nearby'; $formParams = []; $queryParams = []; @@ -6083,9 +6984,15 @@ protected function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $ $multipart = false; // query params - if ($local_time !== null) { - $queryParams['localTime'] = ObjectSerializer::toQueryValue($local_time); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $local_time, + 'localTime', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -6104,53 +7011,35 @@ protected function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6171,10 +7060,11 @@ protected function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6185,17 +7075,18 @@ protected function auManagerRosterShiftNearbyRosterShiftsRequest($employee_id, $ * * Create roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model shift_model (required) * @param bool $publish publish (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auManagerRosterShiftPost($shift_model, $publish, $business_id) + public function auManagerRosterShiftPost($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPost'][0]) { - $this->auManagerRosterShiftPostWithHttpInfo($shift_model, $publish, $business_id); + $this->auManagerRosterShiftPostWithHttpInfo($publish, $business_id, $shift_model, $contentType); } /** @@ -6203,18 +7094,18 @@ public function auManagerRosterShiftPost($shift_model, $publish, $business_id) * * Create roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftPostWithHttpInfo($shift_model, $publish, $business_id) + public function auManagerRosterShiftPostWithHttpInfo($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPost'][0]) { - $returnType = ''; - $request = $this->auManagerRosterShiftPostRequest($shift_model, $publish, $business_id); + $request = $this->auManagerRosterShiftPostRequest($publish, $business_id, $shift_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6223,9 +7114,16 @@ public function auManagerRosterShiftPostWithHttpInfo($shift_model, $publish, $bu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6236,11 +7134,11 @@ public function auManagerRosterShiftPostWithHttpInfo($shift_model, $publish, $bu sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6258,16 +7156,17 @@ public function auManagerRosterShiftPostWithHttpInfo($shift_model, $publish, $bu * * Create roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftPostAsync($shift_model, $publish, $business_id) + public function auManagerRosterShiftPostAsync($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPost'][0]) { - return $this->auManagerRosterShiftPostAsyncWithHttpInfo($shift_model, $publish, $business_id) + return $this->auManagerRosterShiftPostAsyncWithHttpInfo($publish, $business_id, $shift_model, $contentType) ->then( function ($response) { return $response[0]; @@ -6280,17 +7179,18 @@ function ($response) { * * Create roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftPostAsyncWithHttpInfo($shift_model, $publish, $business_id) + public function auManagerRosterShiftPostAsyncWithHttpInfo($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPost'][0]) { $returnType = ''; - $request = $this->auManagerRosterShiftPostRequest($shift_model, $publish, $business_id); + $request = $this->auManagerRosterShiftPostRequest($publish, $business_id, $shift_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6309,7 +7209,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6318,27 +7218,24 @@ function ($exception) { /** * Create request for operation 'auManagerRosterShiftPost' * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftPostRequest($shift_model, $publish, $business_id) + public function auManagerRosterShiftPostRequest($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPost'][0]) { - // verify the required parameter 'shift_model' is set - if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $shift_model when calling auManagerRosterShiftPost' - ); - } + // verify the required parameter 'publish' is set if ($publish === null || (is_array($publish) && count($publish) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $publish when calling auManagerRosterShiftPost' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6346,6 +7243,14 @@ protected function auManagerRosterShiftPostRequest($shift_model, $publish, $busi ); } + // verify the required parameter 'shift_model' is set + if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $shift_model when calling auManagerRosterShiftPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift'; $formParams = []; $queryParams = []; @@ -6354,9 +7259,15 @@ protected function auManagerRosterShiftPostRequest($shift_model, $publish, $busi $multipart = false; // query params - if ($publish !== null) { - $queryParams['publish'] = ObjectSerializer::toQueryValue($publish); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $publish, + 'publish', // param base name + 'boolean', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6367,56 +7278,42 @@ protected function auManagerRosterShiftPostRequest($shift_model, $publish, $busi ); } - // body params - $_tempBody = null; - if (isset($shift_model)) { - $_tempBody = $shift_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($shift_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shift_model)); + } else { + $httpBody = $shift_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6437,10 +7334,11 @@ protected function auManagerRosterShiftPostRequest($shift_model, $publish, $busi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6451,18 +7349,19 @@ protected function auManagerRosterShiftPostRequest($shift_model, $publish, $busi * * Update roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model shift_model (required) * @param int $roster_shift_id roster_shift_id (required) * @param bool $publish publish (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auManagerRosterShiftPut($shift_model, $roster_shift_id, $publish, $business_id) + public function auManagerRosterShiftPut($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPut'][0]) { - $this->auManagerRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id); + $this->auManagerRosterShiftPutWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, $contentType); } /** @@ -6470,19 +7369,19 @@ public function auManagerRosterShiftPut($shift_model, $roster_shift_id, $publish * * Update roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id) + public function auManagerRosterShiftPutWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPut'][0]) { - $returnType = ''; - $request = $this->auManagerRosterShiftPutRequest($shift_model, $roster_shift_id, $publish, $business_id); + $request = $this->auManagerRosterShiftPutRequest($roster_shift_id, $publish, $business_id, $shift_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6491,9 +7390,16 @@ public function auManagerRosterShiftPutWithHttpInfo($shift_model, $roster_shift_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + (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 ); } @@ -6504,11 +7410,11 @@ public function auManagerRosterShiftPutWithHttpInfo($shift_model, $roster_shift_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6526,17 +7432,18 @@ public function auManagerRosterShiftPutWithHttpInfo($shift_model, $roster_shift_ * * Update roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftPutAsync($shift_model, $roster_shift_id, $publish, $business_id) + public function auManagerRosterShiftPutAsync($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPut'][0]) { - return $this->auManagerRosterShiftPutAsyncWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id) + return $this->auManagerRosterShiftPutAsyncWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, $contentType) ->then( function ($response) { return $response[0]; @@ -6549,18 +7456,19 @@ function ($response) { * * Update roster shift * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftPutAsyncWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id) + public function auManagerRosterShiftPutAsyncWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPut'][0]) { $returnType = ''; - $request = $this->auManagerRosterShiftPutRequest($shift_model, $roster_shift_id, $publish, $business_id); + $request = $this->auManagerRosterShiftPutRequest($roster_shift_id, $publish, $business_id, $shift_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6579,7 +7487,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6588,34 +7496,32 @@ function ($exception) { /** * Create request for operation 'auManagerRosterShiftPut' * - * @param \Swagger\Client\Model\RosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\RosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftPutRequest($shift_model, $roster_shift_id, $publish, $business_id) + public function auManagerRosterShiftPutRequest($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auManagerRosterShiftPut'][0]) { - // verify the required parameter 'shift_model' is set - if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $shift_model when calling auManagerRosterShiftPut' - ); - } + // verify the required parameter 'roster_shift_id' is set if ($roster_shift_id === null || (is_array($roster_shift_id) && count($roster_shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $roster_shift_id when calling auManagerRosterShiftPut' ); } + // verify the required parameter 'publish' is set if ($publish === null || (is_array($publish) && count($publish) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $publish when calling auManagerRosterShiftPut' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6623,6 +7529,14 @@ protected function auManagerRosterShiftPutRequest($shift_model, $roster_shift_id ); } + // verify the required parameter 'shift_model' is set + if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $shift_model when calling auManagerRosterShiftPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/{rosterShiftId}'; $formParams = []; $queryParams = []; @@ -6631,9 +7545,15 @@ protected function auManagerRosterShiftPutRequest($shift_model, $roster_shift_id $multipart = false; // query params - if ($publish !== null) { - $queryParams['publish'] = ObjectSerializer::toQueryValue($publish); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $publish, + 'publish', // param base name + 'boolean', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($roster_shift_id !== null) { @@ -6652,56 +7572,42 @@ protected function auManagerRosterShiftPutRequest($shift_model, $roster_shift_id ); } - // body params - $_tempBody = null; - if (isset($shift_model)) { - $_tempBody = $shift_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($shift_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shift_model)); + } else { + $httpBody = $shift_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6722,10 +7628,11 @@ protected function auManagerRosterShiftPutRequest($shift_model, $roster_shift_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6737,16 +7644,17 @@ protected function auManagerRosterShiftPutRequest($shift_model, $roster_shift_id * Stub Shift Timesheets * * @param int $roster_shift_id roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftStubShiftTimesheets'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auManagerRosterShiftStubShiftTimesheets($roster_shift_id, $model, $business_id) + public function auManagerRosterShiftStubShiftTimesheets($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auManagerRosterShiftStubShiftTimesheets'][0]) { - $this->auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $model, $business_id); + $this->auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $business_id, $model, $contentType); } /** @@ -6755,17 +7663,17 @@ public function auManagerRosterShiftStubShiftTimesheets($roster_shift_id, $model * Stub Shift Timesheets * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftStubShiftTimesheets'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $model, $business_id) + public function auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auManagerRosterShiftStubShiftTimesheets'][0]) { - $returnType = ''; - $request = $this->auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $model, $business_id); + $request = $this->auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6774,9 +7682,16 @@ public function auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shif } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6787,11 +7702,11 @@ public function auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shif sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6810,15 +7725,16 @@ public function auManagerRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shif * Stub Shift Timesheets * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftStubShiftTimesheets'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftStubShiftTimesheetsAsync($roster_shift_id, $model, $business_id) + public function auManagerRosterShiftStubShiftTimesheetsAsync($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auManagerRosterShiftStubShiftTimesheets'][0]) { - return $this->auManagerRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $model, $business_id) + return $this->auManagerRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6832,16 +7748,17 @@ function ($response) { * Stub Shift Timesheets * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftStubShiftTimesheets'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $model, $business_id) + public function auManagerRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auManagerRosterShiftStubShiftTimesheets'][0]) { $returnType = ''; - $request = $this->auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $model, $business_id); + $request = $this->auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6860,7 +7777,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6870,26 +7787,23 @@ function ($exception) { * Create request for operation 'auManagerRosterShiftStubShiftTimesheets' * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerRosterShiftStubShiftTimesheets'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $model, $business_id) + public function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auManagerRosterShiftStubShiftTimesheets'][0]) { + // verify the required parameter 'roster_shift_id' is set if ($roster_shift_id === null || (is_array($roster_shift_id) && count($roster_shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $roster_shift_id when calling auManagerRosterShiftStubShiftTimesheets' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auManagerRosterShiftStubShiftTimesheets' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6897,6 +7811,14 @@ protected function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auManagerRosterShiftStubShiftTimesheets' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/rostershift/{rosterShiftId}/stub'; $formParams = []; $queryParams = []; @@ -6905,6 +7827,7 @@ protected function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_ $multipart = false; + // path params if ($roster_shift_id !== null) { $resourcePath = str_replace( @@ -6922,56 +7845,42 @@ protected function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6992,10 +7901,11 @@ protected function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7006,14 +7916,15 @@ protected function auManagerRosterShiftStubShiftTimesheetsRequest($roster_shift_ * * List Businesses * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerSecurityBusinesses'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuAvailableBusinessModel[] + * @return \OpenAPI\Client\Model\AuAvailableBusinessModel[] */ - public function auManagerSecurityBusinesses() + public function auManagerSecurityBusinesses(string $contentType = self::contentTypes['auManagerSecurityBusinesses'][0]) { - list($response) = $this->auManagerSecurityBusinessesWithHttpInfo(); + list($response) = $this->auManagerSecurityBusinessesWithHttpInfo($contentType); return $response; } @@ -7022,15 +7933,15 @@ public function auManagerSecurityBusinesses() * * List Businesses * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerSecurityBusinesses'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuAvailableBusinessModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuAvailableBusinessModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerSecurityBusinessesWithHttpInfo() + public function auManagerSecurityBusinessesWithHttpInfo(string $contentType = self::contentTypes['auManagerSecurityBusinesses'][0]) { - $returnType = '\Swagger\Client\Model\AuAvailableBusinessModel[]'; - $request = $this->auManagerSecurityBusinessesRequest(); + $request = $this->auManagerSecurityBusinessesRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -7039,9 +7950,16 @@ public function auManagerSecurityBusinessesWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7052,19 +7970,37 @@ public function auManagerSecurityBusinessesWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuAvailableBusinessModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuAvailableBusinessModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuAvailableBusinessModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuAvailableBusinessModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7081,7 +8017,7 @@ public function auManagerSecurityBusinessesWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuAvailableBusinessModel[]', + '\OpenAPI\Client\Model\AuAvailableBusinessModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7096,13 +8032,14 @@ public function auManagerSecurityBusinessesWithHttpInfo() * * List Businesses * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerSecurityBusinesses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerSecurityBusinessesAsync() + public function auManagerSecurityBusinessesAsync(string $contentType = self::contentTypes['auManagerSecurityBusinesses'][0]) { - return $this->auManagerSecurityBusinessesAsyncWithHttpInfo() + return $this->auManagerSecurityBusinessesAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -7115,24 +8052,24 @@ function ($response) { * * List Businesses * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerSecurityBusinesses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerSecurityBusinessesAsyncWithHttpInfo() + public function auManagerSecurityBusinessesAsyncWithHttpInfo(string $contentType = self::contentTypes['auManagerSecurityBusinesses'][0]) { - $returnType = '\Swagger\Client\Model\AuAvailableBusinessModel[]'; - $request = $this->auManagerSecurityBusinessesRequest(); + $returnType = '\OpenAPI\Client\Model\AuAvailableBusinessModel[]'; + $request = $this->auManagerSecurityBusinessesRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7155,7 +8092,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7164,13 +8101,15 @@ function ($exception) { /** * Create request for operation 'auManagerSecurityBusinesses' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerSecurityBusinesses'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerSecurityBusinessesRequest() + public function auManagerSecurityBusinessesRequest(string $contentType = self::contentTypes['auManagerSecurityBusinesses'][0]) { + $resourcePath = '/api/v2/manager/security/businesses'; $formParams = []; $queryParams = []; @@ -7180,53 +8119,36 @@ protected function auManagerSecurityBusinessesRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7247,10 +8169,11 @@ protected function auManagerSecurityBusinessesRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7264,14 +8187,15 @@ protected function auManagerSecurityBusinessesRequest() * @param int $kiosk_id kiosk_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceGetLookupData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel */ - public function auManagerTimeAndAttendanceGetLookupData($kiosk_id, $employee_id, $business_id) + public function auManagerTimeAndAttendanceGetLookupData($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auManagerTimeAndAttendanceGetLookupData'][0]) { - list($response) = $this->auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id); + list($response) = $this->auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id, $contentType); return $response; } @@ -7283,15 +8207,15 @@ public function auManagerTimeAndAttendanceGetLookupData($kiosk_id, $employee_id, * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceGetLookupData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id) + public function auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auManagerTimeAndAttendanceGetLookupData'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel'; - $request = $this->auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id); + $request = $this->auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7300,9 +8224,16 @@ public function auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7313,19 +8244,37 @@ public function auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7342,7 +8291,7 @@ public function auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel', + '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7360,13 +8309,14 @@ public function auManagerTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $ * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimeAndAttendanceGetLookupDataAsync($kiosk_id, $employee_id, $business_id) + public function auManagerTimeAndAttendanceGetLookupDataAsync($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auManagerTimeAndAttendanceGetLookupData'][0]) { - return $this->auManagerTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id) + return $this->auManagerTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7382,24 +8332,24 @@ function ($response) { * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id) + public function auManagerTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auManagerTimeAndAttendanceGetLookupData'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel'; - $request = $this->auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel'; + $request = $this->auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7422,7 +8372,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7434,24 +8384,28 @@ function ($exception) { * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id) + public function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auManagerTimeAndAttendanceGetLookupData'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling auManagerTimeAndAttendanceGetLookupData' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auManagerTimeAndAttendanceGetLookupData' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7459,6 +8413,7 @@ protected function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $em ); } + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/lookupdata/{employeeId}'; $formParams = []; $queryParams = []; @@ -7467,6 +8422,7 @@ protected function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $em $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -7492,53 +8448,35 @@ protected function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7559,10 +8497,11 @@ protected function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7573,16 +8512,17 @@ protected function auManagerTimeAndAttendanceGetLookupDataRequest($kiosk_id, $em * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimeAndAttendanceShiftModel[] + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[] */ - public function auManagerTimeAndAttendanceShifts($model, $business_id) + public function auManagerTimeAndAttendanceShifts($business_id, $model, string $contentType = self::contentTypes['auManagerTimeAndAttendanceShifts'][0]) { - list($response) = $this->auManagerTimeAndAttendanceShiftsWithHttpInfo($model, $business_id); + list($response) = $this->auManagerTimeAndAttendanceShiftsWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -7591,17 +8531,17 @@ public function auManagerTimeAndAttendanceShifts($model, $business_id) * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimeAndAttendanceShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auManagerTimeAndAttendanceShiftsWithHttpInfo($model, $business_id) + public function auManagerTimeAndAttendanceShiftsWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auManagerTimeAndAttendanceShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]'; - $request = $this->auManagerTimeAndAttendanceShiftsRequest($model, $business_id); + $request = $this->auManagerTimeAndAttendanceShiftsRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -7610,9 +8550,16 @@ public function auManagerTimeAndAttendanceShiftsWithHttpInfo($model, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7623,19 +8570,37 @@ public function auManagerTimeAndAttendanceShiftsWithHttpInfo($model, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7652,7 +8617,7 @@ public function auManagerTimeAndAttendanceShiftsWithHttpInfo($model, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]', + '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7667,15 +8632,16 @@ public function auManagerTimeAndAttendanceShiftsWithHttpInfo($model, $business_i * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimeAndAttendanceShiftsAsync($model, $business_id) + public function auManagerTimeAndAttendanceShiftsAsync($business_id, $model, string $contentType = self::contentTypes['auManagerTimeAndAttendanceShifts'][0]) { - return $this->auManagerTimeAndAttendanceShiftsAsyncWithHttpInfo($model, $business_id) + return $this->auManagerTimeAndAttendanceShiftsAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -7688,26 +8654,26 @@ function ($response) { * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimeAndAttendanceShiftsAsyncWithHttpInfo($model, $business_id) + public function auManagerTimeAndAttendanceShiftsAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auManagerTimeAndAttendanceShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]'; - $request = $this->auManagerTimeAndAttendanceShiftsRequest($model, $business_id); + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]'; + $request = $this->auManagerTimeAndAttendanceShiftsRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7730,7 +8696,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7739,20 +8705,16 @@ function ($exception) { /** * Create request for operation 'auManagerTimeAndAttendanceShifts' * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimeAndAttendanceShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerTimeAndAttendanceShiftsRequest($model, $business_id) + public function auManagerTimeAndAttendanceShiftsRequest($business_id, $model, string $contentType = self::contentTypes['auManagerTimeAndAttendanceShifts'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auManagerTimeAndAttendanceShifts' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7760,6 +8722,14 @@ protected function auManagerTimeAndAttendanceShiftsRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auManagerTimeAndAttendanceShifts' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/shifts'; $formParams = []; $queryParams = []; @@ -7768,6 +8738,7 @@ protected function auManagerTimeAndAttendanceShiftsRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7777,56 +8748,42 @@ protected function auManagerTimeAndAttendanceShiftsRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7847,10 +8804,11 @@ protected function auManagerTimeAndAttendanceShiftsRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7861,16 +8819,17 @@ protected function auManagerTimeAndAttendanceShiftsRequest($model, $business_id) * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPostIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auManagerTimesheetPostIndividual($request, $business_id) + public function auManagerTimesheetPostIndividual($business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPostIndividual'][0]) { - list($response) = $this->auManagerTimesheetPostIndividualWithHttpInfo($request, $business_id); + list($response) = $this->auManagerTimesheetPostIndividualWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -7879,17 +8838,17 @@ public function auManagerTimesheetPostIndividual($request, $business_id) * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPostIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerTimesheetPostIndividualWithHttpInfo($request, $business_id) + public function auManagerTimesheetPostIndividualWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPostIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerTimesheetPostIndividualRequest($request, $business_id); + $request = $this->auManagerTimesheetPostIndividualRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -7898,9 +8857,16 @@ public function auManagerTimesheetPostIndividualWithHttpInfo($request, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7911,19 +8877,37 @@ public function auManagerTimesheetPostIndividualWithHttpInfo($request, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7940,7 +8924,7 @@ public function auManagerTimesheetPostIndividualWithHttpInfo($request, $business case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7955,15 +8939,16 @@ public function auManagerTimesheetPostIndividualWithHttpInfo($request, $business * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimesheetPostIndividualAsync($request, $business_id) + public function auManagerTimesheetPostIndividualAsync($business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPostIndividual'][0]) { - return $this->auManagerTimesheetPostIndividualAsyncWithHttpInfo($request, $business_id) + return $this->auManagerTimesheetPostIndividualAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -7976,26 +8961,26 @@ function ($response) { * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimesheetPostIndividualAsyncWithHttpInfo($request, $business_id) + public function auManagerTimesheetPostIndividualAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPostIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerTimesheetPostIndividualRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auManagerTimesheetPostIndividualRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8018,7 +9003,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8027,20 +9012,16 @@ function ($exception) { /** * Create request for operation 'auManagerTimesheetPostIndividual' * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerTimesheetPostIndividualRequest($request, $business_id) + public function auManagerTimesheetPostIndividualRequest($business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPostIndividual'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auManagerTimesheetPostIndividual' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8048,6 +9029,14 @@ protected function auManagerTimesheetPostIndividualRequest($request, $business_i ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auManagerTimesheetPostIndividual' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/timesheet'; $formParams = []; $queryParams = []; @@ -8056,6 +9045,7 @@ protected function auManagerTimesheetPostIndividualRequest($request, $business_i $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -8065,56 +9055,42 @@ protected function auManagerTimesheetPostIndividualRequest($request, $business_i ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8135,10 +9111,11 @@ protected function auManagerTimesheetPostIndividualRequest($request, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8150,16 +9127,17 @@ protected function auManagerTimesheetPostIndividualRequest($request, $business_i * Update timesheet line * * @param int $timesheet_line_id timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPutIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auManagerTimesheetPutIndividual($timesheet_line_id, $request, $business_id) + public function auManagerTimesheetPutIndividual($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPutIndividual'][0]) { - list($response) = $this->auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $request, $business_id); + list($response) = $this->auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $business_id, $request, $contentType); return $response; } @@ -8169,17 +9147,17 @@ public function auManagerTimesheetPutIndividual($timesheet_line_id, $request, $b * Update timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPutIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $request, $business_id) + public function auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPutIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerTimesheetPutIndividualRequest($timesheet_line_id, $request, $business_id); + $request = $this->auManagerTimesheetPutIndividualRequest($timesheet_line_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -8188,9 +9166,16 @@ public function auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8201,19 +9186,37 @@ public function auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8230,7 +9233,7 @@ public function auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8246,15 +9249,16 @@ public function auManagerTimesheetPutIndividualWithHttpInfo($timesheet_line_id, * Update timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimesheetPutIndividualAsync($timesheet_line_id, $request, $business_id) + public function auManagerTimesheetPutIndividualAsync($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPutIndividual'][0]) { - return $this->auManagerTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $request, $business_id) + return $this->auManagerTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -8268,26 +9272,26 @@ function ($response) { * Update timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auManagerTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $request, $business_id) + public function auManagerTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPutIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auManagerTimesheetPutIndividualRequest($timesheet_line_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auManagerTimesheetPutIndividualRequest($timesheet_line_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8310,7 +9314,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8320,26 +9324,23 @@ function ($exception) { * Create request for operation 'auManagerTimesheetPutIndividual' * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auManagerTimesheetPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $request, $business_id) + public function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auManagerTimesheetPutIndividual'][0]) { + // verify the required parameter 'timesheet_line_id' is set if ($timesheet_line_id === null || (is_array($timesheet_line_id) && count($timesheet_line_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_line_id when calling auManagerTimesheetPutIndividual' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auManagerTimesheetPutIndividual' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8347,6 +9348,14 @@ protected function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $r ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auManagerTimesheetPutIndividual' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/timesheet/{timesheetLineId}'; $formParams = []; $queryParams = []; @@ -8355,6 +9364,7 @@ protected function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $r $multipart = false; + // path params if ($timesheet_line_id !== null) { $resourcePath = str_replace( @@ -8372,56 +9382,42 @@ protected function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $r ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + // for model (json/xml) + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8442,10 +9438,11 @@ protected function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $r $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8458,16 +9455,17 @@ protected function auManagerTimesheetPutIndividualRequest($timesheet_line_id, $r * * @param int $kiosk_id kiosk_id (required) * @param int $shift_id shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceAddNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftNoteViewModel + * @return \OpenAPI\Client\Model\ShiftNoteViewModel */ - public function genericManagerTimeAndAttendanceAddNote($kiosk_id, $shift_id, $model, $business_id) + public function genericManagerTimeAndAttendanceAddNote($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceAddNote'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $model, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, $contentType); return $response; } @@ -8478,17 +9476,17 @@ public function genericManagerTimeAndAttendanceAddNote($kiosk_id, $shift_id, $mo * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceAddNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftNoteViewModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftNoteViewModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $model, $business_id) + public function genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceAddNote'][0]) { - $returnType = '\Swagger\Client\Model\ShiftNoteViewModel'; - $request = $this->genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $model, $business_id); + $request = $this->genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -8497,9 +9495,16 @@ public function genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $s } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8510,19 +9515,37 @@ public function genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $s sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftNoteViewModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftNoteViewModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftNoteViewModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftNoteViewModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8539,7 +9562,7 @@ public function genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $s case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftNoteViewModel', + '\OpenAPI\Client\Model\ShiftNoteViewModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8556,15 +9579,16 @@ public function genericManagerTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $s * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceAddNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceAddNoteAsync($kiosk_id, $shift_id, $model, $business_id) + public function genericManagerTimeAndAttendanceAddNoteAsync($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceAddNote'][0]) { - return $this->genericManagerTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $model, $business_id) + return $this->genericManagerTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -8579,26 +9603,26 @@ function ($response) { * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceAddNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $model, $business_id) + public function genericManagerTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceAddNote'][0]) { - $returnType = '\Swagger\Client\Model\ShiftNoteViewModel'; - $request = $this->genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\ShiftNoteViewModel'; + $request = $this->genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8621,7 +9645,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8632,32 +9656,30 @@ function ($exception) { * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceAddNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $model, $business_id) + public function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceAddNote'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceAddNote' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling genericManagerTimeAndAttendanceAddNote' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceAddNote' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8665,6 +9687,14 @@ protected function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shi ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceAddNote' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/shift/{shiftId}/notes'; $formParams = []; $queryParams = []; @@ -8673,6 +9703,7 @@ protected function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shi $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -8698,56 +9729,42 @@ protected function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shi ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8768,10 +9785,11 @@ protected function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8783,16 +9801,17 @@ protected function genericManagerTimeAndAttendanceAddNoteRequest($kiosk_id, $shi * Change PIN * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceChangePin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceChangePin($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceChangePin($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceChangePin'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $business_id, $model, $contentType); return $response; } @@ -8802,17 +9821,17 @@ public function genericManagerTimeAndAttendanceChangePin($kiosk_id, $model, $bus * Change PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceChangePin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceChangePin'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $model, $business_id); + $request = $this->genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -8821,9 +9840,16 @@ public function genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8834,19 +9860,37 @@ public function genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8863,7 +9907,7 @@ public function genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8879,15 +9923,16 @@ public function genericManagerTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, * Change PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceChangePin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceChangePinAsync($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceChangePinAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceChangePin'][0]) { - return $this->genericManagerTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericManagerTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -8901,26 +9946,26 @@ function ($response) { * Change PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceChangePin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceChangePin'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8943,7 +9988,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8953,26 +9998,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceChangePin' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceChangePin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceChangePin'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceChangePin' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceChangePin' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8980,6 +10022,14 @@ protected function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $m ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceChangePin' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/changepin'; $formParams = []; $queryParams = []; @@ -8988,6 +10038,7 @@ protected function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $m $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -9005,56 +10056,42 @@ protected function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $m ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9075,10 +10112,11 @@ protected function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $m $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9090,16 +10128,17 @@ protected function genericManagerTimeAndAttendanceChangePinRequest($kiosk_id, $m * Check Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskEmployeeIdModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskEmployeeIdModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BasicKioskEmployeeModel + * @return \OpenAPI\Client\Model\BasicKioskEmployeeModel */ - public function genericManagerTimeAndAttendanceCheckId($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckId($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckId'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $model, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $business_id, $model, $contentType); return $response; } @@ -9109,17 +10148,17 @@ public function genericManagerTimeAndAttendanceCheckId($kiosk_id, $model, $busin * Check Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskEmployeeIdModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskEmployeeIdModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BasicKioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BasicKioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckId'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $model, $business_id); + $request = $this->genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -9128,9 +10167,16 @@ public function genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $m } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9141,19 +10187,37 @@ public function genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $m sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BasicKioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9170,7 +10234,7 @@ public function genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $m case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BasicKioskEmployeeModel', + '\OpenAPI\Client\Model\BasicKioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9186,15 +10250,16 @@ public function genericManagerTimeAndAttendanceCheckIdWithHttpInfo($kiosk_id, $m * Check Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskEmployeeIdModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskEmployeeIdModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceCheckIdAsync($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckIdAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckId'][0]) { - return $this->genericManagerTimeAndAttendanceCheckIdAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericManagerTimeAndAttendanceCheckIdAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -9208,26 +10273,26 @@ function ($response) { * Check Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskEmployeeIdModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskEmployeeIdModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceCheckIdAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckIdAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckId'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9250,7 +10315,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9260,26 +10325,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceCheckId' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskEmployeeIdModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskEmployeeIdModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckId'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceCheckId' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceCheckId' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9287,6 +10349,14 @@ protected function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $mod ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceCheckId' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/checkid'; $formParams = []; $queryParams = []; @@ -9295,6 +10365,7 @@ protected function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $mod $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -9312,56 +10383,42 @@ protected function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $mod ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9382,10 +10439,11 @@ protected function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $mod $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9397,16 +10455,17 @@ protected function genericManagerTimeAndAttendanceCheckIdRequest($kiosk_id, $mod * Verify Kiosk PIN * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskPinModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckPin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceCheckPin($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckPin($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckPin'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $model, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $business_id, $model, $contentType); return $response; } @@ -9416,17 +10475,17 @@ public function genericManagerTimeAndAttendanceCheckPin($kiosk_id, $model, $busi * Verify Kiosk PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckPin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckPin'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $model, $business_id); + $request = $this->genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -9435,9 +10494,16 @@ public function genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9448,19 +10514,37 @@ public function genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9477,7 +10561,7 @@ public function genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9493,15 +10577,16 @@ public function genericManagerTimeAndAttendanceCheckPinWithHttpInfo($kiosk_id, $ * Verify Kiosk PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckPin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceCheckPinAsync($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckPinAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckPin'][0]) { - return $this->genericManagerTimeAndAttendanceCheckPinAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericManagerTimeAndAttendanceCheckPinAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -9515,26 +10600,26 @@ function ($response) { * Verify Kiosk PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckPin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceCheckPinAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckPinAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckPin'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9557,7 +10642,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9567,26 +10652,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceCheckPin' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceCheckPin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceCheckPin'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceCheckPin' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceCheckPin' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9594,6 +10676,14 @@ protected function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $mo ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceCheckPin' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/checkpin'; $formParams = []; $queryParams = []; @@ -9602,6 +10692,7 @@ protected function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $mo $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -9619,56 +10710,42 @@ protected function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $mo ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9689,10 +10766,11 @@ protected function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $mo $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9704,16 +10782,17 @@ protected function genericManagerTimeAndAttendanceCheckPinRequest($kiosk_id, $mo * Clock Out Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceClockOff($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOff($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOff'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $business_id, $request, $contentType); return $response; } @@ -9723,17 +10802,17 @@ public function genericManagerTimeAndAttendanceClockOff($kiosk_id, $request, $bu * Clock Out Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOff'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $request, $business_id); + $request = $this->genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -9742,9 +10821,16 @@ public function genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9755,19 +10841,37 @@ public function genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9784,7 +10888,7 @@ public function genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9800,15 +10904,16 @@ public function genericManagerTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $ * Clock Out Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceClockOffAsync($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOffAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOff'][0]) { - return $this->genericManagerTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericManagerTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -9822,26 +10927,26 @@ function ($response) { * Clock Out Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOff'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9864,7 +10969,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9874,26 +10979,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceClockOff' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOff'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceClockOff' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceClockOff' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9901,6 +11003,14 @@ protected function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $re ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceClockOff' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/clockoff'; $formParams = []; $queryParams = []; @@ -9909,6 +11019,7 @@ protected function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $re $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -9926,56 +11037,42 @@ protected function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $re ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9996,10 +11093,11 @@ protected function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $re $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10011,16 +11109,17 @@ protected function genericManagerTimeAndAttendanceClockOffRequest($kiosk_id, $re * Clock In Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ClockOnModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ClockOnModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOn'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceClockOn($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOn($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOn'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $request, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $business_id, $request, $contentType); return $response; } @@ -10030,17 +11129,17 @@ public function genericManagerTimeAndAttendanceClockOn($kiosk_id, $request, $bus * Clock In Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOnModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOnModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOn'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOn'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $request, $business_id); + $request = $this->genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -10049,9 +11148,16 @@ public function genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $r } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10062,19 +11168,37 @@ public function genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $r sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10091,7 +11215,7 @@ public function genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $r case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10107,15 +11231,16 @@ public function genericManagerTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $r * Clock In Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOnModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOnModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceClockOnAsync($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOnAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOn'][0]) { - return $this->genericManagerTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericManagerTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -10129,26 +11254,26 @@ function ($response) { * Clock In Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOnModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOnModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOn'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10171,7 +11296,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10181,26 +11306,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceClockOn' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOnModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOnModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceClockOn'][0]) { - // verify the required parameter 'kiosk_id' is set - if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceClockOn' - ); - } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { + + // verify the required parameter 'kiosk_id' is set + if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceClockOn' + 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceClockOn' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -10208,6 +11330,14 @@ protected function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $req ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceClockOn' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/clockon'; $formParams = []; $queryParams = []; @@ -10216,6 +11346,7 @@ protected function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $req $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -10233,56 +11364,42 @@ protected function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $req ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10303,10 +11420,11 @@ protected function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $req $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10321,14 +11439,15 @@ protected function genericManagerTimeAndAttendanceClockOnRequest($kiosk_id, $req * @param int $shift_id shift_id (required) * @param int $note_id note_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericManagerTimeAndAttendanceDeleteNote($kiosk_id, $shift_id, $note_id, $business_id) + public function genericManagerTimeAndAttendanceDeleteNote($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'][0]) { - $this->genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id); + $this->genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, $contentType); } /** @@ -10340,15 +11459,15 @@ public function genericManagerTimeAndAttendanceDeleteNote($kiosk_id, $shift_id, * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id) + public function genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'][0]) { - $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id); + $request = $this->genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -10357,9 +11476,16 @@ public function genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10370,11 +11496,11 @@ public function genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -10396,13 +11522,14 @@ public function genericManagerTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceDeleteNoteAsync($kiosk_id, $shift_id, $note_id, $business_id) + public function genericManagerTimeAndAttendanceDeleteNoteAsync($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'][0]) { - return $this->genericManagerTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id) + return $this->genericManagerTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -10419,14 +11546,15 @@ function ($response) { * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id) + public function genericManagerTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'][0]) { $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id); + $request = $this->genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10445,7 +11573,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10458,30 +11586,35 @@ function ($exception) { * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id) + public function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDeleteNote'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceDeleteNote' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling genericManagerTimeAndAttendanceDeleteNote' ); } + // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $note_id when calling genericManagerTimeAndAttendanceDeleteNote' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -10489,6 +11622,7 @@ protected function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/shift/{shiftId}/notes/{noteId}'; $formParams = []; $queryParams = []; @@ -10497,6 +11631,7 @@ protected function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $ $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -10530,53 +11665,35 @@ protected function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10597,10 +11714,11 @@ protected function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10612,16 +11730,17 @@ protected function genericManagerTimeAndAttendanceDeleteNoteRequest($kiosk_id, $ * Discard current shift * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceDiscardShift($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceDiscardShift($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $request, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $business_id, $request, $contentType); return $response; } @@ -10631,17 +11750,17 @@ public function genericManagerTimeAndAttendanceDiscardShift($kiosk_id, $request, * Discard current shift * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $request, $business_id); + $request = $this->genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -10650,9 +11769,16 @@ public function genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10663,19 +11789,37 @@ public function genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10692,7 +11836,7 @@ public function genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10708,15 +11852,16 @@ public function genericManagerTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_i * Discard current shift * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceDiscardShiftAsync($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceDiscardShiftAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'][0]) { - return $this->genericManagerTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericManagerTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -10730,26 +11875,26 @@ function ($response) { * Discard current shift * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10772,7 +11917,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10782,26 +11927,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceDiscardShift' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceDiscardShift'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceDiscardShift' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceDiscardShift' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -10809,6 +11951,14 @@ protected function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceDiscardShift' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/discard'; $formParams = []; $queryParams = []; @@ -10817,6 +11967,7 @@ protected function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -10834,56 +11985,42 @@ protected function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10904,10 +12041,11 @@ protected function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10918,17 +12056,18 @@ protected function genericManagerTimeAndAttendanceDiscardShiftRequest($kiosk_id, * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEmailReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericManagerTimeAndAttendanceEmailReset($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceEmailReset($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEmailReset'][0]) { - $this->genericManagerTimeAndAttendanceEmailResetWithHttpInfo($model, $business_id, $kiosk_id); + $this->genericManagerTimeAndAttendanceEmailResetWithHttpInfo($business_id, $kiosk_id, $model, $contentType); } /** @@ -10936,18 +12075,18 @@ public function genericManagerTimeAndAttendanceEmailReset($model, $business_id, * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEmailReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceEmailResetWithHttpInfo($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceEmailResetWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEmailReset'][0]) { - $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceEmailResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericManagerTimeAndAttendanceEmailResetRequest($business_id, $kiosk_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -10956,9 +12095,16 @@ public function genericManagerTimeAndAttendanceEmailResetWithHttpInfo($model, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10969,11 +12115,11 @@ public function genericManagerTimeAndAttendanceEmailResetWithHttpInfo($model, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -10991,16 +12137,17 @@ public function genericManagerTimeAndAttendanceEmailResetWithHttpInfo($model, $b * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEmailReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceEmailResetAsync($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceEmailResetAsync($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEmailReset'][0]) { - return $this->genericManagerTimeAndAttendanceEmailResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + return $this->genericManagerTimeAndAttendanceEmailResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -11013,17 +12160,18 @@ function ($response) { * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEmailReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceEmailResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceEmailResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEmailReset'][0]) { $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceEmailResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericManagerTimeAndAttendanceEmailResetRequest($business_id, $kiosk_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -11042,7 +12190,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11051,27 +12199,24 @@ function ($exception) { /** * Create request for operation 'genericManagerTimeAndAttendanceEmailReset' * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEmailReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceEmailResetRequest($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceEmailResetRequest($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEmailReset'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceEmailReset' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericManagerTimeAndAttendanceEmailReset' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( @@ -11079,6 +12224,14 @@ protected function genericManagerTimeAndAttendanceEmailResetRequest($model, $bus ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceEmailReset' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/emailreset'; $formParams = []; $queryParams = []; @@ -11087,6 +12240,7 @@ protected function genericManagerTimeAndAttendanceEmailResetRequest($model, $bus $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -11104,56 +12258,42 @@ protected function genericManagerTimeAndAttendanceEmailResetRequest($model, $bus ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11174,10 +12314,11 @@ protected function genericManagerTimeAndAttendanceEmailResetRequest($model, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11189,16 +12330,17 @@ protected function genericManagerTimeAndAttendanceEmailResetRequest($model, $bus * End Break * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEndBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceEndBreak($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceEndBreak($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEndBreak'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $business_id, $request, $contentType); return $response; } @@ -11208,17 +12350,17 @@ public function genericManagerTimeAndAttendanceEndBreak($kiosk_id, $request, $bu * End Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEndBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEndBreak'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $business_id); + $request = $this->genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -11227,9 +12369,16 @@ public function genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11240,19 +12389,37 @@ public function genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11269,7 +12436,7 @@ public function genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11285,15 +12452,16 @@ public function genericManagerTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $ * End Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEndBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceEndBreakAsync($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceEndBreakAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEndBreak'][0]) { - return $this->genericManagerTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericManagerTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -11307,26 +12475,26 @@ function ($response) { * End Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEndBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEndBreak'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11349,7 +12517,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11359,26 +12527,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceEndBreak' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceEndBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceEndBreak'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceEndBreak' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceEndBreak' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -11386,6 +12551,14 @@ protected function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $re ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceEndBreak' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/endbreak'; $formParams = []; $queryParams = []; @@ -11394,6 +12567,7 @@ protected function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $re $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -11411,56 +12585,42 @@ protected function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $re ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11481,10 +12641,11 @@ protected function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $re $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11498,18 +12659,19 @@ protected function genericManagerTimeAndAttendanceEndBreakRequest($kiosk_id, $re * @param int $kiosk_id kiosk_id (required) * @param int $shift_id shift_id (required) * @param string $business_id business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id model_employee_id (optional) + * @param bool $model_is_admin_initiated model_is_admin_initiated (optional) + * @param string $model_type model_type (optional) + * @param string $model_visibility model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftNoteViewModel[] + * @return \OpenAPI\Client\Model\ShiftNoteViewModel[] */ - public function genericManagerTimeAndAttendanceGetShiftNotes($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericManagerTimeAndAttendanceGetShiftNotes($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + list($response) = $this->genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); return $response; } @@ -11521,19 +12683,19 @@ public function genericManagerTimeAndAttendanceGetShiftNotes($kiosk_id, $shift_i * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftNoteViewModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftNoteViewModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'][0]) { - $returnType = '\Swagger\Client\Model\ShiftNoteViewModel[]'; - $request = $this->genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $request = $this->genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); try { $options = $this->createHttpClientOption(); @@ -11542,9 +12704,16 @@ public function genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11555,19 +12724,37 @@ public function genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftNoteViewModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftNoteViewModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftNoteViewModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftNoteViewModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11584,7 +12771,7 @@ public function genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftNoteViewModel[]', + '\OpenAPI\Client\Model\ShiftNoteViewModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11602,17 +12789,18 @@ public function genericManagerTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_ * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceGetShiftNotesAsync($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericManagerTimeAndAttendanceGetShiftNotesAsync($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'][0]) { - return $this->genericManagerTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility) + return $this->genericManagerTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType) ->then( function ($response) { return $response[0]; @@ -11628,28 +12816,28 @@ function ($response) { * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericManagerTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'][0]) { - $returnType = '\Swagger\Client\Model\ShiftNoteViewModel[]'; - $request = $this->genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $returnType = '\OpenAPI\Client\Model\ShiftNoteViewModel[]'; + $request = $this->genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11672,7 +12860,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11684,28 +12872,32 @@ function ($exception) { * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetShiftNotes'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceGetShiftNotes' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling genericManagerTimeAndAttendanceGetShiftNotes' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -11713,6 +12905,11 @@ protected function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/shift/{shiftId}/notes'; $formParams = []; $queryParams = []; @@ -11721,21 +12918,42 @@ protected function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id $multipart = false; // query params - if ($model_employee_id !== null) { - $queryParams['model.employeeId'] = ObjectSerializer::toQueryValue($model_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employee_id, + 'model.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_is_admin_initiated !== null) { - $queryParams['model.isAdminInitiated'] = ObjectSerializer::toQueryValue($model_is_admin_initiated); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_is_admin_initiated, + 'model.isAdminInitiated', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_type !== null) { - $queryParams['model.type'] = ObjectSerializer::toQueryValue($model_type); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_type, + 'model.type', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_visibility !== null) { - $queryParams['model.visibility'] = ObjectSerializer::toQueryValue($model_visibility); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_visibility, + 'model.visibility', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($kiosk_id !== null) { @@ -11762,53 +12980,35 @@ protected function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11829,10 +13029,11 @@ protected function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11846,14 +13047,15 @@ protected function genericManagerTimeAndAttendanceGetShiftNotesRequest($kiosk_id * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BasicKioskEmployeeModel[] + * @return \OpenAPI\Client\Model\BasicKioskEmployeeModel[] */ - public function genericManagerTimeAndAttendanceGetStaff($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericManagerTimeAndAttendanceGetStaff($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetStaff'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location); + list($response) = $this->genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType); return $response; } @@ -11865,15 +13067,15 @@ public function genericManagerTimeAndAttendanceGetStaff($kiosk_id, $business_id, * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BasicKioskEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BasicKioskEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetStaff'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel[]'; - $request = $this->genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location); + $request = $this->genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType); try { $options = $this->createHttpClientOption(); @@ -11882,9 +13084,16 @@ public function genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11895,19 +13104,37 @@ public function genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11924,7 +13151,7 @@ public function genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BasicKioskEmployeeModel[]', + '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11942,13 +13169,14 @@ public function genericManagerTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $ * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceGetStaffAsync($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericManagerTimeAndAttendanceGetStaffAsync($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetStaff'][0]) { - return $this->genericManagerTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location) + return $this->genericManagerTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType) ->then( function ($response) { return $response[0]; @@ -11964,24 +13192,24 @@ function ($response) { * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericManagerTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetStaff'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel[]'; - $request = $this->genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location); + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]'; + $request = $this->genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12004,7 +13232,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12016,18 +13244,21 @@ function ($exception) { * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceGetStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceGetStaff'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceGetStaff' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -12035,6 +13266,8 @@ protected function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $bu ); } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/staff'; $formParams = []; $queryParams = []; @@ -12043,9 +13276,15 @@ protected function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $bu $multipart = false; // query params - if ($restrict_current_shifts_to_current_kiosk_location !== null) { - $queryParams['restrictCurrentShiftsToCurrentKioskLocation'] = ObjectSerializer::toQueryValue($restrict_current_shifts_to_current_kiosk_location); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $restrict_current_shifts_to_current_kiosk_location, + 'restrictCurrentShiftsToCurrentKioskLocation', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($kiosk_id !== null) { @@ -12064,53 +13303,35 @@ protected function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $bu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12131,10 +13352,11 @@ protected function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $bu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12145,18 +13367,19 @@ protected function genericManagerTimeAndAttendanceGetStaffRequest($kiosk_id, $bu * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) * @param string $shift_id shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericManagerTimeAndAttendanceMarkNotesRead($model, $business_id, $kiosk_id, $shift_id) + public function genericManagerTimeAndAttendanceMarkNotesRead($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'][0]) { - $this->genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $business_id, $kiosk_id, $shift_id); + $this->genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, $contentType); } /** @@ -12164,19 +13387,19 @@ public function genericManagerTimeAndAttendanceMarkNotesRead($model, $business_i * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $business_id, $kiosk_id, $shift_id) + public function genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'][0]) { - $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $business_id, $kiosk_id, $shift_id); + $request = $this->genericManagerTimeAndAttendanceMarkNotesReadRequest($business_id, $kiosk_id, $shift_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -12185,9 +13408,16 @@ public function genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($model, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12198,11 +13428,11 @@ public function genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($model, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -12220,17 +13450,18 @@ public function genericManagerTimeAndAttendanceMarkNotesReadWithHttpInfo($model, * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceMarkNotesReadAsync($model, $business_id, $kiosk_id, $shift_id) + public function genericManagerTimeAndAttendanceMarkNotesReadAsync($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'][0]) { - return $this->genericManagerTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($model, $business_id, $kiosk_id, $shift_id) + return $this->genericManagerTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -12243,18 +13474,19 @@ function ($response) { * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($model, $business_id, $kiosk_id, $shift_id) + public function genericManagerTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'][0]) { $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $business_id, $kiosk_id, $shift_id); + $request = $this->genericManagerTimeAndAttendanceMarkNotesReadRequest($business_id, $kiosk_id, $shift_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12273,7 +13505,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12282,34 +13514,32 @@ function ($exception) { /** * Create request for operation 'genericManagerTimeAndAttendanceMarkNotesRead' * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $business_id, $kiosk_id, $shift_id) + public function genericManagerTimeAndAttendanceMarkNotesReadRequest($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceMarkNotesRead'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceMarkNotesRead' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericManagerTimeAndAttendanceMarkNotesRead' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceMarkNotesRead' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( @@ -12317,6 +13547,14 @@ protected function genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceMarkNotesRead' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/shift/{shiftId}/notes/read-state'; $formParams = []; $queryParams = []; @@ -12325,6 +13563,7 @@ protected function genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $ $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -12350,56 +13589,42 @@ protected function genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12420,10 +13645,11 @@ protected function genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12435,16 +13661,17 @@ protected function genericManagerTimeAndAttendanceMarkNotesReadRequest($model, $ * Add an Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendancePostStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericManagerTimeAndAttendancePostStaff($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendancePostStaff($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendancePostStaff'][0]) { - $this->genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, $business_id); + $this->genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $business_id, $model, $contentType); } /** @@ -12453,17 +13680,17 @@ public function genericManagerTimeAndAttendancePostStaff($kiosk_id, $model, $bus * Add an Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendancePostStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendancePostStaff'][0]) { - $returnType = ''; - $request = $this->genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $model, $business_id); + $request = $this->genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -12472,9 +13699,16 @@ public function genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12485,11 +13719,11 @@ public function genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -12508,15 +13742,16 @@ public function genericManagerTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, * Add an Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendancePostStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendancePostStaffAsync($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendancePostStaffAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendancePostStaff'][0]) { - return $this->genericManagerTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericManagerTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -12530,16 +13765,17 @@ function ($response) { * Add an Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendancePostStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendancePostStaff'][0]) { $returnType = ''; - $request = $this->genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $model, $business_id); + $request = $this->genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12558,7 +13794,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12568,26 +13804,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendancePostStaff' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendancePostStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $model, $business_id) + public function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendancePostStaff'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendancePostStaff' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendancePostStaff' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -12595,6 +13828,14 @@ protected function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $m ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendancePostStaff' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/staff'; $formParams = []; $queryParams = []; @@ -12603,6 +13844,7 @@ protected function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $m $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -12620,56 +13862,42 @@ protected function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $m ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12690,10 +13918,11 @@ protected function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $m $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12704,17 +13933,18 @@ protected function genericManagerTimeAndAttendancePostStaffRequest($kiosk_id, $m * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceSmsReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericManagerTimeAndAttendanceSmsReset($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceSmsReset($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceSmsReset'][0]) { - $this->genericManagerTimeAndAttendanceSmsResetWithHttpInfo($model, $business_id, $kiosk_id); + $this->genericManagerTimeAndAttendanceSmsResetWithHttpInfo($business_id, $kiosk_id, $model, $contentType); } /** @@ -12722,18 +13952,18 @@ public function genericManagerTimeAndAttendanceSmsReset($model, $business_id, $k * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceSmsReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceSmsResetWithHttpInfo($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceSmsResetWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceSmsReset'][0]) { - $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceSmsResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericManagerTimeAndAttendanceSmsResetRequest($business_id, $kiosk_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -12742,9 +13972,16 @@ public function genericManagerTimeAndAttendanceSmsResetWithHttpInfo($model, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12755,11 +13992,11 @@ public function genericManagerTimeAndAttendanceSmsResetWithHttpInfo($model, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -12777,16 +14014,17 @@ public function genericManagerTimeAndAttendanceSmsResetWithHttpInfo($model, $bus * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceSmsReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceSmsResetAsync($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceSmsResetAsync($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceSmsReset'][0]) { - return $this->genericManagerTimeAndAttendanceSmsResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + return $this->genericManagerTimeAndAttendanceSmsResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -12799,17 +14037,18 @@ function ($response) { * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceSmsReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceSmsResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceSmsResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceSmsReset'][0]) { $returnType = ''; - $request = $this->genericManagerTimeAndAttendanceSmsResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericManagerTimeAndAttendanceSmsResetRequest($business_id, $kiosk_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12828,7 +14067,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12837,27 +14076,24 @@ function ($exception) { /** * Create request for operation 'genericManagerTimeAndAttendanceSmsReset' * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceSmsReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceSmsResetRequest($model, $business_id, $kiosk_id) + public function genericManagerTimeAndAttendanceSmsResetRequest($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceSmsReset'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceSmsReset' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericManagerTimeAndAttendanceSmsReset' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( @@ -12865,6 +14101,14 @@ protected function genericManagerTimeAndAttendanceSmsResetRequest($model, $busin ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericManagerTimeAndAttendanceSmsReset' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/smsreset'; $formParams = []; $queryParams = []; @@ -12873,6 +14117,7 @@ protected function genericManagerTimeAndAttendanceSmsResetRequest($model, $busin $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -12890,56 +14135,42 @@ protected function genericManagerTimeAndAttendanceSmsResetRequest($model, $busin ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12960,10 +14191,11 @@ protected function genericManagerTimeAndAttendanceSmsResetRequest($model, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12975,16 +14207,17 @@ protected function genericManagerTimeAndAttendanceSmsResetRequest($model, $busin * Start Break * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceStartBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericManagerTimeAndAttendanceStartBreak($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceStartBreak($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceStartBreak'][0]) { - list($response) = $this->genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $request, $business_id); + list($response) = $this->genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $business_id, $request, $contentType); return $response; } @@ -12994,17 +14227,17 @@ public function genericManagerTimeAndAttendanceStartBreak($kiosk_id, $request, $ * Start Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceStartBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceStartBreak'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $request, $business_id); + $request = $this->genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -13013,9 +14246,16 @@ public function genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13026,19 +14266,37 @@ public function genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13055,7 +14313,7 @@ public function genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13071,15 +14329,16 @@ public function genericManagerTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, * Start Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceStartBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceStartBreakAsync($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceStartBreakAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceStartBreak'][0]) { - return $this->genericManagerTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericManagerTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -13093,26 +14352,26 @@ function ($response) { * Start Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceStartBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceStartBreak'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13135,7 +14394,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13145,26 +14404,23 @@ function ($exception) { * Create request for operation 'genericManagerTimeAndAttendanceStartBreak' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimeAndAttendanceStartBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $request, $business_id) + public function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericManagerTimeAndAttendanceStartBreak'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericManagerTimeAndAttendanceStartBreak' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceStartBreak' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13172,6 +14428,14 @@ protected function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $ ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericManagerTimeAndAttendanceStartBreak' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{kioskId}/startbreak'; $formParams = []; $queryParams = []; @@ -13180,6 +14444,7 @@ protected function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $ $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -13197,56 +14462,42 @@ protected function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $ ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13267,10 +14518,11 @@ protected function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13282,24 +14534,25 @@ protected function genericManagerTimeAndAttendanceStartBreakRequest($kiosk_id, $ * Get Business Timesheets * * @param string $business_id business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_status (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_employee_group_id (optional) - * @param int $filter_location_id (optional) - * @param bool $filter_include_costs (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) - * @param string $filter_order_by (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param string $filter_status filter_status (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param int $filter_employee_group_id filter_employee_group_id (optional) + * @param int $filter_location_id filter_location_id (optional) + * @param bool $filter_include_costs filter_include_costs (optional) + * @param int $filter_current_page filter_current_page (optional) + * @param int $filter_page_size filter_page_size (optional) + * @param string $filter_order_by filter_order_by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PagedResultModelOfManagerTimesheetLineModel + * @return \OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel */ - public function genericManagerTimesheetGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null) + public function genericManagerTimesheetGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null, string $contentType = self::contentTypes['genericManagerTimesheetGet'][0]) { - list($response) = $this->genericManagerTimesheetGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by); + list($response) = $this->genericManagerTimesheetGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by, $contentType); return $response; } @@ -13309,25 +14562,25 @@ public function genericManagerTimesheetGet($business_id, $filter_from_date = nul * Get Business Timesheets * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_status (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_employee_group_id (optional) - * @param int $filter_location_id (optional) - * @param bool $filter_include_costs (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) - * @param string $filter_order_by (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_status (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_employee_group_id (optional) + * @param int $filter_location_id (optional) + * @param bool $filter_include_costs (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $filter_order_by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PagedResultModelOfManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimesheetGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null) + public function genericManagerTimesheetGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null, string $contentType = self::contentTypes['genericManagerTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\PagedResultModelOfManagerTimesheetLineModel'; - $request = $this->genericManagerTimesheetGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by); + $request = $this->genericManagerTimesheetGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by, $contentType); try { $options = $this->createHttpClientOption(); @@ -13336,9 +14589,16 @@ public function genericManagerTimesheetGetWithHttpInfo($business_id, $filter_fro } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13349,19 +14609,37 @@ public function genericManagerTimesheetGetWithHttpInfo($business_id, $filter_fro sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13378,7 +14656,7 @@ public function genericManagerTimesheetGetWithHttpInfo($business_id, $filter_fro case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PagedResultModelOfManagerTimesheetLineModel', + '\OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13394,23 +14672,24 @@ public function genericManagerTimesheetGetWithHttpInfo($business_id, $filter_fro * Get Business Timesheets * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_status (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_employee_group_id (optional) - * @param int $filter_location_id (optional) - * @param bool $filter_include_costs (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) - * @param string $filter_order_by (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_status (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_employee_group_id (optional) + * @param int $filter_location_id (optional) + * @param bool $filter_include_costs (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $filter_order_by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null) + public function genericManagerTimesheetGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null, string $contentType = self::contentTypes['genericManagerTimesheetGet'][0]) { - return $this->genericManagerTimesheetGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by) + return $this->genericManagerTimesheetGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by, $contentType) ->then( function ($response) { return $response[0]; @@ -13424,34 +14703,34 @@ function ($response) { * Get Business Timesheets * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_status (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_employee_group_id (optional) - * @param int $filter_location_id (optional) - * @param bool $filter_include_costs (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) - * @param string $filter_order_by (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_status (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_employee_group_id (optional) + * @param int $filter_location_id (optional) + * @param bool $filter_include_costs (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $filter_order_by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null) + public function genericManagerTimesheetGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null, string $contentType = self::contentTypes['genericManagerTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\PagedResultModelOfManagerTimesheetLineModel'; - $request = $this->genericManagerTimesheetGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by); + $returnType = '\OpenAPI\Client\Model\PagedResultModelOfManagerTimesheetLineModel'; + $request = $this->genericManagerTimesheetGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_status, $filter_employee_id, $filter_employee_group_id, $filter_location_id, $filter_include_costs, $filter_current_page, $filter_page_size, $filter_order_by, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13474,7 +14753,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13484,22 +14763,24 @@ function ($exception) { * Create request for operation 'genericManagerTimesheetGet' * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_status (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_employee_group_id (optional) - * @param int $filter_location_id (optional) - * @param bool $filter_include_costs (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) - * @param string $filter_order_by (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_status (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_employee_group_id (optional) + * @param int $filter_location_id (optional) + * @param bool $filter_include_costs (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $filter_order_by (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimesheetGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null) + public function genericManagerTimesheetGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_status = null, $filter_employee_id = null, $filter_employee_group_id = null, $filter_location_id = null, $filter_include_costs = null, $filter_current_page = null, $filter_page_size = null, $filter_order_by = null, string $contentType = self::contentTypes['genericManagerTimesheetGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13507,6 +14788,17 @@ protected function genericManagerTimesheetGetRequest($business_id, $filter_from_ ); } + + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/timesheet'; $formParams = []; $queryParams = []; @@ -13515,45 +14807,96 @@ protected function genericManagerTimesheetGetRequest($business_id, $filter_from_ $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_status !== null) { - $queryParams['filter.status'] = ObjectSerializer::toQueryValue($filter_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_status, + 'filter.status', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_group_id !== null) { - $queryParams['filter.employeeGroupId'] = ObjectSerializer::toQueryValue($filter_employee_group_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_group_id, + 'filter.employeeGroupId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_include_costs !== null) { - $queryParams['filter.includeCosts'] = ObjectSerializer::toQueryValue($filter_include_costs); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_include_costs, + 'filter.includeCosts', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_current_page !== null) { - $queryParams['filter.currentPage'] = ObjectSerializer::toQueryValue($filter_current_page); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_current_page, + 'filter.currentPage', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_page_size !== null) { - $queryParams['filter.pageSize'] = ObjectSerializer::toQueryValue($filter_page_size); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_page_size, + 'filter.pageSize', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_order_by !== null) { - $queryParams['filter.orderBy'] = ObjectSerializer::toQueryValue($filter_order_by); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_order_by, + 'filter.orderBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -13564,53 +14907,35 @@ protected function genericManagerTimesheetGetRequest($business_id, $filter_from_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13631,10 +14956,11 @@ protected function genericManagerTimesheetGetRequest($business_id, $filter_from_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13646,14 +14972,15 @@ protected function genericManagerTimesheetGetRequest($business_id, $filter_from_ * List Employee Groups * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetEmployeeGroups'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerEmployeeGroup[] + * @return \OpenAPI\Client\Model\ManagerEmployeeGroup[] */ - public function genericManagerTimesheetGetEmployeeGroups($business_id) + public function genericManagerTimesheetGetEmployeeGroups($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetEmployeeGroups'][0]) { - list($response) = $this->genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_id); + list($response) = $this->genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_id, $contentType); return $response; } @@ -13663,15 +14990,15 @@ public function genericManagerTimesheetGetEmployeeGroups($business_id) * List Employee Groups * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetEmployeeGroups'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerEmployeeGroup[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerEmployeeGroup[], HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_id) + public function genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetEmployeeGroups'][0]) { - $returnType = '\Swagger\Client\Model\ManagerEmployeeGroup[]'; - $request = $this->genericManagerTimesheetGetEmployeeGroupsRequest($business_id); + $request = $this->genericManagerTimesheetGetEmployeeGroupsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13680,9 +15007,16 @@ public function genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13693,19 +15027,37 @@ public function genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerEmployeeGroup[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerEmployeeGroup[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerEmployeeGroup[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerEmployeeGroup[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13722,7 +15074,7 @@ public function genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerEmployeeGroup[]', + '\OpenAPI\Client\Model\ManagerEmployeeGroup[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13738,13 +15090,14 @@ public function genericManagerTimesheetGetEmployeeGroupsWithHttpInfo($business_i * List Employee Groups * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetEmployeeGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetEmployeeGroupsAsync($business_id) + public function genericManagerTimesheetGetEmployeeGroupsAsync($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetEmployeeGroups'][0]) { - return $this->genericManagerTimesheetGetEmployeeGroupsAsyncWithHttpInfo($business_id) + return $this->genericManagerTimesheetGetEmployeeGroupsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13758,24 +15111,24 @@ function ($response) { * List Employee Groups * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetEmployeeGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetEmployeeGroupsAsyncWithHttpInfo($business_id) + public function genericManagerTimesheetGetEmployeeGroupsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetEmployeeGroups'][0]) { - $returnType = '\Swagger\Client\Model\ManagerEmployeeGroup[]'; - $request = $this->genericManagerTimesheetGetEmployeeGroupsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerEmployeeGroup[]'; + $request = $this->genericManagerTimesheetGetEmployeeGroupsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13798,7 +15151,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13808,12 +15161,14 @@ function ($exception) { * Create request for operation 'genericManagerTimesheetGetEmployeeGroups' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetEmployeeGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimesheetGetEmployeeGroupsRequest($business_id) + public function genericManagerTimesheetGetEmployeeGroupsRequest($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetEmployeeGroups'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13821,6 +15176,7 @@ protected function genericManagerTimesheetGetEmployeeGroupsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/timesheet/employeegroups'; $formParams = []; $queryParams = []; @@ -13829,6 +15185,7 @@ protected function genericManagerTimesheetGetEmployeeGroupsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -13838,53 +15195,35 @@ protected function genericManagerTimesheetGetEmployeeGroupsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13905,10 +15244,11 @@ protected function genericManagerTimesheetGetEmployeeGroupsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13920,14 +15260,15 @@ protected function genericManagerTimesheetGetEmployeeGroupsRequest($business_id) * List Timesheet Locations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function genericManagerTimesheetGetLocations($business_id) + public function genericManagerTimesheetGetLocations($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetLocations'][0]) { - list($response) = $this->genericManagerTimesheetGetLocationsWithHttpInfo($business_id); + list($response) = $this->genericManagerTimesheetGetLocationsWithHttpInfo($business_id, $contentType); return $response; } @@ -13937,15 +15278,15 @@ public function genericManagerTimesheetGetLocations($business_id) * List Timesheet Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimesheetGetLocationsWithHttpInfo($business_id) + public function genericManagerTimesheetGetLocationsWithHttpInfo($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->genericManagerTimesheetGetLocationsRequest($business_id); + $request = $this->genericManagerTimesheetGetLocationsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13954,9 +15295,16 @@ public function genericManagerTimesheetGetLocationsWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13967,19 +15315,37 @@ public function genericManagerTimesheetGetLocationsWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13996,7 +15362,7 @@ public function genericManagerTimesheetGetLocationsWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14012,13 +15378,14 @@ public function genericManagerTimesheetGetLocationsWithHttpInfo($business_id) * List Timesheet Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetLocationsAsync($business_id) + public function genericManagerTimesheetGetLocationsAsync($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetLocations'][0]) { - return $this->genericManagerTimesheetGetLocationsAsyncWithHttpInfo($business_id) + return $this->genericManagerTimesheetGetLocationsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14032,24 +15399,24 @@ function ($response) { * List Timesheet Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetLocationsAsyncWithHttpInfo($business_id) + public function genericManagerTimesheetGetLocationsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->genericManagerTimesheetGetLocationsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->genericManagerTimesheetGetLocationsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14072,7 +15439,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14082,12 +15449,14 @@ function ($exception) { * Create request for operation 'genericManagerTimesheetGetLocations' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimesheetGetLocationsRequest($business_id) + public function genericManagerTimesheetGetLocationsRequest($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -14095,6 +15464,7 @@ protected function genericManagerTimesheetGetLocationsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/timesheet/locations'; $formParams = []; $queryParams = []; @@ -14103,6 +15473,7 @@ protected function genericManagerTimesheetGetLocationsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -14112,53 +15483,35 @@ protected function genericManagerTimesheetGetLocationsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14179,10 +15532,11 @@ protected function genericManagerTimesheetGetLocationsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14194,14 +15548,15 @@ protected function genericManagerTimesheetGetLocationsRequest($business_id) * List Timesheet Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerTimesheetEmployeeModel[] + * @return \OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[] */ - public function genericManagerTimesheetGetTimesheetEmployees($business_id) + public function genericManagerTimesheetGetTimesheetEmployees($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'][0]) { - list($response) = $this->genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($business_id); + list($response) = $this->genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($business_id, $contentType); return $response; } @@ -14211,15 +15566,15 @@ public function genericManagerTimesheetGetTimesheetEmployees($business_id) * List Timesheet Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerTimesheetEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($business_id) + public function genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetEmployeeModel[]'; - $request = $this->genericManagerTimesheetGetTimesheetEmployeesRequest($business_id); + $request = $this->genericManagerTimesheetGetTimesheetEmployeesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14228,9 +15583,16 @@ public function genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14241,19 +15603,37 @@ public function genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14270,7 +15650,7 @@ public function genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerTimesheetEmployeeModel[]', + '\OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14286,13 +15666,14 @@ public function genericManagerTimesheetGetTimesheetEmployeesWithHttpInfo($busine * List Timesheet Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetTimesheetEmployeesAsync($business_id) + public function genericManagerTimesheetGetTimesheetEmployeesAsync($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'][0]) { - return $this->genericManagerTimesheetGetTimesheetEmployeesAsyncWithHttpInfo($business_id) + return $this->genericManagerTimesheetGetTimesheetEmployeesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14306,24 +15687,24 @@ function ($response) { * List Timesheet Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericManagerTimesheetGetTimesheetEmployeesAsyncWithHttpInfo($business_id) + public function genericManagerTimesheetGetTimesheetEmployeesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerTimesheetEmployeeModel[]'; - $request = $this->genericManagerTimesheetGetTimesheetEmployeesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerTimesheetEmployeeModel[]'; + $request = $this->genericManagerTimesheetGetTimesheetEmployeesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14346,7 +15727,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14356,12 +15737,14 @@ function ($exception) { * Create request for operation 'genericManagerTimesheetGetTimesheetEmployees' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericManagerTimesheetGetTimesheetEmployeesRequest($business_id) + public function genericManagerTimesheetGetTimesheetEmployeesRequest($business_id, string $contentType = self::contentTypes['genericManagerTimesheetGetTimesheetEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -14369,6 +15752,7 @@ protected function genericManagerTimesheetGetTimesheetEmployeesRequest($business ); } + $resourcePath = '/api/v2/business/{businessId}/manager/timesheet/employees'; $formParams = []; $queryParams = []; @@ -14377,6 +15761,7 @@ protected function genericManagerTimesheetGetTimesheetEmployeesRequest($business $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -14386,53 +15771,35 @@ protected function genericManagerTimesheetGetTimesheetEmployeesRequest($business ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14453,10 +15820,11 @@ protected function genericManagerTimesheetGetTimesheetEmployeesRequest($business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14470,14 +15838,15 @@ protected function genericManagerTimesheetGetTimesheetEmployeesRequest($business * @param int $document_id document_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerDocumentDownload'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function managerDocumentDownload($document_id, $business_id, $employee_id) + public function managerDocumentDownload($document_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerDocumentDownload'][0]) { - $this->managerDocumentDownloadWithHttpInfo($document_id, $business_id, $employee_id); + $this->managerDocumentDownloadWithHttpInfo($document_id, $business_id, $employee_id, $contentType); } /** @@ -14488,15 +15857,15 @@ public function managerDocumentDownload($document_id, $business_id, $employee_id * @param int $document_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerDocumentDownload'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function managerDocumentDownloadWithHttpInfo($document_id, $business_id, $employee_id) + public function managerDocumentDownloadWithHttpInfo($document_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerDocumentDownload'][0]) { - $returnType = ''; - $request = $this->managerDocumentDownloadRequest($document_id, $business_id, $employee_id); + $request = $this->managerDocumentDownloadRequest($document_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14505,9 +15874,16 @@ public function managerDocumentDownloadWithHttpInfo($document_id, $business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14518,11 +15894,11 @@ public function managerDocumentDownloadWithHttpInfo($document_id, $business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -14543,13 +15919,14 @@ public function managerDocumentDownloadWithHttpInfo($document_id, $business_id, * @param int $document_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerDocumentDownload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerDocumentDownloadAsync($document_id, $business_id, $employee_id) + public function managerDocumentDownloadAsync($document_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerDocumentDownload'][0]) { - return $this->managerDocumentDownloadAsyncWithHttpInfo($document_id, $business_id, $employee_id) + return $this->managerDocumentDownloadAsyncWithHttpInfo($document_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14565,14 +15942,15 @@ function ($response) { * @param int $document_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerDocumentDownload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerDocumentDownloadAsyncWithHttpInfo($document_id, $business_id, $employee_id) + public function managerDocumentDownloadAsyncWithHttpInfo($document_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerDocumentDownload'][0]) { $returnType = ''; - $request = $this->managerDocumentDownloadRequest($document_id, $business_id, $employee_id); + $request = $this->managerDocumentDownloadRequest($document_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -14591,7 +15969,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14603,24 +15981,28 @@ function ($exception) { * @param int $document_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerDocumentDownload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerDocumentDownloadRequest($document_id, $business_id, $employee_id) + public function managerDocumentDownloadRequest($document_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerDocumentDownload'][0]) { + // verify the required parameter 'document_id' is set if ($document_id === null || (is_array($document_id) && count($document_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $document_id when calling managerDocumentDownload' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerDocumentDownload' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -14628,6 +16010,7 @@ protected function managerDocumentDownloadRequest($document_id, $business_id, $e ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/document/download/{documentId}'; $formParams = []; $queryParams = []; @@ -14636,6 +16019,7 @@ protected function managerDocumentDownloadRequest($document_id, $business_id, $e $multipart = false; + // path params if ($document_id !== null) { $resourcePath = str_replace( @@ -14661,53 +16045,35 @@ protected function managerDocumentDownloadRequest($document_id, $business_id, $e ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14728,10 +16094,11 @@ protected function managerDocumentDownloadRequest($document_id, $business_id, $e $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14745,14 +16112,15 @@ protected function managerDocumentDownloadRequest($document_id, $business_id, $e * @param int $employee_id employee_id (required) * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerExpenseRequestModel + * @return \OpenAPI\Client\Model\ManagerExpenseRequestModel */ - public function managerEmployeeExpenseApprove($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseApprove($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseApprove'][0]) { - list($response) = $this->managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense_request_id, $business_id); + list($response) = $this->managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType); return $response; } @@ -14764,15 +16132,15 @@ public function managerEmployeeExpenseApprove($employee_id, $expense_request_id, * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseApprove'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseApproveRequest($employee_id, $expense_request_id, $business_id); + $request = $this->managerEmployeeExpenseApproveRequest($employee_id, $expense_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14781,9 +16149,16 @@ public function managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14794,19 +16169,37 @@ public function managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerExpenseRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14823,7 +16216,7 @@ public function managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerExpenseRequestModel', + '\OpenAPI\Client\Model\ManagerExpenseRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14841,13 +16234,14 @@ public function managerEmployeeExpenseApproveWithHttpInfo($employee_id, $expense * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseApproveAsync($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseApproveAsync($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseApprove'][0]) { - return $this->managerEmployeeExpenseApproveAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + return $this->managerEmployeeExpenseApproveAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14863,24 +16257,24 @@ function ($response) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseApproveAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseApproveAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseApprove'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseApproveRequest($employee_id, $expense_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; + $request = $this->managerEmployeeExpenseApproveRequest($employee_id, $expense_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14903,7 +16297,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14915,24 +16309,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseApproveRequest($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseApproveRequest($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseApprove'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseApprove' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling managerEmployeeExpenseApprove' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -14940,6 +16338,7 @@ protected function managerEmployeeExpenseApproveRequest($employee_id, $expense_r ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/{expenseRequestId}/approve'; $formParams = []; $queryParams = []; @@ -14948,6 +16347,7 @@ protected function managerEmployeeExpenseApproveRequest($employee_id, $expense_r $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -14973,53 +16373,35 @@ protected function managerEmployeeExpenseApproveRequest($employee_id, $expense_r ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15040,10 +16422,11 @@ protected function managerEmployeeExpenseApproveRequest($employee_id, $expense_r $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15055,16 +16438,17 @@ protected function managerEmployeeExpenseApproveRequest($employee_id, $expense_r * Create expense request * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request expense_request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseCreate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerExpenseRequestModel + * @return \OpenAPI\Client\Model\ManagerExpenseRequestModel */ - public function managerEmployeeExpenseCreate($employee_id, $expense_request, $business_id) + public function managerEmployeeExpenseCreate($employee_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseCreate'][0]) { - list($response) = $this->managerEmployeeExpenseCreateWithHttpInfo($employee_id, $expense_request, $business_id); + list($response) = $this->managerEmployeeExpenseCreateWithHttpInfo($employee_id, $business_id, $expense_request, $contentType); return $response; } @@ -15074,17 +16458,17 @@ public function managerEmployeeExpenseCreate($employee_id, $expense_request, $bu * Create expense request * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseCreate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseCreateWithHttpInfo($employee_id, $expense_request, $business_id) + public function managerEmployeeExpenseCreateWithHttpInfo($employee_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseCreate'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseCreateRequest($employee_id, $expense_request, $business_id); + $request = $this->managerEmployeeExpenseCreateRequest($employee_id, $business_id, $expense_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -15093,9 +16477,16 @@ public function managerEmployeeExpenseCreateWithHttpInfo($employee_id, $expense_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15106,19 +16497,37 @@ public function managerEmployeeExpenseCreateWithHttpInfo($employee_id, $expense_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerExpenseRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15135,7 +16544,7 @@ public function managerEmployeeExpenseCreateWithHttpInfo($employee_id, $expense_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerExpenseRequestModel', + '\OpenAPI\Client\Model\ManagerExpenseRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15151,15 +16560,16 @@ public function managerEmployeeExpenseCreateWithHttpInfo($employee_id, $expense_ * Create expense request * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseCreateAsync($employee_id, $expense_request, $business_id) + public function managerEmployeeExpenseCreateAsync($employee_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseCreate'][0]) { - return $this->managerEmployeeExpenseCreateAsyncWithHttpInfo($employee_id, $expense_request, $business_id) + return $this->managerEmployeeExpenseCreateAsyncWithHttpInfo($employee_id, $business_id, $expense_request, $contentType) ->then( function ($response) { return $response[0]; @@ -15173,26 +16583,26 @@ function ($response) { * Create expense request * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseCreateAsyncWithHttpInfo($employee_id, $expense_request, $business_id) + public function managerEmployeeExpenseCreateAsyncWithHttpInfo($employee_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseCreate'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseCreateRequest($employee_id, $expense_request, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; + $request = $this->managerEmployeeExpenseCreateRequest($employee_id, $business_id, $expense_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15215,7 +16625,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15225,26 +16635,23 @@ function ($exception) { * Create request for operation 'managerEmployeeExpenseCreate' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseCreateRequest($employee_id, $expense_request, $business_id) + public function managerEmployeeExpenseCreateRequest($employee_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseCreate'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseCreate' ); } - // verify the required parameter 'expense_request' is set - if ($expense_request === null || (is_array($expense_request) && count($expense_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $expense_request when calling managerEmployeeExpenseCreate' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15252,6 +16659,14 @@ protected function managerEmployeeExpenseCreateRequest($employee_id, $expense_re ); } + // verify the required parameter 'expense_request' is set + if ($expense_request === null || (is_array($expense_request) && count($expense_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $expense_request when calling managerEmployeeExpenseCreate' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense'; $formParams = []; $queryParams = []; @@ -15260,6 +16675,7 @@ protected function managerEmployeeExpenseCreateRequest($employee_id, $expense_re $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -15277,56 +16693,42 @@ protected function managerEmployeeExpenseCreateRequest($employee_id, $expense_re ); } - // body params - $_tempBody = null; - if (isset($expense_request)) { - $_tempBody = $expense_request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($expense_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($expense_request)); + } else { + $httpBody = $expense_request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15347,10 +16749,11 @@ protected function managerEmployeeExpenseCreateRequest($employee_id, $expense_re $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15363,16 +16766,17 @@ protected function managerEmployeeExpenseCreateRequest($employee_id, $expense_re * * @param int $employee_id employee_id (required) * @param int $expense_request_id expense_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $reason reason (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $reason reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerExpenseRequestModel + * @return \OpenAPI\Client\Model\ManagerExpenseRequestModel */ - public function managerEmployeeExpenseDecline($employee_id, $expense_request_id, $reason, $business_id) + public function managerEmployeeExpenseDecline($employee_id, $expense_request_id, $business_id, $reason, string $contentType = self::contentTypes['managerEmployeeExpenseDecline'][0]) { - list($response) = $this->managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense_request_id, $reason, $business_id); + list($response) = $this->managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense_request_id, $business_id, $reason, $contentType); return $response; } @@ -15383,17 +16787,17 @@ public function managerEmployeeExpenseDecline($employee_id, $expense_request_id, * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense_request_id, $reason, $business_id) + public function managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense_request_id, $business_id, $reason, string $contentType = self::contentTypes['managerEmployeeExpenseDecline'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseDeclineRequest($employee_id, $expense_request_id, $reason, $business_id); + $request = $this->managerEmployeeExpenseDeclineRequest($employee_id, $expense_request_id, $business_id, $reason, $contentType); try { $options = $this->createHttpClientOption(); @@ -15402,9 +16806,16 @@ public function managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15415,19 +16826,37 @@ public function managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerExpenseRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15444,7 +16873,7 @@ public function managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerExpenseRequestModel', + '\OpenAPI\Client\Model\ManagerExpenseRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15461,15 +16890,16 @@ public function managerEmployeeExpenseDeclineWithHttpInfo($employee_id, $expense * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseDeclineAsync($employee_id, $expense_request_id, $reason, $business_id) + public function managerEmployeeExpenseDeclineAsync($employee_id, $expense_request_id, $business_id, $reason, string $contentType = self::contentTypes['managerEmployeeExpenseDecline'][0]) { - return $this->managerEmployeeExpenseDeclineAsyncWithHttpInfo($employee_id, $expense_request_id, $reason, $business_id) + return $this->managerEmployeeExpenseDeclineAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $reason, $contentType) ->then( function ($response) { return $response[0]; @@ -15484,26 +16914,26 @@ function ($response) { * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseDeclineAsyncWithHttpInfo($employee_id, $expense_request_id, $reason, $business_id) + public function managerEmployeeExpenseDeclineAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $reason, string $contentType = self::contentTypes['managerEmployeeExpenseDecline'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseDeclineRequest($employee_id, $expense_request_id, $reason, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; + $request = $this->managerEmployeeExpenseDeclineRequest($employee_id, $expense_request_id, $business_id, $reason, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15526,7 +16956,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15537,32 +16967,30 @@ function ($exception) { * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseDeclineRequest($employee_id, $expense_request_id, $reason, $business_id) + public function managerEmployeeExpenseDeclineRequest($employee_id, $expense_request_id, $business_id, $reason, string $contentType = self::contentTypes['managerEmployeeExpenseDecline'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseDecline' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling managerEmployeeExpenseDecline' ); } - // verify the required parameter 'reason' is set - if ($reason === null || (is_array($reason) && count($reason) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $reason when calling managerEmployeeExpenseDecline' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15570,6 +16998,14 @@ protected function managerEmployeeExpenseDeclineRequest($employee_id, $expense_r ); } + // verify the required parameter 'reason' is set + if ($reason === null || (is_array($reason) && count($reason) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $reason when calling managerEmployeeExpenseDecline' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/{expenseRequestId}/decline'; $formParams = []; $queryParams = []; @@ -15578,6 +17014,7 @@ protected function managerEmployeeExpenseDeclineRequest($employee_id, $expense_r $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -15603,56 +17040,42 @@ protected function managerEmployeeExpenseDeclineRequest($employee_id, $expense_r ); } - // body params - $_tempBody = null; - if (isset($reason)) { - $_tempBody = $reason; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($reason)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($reason)); + } else { + $httpBody = $reason; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15673,10 +17096,11 @@ protected function managerEmployeeExpenseDeclineRequest($employee_id, $expense_r $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15690,14 +17114,15 @@ protected function managerEmployeeExpenseDeclineRequest($employee_id, $expense_r * @param int $employee_id employee_id (required) * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function managerEmployeeExpenseDelete($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseDelete($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseDelete'][0]) { - $this->managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_request_id, $business_id); + $this->managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType); } /** @@ -15708,15 +17133,15 @@ public function managerEmployeeExpenseDelete($employee_id, $expense_request_id, * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseDelete'][0]) { - $returnType = ''; - $request = $this->managerEmployeeExpenseDeleteRequest($employee_id, $expense_request_id, $business_id); + $request = $this->managerEmployeeExpenseDeleteRequest($employee_id, $expense_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -15725,9 +17150,16 @@ public function managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15738,11 +17170,11 @@ public function managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -15763,13 +17195,14 @@ public function managerEmployeeExpenseDeleteWithHttpInfo($employee_id, $expense_ * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseDeleteAsync($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseDeleteAsync($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseDelete'][0]) { - return $this->managerEmployeeExpenseDeleteAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + return $this->managerEmployeeExpenseDeleteAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -15785,14 +17218,15 @@ function ($response) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseDeleteAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseDeleteAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseDelete'][0]) { $returnType = ''; - $request = $this->managerEmployeeExpenseDeleteRequest($employee_id, $expense_request_id, $business_id); + $request = $this->managerEmployeeExpenseDeleteRequest($employee_id, $expense_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -15811,7 +17245,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15823,24 +17257,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseDeleteRequest($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseDeleteRequest($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseDelete'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseDelete' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling managerEmployeeExpenseDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15848,6 +17286,7 @@ protected function managerEmployeeExpenseDeleteRequest($employee_id, $expense_re ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -15856,6 +17295,7 @@ protected function managerEmployeeExpenseDeleteRequest($employee_id, $expense_re $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -15881,53 +17321,35 @@ protected function managerEmployeeExpenseDeleteRequest($employee_id, $expense_re ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15948,10 +17370,11 @@ protected function managerEmployeeExpenseDeleteRequest($employee_id, $expense_re $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15964,16 +17387,17 @@ protected function managerEmployeeExpenseDeleteRequest($employee_id, $expense_re * * @param int $employee_id employee_id (required) * @param int $expense_request_id expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request expense_request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseEdit'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerExpenseRequestModel + * @return \OpenAPI\Client\Model\ManagerExpenseRequestModel */ - public function managerEmployeeExpenseEdit($employee_id, $expense_request_id, $expense_request, $business_id) + public function managerEmployeeExpenseEdit($employee_id, $expense_request_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseEdit'][0]) { - list($response) = $this->managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_request_id, $expense_request, $business_id); + list($response) = $this->managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_request_id, $business_id, $expense_request, $contentType); return $response; } @@ -15984,17 +17408,17 @@ public function managerEmployeeExpenseEdit($employee_id, $expense_request_id, $e * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseEdit'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_request_id, $expense_request, $business_id) + public function managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_request_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseEdit'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseEditRequest($employee_id, $expense_request_id, $expense_request, $business_id); + $request = $this->managerEmployeeExpenseEditRequest($employee_id, $expense_request_id, $business_id, $expense_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -16003,9 +17427,16 @@ public function managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_re } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16016,19 +17447,37 @@ public function managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_re sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerExpenseRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16045,7 +17494,7 @@ public function managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_re case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerExpenseRequestModel', + '\OpenAPI\Client\Model\ManagerExpenseRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16062,15 +17511,16 @@ public function managerEmployeeExpenseEditWithHttpInfo($employee_id, $expense_re * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseEditAsync($employee_id, $expense_request_id, $expense_request, $business_id) + public function managerEmployeeExpenseEditAsync($employee_id, $expense_request_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseEdit'][0]) { - return $this->managerEmployeeExpenseEditAsyncWithHttpInfo($employee_id, $expense_request_id, $expense_request, $business_id) + return $this->managerEmployeeExpenseEditAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $expense_request, $contentType) ->then( function ($response) { return $response[0]; @@ -16085,26 +17535,26 @@ function ($response) { * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseEditAsyncWithHttpInfo($employee_id, $expense_request_id, $expense_request, $business_id) + public function managerEmployeeExpenseEditAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseEdit'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseEditRequest($employee_id, $expense_request_id, $expense_request, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; + $request = $this->managerEmployeeExpenseEditRequest($employee_id, $expense_request_id, $business_id, $expense_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16127,7 +17577,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16138,32 +17588,30 @@ function ($exception) { * * @param int $employee_id (required) * @param int $expense_request_id (required) - * @param \Swagger\Client\Model\ExpenseRequestEditModel $expense_request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ExpenseRequestEditModel $expense_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseEdit'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseEditRequest($employee_id, $expense_request_id, $expense_request, $business_id) + public function managerEmployeeExpenseEditRequest($employee_id, $expense_request_id, $business_id, $expense_request, string $contentType = self::contentTypes['managerEmployeeExpenseEdit'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseEdit' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling managerEmployeeExpenseEdit' ); } - // verify the required parameter 'expense_request' is set - if ($expense_request === null || (is_array($expense_request) && count($expense_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $expense_request when calling managerEmployeeExpenseEdit' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -16171,6 +17619,14 @@ protected function managerEmployeeExpenseEditRequest($employee_id, $expense_requ ); } + // verify the required parameter 'expense_request' is set + if ($expense_request === null || (is_array($expense_request) && count($expense_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $expense_request when calling managerEmployeeExpenseEdit' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -16179,6 +17635,7 @@ protected function managerEmployeeExpenseEditRequest($employee_id, $expense_requ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -16204,56 +17661,42 @@ protected function managerEmployeeExpenseEditRequest($employee_id, $expense_requ ); } - // body params - $_tempBody = null; - if (isset($expense_request)) { - $_tempBody = $expense_request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($expense_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($expense_request)); + } else { + $httpBody = $expense_request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16274,10 +17717,11 @@ protected function managerEmployeeExpenseEditRequest($employee_id, $expense_requ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16290,14 +17734,15 @@ protected function managerEmployeeExpenseEditRequest($employee_id, $expense_requ * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ExpenseReferenceData + * @return \OpenAPI\Client\Model\ExpenseReferenceData */ - public function managerEmployeeExpenseGet($employee_id, $business_id) + public function managerEmployeeExpenseGet($employee_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGet'][0]) { - list($response) = $this->managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id); + list($response) = $this->managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id, $contentType); return $response; } @@ -16308,15 +17753,15 @@ public function managerEmployeeExpenseGet($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ExpenseReferenceData, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ExpenseReferenceData, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id) + public function managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGet'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseReferenceData'; - $request = $this->managerEmployeeExpenseGetRequest($employee_id, $business_id); + $request = $this->managerEmployeeExpenseGetRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -16325,9 +17770,16 @@ public function managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16338,19 +17790,37 @@ public function managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ExpenseReferenceData' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExpenseReferenceData' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExpenseReferenceData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExpenseReferenceData'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16367,7 +17837,7 @@ public function managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ExpenseReferenceData', + '\OpenAPI\Client\Model\ExpenseReferenceData', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16384,13 +17854,14 @@ public function managerEmployeeExpenseGetWithHttpInfo($employee_id, $business_id * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseGetAsync($employee_id, $business_id) + public function managerEmployeeExpenseGetAsync($employee_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGet'][0]) { - return $this->managerEmployeeExpenseGetAsyncWithHttpInfo($employee_id, $business_id) + return $this->managerEmployeeExpenseGetAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -16405,24 +17876,24 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseGetAsyncWithHttpInfo($employee_id, $business_id) + public function managerEmployeeExpenseGetAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGet'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseReferenceData'; - $request = $this->managerEmployeeExpenseGetRequest($employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ExpenseReferenceData'; + $request = $this->managerEmployeeExpenseGetRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16445,7 +17916,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16456,18 +17927,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseGetRequest($employee_id, $business_id) + public function managerEmployeeExpenseGetRequest($employee_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGet'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -16475,6 +17949,7 @@ protected function managerEmployeeExpenseGetRequest($employee_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/reference'; $formParams = []; $queryParams = []; @@ -16483,6 +17958,7 @@ protected function managerEmployeeExpenseGetRequest($employee_id, $business_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -16500,53 +17976,35 @@ protected function managerEmployeeExpenseGetRequest($employee_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16567,10 +18025,11 @@ protected function managerEmployeeExpenseGetRequest($employee_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16584,14 +18043,15 @@ protected function managerEmployeeExpenseGetRequest($employee_id, $business_id) * @param int $employee_id employee_id (required) * @param int $expense_request_id expense_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerExpenseRequestModel + * @return \OpenAPI\Client\Model\ManagerExpenseRequestModel */ - public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'][0]) { - list($response) = $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdWithHttpInfo($employee_id, $expense_request_id, $business_id); + list($response) = $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType); return $response; } @@ -16603,15 +18063,15 @@ public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmplo * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdRequest($employee_id, $expense_request_id, $business_id); + $request = $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdRequest($employee_id, $expense_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -16620,9 +18080,16 @@ public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmplo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16633,19 +18100,37 @@ public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmplo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerExpenseRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerExpenseRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16662,7 +18147,7 @@ public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmplo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerExpenseRequestModel', + '\OpenAPI\Client\Model\ManagerExpenseRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16680,13 +18165,14 @@ public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmplo * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdAsync($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdAsync($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'][0]) { - return $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + return $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -16702,24 +18188,24 @@ function ($response) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdAsyncWithHttpInfo($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseRequestModel'; - $request = $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdRequest($employee_id, $expense_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerExpenseRequestModel'; + $request = $this->managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdRequest($employee_id, $expense_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16742,7 +18228,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16754,24 +18240,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $expense_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdRequest($employee_id, $expense_request_id, $business_id) + public function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestIdRequest($employee_id, $expense_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEmployeeIdExpenseByExpenseRequestId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -16779,6 +18269,7 @@ protected function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEm ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/{expenseRequestId}'; $formParams = []; $queryParams = []; @@ -16787,6 +18278,7 @@ protected function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEm $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -16812,53 +18304,35 @@ protected function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEm ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16879,10 +18353,11 @@ protected function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEm $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16897,14 +18372,15 @@ protected function managerEmployeeExpenseGetApiV2BusinessByBusinessIdManagerByEm * @param int $expense_request_id expense_request_id (required) * @param string $file_name file_name (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AttachmentModel + * @return \OpenAPI\Client\Model\AttachmentModel */ - public function managerEmployeeExpenseUploadAttachment($employee_id, $expense_request_id, $file_name, $business_id) + public function managerEmployeeExpenseUploadAttachment($employee_id, $expense_request_id, $file_name, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseUploadAttachment'][0]) { - list($response) = $this->managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id); + list($response) = $this->managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id, $contentType); return $response; } @@ -16917,15 +18393,15 @@ public function managerEmployeeExpenseUploadAttachment($employee_id, $expense_re * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseUploadAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AttachmentModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AttachmentModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id) + public function managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseUploadAttachment'][0]) { - $returnType = '\Swagger\Client\Model\AttachmentModel'; - $request = $this->managerEmployeeExpenseUploadAttachmentRequest($employee_id, $expense_request_id, $file_name, $business_id); + $request = $this->managerEmployeeExpenseUploadAttachmentRequest($employee_id, $expense_request_id, $file_name, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -16934,9 +18410,16 @@ public function managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16947,19 +18430,37 @@ public function managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AttachmentModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AttachmentModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AttachmentModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AttachmentModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16976,7 +18477,7 @@ public function managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AttachmentModel', + '\OpenAPI\Client\Model\AttachmentModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16995,13 +18496,14 @@ public function managerEmployeeExpenseUploadAttachmentWithHttpInfo($employee_id, * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseUploadAttachmentAsync($employee_id, $expense_request_id, $file_name, $business_id) + public function managerEmployeeExpenseUploadAttachmentAsync($employee_id, $expense_request_id, $file_name, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseUploadAttachment'][0]) { - return $this->managerEmployeeExpenseUploadAttachmentAsyncWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id) + return $this->managerEmployeeExpenseUploadAttachmentAsyncWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -17018,24 +18520,24 @@ function ($response) { * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeExpenseUploadAttachmentAsyncWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id) + public function managerEmployeeExpenseUploadAttachmentAsyncWithHttpInfo($employee_id, $expense_request_id, $file_name, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseUploadAttachment'][0]) { - $returnType = '\Swagger\Client\Model\AttachmentModel'; - $request = $this->managerEmployeeExpenseUploadAttachmentRequest($employee_id, $expense_request_id, $file_name, $business_id); + $returnType = '\OpenAPI\Client\Model\AttachmentModel'; + $request = $this->managerEmployeeExpenseUploadAttachmentRequest($employee_id, $expense_request_id, $file_name, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17058,7 +18560,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17071,30 +18573,35 @@ function ($exception) { * @param int $expense_request_id (required) * @param string $file_name (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeExpenseUploadAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $expense_request_id, $file_name, $business_id) + public function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $expense_request_id, $file_name, $business_id, string $contentType = self::contentTypes['managerEmployeeExpenseUploadAttachment'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeExpenseUploadAttachment' ); } + // verify the required parameter 'expense_request_id' is set if ($expense_request_id === null || (is_array($expense_request_id) && count($expense_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $expense_request_id when calling managerEmployeeExpenseUploadAttachment' ); } + // verify the required parameter 'file_name' is set if ($file_name === null || (is_array($file_name) && count($file_name) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $file_name when calling managerEmployeeExpenseUploadAttachment' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -17102,6 +18609,7 @@ protected function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/expense/{expenseRequestId}/attachment'; $formParams = []; $queryParams = []; @@ -17110,9 +18618,15 @@ protected function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $ $multipart = false; // query params - if ($file_name !== null) { - $queryParams['fileName'] = ObjectSerializer::toQueryValue($file_name); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_name, + 'fileName', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -17139,53 +18653,35 @@ protected function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17206,10 +18702,11 @@ protected function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17223,14 +18720,15 @@ protected function managerEmployeeExpenseUploadAttachmentRequest($employee_id, $ * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel */ - public function managerEmployeeLeaveRequestApprove($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestApprove($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestApprove'][0]) { - list($response) = $this->managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -17242,15 +18740,15 @@ public function managerEmployeeLeaveRequestApprove($employee_id, $leave_request_ * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestApprove'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestApprove'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id); + $request = $this->managerEmployeeLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -17259,9 +18757,16 @@ public function managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $le } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17272,19 +18777,37 @@ public function managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $le sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17301,7 +18824,7 @@ public function managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $le case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -17319,13 +18842,14 @@ public function managerEmployeeLeaveRequestApproveWithHttpInfo($employee_id, $le * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestApproveAsync($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestApproveAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestApprove'][0]) { - return $this->managerEmployeeLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->managerEmployeeLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -17341,24 +18865,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestApproveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestApprove'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; + $request = $this->managerEmployeeLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17381,7 +18905,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17393,24 +18917,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestApprove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestApproveRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestApprove'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestApprove' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestApprove' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -17418,6 +18946,7 @@ protected function managerEmployeeLeaveRequestApproveRequest($employee_id, $leav ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}/approve'; $formParams = []; $queryParams = []; @@ -17426,6 +18955,7 @@ protected function managerEmployeeLeaveRequestApproveRequest($employee_id, $leav $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -17451,53 +18981,35 @@ protected function managerEmployeeLeaveRequestApproveRequest($employee_id, $leav ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17518,10 +19030,11 @@ protected function managerEmployeeLeaveRequestApproveRequest($employee_id, $leav $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17535,14 +19048,15 @@ protected function managerEmployeeLeaveRequestApproveRequest($employee_id, $leav * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentFile + * @return \OpenAPI\Client\Model\DocumentFile */ - public function managerEmployeeLeaveRequestAttachment($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestAttachment($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestAttachment'][0]) { - list($response) = $this->managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -17554,15 +19068,15 @@ public function managerEmployeeLeaveRequestAttachment($employee_id, $leave_reque * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestAttachment'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentFile, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestAttachment'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->managerEmployeeLeaveRequestAttachmentRequest($employee_id, $leave_request_id, $business_id); + $request = $this->managerEmployeeLeaveRequestAttachmentRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -17571,9 +19085,16 @@ public function managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17584,19 +19105,37 @@ public function managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentFile' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentFile' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentFile', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentFile'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17613,7 +19152,7 @@ public function managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentFile', + '\OpenAPI\Client\Model\DocumentFile', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -17631,13 +19170,14 @@ public function managerEmployeeLeaveRequestAttachmentWithHttpInfo($employee_id, * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestAttachmentAsync($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestAttachmentAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestAttachment'][0]) { - return $this->managerEmployeeLeaveRequestAttachmentAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->managerEmployeeLeaveRequestAttachmentAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -17653,24 +19193,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestAttachmentAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestAttachmentAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestAttachment'][0]) { - $returnType = '\Swagger\Client\Model\DocumentFile'; - $request = $this->managerEmployeeLeaveRequestAttachmentRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\DocumentFile'; + $request = $this->managerEmployeeLeaveRequestAttachmentRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17693,7 +19233,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17705,24 +19245,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestAttachment'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestAttachment'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestAttachment' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestAttachment' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -17730,6 +19274,7 @@ protected function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $l ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}/attachment'; $formParams = []; $queryParams = []; @@ -17738,6 +19283,7 @@ protected function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $l $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -17763,53 +19309,35 @@ protected function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $l ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17830,10 +19358,11 @@ protected function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $l $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17847,14 +19376,15 @@ protected function managerEmployeeLeaveRequestAttachmentRequest($employee_id, $l * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) * @param \DateTime $as_at_date as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestBalances'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LeaveBalanceModel[] + * @return \OpenAPI\Client\Model\LeaveBalanceModel[] */ - public function managerEmployeeLeaveRequestBalances($employee_id, $business_id, $as_at_date = null) + public function managerEmployeeLeaveRequestBalances($employee_id, $business_id, $as_at_date = null, string $contentType = self::contentTypes['managerEmployeeLeaveRequestBalances'][0]) { - list($response) = $this->managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $business_id, $as_at_date); + list($response) = $this->managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $business_id, $as_at_date, $contentType); return $response; } @@ -17866,15 +19396,15 @@ public function managerEmployeeLeaveRequestBalances($employee_id, $business_id, * @param int $employee_id (required) * @param string $business_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestBalances'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LeaveBalanceModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LeaveBalanceModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $business_id, $as_at_date = null) + public function managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $business_id, $as_at_date = null, string $contentType = self::contentTypes['managerEmployeeLeaveRequestBalances'][0]) { - $returnType = '\Swagger\Client\Model\LeaveBalanceModel[]'; - $request = $this->managerEmployeeLeaveRequestBalancesRequest($employee_id, $business_id, $as_at_date); + $request = $this->managerEmployeeLeaveRequestBalancesRequest($employee_id, $business_id, $as_at_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -17883,9 +19413,16 @@ public function managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17896,19 +19433,37 @@ public function managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LeaveBalanceModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LeaveBalanceModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LeaveBalanceModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LeaveBalanceModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -17925,7 +19480,7 @@ public function managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $b case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LeaveBalanceModel[]', + '\OpenAPI\Client\Model\LeaveBalanceModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -17943,13 +19498,14 @@ public function managerEmployeeLeaveRequestBalancesWithHttpInfo($employee_id, $b * @param int $employee_id (required) * @param string $business_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestBalancesAsync($employee_id, $business_id, $as_at_date = null) + public function managerEmployeeLeaveRequestBalancesAsync($employee_id, $business_id, $as_at_date = null, string $contentType = self::contentTypes['managerEmployeeLeaveRequestBalances'][0]) { - return $this->managerEmployeeLeaveRequestBalancesAsyncWithHttpInfo($employee_id, $business_id, $as_at_date) + return $this->managerEmployeeLeaveRequestBalancesAsyncWithHttpInfo($employee_id, $business_id, $as_at_date, $contentType) ->then( function ($response) { return $response[0]; @@ -17965,24 +19521,24 @@ function ($response) { * @param int $employee_id (required) * @param string $business_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestBalancesAsyncWithHttpInfo($employee_id, $business_id, $as_at_date = null) + public function managerEmployeeLeaveRequestBalancesAsyncWithHttpInfo($employee_id, $business_id, $as_at_date = null, string $contentType = self::contentTypes['managerEmployeeLeaveRequestBalances'][0]) { - $returnType = '\Swagger\Client\Model\LeaveBalanceModel[]'; - $request = $this->managerEmployeeLeaveRequestBalancesRequest($employee_id, $business_id, $as_at_date); + $returnType = '\OpenAPI\Client\Model\LeaveBalanceModel[]'; + $request = $this->managerEmployeeLeaveRequestBalancesRequest($employee_id, $business_id, $as_at_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18005,7 +19561,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18017,18 +19573,21 @@ function ($exception) { * @param int $employee_id (required) * @param string $business_id (required) * @param \DateTime $as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestBalances'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestBalancesRequest($employee_id, $business_id, $as_at_date = null) + public function managerEmployeeLeaveRequestBalancesRequest($employee_id, $business_id, $as_at_date = null, string $contentType = self::contentTypes['managerEmployeeLeaveRequestBalances'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestBalances' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -18036,6 +19595,8 @@ protected function managerEmployeeLeaveRequestBalancesRequest($employee_id, $bus ); } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/balances'; $formParams = []; $queryParams = []; @@ -18044,9 +19605,15 @@ protected function managerEmployeeLeaveRequestBalancesRequest($employee_id, $bus $multipart = false; // query params - if ($as_at_date !== null) { - $queryParams['asAtDate'] = ObjectSerializer::toQueryValue($as_at_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $as_at_date, + 'asAtDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -18065,53 +19632,35 @@ protected function managerEmployeeLeaveRequestBalancesRequest($employee_id, $bus ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18132,10 +19681,11 @@ protected function managerEmployeeLeaveRequestBalancesRequest($employee_id, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18147,16 +19697,17 @@ protected function managerEmployeeLeaveRequestBalancesRequest($employee_id, $bus * Create Leave Request * * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application leave_application (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestCreateLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel */ - public function managerEmployeeLeaveRequestCreateLeave($employee_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestCreateLeave($employee_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestCreateLeave'][0]) { - list($response) = $this->managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, $leave_application, $business_id); + list($response) = $this->managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, $business_id, $leave_application, $contentType); return $response; } @@ -18166,17 +19717,17 @@ public function managerEmployeeLeaveRequestCreateLeave($employee_id, $leave_appl * Create Leave Request * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestCreateLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestCreateLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $leave_application, $business_id); + $request = $this->managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $business_id, $leave_application, $contentType); try { $options = $this->createHttpClientOption(); @@ -18185,9 +19736,16 @@ public function managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18198,19 +19756,37 @@ public function managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18227,7 +19803,7 @@ public function managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -18243,15 +19819,16 @@ public function managerEmployeeLeaveRequestCreateLeaveWithHttpInfo($employee_id, * Create Leave Request * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestCreateLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestCreateLeaveAsync($employee_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestCreateLeaveAsync($employee_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestCreateLeave'][0]) { - return $this->managerEmployeeLeaveRequestCreateLeaveAsyncWithHttpInfo($employee_id, $leave_application, $business_id) + return $this->managerEmployeeLeaveRequestCreateLeaveAsyncWithHttpInfo($employee_id, $business_id, $leave_application, $contentType) ->then( function ($response) { return $response[0]; @@ -18265,26 +19842,26 @@ function ($response) { * Create Leave Request * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestCreateLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestCreateLeaveAsyncWithHttpInfo($employee_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestCreateLeaveAsyncWithHttpInfo($employee_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestCreateLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $leave_application, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; + $request = $this->managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $business_id, $leave_application, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18307,7 +19884,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18317,26 +19894,23 @@ function ($exception) { * Create request for operation 'managerEmployeeLeaveRequestCreateLeave' * * @param int $employee_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestCreateLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestCreateLeave'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestCreateLeave' ); } - // verify the required parameter 'leave_application' is set - if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_application when calling managerEmployeeLeaveRequestCreateLeave' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -18344,6 +19918,14 @@ protected function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $ ); } + // verify the required parameter 'leave_application' is set + if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_application when calling managerEmployeeLeaveRequestCreateLeave' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest'; $formParams = []; $queryParams = []; @@ -18352,6 +19934,7 @@ protected function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -18369,56 +19952,42 @@ protected function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $ ); } - // body params - $_tempBody = null; - if (isset($leave_application)) { - $_tempBody = $leave_application; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_application)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_application)); + } else { + $httpBody = $leave_application; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18439,10 +20008,11 @@ protected function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18455,16 +20025,17 @@ protected function managerEmployeeLeaveRequestCreateLeaveRequest($employee_id, $ * * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $decline_reason decline_reason (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $decline_reason decline_reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel */ - public function managerEmployeeLeaveRequestDecline($employee_id, $leave_request_id, $decline_reason, $business_id) + public function managerEmployeeLeaveRequestDecline($employee_id, $leave_request_id, $business_id, $decline_reason, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDecline'][0]) { - list($response) = $this->managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $decline_reason, $business_id); + list($response) = $this->managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline_reason, $contentType); return $response; } @@ -18475,17 +20046,17 @@ public function managerEmployeeLeaveRequestDecline($employee_id, $leave_request_ * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $decline_reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $decline_reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDecline'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $decline_reason, $business_id) + public function managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline_reason, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDecline'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestDeclineRequest($employee_id, $leave_request_id, $decline_reason, $business_id); + $request = $this->managerEmployeeLeaveRequestDeclineRequest($employee_id, $leave_request_id, $business_id, $decline_reason, $contentType); try { $options = $this->createHttpClientOption(); @@ -18494,9 +20065,16 @@ public function managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $le } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18507,19 +20085,37 @@ public function managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $le sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18536,7 +20132,7 @@ public function managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $le case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -18553,15 +20149,16 @@ public function managerEmployeeLeaveRequestDeclineWithHttpInfo($employee_id, $le * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $decline_reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $decline_reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestDeclineAsync($employee_id, $leave_request_id, $decline_reason, $business_id) + public function managerEmployeeLeaveRequestDeclineAsync($employee_id, $leave_request_id, $business_id, $decline_reason, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDecline'][0]) { - return $this->managerEmployeeLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $decline_reason, $business_id) + return $this->managerEmployeeLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline_reason, $contentType) ->then( function ($response) { return $response[0]; @@ -18576,26 +20173,26 @@ function ($response) { * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $decline_reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $decline_reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $decline_reason, $business_id) + public function managerEmployeeLeaveRequestDeclineAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $decline_reason, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDecline'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestDeclineRequest($employee_id, $leave_request_id, $decline_reason, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; + $request = $this->managerEmployeeLeaveRequestDeclineRequest($employee_id, $leave_request_id, $business_id, $decline_reason, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18618,7 +20215,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18629,32 +20226,30 @@ function ($exception) { * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\DeclineReason $decline_reason (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\DeclineReason $decline_reason (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDecline'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leave_request_id, $decline_reason, $business_id) + public function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leave_request_id, $business_id, $decline_reason, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDecline'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestDecline' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestDecline' ); } - // verify the required parameter 'decline_reason' is set - if ($decline_reason === null || (is_array($decline_reason) && count($decline_reason) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $decline_reason when calling managerEmployeeLeaveRequestDecline' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -18662,6 +20257,14 @@ protected function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leav ); } + // verify the required parameter 'decline_reason' is set + if ($decline_reason === null || (is_array($decline_reason) && count($decline_reason) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $decline_reason when calling managerEmployeeLeaveRequestDecline' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}/decline'; $formParams = []; $queryParams = []; @@ -18670,6 +20273,7 @@ protected function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leav $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -18695,56 +20299,42 @@ protected function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leav ); } - // body params - $_tempBody = null; - if (isset($decline_reason)) { - $_tempBody = $decline_reason; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($decline_reason)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($decline_reason)); + } else { + $httpBody = $decline_reason; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -18765,10 +20355,11 @@ protected function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leav $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -18782,14 +20373,15 @@ protected function managerEmployeeLeaveRequestDeclineRequest($employee_id, $leav * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel */ - public function managerEmployeeLeaveRequestDelete($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestDelete($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDelete'][0]) { - list($response) = $this->managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -18801,15 +20393,15 @@ public function managerEmployeeLeaveRequestDelete($employee_id, $leave_request_i * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDelete'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id); + $request = $this->managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -18818,9 +20410,16 @@ public function managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $lea } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -18831,19 +20430,37 @@ public function managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $lea sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18860,7 +20477,7 @@ public function managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $lea case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -18878,13 +20495,14 @@ public function managerEmployeeLeaveRequestDeleteWithHttpInfo($employee_id, $lea * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestDeleteAsync($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestDeleteAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDelete'][0]) { - return $this->managerEmployeeLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->managerEmployeeLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -18900,24 +20518,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestDeleteAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDelete'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; + $request = $this->managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -18940,7 +20558,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -18952,24 +20570,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestDelete'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestDelete' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -18977,6 +20599,7 @@ protected function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -18985,6 +20608,7 @@ protected function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -19010,53 +20634,35 @@ protected function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -19077,10 +20683,11 @@ protected function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -19096,14 +20703,15 @@ protected function managerEmployeeLeaveRequestDeleteRequest($employee_id, $leave * @param \DateTime $to_date to_date (required) * @param int $leave_category_id leave_category_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestEstimate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveEstimate + * @return \OpenAPI\Client\Model\ManagerLeaveEstimate */ - public function managerEmployeeLeaveRequestEstimate($employee_id, $from_date, $to_date, $leave_category_id, $business_id) + public function managerEmployeeLeaveRequestEstimate($employee_id, $from_date, $to_date, $leave_category_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestEstimate'][0]) { - list($response) = $this->managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id); + list($response) = $this->managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id, $contentType); return $response; } @@ -19117,15 +20725,15 @@ public function managerEmployeeLeaveRequestEstimate($employee_id, $from_date, $t * @param \DateTime $to_date (required) * @param int $leave_category_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestEstimate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveEstimate, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveEstimate, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id) + public function managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestEstimate'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveEstimate'; - $request = $this->managerEmployeeLeaveRequestEstimateRequest($employee_id, $from_date, $to_date, $leave_category_id, $business_id); + $request = $this->managerEmployeeLeaveRequestEstimateRequest($employee_id, $from_date, $to_date, $leave_category_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -19134,9 +20742,16 @@ public function managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $f } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -19147,19 +20762,37 @@ public function managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $f sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveEstimate' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveEstimate' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveEstimate', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveEstimate'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19176,7 +20809,7 @@ public function managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $f case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveEstimate', + '\OpenAPI\Client\Model\ManagerLeaveEstimate', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -19196,13 +20829,14 @@ public function managerEmployeeLeaveRequestEstimateWithHttpInfo($employee_id, $f * @param \DateTime $to_date (required) * @param int $leave_category_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestEstimateAsync($employee_id, $from_date, $to_date, $leave_category_id, $business_id) + public function managerEmployeeLeaveRequestEstimateAsync($employee_id, $from_date, $to_date, $leave_category_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestEstimate'][0]) { - return $this->managerEmployeeLeaveRequestEstimateAsyncWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id) + return $this->managerEmployeeLeaveRequestEstimateAsyncWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -19220,24 +20854,24 @@ function ($response) { * @param \DateTime $to_date (required) * @param int $leave_category_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestEstimateAsyncWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id) + public function managerEmployeeLeaveRequestEstimateAsyncWithHttpInfo($employee_id, $from_date, $to_date, $leave_category_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestEstimate'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveEstimate'; - $request = $this->managerEmployeeLeaveRequestEstimateRequest($employee_id, $from_date, $to_date, $leave_category_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveEstimate'; + $request = $this->managerEmployeeLeaveRequestEstimateRequest($employee_id, $from_date, $to_date, $leave_category_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19260,7 +20894,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19274,36 +20908,42 @@ function ($exception) { * @param \DateTime $to_date (required) * @param int $leave_category_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestEstimate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestEstimateRequest($employee_id, $from_date, $to_date, $leave_category_id, $business_id) + public function managerEmployeeLeaveRequestEstimateRequest($employee_id, $from_date, $to_date, $leave_category_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestEstimate'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestEstimate' ); } + // verify the required parameter 'from_date' is set if ($from_date === null || (is_array($from_date) && count($from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $from_date when calling managerEmployeeLeaveRequestEstimate' ); } + // verify the required parameter 'to_date' is set if ($to_date === null || (is_array($to_date) && count($to_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $to_date when calling managerEmployeeLeaveRequestEstimate' ); } + // verify the required parameter 'leave_category_id' is set if ($leave_category_id === null || (is_array($leave_category_id) && count($leave_category_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_category_id when calling managerEmployeeLeaveRequestEstimate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -19311,6 +20951,7 @@ protected function managerEmployeeLeaveRequestEstimateRequest($employee_id, $fro ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/estimate'; $formParams = []; $queryParams = []; @@ -19319,17 +20960,33 @@ protected function managerEmployeeLeaveRequestEstimateRequest($employee_id, $fro $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($leave_category_id !== null) { - $queryParams['leaveCategoryId'] = ObjectSerializer::toQueryValue($leave_category_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $leave_category_id, + 'leaveCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -19348,53 +21005,35 @@ protected function managerEmployeeLeaveRequestEstimateRequest($employee_id, $fro ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -19415,10 +21054,11 @@ protected function managerEmployeeLeaveRequestEstimateRequest($employee_id, $fro $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -19432,14 +21072,15 @@ protected function managerEmployeeLeaveRequestEstimateRequest($employee_id, $fro * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel */ - public function managerEmployeeLeaveRequestGet($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestGet($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGet'][0]) { - list($response) = $this->managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id); + list($response) = $this->managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType); return $response; } @@ -19451,15 +21092,15 @@ public function managerEmployeeLeaveRequestGet($employee_id, $leave_request_id, * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGet'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id); + $request = $this->managerEmployeeLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -19468,9 +21109,16 @@ public function managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -19481,19 +21129,37 @@ public function managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19510,7 +21176,7 @@ public function managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -19528,13 +21194,14 @@ public function managerEmployeeLeaveRequestGetWithHttpInfo($employee_id, $leave_ * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestGetAsync($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestGetAsync($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGet'][0]) { - return $this->managerEmployeeLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + return $this->managerEmployeeLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -19550,24 +21217,24 @@ function ($response) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestGetAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGet'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; + $request = $this->managerEmployeeLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19590,7 +21257,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19602,24 +21269,28 @@ function ($exception) { * @param int $employee_id (required) * @param int $leave_request_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id) + public function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_request_id, $business_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGet'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestGet' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -19627,6 +21298,7 @@ protected function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_re ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -19635,6 +21307,7 @@ protected function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_re $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -19660,53 +21333,35 @@ protected function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_re ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -19727,10 +21382,11 @@ protected function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_re $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -19743,14 +21399,15 @@ protected function managerEmployeeLeaveRequestGetRequest($employee_id, $leave_re * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\ManagerLeaveCategoryModel[] */ - public function managerEmployeeLeaveRequestGetLeaveCategories($business_id, $employee_id) + public function managerEmployeeLeaveRequestGetLeaveCategories($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'][0]) { - list($response) = $this->managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id, $employee_id); + list($response) = $this->managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -19761,15 +21418,15 @@ public function managerEmployeeLeaveRequestGetLeaveCategories($business_id, $emp * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id, $employee_id) + public function managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveCategoryModel[]'; - $request = $this->managerEmployeeLeaveRequestGetLeaveCategoriesRequest($business_id, $employee_id); + $request = $this->managerEmployeeLeaveRequestGetLeaveCategoriesRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -19778,9 +21435,16 @@ public function managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -19791,19 +21455,37 @@ public function managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19820,7 +21502,7 @@ public function managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($busin case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveCategoryModel[]', + '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -19837,13 +21519,14 @@ public function managerEmployeeLeaveRequestGetLeaveCategoriesWithHttpInfo($busin * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestGetLeaveCategoriesAsync($business_id, $employee_id) + public function managerEmployeeLeaveRequestGetLeaveCategoriesAsync($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'][0]) { - return $this->managerEmployeeLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id, $employee_id) + return $this->managerEmployeeLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -19858,24 +21541,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id, $employee_id) + public function managerEmployeeLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveCategoryModel[]'; - $request = $this->managerEmployeeLeaveRequestGetLeaveCategoriesRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]'; + $request = $this->managerEmployeeLeaveRequestGetLeaveCategoriesRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -19898,7 +21581,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -19909,18 +21592,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($business_id, $employee_id) + public function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestGetLeaveCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeLeaveRequestGetLeaveCategories' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -19928,6 +21614,7 @@ protected function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($busines ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/categories'; $formParams = []; $queryParams = []; @@ -19936,6 +21623,7 @@ protected function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($busines $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -19953,53 +21641,35 @@ protected function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($busines ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20020,10 +21690,11 @@ protected function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20037,14 +21708,15 @@ protected function managerEmployeeLeaveRequestGetLeaveCategoriesRequest($busines * @param int $leave_request_id leave_request_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel[] + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel[] */ - public function managerEmployeeLeaveRequestOverlappingLeave($leave_request_id, $business_id, $employee_id) + public function managerEmployeeLeaveRequestOverlappingLeave($leave_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'][0]) { - list($response) = $this->managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_request_id, $business_id, $employee_id); + list($response) = $this->managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_request_id, $business_id, $employee_id, $contentType); return $response; } @@ -20056,15 +21728,15 @@ public function managerEmployeeLeaveRequestOverlappingLeave($leave_request_id, $ * @param int $leave_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_request_id, $business_id, $employee_id) + public function managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel[]'; - $request = $this->managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_request_id, $business_id, $employee_id); + $request = $this->managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_request_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -20073,9 +21745,16 @@ public function managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_r } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20086,19 +21765,37 @@ public function managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_r sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -20115,7 +21812,7 @@ public function managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_r case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel[]', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -20133,13 +21830,14 @@ public function managerEmployeeLeaveRequestOverlappingLeaveWithHttpInfo($leave_r * @param int $leave_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestOverlappingLeaveAsync($leave_request_id, $business_id, $employee_id) + public function managerEmployeeLeaveRequestOverlappingLeaveAsync($leave_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'][0]) { - return $this->managerEmployeeLeaveRequestOverlappingLeaveAsyncWithHttpInfo($leave_request_id, $business_id, $employee_id) + return $this->managerEmployeeLeaveRequestOverlappingLeaveAsyncWithHttpInfo($leave_request_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -20155,24 +21853,24 @@ function ($response) { * @param int $leave_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestOverlappingLeaveAsyncWithHttpInfo($leave_request_id, $business_id, $employee_id) + public function managerEmployeeLeaveRequestOverlappingLeaveAsyncWithHttpInfo($leave_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel[]'; - $request = $this->managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_request_id, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]'; + $request = $this->managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_request_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -20195,7 +21893,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -20207,24 +21905,28 @@ function ($exception) { * @param int $leave_request_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_request_id, $business_id, $employee_id) + public function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_request_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeLeaveRequestOverlappingLeave'][0]) { + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestOverlappingLeave' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeLeaveRequestOverlappingLeave' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -20232,6 +21934,7 @@ protected function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_req ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}/overlapping'; $formParams = []; $queryParams = []; @@ -20240,6 +21943,7 @@ protected function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_req $multipart = false; + // path params if ($leave_request_id !== null) { $resourcePath = str_replace( @@ -20265,53 +21969,35 @@ protected function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_req ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20332,10 +22018,11 @@ protected function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_req $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20348,16 +22035,17 @@ protected function managerEmployeeLeaveRequestOverlappingLeaveRequest($leave_req * * @param int $employee_id employee_id (required) * @param int $leave_request_id leave_request_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application leave_application (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel */ - public function managerEmployeeLeaveRequestUpdateLeave($employee_id, $leave_request_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestUpdateLeave($employee_id, $leave_request_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'][0]) { - list($response) = $this->managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, $leave_request_id, $leave_application, $business_id); + list($response) = $this->managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, $leave_request_id, $business_id, $leave_application, $contentType); return $response; } @@ -20368,17 +22056,17 @@ public function managerEmployeeLeaveRequestUpdateLeave($employee_id, $leave_requ * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, $leave_request_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, $leave_request_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $leave_request_id, $leave_application, $business_id); + $request = $this->managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $leave_request_id, $business_id, $leave_application, $contentType); try { $options = $this->createHttpClientOption(); @@ -20387,9 +22075,16 @@ public function managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20400,19 +22095,37 @@ public function managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -20429,7 +22142,7 @@ public function managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -20446,15 +22159,16 @@ public function managerEmployeeLeaveRequestUpdateLeaveWithHttpInfo($employee_id, * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestUpdateLeaveAsync($employee_id, $leave_request_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestUpdateLeaveAsync($employee_id, $leave_request_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'][0]) { - return $this->managerEmployeeLeaveRequestUpdateLeaveAsyncWithHttpInfo($employee_id, $leave_request_id, $leave_application, $business_id) + return $this->managerEmployeeLeaveRequestUpdateLeaveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $leave_application, $contentType) ->then( function ($response) { return $response[0]; @@ -20469,26 +22183,26 @@ function ($response) { * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeLeaveRequestUpdateLeaveAsyncWithHttpInfo($employee_id, $leave_request_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestUpdateLeaveAsyncWithHttpInfo($employee_id, $leave_request_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel'; - $request = $this->managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $leave_request_id, $leave_application, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel'; + $request = $this->managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $leave_request_id, $business_id, $leave_application, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -20511,7 +22225,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -20522,32 +22236,30 @@ function ($exception) { * * @param int $employee_id (required) * @param int $leave_request_id (required) - * @param \Swagger\Client\Model\ManagerLeaveApplicationModel $leave_application (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ManagerLeaveApplicationModel $leave_application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $leave_request_id, $leave_application, $business_id) + public function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $leave_request_id, $business_id, $leave_application, string $contentType = self::contentTypes['managerEmployeeLeaveRequestUpdateLeave'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling managerEmployeeLeaveRequestUpdateLeave' ); } + // verify the required parameter 'leave_request_id' is set if ($leave_request_id === null || (is_array($leave_request_id) && count($leave_request_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $leave_request_id when calling managerEmployeeLeaveRequestUpdateLeave' ); } - // verify the required parameter 'leave_application' is set - if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leave_application when calling managerEmployeeLeaveRequestUpdateLeave' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -20555,6 +22267,14 @@ protected function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $ ); } + // verify the required parameter 'leave_application' is set + if ($leave_application === null || (is_array($leave_application) && count($leave_application) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leave_application when calling managerEmployeeLeaveRequestUpdateLeave' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/leaverequest/{leaveRequestId}'; $formParams = []; $queryParams = []; @@ -20563,6 +22283,7 @@ protected function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $ $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -20588,56 +22309,42 @@ protected function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $ ); } - // body params - $_tempBody = null; - if (isset($leave_application)) { - $_tempBody = $leave_application; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($leave_application)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($leave_application)); + } else { + $httpBody = $leave_application; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20658,10 +22365,11 @@ protected function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20674,14 +22382,15 @@ protected function managerEmployeeLeaveRequestUpdateLeaveRequest($employee_id, $ * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function managerEmployeeProfileImageDelete($business_id, $employee_id) + public function managerEmployeeProfileImageDelete($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageDelete'][0]) { - $this->managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $employee_id); + $this->managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $employee_id, $contentType); } /** @@ -20691,15 +22400,15 @@ public function managerEmployeeProfileImageDelete($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $employee_id) + public function managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageDelete'][0]) { - $returnType = ''; - $request = $this->managerEmployeeProfileImageDeleteRequest($business_id, $employee_id); + $request = $this->managerEmployeeProfileImageDeleteRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -20708,9 +22417,16 @@ public function managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $emp } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20721,11 +22437,11 @@ public function managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $emp sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -20745,13 +22461,14 @@ public function managerEmployeeProfileImageDeleteWithHttpInfo($business_id, $emp * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeProfileImageDeleteAsync($business_id, $employee_id) + public function managerEmployeeProfileImageDeleteAsync($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageDelete'][0]) { - return $this->managerEmployeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id) + return $this->managerEmployeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -20766,14 +22483,15 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id) + public function managerEmployeeProfileImageDeleteAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageDelete'][0]) { $returnType = ''; - $request = $this->managerEmployeeProfileImageDeleteRequest($business_id, $employee_id); + $request = $this->managerEmployeeProfileImageDeleteRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -20792,7 +22510,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -20803,18 +22521,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeProfileImageDeleteRequest($business_id, $employee_id) + public function managerEmployeeProfileImageDeleteRequest($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageDelete'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeProfileImageDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -20822,6 +22543,7 @@ protected function managerEmployeeProfileImageDeleteRequest($business_id, $emplo ); } + $resourcePath = '/api/v2/business/{businessId}/manager/employee/{employeeId}/image'; $formParams = []; $queryParams = []; @@ -20830,6 +22552,7 @@ protected function managerEmployeeProfileImageDeleteRequest($business_id, $emplo $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -20847,53 +22570,35 @@ protected function managerEmployeeProfileImageDeleteRequest($business_id, $emplo ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -20914,10 +22619,11 @@ protected function managerEmployeeProfileImageDeleteRequest($business_id, $emplo $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -20930,14 +22636,15 @@ protected function managerEmployeeProfileImageDeleteRequest($business_id, $emplo * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function managerEmployeeProfileImageGet($business_id, $employee_id) + public function managerEmployeeProfileImageGet($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageGet'][0]) { - $this->managerEmployeeProfileImageGetWithHttpInfo($business_id, $employee_id); + $this->managerEmployeeProfileImageGetWithHttpInfo($business_id, $employee_id, $contentType); } /** @@ -20947,15 +22654,15 @@ public function managerEmployeeProfileImageGet($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeProfileImageGetWithHttpInfo($business_id, $employee_id) + public function managerEmployeeProfileImageGetWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageGet'][0]) { - $returnType = ''; - $request = $this->managerEmployeeProfileImageGetRequest($business_id, $employee_id); + $request = $this->managerEmployeeProfileImageGetRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -20964,9 +22671,16 @@ public function managerEmployeeProfileImageGetWithHttpInfo($business_id, $employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -20977,11 +22691,11 @@ public function managerEmployeeProfileImageGetWithHttpInfo($business_id, $employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -21001,13 +22715,14 @@ public function managerEmployeeProfileImageGetWithHttpInfo($business_id, $employ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeProfileImageGetAsync($business_id, $employee_id) + public function managerEmployeeProfileImageGetAsync($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageGet'][0]) { - return $this->managerEmployeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id) + return $this->managerEmployeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -21022,14 +22737,15 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id) + public function managerEmployeeProfileImageGetAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageGet'][0]) { $returnType = ''; - $request = $this->managerEmployeeProfileImageGetRequest($business_id, $employee_id); + $request = $this->managerEmployeeProfileImageGetRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -21048,7 +22764,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21059,18 +22775,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImageGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeProfileImageGetRequest($business_id, $employee_id) + public function managerEmployeeProfileImageGetRequest($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImageGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeProfileImageGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -21078,6 +22797,7 @@ protected function managerEmployeeProfileImageGetRequest($business_id, $employee ); } + $resourcePath = '/api/v2/business/{businessId}/manager/employee/{employeeId}/image'; $formParams = []; $queryParams = []; @@ -21086,6 +22806,7 @@ protected function managerEmployeeProfileImageGetRequest($business_id, $employee $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -21103,53 +22824,35 @@ protected function managerEmployeeProfileImageGetRequest($business_id, $employee ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21170,10 +22873,11 @@ protected function managerEmployeeProfileImageGetRequest($business_id, $employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21186,14 +22890,15 @@ protected function managerEmployeeProfileImageGetRequest($business_id, $employee * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImagePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ProfileImageMetadata + * @return \OpenAPI\Client\Model\ProfileImageMetadata */ - public function managerEmployeeProfileImagePost($business_id, $employee_id) + public function managerEmployeeProfileImagePost($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImagePost'][0]) { - list($response) = $this->managerEmployeeProfileImagePostWithHttpInfo($business_id, $employee_id); + list($response) = $this->managerEmployeeProfileImagePostWithHttpInfo($business_id, $employee_id, $contentType); return $response; } @@ -21204,15 +22909,15 @@ public function managerEmployeeProfileImagePost($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImagePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ProfileImageMetadata, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ProfileImageMetadata, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeProfileImagePostWithHttpInfo($business_id, $employee_id) + public function managerEmployeeProfileImagePostWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImagePost'][0]) { - $returnType = '\Swagger\Client\Model\ProfileImageMetadata'; - $request = $this->managerEmployeeProfileImagePostRequest($business_id, $employee_id); + $request = $this->managerEmployeeProfileImagePostRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -21221,9 +22926,16 @@ public function managerEmployeeProfileImagePostWithHttpInfo($business_id, $emplo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21234,19 +22946,37 @@ public function managerEmployeeProfileImagePostWithHttpInfo($business_id, $emplo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ProfileImageMetadata' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProfileImageMetadata' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProfileImageMetadata', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProfileImageMetadata'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -21263,7 +22993,7 @@ public function managerEmployeeProfileImagePostWithHttpInfo($business_id, $emplo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ProfileImageMetadata', + '\OpenAPI\Client\Model\ProfileImageMetadata', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -21280,13 +23010,14 @@ public function managerEmployeeProfileImagePostWithHttpInfo($business_id, $emplo * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeProfileImagePostAsync($business_id, $employee_id) + public function managerEmployeeProfileImagePostAsync($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImagePost'][0]) { - return $this->managerEmployeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id) + return $this->managerEmployeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -21301,24 +23032,24 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id) + public function managerEmployeeProfileImagePostAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImagePost'][0]) { - $returnType = '\Swagger\Client\Model\ProfileImageMetadata'; - $request = $this->managerEmployeeProfileImagePostRequest($business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ProfileImageMetadata'; + $request = $this->managerEmployeeProfileImagePostRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -21341,7 +23072,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21352,18 +23083,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeProfileImagePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeProfileImagePostRequest($business_id, $employee_id) + public function managerEmployeeProfileImagePostRequest($business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeProfileImagePost'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeProfileImagePost' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -21371,6 +23105,7 @@ protected function managerEmployeeProfileImagePostRequest($business_id, $employe ); } + $resourcePath = '/api/v2/business/{businessId}/manager/employee/{employeeId}/image'; $formParams = []; $queryParams = []; @@ -21379,6 +23114,7 @@ protected function managerEmployeeProfileImagePostRequest($business_id, $employe $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -21396,53 +23132,35 @@ protected function managerEmployeeProfileImagePostRequest($business_id, $employe ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21463,10 +23181,11 @@ protected function managerEmployeeProfileImagePostRequest($business_id, $employe $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21477,17 +23196,18 @@ protected function managerEmployeeProfileImagePostRequest($business_id, $employe * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftCreate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerUnavailabilityModel + * @return \OpenAPI\Client\Model\ManagerUnavailabilityModel */ - public function managerEmployeeRosterShiftCreate($model, $business_id, $employee_id) + public function managerEmployeeRosterShiftCreate($business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftCreate'][0]) { - list($response) = $this->managerEmployeeRosterShiftCreateWithHttpInfo($model, $business_id, $employee_id); + list($response) = $this->managerEmployeeRosterShiftCreateWithHttpInfo($business_id, $employee_id, $model, $contentType); return $response; } @@ -21496,18 +23216,18 @@ public function managerEmployeeRosterShiftCreate($model, $business_id, $employee * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftCreate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeRosterShiftCreateWithHttpInfo($model, $business_id, $employee_id) + public function managerEmployeeRosterShiftCreateWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftCreate'][0]) { - $returnType = '\Swagger\Client\Model\ManagerUnavailabilityModel'; - $request = $this->managerEmployeeRosterShiftCreateRequest($model, $business_id, $employee_id); + $request = $this->managerEmployeeRosterShiftCreateRequest($business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -21516,9 +23236,16 @@ public function managerEmployeeRosterShiftCreateWithHttpInfo($model, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21529,19 +23256,37 @@ public function managerEmployeeRosterShiftCreateWithHttpInfo($model, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerUnavailabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerUnavailabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerUnavailabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerUnavailabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -21558,7 +23303,7 @@ public function managerEmployeeRosterShiftCreateWithHttpInfo($model, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerUnavailabilityModel', + '\OpenAPI\Client\Model\ManagerUnavailabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -21573,16 +23318,17 @@ public function managerEmployeeRosterShiftCreateWithHttpInfo($model, $business_i * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeRosterShiftCreateAsync($model, $business_id, $employee_id) + public function managerEmployeeRosterShiftCreateAsync($business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftCreate'][0]) { - return $this->managerEmployeeRosterShiftCreateAsyncWithHttpInfo($model, $business_id, $employee_id) + return $this->managerEmployeeRosterShiftCreateAsyncWithHttpInfo($business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -21595,27 +23341,27 @@ function ($response) { * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeRosterShiftCreateAsyncWithHttpInfo($model, $business_id, $employee_id) + public function managerEmployeeRosterShiftCreateAsyncWithHttpInfo($business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftCreate'][0]) { - $returnType = '\Swagger\Client\Model\ManagerUnavailabilityModel'; - $request = $this->managerEmployeeRosterShiftCreateRequest($model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ManagerUnavailabilityModel'; + $request = $this->managerEmployeeRosterShiftCreateRequest($business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -21638,7 +23384,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21647,27 +23393,24 @@ function ($exception) { /** * Create request for operation 'managerEmployeeRosterShiftCreate' * - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftCreate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeRosterShiftCreateRequest($model, $business_id, $employee_id) + public function managerEmployeeRosterShiftCreateRequest($business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftCreate'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling managerEmployeeRosterShiftCreate' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeRosterShiftCreate' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -21675,6 +23418,14 @@ protected function managerEmployeeRosterShiftCreateRequest($model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling managerEmployeeRosterShiftCreate' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/rostershift/unavailability'; $formParams = []; $queryParams = []; @@ -21683,6 +23434,7 @@ protected function managerEmployeeRosterShiftCreateRequest($model, $business_id, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -21700,56 +23452,42 @@ protected function managerEmployeeRosterShiftCreateRequest($model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -21770,10 +23508,11 @@ protected function managerEmployeeRosterShiftCreateRequest($model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -21787,14 +23526,15 @@ protected function managerEmployeeRosterShiftCreateRequest($model, $business_id, * @param int $unavailability_id unavailability_id (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function managerEmployeeRosterShiftDelete($unavailability_id, $business_id, $employee_id) + public function managerEmployeeRosterShiftDelete($unavailability_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeRosterShiftDelete'][0]) { - $this->managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, $business_id, $employee_id); + $this->managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, $business_id, $employee_id, $contentType); } /** @@ -21805,15 +23545,15 @@ public function managerEmployeeRosterShiftDelete($unavailability_id, $business_i * @param int $unavailability_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, $business_id, $employee_id) + public function managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeRosterShiftDelete'][0]) { - $returnType = ''; - $request = $this->managerEmployeeRosterShiftDeleteRequest($unavailability_id, $business_id, $employee_id); + $request = $this->managerEmployeeRosterShiftDeleteRequest($unavailability_id, $business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -21822,9 +23562,16 @@ public function managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -21835,11 +23582,11 @@ public function managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -21860,13 +23607,14 @@ public function managerEmployeeRosterShiftDeleteWithHttpInfo($unavailability_id, * @param int $unavailability_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeRosterShiftDeleteAsync($unavailability_id, $business_id, $employee_id) + public function managerEmployeeRosterShiftDeleteAsync($unavailability_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeRosterShiftDelete'][0]) { - return $this->managerEmployeeRosterShiftDeleteAsyncWithHttpInfo($unavailability_id, $business_id, $employee_id) + return $this->managerEmployeeRosterShiftDeleteAsyncWithHttpInfo($unavailability_id, $business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -21882,14 +23630,15 @@ function ($response) { * @param int $unavailability_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeRosterShiftDeleteAsyncWithHttpInfo($unavailability_id, $business_id, $employee_id) + public function managerEmployeeRosterShiftDeleteAsyncWithHttpInfo($unavailability_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeRosterShiftDelete'][0]) { $returnType = ''; - $request = $this->managerEmployeeRosterShiftDeleteRequest($unavailability_id, $business_id, $employee_id); + $request = $this->managerEmployeeRosterShiftDeleteRequest($unavailability_id, $business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -21908,7 +23657,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -21920,24 +23669,28 @@ function ($exception) { * @param int $unavailability_id (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $business_id, $employee_id) + public function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $business_id, $employee_id, string $contentType = self::contentTypes['managerEmployeeRosterShiftDelete'][0]) { + // verify the required parameter 'unavailability_id' is set if ($unavailability_id === null || (is_array($unavailability_id) && count($unavailability_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $unavailability_id when calling managerEmployeeRosterShiftDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeRosterShiftDelete' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -21945,6 +23698,7 @@ protected function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/rostershift/unavailability/{unavailabilityId}'; $formParams = []; $queryParams = []; @@ -21953,6 +23707,7 @@ protected function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $ $multipart = false; + // path params if ($unavailability_id !== null) { $resourcePath = str_replace( @@ -21978,53 +23733,35 @@ protected function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22045,10 +23782,11 @@ protected function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -22060,17 +23798,18 @@ protected function managerEmployeeRosterShiftDeleteRequest($unavailability_id, $ * Update Unavailability * * @param int $unavailability_id unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $model model (required) * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftSave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerUnavailabilityModel + * @return \OpenAPI\Client\Model\ManagerUnavailabilityModel */ - public function managerEmployeeRosterShiftSave($unavailability_id, $model, $business_id, $employee_id) + public function managerEmployeeRosterShiftSave($unavailability_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftSave'][0]) { - list($response) = $this->managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $model, $business_id, $employee_id); + list($response) = $this->managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $business_id, $employee_id, $model, $contentType); return $response; } @@ -22080,18 +23819,18 @@ public function managerEmployeeRosterShiftSave($unavailability_id, $model, $busi * Update Unavailability * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftSave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerUnavailabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $model, $business_id, $employee_id) + public function managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftSave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerUnavailabilityModel'; - $request = $this->managerEmployeeRosterShiftSaveRequest($unavailability_id, $model, $business_id, $employee_id); + $request = $this->managerEmployeeRosterShiftSaveRequest($unavailability_id, $business_id, $employee_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -22100,9 +23839,16 @@ public function managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -22113,19 +23859,37 @@ public function managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerUnavailabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerUnavailabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerUnavailabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerUnavailabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22142,7 +23906,7 @@ public function managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerUnavailabilityModel', + '\OpenAPI\Client\Model\ManagerUnavailabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -22158,16 +23922,17 @@ public function managerEmployeeRosterShiftSaveWithHttpInfo($unavailability_id, $ * Update Unavailability * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftSave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeRosterShiftSaveAsync($unavailability_id, $model, $business_id, $employee_id) + public function managerEmployeeRosterShiftSaveAsync($unavailability_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftSave'][0]) { - return $this->managerEmployeeRosterShiftSaveAsyncWithHttpInfo($unavailability_id, $model, $business_id, $employee_id) + return $this->managerEmployeeRosterShiftSaveAsyncWithHttpInfo($unavailability_id, $business_id, $employee_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -22181,27 +23946,27 @@ function ($response) { * Update Unavailability * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftSave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerEmployeeRosterShiftSaveAsyncWithHttpInfo($unavailability_id, $model, $business_id, $employee_id) + public function managerEmployeeRosterShiftSaveAsyncWithHttpInfo($unavailability_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftSave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerUnavailabilityModel'; - $request = $this->managerEmployeeRosterShiftSaveRequest($unavailability_id, $model, $business_id, $employee_id); + $returnType = '\OpenAPI\Client\Model\ManagerUnavailabilityModel'; + $request = $this->managerEmployeeRosterShiftSaveRequest($unavailability_id, $business_id, $employee_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22224,7 +23989,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22234,33 +23999,31 @@ function ($exception) { * Create request for operation 'managerEmployeeRosterShiftSave' * * @param int $unavailability_id (required) - * @param \Swagger\Client\Model\UnavailabilityEditModel $model (required) * @param string $business_id (required) * @param string $employee_id (required) + * @param \OpenAPI\Client\Model\UnavailabilityEditModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerEmployeeRosterShiftSave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerEmployeeRosterShiftSaveRequest($unavailability_id, $model, $business_id, $employee_id) + public function managerEmployeeRosterShiftSaveRequest($unavailability_id, $business_id, $employee_id, $model, string $contentType = self::contentTypes['managerEmployeeRosterShiftSave'][0]) { + // verify the required parameter 'unavailability_id' is set if ($unavailability_id === null || (is_array($unavailability_id) && count($unavailability_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $unavailability_id when calling managerEmployeeRosterShiftSave' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling managerEmployeeRosterShiftSave' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerEmployeeRosterShiftSave' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -22268,6 +24031,14 @@ protected function managerEmployeeRosterShiftSaveRequest($unavailability_id, $mo ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling managerEmployeeRosterShiftSave' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/{employeeId}/rostershift/unavailability/{unavailabilityId}'; $formParams = []; $queryParams = []; @@ -22276,6 +24047,7 @@ protected function managerEmployeeRosterShiftSaveRequest($unavailability_id, $mo $multipart = false; + // path params if ($unavailability_id !== null) { $resourcePath = str_replace( @@ -22301,56 +24073,42 @@ protected function managerEmployeeRosterShiftSaveRequest($unavailability_id, $mo ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22371,10 +24129,11 @@ protected function managerEmployeeRosterShiftSaveRequest($unavailability_id, $mo $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -22386,23 +24145,24 @@ protected function managerEmployeeRosterShiftSaveRequest($unavailability_id, $mo * Get Business Expense Requests * * @param string $business_id business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_expense_category_id (optional) - * @param string $filter_group_by (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) + * @param string $filter_status filter_status (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param int $filter_location_id filter_location_id (optional) + * @param int $filter_expense_category_id filter_expense_category_id (optional) + * @param string $filter_group_by filter_group_by (optional) + * @param int $filter_current_page filter_current_page (optional) + * @param int $filter_page_size filter_page_size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PagedResultModelOfManagerExpenseRequestModel + * @return \OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel */ - public function managerExpenseGet($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null) + public function managerExpenseGet($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null, string $contentType = self::contentTypes['managerExpenseGet'][0]) { - list($response) = $this->managerExpenseGetWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size); + list($response) = $this->managerExpenseGetWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size, $contentType); return $response; } @@ -22412,24 +24172,24 @@ public function managerExpenseGet($business_id, $filter_status = null, $filter_f * Get Business Expense Requests * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_expense_category_id (optional) - * @param string $filter_group_by (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_expense_category_id (optional) + * @param string $filter_group_by (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PagedResultModelOfManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerExpenseGetWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null) + public function managerExpenseGetWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null, string $contentType = self::contentTypes['managerExpenseGet'][0]) { - $returnType = '\Swagger\Client\Model\PagedResultModelOfManagerExpenseRequestModel'; - $request = $this->managerExpenseGetRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size); + $request = $this->managerExpenseGetRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size, $contentType); try { $options = $this->createHttpClientOption(); @@ -22438,9 +24198,16 @@ public function managerExpenseGetWithHttpInfo($business_id, $filter_status = nul } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -22451,19 +24218,37 @@ public function managerExpenseGetWithHttpInfo($business_id, $filter_status = nul sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22480,7 +24265,7 @@ public function managerExpenseGetWithHttpInfo($business_id, $filter_status = nul case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PagedResultModelOfManagerExpenseRequestModel', + '\OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -22496,22 +24281,23 @@ public function managerExpenseGetWithHttpInfo($business_id, $filter_status = nul * Get Business Expense Requests * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_expense_category_id (optional) - * @param string $filter_group_by (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_expense_category_id (optional) + * @param string $filter_group_by (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetAsync($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null) + public function managerExpenseGetAsync($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null, string $contentType = self::contentTypes['managerExpenseGet'][0]) { - return $this->managerExpenseGetAsyncWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size) + return $this->managerExpenseGetAsyncWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -22525,33 +24311,33 @@ function ($response) { * Get Business Expense Requests * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_expense_category_id (optional) - * @param string $filter_group_by (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_expense_category_id (optional) + * @param string $filter_group_by (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetAsyncWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null) + public function managerExpenseGetAsyncWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null, string $contentType = self::contentTypes['managerExpenseGet'][0]) { - $returnType = '\Swagger\Client\Model\PagedResultModelOfManagerExpenseRequestModel'; - $request = $this->managerExpenseGetRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size); + $returnType = '\OpenAPI\Client\Model\PagedResultModelOfManagerExpenseRequestModel'; + $request = $this->managerExpenseGetRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_location_id, $filter_expense_category_id, $filter_group_by, $filter_current_page, $filter_page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22574,7 +24360,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22584,21 +24370,23 @@ function ($exception) { * Create request for operation 'managerExpenseGet' * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_expense_category_id (optional) - * @param string $filter_group_by (optional) - * @param int $filter_current_page (optional) - * @param int $filter_page_size (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_expense_category_id (optional) + * @param string $filter_group_by (optional) + * @param int $filter_current_page (optional) + * @param int $filter_page_size (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerExpenseGetRequest($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null) + public function managerExpenseGetRequest($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_location_id = null, $filter_expense_category_id = null, $filter_group_by = null, $filter_current_page = null, $filter_page_size = null, string $contentType = self::contentTypes['managerExpenseGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -22606,6 +24394,16 @@ protected function managerExpenseGetRequest($business_id, $filter_status = null, ); } + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/expense'; $formParams = []; $queryParams = []; @@ -22614,41 +24412,87 @@ protected function managerExpenseGetRequest($business_id, $filter_status = null, $multipart = false; // query params - if ($filter_status !== null) { - $queryParams['filter.status'] = ObjectSerializer::toQueryValue($filter_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_status, + 'filter.status', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_expense_category_id !== null) { - $queryParams['filter.expenseCategoryId'] = ObjectSerializer::toQueryValue($filter_expense_category_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_expense_category_id, + 'filter.expenseCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_group_by !== null) { - $queryParams['filter.groupBy'] = ObjectSerializer::toQueryValue($filter_group_by); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_group_by, + 'filter.groupBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_current_page !== null) { - $queryParams['filter.currentPage'] = ObjectSerializer::toQueryValue($filter_current_page); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_current_page, + 'filter.currentPage', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_page_size !== null) { - $queryParams['filter.pageSize'] = ObjectSerializer::toQueryValue($filter_page_size); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_page_size, + 'filter.pageSize', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -22659,53 +24503,35 @@ protected function managerExpenseGetRequest($business_id, $filter_status = null, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -22726,10 +24552,11 @@ protected function managerExpenseGetRequest($business_id, $filter_status = null, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -22741,14 +24568,15 @@ protected function managerExpenseGetRequest($business_id, $filter_status = null, * List Expense Categories * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpenseCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ExpenseCategoryResponseModel[] + * @return \OpenAPI\Client\Model\ExpenseCategoryResponseModel[] */ - public function managerExpenseGetExpenseCategories($business_id) + public function managerExpenseGetExpenseCategories($business_id, string $contentType = self::contentTypes['managerExpenseGetExpenseCategories'][0]) { - list($response) = $this->managerExpenseGetExpenseCategoriesWithHttpInfo($business_id); + list($response) = $this->managerExpenseGetExpenseCategoriesWithHttpInfo($business_id, $contentType); return $response; } @@ -22758,15 +24586,15 @@ public function managerExpenseGetExpenseCategories($business_id) * List Expense Categories * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpenseCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ExpenseCategoryResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ExpenseCategoryResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerExpenseGetExpenseCategoriesWithHttpInfo($business_id) + public function managerExpenseGetExpenseCategoriesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetExpenseCategories'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseCategoryResponseModel[]'; - $request = $this->managerExpenseGetExpenseCategoriesRequest($business_id); + $request = $this->managerExpenseGetExpenseCategoriesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -22775,9 +24603,16 @@ public function managerExpenseGetExpenseCategoriesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -22788,19 +24623,37 @@ public function managerExpenseGetExpenseCategoriesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22817,7 +24670,7 @@ public function managerExpenseGetExpenseCategoriesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ExpenseCategoryResponseModel[]', + '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -22833,13 +24686,14 @@ public function managerExpenseGetExpenseCategoriesWithHttpInfo($business_id) * List Expense Categories * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetExpenseCategoriesAsync($business_id) + public function managerExpenseGetExpenseCategoriesAsync($business_id, string $contentType = self::contentTypes['managerExpenseGetExpenseCategories'][0]) { - return $this->managerExpenseGetExpenseCategoriesAsyncWithHttpInfo($business_id) + return $this->managerExpenseGetExpenseCategoriesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -22853,24 +24707,24 @@ function ($response) { * List Expense Categories * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetExpenseCategoriesAsyncWithHttpInfo($business_id) + public function managerExpenseGetExpenseCategoriesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetExpenseCategories'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseCategoryResponseModel[]'; - $request = $this->managerExpenseGetExpenseCategoriesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]'; + $request = $this->managerExpenseGetExpenseCategoriesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -22893,7 +24747,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -22903,12 +24757,14 @@ function ($exception) { * Create request for operation 'managerExpenseGetExpenseCategories' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpenseCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerExpenseGetExpenseCategoriesRequest($business_id) + public function managerExpenseGetExpenseCategoriesRequest($business_id, string $contentType = self::contentTypes['managerExpenseGetExpenseCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -22916,6 +24772,7 @@ protected function managerExpenseGetExpenseCategoriesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/expense/categories'; $formParams = []; $queryParams = []; @@ -22924,6 +24781,7 @@ protected function managerExpenseGetExpenseCategoriesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -22933,53 +24791,35 @@ protected function managerExpenseGetExpenseCategoriesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23000,10 +24840,11 @@ protected function managerExpenseGetExpenseCategoriesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23015,14 +24856,15 @@ protected function managerExpenseGetExpenseCategoriesRequest($business_id) * List Expense Request Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpensesEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerExpenseEmployeeModel[] + * @return \OpenAPI\Client\Model\ManagerExpenseEmployeeModel[] */ - public function managerExpenseGetExpensesEmployees($business_id) + public function managerExpenseGetExpensesEmployees($business_id, string $contentType = self::contentTypes['managerExpenseGetExpensesEmployees'][0]) { - list($response) = $this->managerExpenseGetExpensesEmployeesWithHttpInfo($business_id); + list($response) = $this->managerExpenseGetExpensesEmployeesWithHttpInfo($business_id, $contentType); return $response; } @@ -23032,15 +24874,15 @@ public function managerExpenseGetExpensesEmployees($business_id) * List Expense Request Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpensesEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerExpenseEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerExpenseEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerExpenseGetExpensesEmployeesWithHttpInfo($business_id) + public function managerExpenseGetExpensesEmployeesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetExpensesEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseEmployeeModel[]'; - $request = $this->managerExpenseGetExpensesEmployeesRequest($business_id); + $request = $this->managerExpenseGetExpensesEmployeesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23049,9 +24891,16 @@ public function managerExpenseGetExpensesEmployeesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23062,19 +24911,37 @@ public function managerExpenseGetExpensesEmployeesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerExpenseEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerExpenseEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerExpenseEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerExpenseEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23091,7 +24958,7 @@ public function managerExpenseGetExpensesEmployeesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerExpenseEmployeeModel[]', + '\OpenAPI\Client\Model\ManagerExpenseEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -23107,13 +24974,14 @@ public function managerExpenseGetExpensesEmployeesWithHttpInfo($business_id) * List Expense Request Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpensesEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetExpensesEmployeesAsync($business_id) + public function managerExpenseGetExpensesEmployeesAsync($business_id, string $contentType = self::contentTypes['managerExpenseGetExpensesEmployees'][0]) { - return $this->managerExpenseGetExpensesEmployeesAsyncWithHttpInfo($business_id) + return $this->managerExpenseGetExpensesEmployeesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23127,24 +24995,24 @@ function ($response) { * List Expense Request Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpensesEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetExpensesEmployeesAsyncWithHttpInfo($business_id) + public function managerExpenseGetExpensesEmployeesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetExpensesEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerExpenseEmployeeModel[]'; - $request = $this->managerExpenseGetExpensesEmployeesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerExpenseEmployeeModel[]'; + $request = $this->managerExpenseGetExpensesEmployeesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23167,7 +25035,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23177,12 +25045,14 @@ function ($exception) { * Create request for operation 'managerExpenseGetExpensesEmployees' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetExpensesEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerExpenseGetExpensesEmployeesRequest($business_id) + public function managerExpenseGetExpensesEmployeesRequest($business_id, string $contentType = self::contentTypes['managerExpenseGetExpensesEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -23190,6 +25060,7 @@ protected function managerExpenseGetExpensesEmployeesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/expense/employees'; $formParams = []; $queryParams = []; @@ -23198,6 +25069,7 @@ protected function managerExpenseGetExpensesEmployeesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -23207,53 +25079,35 @@ protected function managerExpenseGetExpensesEmployeesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23274,10 +25128,11 @@ protected function managerExpenseGetExpensesEmployeesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23289,14 +25144,15 @@ protected function managerExpenseGetExpensesEmployeesRequest($business_id) * List Expense Request Locations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function managerExpenseGetLocations($business_id) + public function managerExpenseGetLocations($business_id, string $contentType = self::contentTypes['managerExpenseGetLocations'][0]) { - list($response) = $this->managerExpenseGetLocationsWithHttpInfo($business_id); + list($response) = $this->managerExpenseGetLocationsWithHttpInfo($business_id, $contentType); return $response; } @@ -23306,15 +25162,15 @@ public function managerExpenseGetLocations($business_id) * List Expense Request Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerExpenseGetLocationsWithHttpInfo($business_id) + public function managerExpenseGetLocationsWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerExpenseGetLocationsRequest($business_id); + $request = $this->managerExpenseGetLocationsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23323,9 +25179,16 @@ public function managerExpenseGetLocationsWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23336,19 +25199,37 @@ public function managerExpenseGetLocationsWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23365,7 +25246,7 @@ public function managerExpenseGetLocationsWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -23381,13 +25262,14 @@ public function managerExpenseGetLocationsWithHttpInfo($business_id) * List Expense Request Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetLocationsAsync($business_id) + public function managerExpenseGetLocationsAsync($business_id, string $contentType = self::contentTypes['managerExpenseGetLocations'][0]) { - return $this->managerExpenseGetLocationsAsyncWithHttpInfo($business_id) + return $this->managerExpenseGetLocationsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23401,24 +25283,24 @@ function ($response) { * List Expense Request Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetLocationsAsyncWithHttpInfo($business_id) + public function managerExpenseGetLocationsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerExpenseGetLocationsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->managerExpenseGetLocationsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23441,7 +25323,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23451,12 +25333,14 @@ function ($exception) { * Create request for operation 'managerExpenseGetLocations' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerExpenseGetLocationsRequest($business_id) + public function managerExpenseGetLocationsRequest($business_id, string $contentType = self::contentTypes['managerExpenseGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -23464,6 +25348,7 @@ protected function managerExpenseGetLocationsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/expense/locations'; $formParams = []; $queryParams = []; @@ -23472,6 +25357,7 @@ protected function managerExpenseGetLocationsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -23481,53 +25367,35 @@ protected function managerExpenseGetLocationsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23548,10 +25416,11 @@ protected function managerExpenseGetLocationsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23563,14 +25432,15 @@ protected function managerExpenseGetLocationsRequest($business_id) * List Tax Codes * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetTaxCodes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ExpenseTaxCode[] + * @return \OpenAPI\Client\Model\ExpenseTaxCode[] */ - public function managerExpenseGetTaxCodes($business_id) + public function managerExpenseGetTaxCodes($business_id, string $contentType = self::contentTypes['managerExpenseGetTaxCodes'][0]) { - list($response) = $this->managerExpenseGetTaxCodesWithHttpInfo($business_id); + list($response) = $this->managerExpenseGetTaxCodesWithHttpInfo($business_id, $contentType); return $response; } @@ -23580,15 +25450,15 @@ public function managerExpenseGetTaxCodes($business_id) * List Tax Codes * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetTaxCodes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ExpenseTaxCode[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ExpenseTaxCode[], HTTP status code, HTTP response headers (array of strings) */ - public function managerExpenseGetTaxCodesWithHttpInfo($business_id) + public function managerExpenseGetTaxCodesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetTaxCodes'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseTaxCode[]'; - $request = $this->managerExpenseGetTaxCodesRequest($business_id); + $request = $this->managerExpenseGetTaxCodesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23597,9 +25467,16 @@ public function managerExpenseGetTaxCodesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + (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 ); } @@ -23610,19 +25487,37 @@ public function managerExpenseGetTaxCodesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ExpenseTaxCode[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExpenseTaxCode[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExpenseTaxCode[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExpenseTaxCode[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23639,7 +25534,7 @@ public function managerExpenseGetTaxCodesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ExpenseTaxCode[]', + '\OpenAPI\Client\Model\ExpenseTaxCode[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -23655,13 +25550,14 @@ public function managerExpenseGetTaxCodesWithHttpInfo($business_id) * List Tax Codes * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetTaxCodesAsync($business_id) + public function managerExpenseGetTaxCodesAsync($business_id, string $contentType = self::contentTypes['managerExpenseGetTaxCodes'][0]) { - return $this->managerExpenseGetTaxCodesAsyncWithHttpInfo($business_id) + return $this->managerExpenseGetTaxCodesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23675,24 +25571,24 @@ function ($response) { * List Tax Codes * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerExpenseGetTaxCodesAsyncWithHttpInfo($business_id) + public function managerExpenseGetTaxCodesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerExpenseGetTaxCodes'][0]) { - $returnType = '\Swagger\Client\Model\ExpenseTaxCode[]'; - $request = $this->managerExpenseGetTaxCodesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ExpenseTaxCode[]'; + $request = $this->managerExpenseGetTaxCodesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23715,7 +25611,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23725,12 +25621,14 @@ function ($exception) { * Create request for operation 'managerExpenseGetTaxCodes' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerExpenseGetTaxCodes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerExpenseGetTaxCodesRequest($business_id) + public function managerExpenseGetTaxCodesRequest($business_id, string $contentType = self::contentTypes['managerExpenseGetTaxCodes'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -23738,6 +25636,7 @@ protected function managerExpenseGetTaxCodesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/expense/taxcodes'; $formParams = []; $queryParams = []; @@ -23746,6 +25645,7 @@ protected function managerExpenseGetTaxCodesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -23755,53 +25655,35 @@ protected function managerExpenseGetTaxCodesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -23822,10 +25704,11 @@ protected function managerExpenseGetTaxCodesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -23837,14 +25720,15 @@ protected function managerExpenseGetTaxCodesRequest($business_id) * Get Dashboard * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetDashboard'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerDashboardModel + * @return \OpenAPI\Client\Model\ManagerDashboardModel */ - public function managerGetDashboard($business_id) + public function managerGetDashboard($business_id, string $contentType = self::contentTypes['managerGetDashboard'][0]) { - list($response) = $this->managerGetDashboardWithHttpInfo($business_id); + list($response) = $this->managerGetDashboardWithHttpInfo($business_id, $contentType); return $response; } @@ -23854,15 +25738,15 @@ public function managerGetDashboard($business_id) * Get Dashboard * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetDashboard'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerDashboardModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerDashboardModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerGetDashboardWithHttpInfo($business_id) + public function managerGetDashboardWithHttpInfo($business_id, string $contentType = self::contentTypes['managerGetDashboard'][0]) { - $returnType = '\Swagger\Client\Model\ManagerDashboardModel'; - $request = $this->managerGetDashboardRequest($business_id); + $request = $this->managerGetDashboardRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -23871,9 +25755,16 @@ public function managerGetDashboardWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -23884,19 +25775,37 @@ public function managerGetDashboardWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerDashboardModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerDashboardModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerDashboardModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerDashboardModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23913,7 +25822,7 @@ public function managerGetDashboardWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerDashboardModel', + '\OpenAPI\Client\Model\ManagerDashboardModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -23929,13 +25838,14 @@ public function managerGetDashboardWithHttpInfo($business_id) * Get Dashboard * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetDashboard'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerGetDashboardAsync($business_id) + public function managerGetDashboardAsync($business_id, string $contentType = self::contentTypes['managerGetDashboard'][0]) { - return $this->managerGetDashboardAsyncWithHttpInfo($business_id) + return $this->managerGetDashboardAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -23949,24 +25859,24 @@ function ($response) { * Get Dashboard * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetDashboard'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerGetDashboardAsyncWithHttpInfo($business_id) + public function managerGetDashboardAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerGetDashboard'][0]) { - $returnType = '\Swagger\Client\Model\ManagerDashboardModel'; - $request = $this->managerGetDashboardRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerDashboardModel'; + $request = $this->managerGetDashboardRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -23989,7 +25899,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -23999,12 +25909,14 @@ function ($exception) { * Create request for operation 'managerGetDashboard' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetDashboard'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerGetDashboardRequest($business_id) + public function managerGetDashboardRequest($business_id, string $contentType = self::contentTypes['managerGetDashboard'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -24012,6 +25924,7 @@ protected function managerGetDashboardRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/dashboard'; $formParams = []; $queryParams = []; @@ -24020,6 +25933,7 @@ protected function managerGetDashboardRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -24029,53 +25943,35 @@ protected function managerGetDashboardRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24096,10 +25992,11 @@ protected function managerGetDashboardRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24111,14 +26008,15 @@ protected function managerGetDashboardRequest($business_id) * Get List of Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDetailsModel[] + * @return \OpenAPI\Client\Model\EmployeeDetailsModel[] */ - public function managerGetEmployees($business_id) + public function managerGetEmployees($business_id, string $contentType = self::contentTypes['managerGetEmployees'][0]) { - list($response) = $this->managerGetEmployeesWithHttpInfo($business_id); + list($response) = $this->managerGetEmployeesWithHttpInfo($business_id, $contentType); return $response; } @@ -24128,15 +26026,15 @@ public function managerGetEmployees($business_id) * Get List of Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDetailsModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDetailsModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerGetEmployeesWithHttpInfo($business_id) + public function managerGetEmployeesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerGetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsModel[]'; - $request = $this->managerGetEmployeesRequest($business_id); + $request = $this->managerGetEmployeesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -24145,9 +26043,16 @@ public function managerGetEmployeesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24158,19 +26063,37 @@ public function managerGetEmployeesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDetailsModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDetailsModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDetailsModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24187,7 +26110,7 @@ public function managerGetEmployeesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDetailsModel[]', + '\OpenAPI\Client\Model\EmployeeDetailsModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -24203,13 +26126,14 @@ public function managerGetEmployeesWithHttpInfo($business_id) * Get List of Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerGetEmployeesAsync($business_id) + public function managerGetEmployeesAsync($business_id, string $contentType = self::contentTypes['managerGetEmployees'][0]) { - return $this->managerGetEmployeesAsyncWithHttpInfo($business_id) + return $this->managerGetEmployeesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -24223,24 +26147,24 @@ function ($response) { * Get List of Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerGetEmployeesAsyncWithHttpInfo($business_id) + public function managerGetEmployeesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerGetEmployees'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsModel[]'; - $request = $this->managerGetEmployeesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsModel[]'; + $request = $this->managerGetEmployeesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24263,7 +26187,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -24273,12 +26197,14 @@ function ($exception) { * Create request for operation 'managerGetEmployees' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerGetEmployeesRequest($business_id) + public function managerGetEmployeesRequest($business_id, string $contentType = self::contentTypes['managerGetEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -24286,6 +26212,7 @@ protected function managerGetEmployeesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/employees'; $formParams = []; $queryParams = []; @@ -24294,6 +26221,7 @@ protected function managerGetEmployeesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -24303,53 +26231,35 @@ protected function managerGetEmployeesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24370,10 +26280,11 @@ protected function managerGetEmployeesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24385,14 +26296,15 @@ protected function managerGetEmployeesRequest($business_id) * Get List of Locations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function managerGetLocations($business_id) + public function managerGetLocations($business_id, string $contentType = self::contentTypes['managerGetLocations'][0]) { - list($response) = $this->managerGetLocationsWithHttpInfo($business_id); + list($response) = $this->managerGetLocationsWithHttpInfo($business_id, $contentType); return $response; } @@ -24402,15 +26314,15 @@ public function managerGetLocations($business_id) * Get List of Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerGetLocationsWithHttpInfo($business_id) + public function managerGetLocationsWithHttpInfo($business_id, string $contentType = self::contentTypes['managerGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerGetLocationsRequest($business_id); + $request = $this->managerGetLocationsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -24419,9 +26331,16 @@ public function managerGetLocationsWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24432,19 +26351,37 @@ public function managerGetLocationsWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24461,7 +26398,7 @@ public function managerGetLocationsWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -24477,13 +26414,14 @@ public function managerGetLocationsWithHttpInfo($business_id) * Get List of Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerGetLocationsAsync($business_id) + public function managerGetLocationsAsync($business_id, string $contentType = self::contentTypes['managerGetLocations'][0]) { - return $this->managerGetLocationsAsyncWithHttpInfo($business_id) + return $this->managerGetLocationsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -24497,24 +26435,24 @@ function ($response) { * Get List of Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerGetLocationsAsyncWithHttpInfo($business_id) + public function managerGetLocationsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerGetLocationsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->managerGetLocationsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24537,7 +26475,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -24547,12 +26485,14 @@ function ($exception) { * Create request for operation 'managerGetLocations' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerGetLocationsRequest($business_id) + public function managerGetLocationsRequest($business_id, string $contentType = self::contentTypes['managerGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -24560,6 +26500,7 @@ protected function managerGetLocationsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/locations'; $formParams = []; $queryParams = []; @@ -24568,6 +26509,7 @@ protected function managerGetLocationsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -24577,53 +26519,35 @@ protected function managerGetLocationsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24644,10 +26568,11 @@ protected function managerGetLocationsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24660,14 +26585,15 @@ protected function managerGetLocationsRequest($business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimeAndAttendanceKioskModel + * @return \OpenAPI\Client\Model\TimeAndAttendanceKioskModel */ - public function managerKioskGet($id, $business_id) + public function managerKioskGet($id, $business_id, string $contentType = self::contentTypes['managerKioskGet'][0]) { - list($response) = $this->managerKioskGetWithHttpInfo($id, $business_id); + list($response) = $this->managerKioskGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -24678,15 +26604,15 @@ public function managerKioskGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerKioskGetWithHttpInfo($id, $business_id) + public function managerKioskGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['managerKioskGet'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->managerKioskGetRequest($id, $business_id); + $request = $this->managerKioskGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -24695,9 +26621,16 @@ public function managerKioskGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -24708,19 +26641,37 @@ public function managerKioskGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24737,7 +26688,7 @@ public function managerKioskGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimeAndAttendanceKioskModel', + '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -24754,13 +26705,14 @@ public function managerKioskGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerKioskGetAsync($id, $business_id) + public function managerKioskGetAsync($id, $business_id, string $contentType = self::contentTypes['managerKioskGet'][0]) { - return $this->managerKioskGetAsyncWithHttpInfo($id, $business_id) + return $this->managerKioskGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -24775,24 +26727,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerKioskGetAsyncWithHttpInfo($id, $business_id) + public function managerKioskGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['managerKioskGet'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->managerKioskGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; + $request = $this->managerKioskGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -24815,7 +26767,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -24826,18 +26778,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerKioskGetRequest($id, $business_id) + public function managerKioskGetRequest($id, $business_id, string $contentType = self::contentTypes['managerKioskGet'][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 managerKioskGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -24845,6 +26800,7 @@ protected function managerKioskGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/{id}'; $formParams = []; $queryParams = []; @@ -24853,6 +26809,7 @@ protected function managerKioskGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -24870,53 +26827,35 @@ protected function managerKioskGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -24937,10 +26876,11 @@ protected function managerKioskGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -24952,18 +26892,20 @@ protected function managerKioskGetRequest($id, $business_id) * Get Business Timesheets * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimesheetLineModel[] + * @return \OpenAPI\Client\Model\TimesheetLineModel[] */ - public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'][0]) { - list($response) = $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -24973,19 +26915,20 @@ public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet($b * Get Business Timesheets * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimesheetLineModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimesheetLineModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'][0]) { - $returnType = '\Swagger\Client\Model\TimesheetLineModel[]'; - $request = $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -24994,9 +26937,16 @@ public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWit } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25007,19 +26957,37 @@ public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWit sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimesheetLineModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimesheetLineModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimesheetLineModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimesheetLineModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25036,7 +27004,7 @@ public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWit case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimesheetLineModel[]', + '\OpenAPI\Client\Model\TimesheetLineModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -25052,17 +27020,19 @@ public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetWit * Get Business Timesheets * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'][0]) { - return $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -25076,28 +27046,29 @@ function ($response) { * Get Business Timesheets * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'][0]) { - $returnType = '\Swagger\Client\Model\TimesheetLineModel[]'; - $request = $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\TimesheetLineModel[]'; + $request = $this->managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25120,7 +27091,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25130,16 +27101,19 @@ function ($exception) { * Create request for operation 'managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheetRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -25147,6 +27121,12 @@ protected function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk/timesheet'; $formParams = []; $queryParams = []; @@ -25155,20 +27135,45 @@ protected function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -25180,53 +27185,35 @@ protected function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -25247,10 +27234,11 @@ protected function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -25262,14 +27250,15 @@ protected function managerKioskGetApiV2BusinessByBusinessIdManagerKioskTimesheet * Get Kiosks * * @param int $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskKiosks'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimeAndAttendanceKioskModel[] + * @return \OpenAPI\Client\Model\TimeAndAttendanceKioskModel[] */ - public function managerKioskKiosks($business_id) + public function managerKioskKiosks($business_id, string $contentType = self::contentTypes['managerKioskKiosks'][0]) { - list($response) = $this->managerKioskKiosksWithHttpInfo($business_id); + list($response) = $this->managerKioskKiosksWithHttpInfo($business_id, $contentType); return $response; } @@ -25279,15 +27268,15 @@ public function managerKioskKiosks($business_id) * Get Kiosks * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskKiosks'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimeAndAttendanceKioskModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimeAndAttendanceKioskModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerKioskKiosksWithHttpInfo($business_id) + public function managerKioskKiosksWithHttpInfo($business_id, string $contentType = self::contentTypes['managerKioskKiosks'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel[]'; - $request = $this->managerKioskKiosksRequest($business_id); + $request = $this->managerKioskKiosksRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -25296,9 +27285,16 @@ public function managerKioskKiosksWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25309,19 +27305,37 @@ public function managerKioskKiosksWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25338,7 +27352,7 @@ public function managerKioskKiosksWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimeAndAttendanceKioskModel[]', + '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -25354,13 +27368,14 @@ public function managerKioskKiosksWithHttpInfo($business_id) * Get Kiosks * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskKiosks'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerKioskKiosksAsync($business_id) + public function managerKioskKiosksAsync($business_id, string $contentType = self::contentTypes['managerKioskKiosks'][0]) { - return $this->managerKioskKiosksAsyncWithHttpInfo($business_id) + return $this->managerKioskKiosksAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -25374,24 +27389,24 @@ function ($response) { * Get Kiosks * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskKiosks'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerKioskKiosksAsyncWithHttpInfo($business_id) + public function managerKioskKiosksAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerKioskKiosks'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel[]'; - $request = $this->managerKioskKiosksRequest($business_id); + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]'; + $request = $this->managerKioskKiosksRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25414,7 +27429,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25424,12 +27439,14 @@ function ($exception) { * Create request for operation 'managerKioskKiosks' * * @param int $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerKioskKiosks'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerKioskKiosksRequest($business_id) + public function managerKioskKiosksRequest($business_id, string $contentType = self::contentTypes['managerKioskKiosks'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -25437,6 +27454,7 @@ protected function managerKioskKiosksRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/kiosk'; $formParams = []; $queryParams = []; @@ -25445,6 +27463,7 @@ protected function managerKioskKiosksRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -25454,53 +27473,35 @@ protected function managerKioskKiosksRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -25521,10 +27522,11 @@ protected function managerKioskKiosksRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -25536,14 +27538,15 @@ protected function managerKioskKiosksRequest($business_id) * List Leave Categories * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\ManagerLeaveCategoryModel[] */ - public function managerLeaveRequestGetLeaveCategories($business_id) + public function managerLeaveRequestGetLeaveCategories($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveCategories'][0]) { - list($response) = $this->managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id); + list($response) = $this->managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id, $contentType); return $response; } @@ -25553,15 +27556,15 @@ public function managerLeaveRequestGetLeaveCategories($business_id) * List Leave Categories * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id) + public function managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveCategoryModel[]'; - $request = $this->managerLeaveRequestGetLeaveCategoriesRequest($business_id); + $request = $this->managerLeaveRequestGetLeaveCategoriesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -25570,9 +27573,16 @@ public function managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25583,19 +27593,37 @@ public function managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25612,7 +27640,7 @@ public function managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveCategoryModel[]', + '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -25628,13 +27656,14 @@ public function managerLeaveRequestGetLeaveCategoriesWithHttpInfo($business_id) * List Leave Categories * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestGetLeaveCategoriesAsync($business_id) + public function managerLeaveRequestGetLeaveCategoriesAsync($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveCategories'][0]) { - return $this->managerLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id) + return $this->managerLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -25648,24 +27677,24 @@ function ($response) { * List Leave Categories * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id) + public function managerLeaveRequestGetLeaveCategoriesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveCategories'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveCategoryModel[]'; - $request = $this->managerLeaveRequestGetLeaveCategoriesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveCategoryModel[]'; + $request = $this->managerLeaveRequestGetLeaveCategoriesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25688,7 +27717,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25698,12 +27727,14 @@ function ($exception) { * Create request for operation 'managerLeaveRequestGetLeaveCategories' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLeaveRequestGetLeaveCategoriesRequest($business_id) + public function managerLeaveRequestGetLeaveCategoriesRequest($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -25711,6 +27742,7 @@ protected function managerLeaveRequestGetLeaveCategoriesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/leaverequest/categories'; $formParams = []; $queryParams = []; @@ -25719,6 +27751,7 @@ protected function managerLeaveRequestGetLeaveCategoriesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -25728,53 +27761,35 @@ protected function managerLeaveRequestGetLeaveCategoriesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -25795,10 +27810,11 @@ protected function managerLeaveRequestGetLeaveCategoriesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -25810,14 +27826,15 @@ protected function managerLeaveRequestGetLeaveCategoriesRequest($business_id) * List Leave Employees * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveEmployeeModel[] + * @return \OpenAPI\Client\Model\ManagerLeaveEmployeeModel[] */ - public function managerLeaveRequestGetLeaveEmployees($business_id) + public function managerLeaveRequestGetLeaveEmployees($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveEmployees'][0]) { - list($response) = $this->managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id); + list($response) = $this->managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id, $contentType); return $response; } @@ -25827,15 +27844,15 @@ public function managerLeaveRequestGetLeaveEmployees($business_id) * List Leave Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveEmployees'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id) + public function managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveEmployeeModel[]'; - $request = $this->managerLeaveRequestGetLeaveEmployeesRequest($business_id); + $request = $this->managerLeaveRequestGetLeaveEmployeesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -25844,9 +27861,16 @@ public function managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -25857,19 +27881,37 @@ public function managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25886,7 +27928,7 @@ public function managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveEmployeeModel[]', + '\OpenAPI\Client\Model\ManagerLeaveEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -25902,13 +27944,14 @@ public function managerLeaveRequestGetLeaveEmployeesWithHttpInfo($business_id) * List Leave Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestGetLeaveEmployeesAsync($business_id) + public function managerLeaveRequestGetLeaveEmployeesAsync($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveEmployees'][0]) { - return $this->managerLeaveRequestGetLeaveEmployeesAsyncWithHttpInfo($business_id) + return $this->managerLeaveRequestGetLeaveEmployeesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -25922,24 +27965,24 @@ function ($response) { * List Leave Employees * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestGetLeaveEmployeesAsyncWithHttpInfo($business_id) + public function managerLeaveRequestGetLeaveEmployeesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveEmployees'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveEmployeeModel[]'; - $request = $this->managerLeaveRequestGetLeaveEmployeesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveEmployeeModel[]'; + $request = $this->managerLeaveRequestGetLeaveEmployeesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -25962,7 +28005,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -25972,12 +28015,14 @@ function ($exception) { * Create request for operation 'managerLeaveRequestGetLeaveEmployees' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLeaveEmployees'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLeaveRequestGetLeaveEmployeesRequest($business_id) + public function managerLeaveRequestGetLeaveEmployeesRequest($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLeaveEmployees'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -25985,6 +28030,7 @@ protected function managerLeaveRequestGetLeaveEmployeesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/leaverequest/employees'; $formParams = []; $queryParams = []; @@ -25993,6 +28039,7 @@ protected function managerLeaveRequestGetLeaveEmployeesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -26002,53 +28049,35 @@ protected function managerLeaveRequestGetLeaveEmployeesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26069,10 +28098,11 @@ protected function managerLeaveRequestGetLeaveEmployeesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26084,14 +28114,15 @@ protected function managerLeaveRequestGetLeaveEmployeesRequest($business_id) * List Leave Locations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function managerLeaveRequestGetLocations($business_id) + public function managerLeaveRequestGetLocations($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLocations'][0]) { - list($response) = $this->managerLeaveRequestGetLocationsWithHttpInfo($business_id); + list($response) = $this->managerLeaveRequestGetLocationsWithHttpInfo($business_id, $contentType); return $response; } @@ -26101,15 +28132,15 @@ public function managerLeaveRequestGetLocations($business_id) * List Leave Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLeaveRequestGetLocationsWithHttpInfo($business_id) + public function managerLeaveRequestGetLocationsWithHttpInfo($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerLeaveRequestGetLocationsRequest($business_id); + $request = $this->managerLeaveRequestGetLocationsRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -26118,9 +28149,16 @@ public function managerLeaveRequestGetLocationsWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26131,19 +28169,37 @@ public function managerLeaveRequestGetLocationsWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26160,7 +28216,7 @@ public function managerLeaveRequestGetLocationsWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -26176,13 +28232,14 @@ public function managerLeaveRequestGetLocationsWithHttpInfo($business_id) * List Leave Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestGetLocationsAsync($business_id) + public function managerLeaveRequestGetLocationsAsync($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLocations'][0]) { - return $this->managerLeaveRequestGetLocationsAsyncWithHttpInfo($business_id) + return $this->managerLeaveRequestGetLocationsAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -26196,24 +28253,24 @@ function ($response) { * List Leave Locations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestGetLocationsAsyncWithHttpInfo($business_id) + public function managerLeaveRequestGetLocationsAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerLeaveRequestGetLocationsRequest($business_id); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->managerLeaveRequestGetLocationsRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26236,7 +28293,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -26246,12 +28303,14 @@ function ($exception) { * Create request for operation 'managerLeaveRequestGetLocations' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLeaveRequestGetLocationsRequest($business_id) + public function managerLeaveRequestGetLocationsRequest($business_id, string $contentType = self::contentTypes['managerLeaveRequestGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -26259,6 +28318,7 @@ protected function managerLeaveRequestGetLocationsRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/leaverequest/locations'; $formParams = []; $queryParams = []; @@ -26267,6 +28327,7 @@ protected function managerLeaveRequestGetLocationsRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -26276,53 +28337,35 @@ protected function managerLeaveRequestGetLocationsRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26343,10 +28386,11 @@ protected function managerLeaveRequestGetLocationsRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26358,22 +28402,23 @@ protected function managerLeaveRequestGetLocationsRequest($business_id) * List Leave Requests * * @param string $business_id business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status filter_status (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param int $filter_leave_category_id filter_leave_category_id (optional) + * @param int $filter_location_id filter_location_id (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param string $filter_group_by filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestListLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel[] + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel[] */ - public function managerLeaveRequestListLeaveRequests($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function managerLeaveRequestListLeaveRequests($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['managerLeaveRequestListLeaveRequests'][0]) { - list($response) = $this->managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave); + list($response) = $this->managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType); return $response; } @@ -26383,23 +28428,23 @@ public function managerLeaveRequestListLeaveRequests($business_id, $filter_statu * List Leave Requests * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestListLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['managerLeaveRequestListLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel[]'; - $request = $this->managerLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave); + $request = $this->managerLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType); try { $options = $this->createHttpClientOption(); @@ -26408,9 +28453,16 @@ public function managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26421,19 +28473,37 @@ public function managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26450,7 +28520,7 @@ public function managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel[]', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -26466,21 +28536,22 @@ public function managerLeaveRequestListLeaveRequestsWithHttpInfo($business_id, $ * List Leave Requests * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestListLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestListLeaveRequestsAsync($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function managerLeaveRequestListLeaveRequestsAsync($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['managerLeaveRequestListLeaveRequests'][0]) { - return $this->managerLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave) + return $this->managerLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType) ->then( function ($response) { return $response[0]; @@ -26494,32 +28565,32 @@ function ($response) { * List Leave Requests * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestListLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function managerLeaveRequestListLeaveRequestsAsyncWithHttpInfo($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['managerLeaveRequestListLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel[]'; - $request = $this->managerLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]'; + $request = $this->managerLeaveRequestListLeaveRequestsRequest($business_id, $filter_status, $filter_from_date, $filter_to_date, $filter_leave_category_id, $filter_location_id, $filter_employee_id, $filter_group_by, $filter_restrict_overlapping_leave, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26542,7 +28613,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -26552,20 +28623,22 @@ function ($exception) { * Create request for operation 'managerLeaveRequestListLeaveRequests' * * @param string $business_id (required) - * @param string $filter_status (optional) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_leave_category_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_id (optional) - * @param string $filter_group_by (optional) - * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $filter_status (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_leave_category_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_id (optional) + * @param string $filter_group_by (optional) + * @param bool $filter_restrict_overlapping_leave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestListLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLeaveRequestListLeaveRequestsRequest($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null) + public function managerLeaveRequestListLeaveRequestsRequest($business_id, $filter_status = null, $filter_from_date = null, $filter_to_date = null, $filter_leave_category_id = null, $filter_location_id = null, $filter_employee_id = null, $filter_group_by = null, $filter_restrict_overlapping_leave = null, string $contentType = self::contentTypes['managerLeaveRequestListLeaveRequests'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -26573,6 +28646,15 @@ protected function managerLeaveRequestListLeaveRequestsRequest($business_id, $fi ); } + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/leaverequest'; $formParams = []; $queryParams = []; @@ -26581,37 +28663,78 @@ protected function managerLeaveRequestListLeaveRequestsRequest($business_id, $fi $multipart = false; // query params - if ($filter_status !== null) { - $queryParams['filter.status'] = ObjectSerializer::toQueryValue($filter_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_status, + 'filter.status', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_leave_category_id !== null) { - $queryParams['filter.leaveCategoryId'] = ObjectSerializer::toQueryValue($filter_leave_category_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_leave_category_id, + 'filter.leaveCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_group_by !== null) { - $queryParams['filter.groupBy'] = ObjectSerializer::toQueryValue($filter_group_by); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_group_by, + 'filter.groupBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_restrict_overlapping_leave !== null) { - $queryParams['filter.restrictOverlappingLeave'] = ObjectSerializer::toQueryValue($filter_restrict_overlapping_leave); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_restrict_overlapping_leave, + 'filter.restrictOverlappingLeave', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -26622,53 +28745,35 @@ protected function managerLeaveRequestListLeaveRequestsRequest($business_id, $fi ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26689,10 +28794,11 @@ protected function managerLeaveRequestListLeaveRequestsRequest($business_id, $fi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -26706,14 +28812,15 @@ protected function managerLeaveRequestListLeaveRequestsRequest($business_id, $fi * @param \DateTime $from_date from_date (required) * @param \DateTime $to_date to_date (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestOverlappingLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ManagerLeaveRequestModel[] + * @return \OpenAPI\Client\Model\ManagerLeaveRequestModel[] */ - public function managerLeaveRequestOverlappingLeave($from_date, $to_date, $business_id) + public function managerLeaveRequestOverlappingLeave($from_date, $to_date, $business_id, string $contentType = self::contentTypes['managerLeaveRequestOverlappingLeave'][0]) { - list($response) = $this->managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_date, $business_id); + list($response) = $this->managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_date, $business_id, $contentType); return $response; } @@ -26725,15 +28832,15 @@ public function managerLeaveRequestOverlappingLeave($from_date, $to_date, $busin * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestOverlappingLeave'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ManagerLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ManagerLeaveRequestModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_date, $business_id) + public function managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_date, $business_id, string $contentType = self::contentTypes['managerLeaveRequestOverlappingLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel[]'; - $request = $this->managerLeaveRequestOverlappingLeaveRequest($from_date, $to_date, $business_id); + $request = $this->managerLeaveRequestOverlappingLeaveRequest($from_date, $to_date, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -26742,9 +28849,16 @@ public function managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -26755,19 +28869,37 @@ public function managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ManagerLeaveRequestModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26784,7 +28916,7 @@ public function managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ManagerLeaveRequestModel[]', + '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -26802,13 +28934,14 @@ public function managerLeaveRequestOverlappingLeaveWithHttpInfo($from_date, $to_ * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestOverlappingLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestOverlappingLeaveAsync($from_date, $to_date, $business_id) + public function managerLeaveRequestOverlappingLeaveAsync($from_date, $to_date, $business_id, string $contentType = self::contentTypes['managerLeaveRequestOverlappingLeave'][0]) { - return $this->managerLeaveRequestOverlappingLeaveAsyncWithHttpInfo($from_date, $to_date, $business_id) + return $this->managerLeaveRequestOverlappingLeaveAsyncWithHttpInfo($from_date, $to_date, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -26824,24 +28957,24 @@ function ($response) { * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestOverlappingLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLeaveRequestOverlappingLeaveAsyncWithHttpInfo($from_date, $to_date, $business_id) + public function managerLeaveRequestOverlappingLeaveAsyncWithHttpInfo($from_date, $to_date, $business_id, string $contentType = self::contentTypes['managerLeaveRequestOverlappingLeave'][0]) { - $returnType = '\Swagger\Client\Model\ManagerLeaveRequestModel[]'; - $request = $this->managerLeaveRequestOverlappingLeaveRequest($from_date, $to_date, $business_id); + $returnType = '\OpenAPI\Client\Model\ManagerLeaveRequestModel[]'; + $request = $this->managerLeaveRequestOverlappingLeaveRequest($from_date, $to_date, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -26864,7 +28997,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -26876,24 +29009,28 @@ function ($exception) { * @param \DateTime $from_date (required) * @param \DateTime $to_date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLeaveRequestOverlappingLeave'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_date, $business_id) + public function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_date, $business_id, string $contentType = self::contentTypes['managerLeaveRequestOverlappingLeave'][0]) { + // verify the required parameter 'from_date' is set if ($from_date === null || (is_array($from_date) && count($from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $from_date when calling managerLeaveRequestOverlappingLeave' ); } + // verify the required parameter 'to_date' is set if ($to_date === null || (is_array($to_date) && count($to_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $to_date when calling managerLeaveRequestOverlappingLeave' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -26901,6 +29038,7 @@ protected function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_da ); } + $resourcePath = '/api/v2/business/{businessId}/manager/leaverequest/overlapping'; $formParams = []; $queryParams = []; @@ -26909,13 +29047,24 @@ protected function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_da $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -26926,53 +29075,35 @@ protected function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_da ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -26993,10 +29124,11 @@ protected function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_da $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27009,18 +29141,20 @@ protected function managerLeaveRequestOverlappingLeaveRequest($from_date, $to_da * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'][0]) { - list($response) = $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip); + list($response) = $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -27031,19 +29165,20 @@ public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmpl * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $request = $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -27052,9 +29187,16 @@ public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmpl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27065,19 +29207,37 @@ public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmpl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27094,7 +29254,7 @@ public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmpl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -27111,17 +29271,19 @@ public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmpl * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationAsync($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationAsync($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'][0]) { - return $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationAsyncWithHttpInfo($business_id, $employee_id, $filter, $orderby, $top, $skip) + return $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationAsyncWithHttpInfo($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -27136,28 +29298,29 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationAsyncWithHttpInfo($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationAsyncWithHttpInfo($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationRequest($business_id, $employee_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationRequest($business_id, $employee_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27180,7 +29343,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27191,22 +29354,26 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationRequest($business_id, $employee_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocationRequest($business_id, $employee_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByEmployeeIdLocation' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -27214,6 +29381,12 @@ protected function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByE ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/employee/{employeeId}/location'; $formParams = []; $queryParams = []; @@ -27222,20 +29395,45 @@ protected function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByE $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -27255,53 +29453,35 @@ protected function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByE ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27322,10 +29502,11 @@ protected function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByE $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27337,18 +29518,20 @@ protected function managerLocationGetApiV2BusinessByBusinessIdManagerEmployeeByE * List Employee Locations * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[] */ - public function managerLocationGetLocations($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetLocations($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetLocations'][0]) { - list($response) = $this->managerLocationGetLocationsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->managerLocationGetLocationsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -27358,19 +29541,20 @@ public function managerLocationGetLocations($business_id, $filter = null, $order * List Employee Locations * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetLocations'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LocationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function managerLocationGetLocationsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetLocationsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerLocationGetLocationsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->managerLocationGetLocationsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -27379,9 +29563,16 @@ public function managerLocationGetLocationsWithHttpInfo($business_id, $filter = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27392,19 +29583,37 @@ public function managerLocationGetLocationsWithHttpInfo($business_id, $filter = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LocationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LocationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LocationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27421,7 +29630,7 @@ public function managerLocationGetLocationsWithHttpInfo($business_id, $filter = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LocationModel[]', + '\OpenAPI\Client\Model\LocationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -27437,17 +29646,19 @@ public function managerLocationGetLocationsWithHttpInfo($business_id, $filter = * List Employee Locations * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLocationGetLocationsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetLocationsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetLocations'][0]) { - return $this->managerLocationGetLocationsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->managerLocationGetLocationsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -27461,28 +29672,29 @@ function ($response) { * List Employee Locations * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerLocationGetLocationsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetLocationsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetLocations'][0]) { - $returnType = '\Swagger\Client\Model\LocationModel[]'; - $request = $this->managerLocationGetLocationsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\LocationModel[]'; + $request = $this->managerLocationGetLocationsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27505,7 +29717,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27515,16 +29727,19 @@ function ($exception) { * Create request for operation 'managerLocationGetLocations' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerLocationGetLocations'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerLocationGetLocationsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function managerLocationGetLocationsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['managerLocationGetLocations'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -27532,6 +29747,12 @@ protected function managerLocationGetLocationsRequest($business_id, $filter = nu ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/manager/location'; $formParams = []; $queryParams = []; @@ -27540,20 +29761,45 @@ protected function managerLocationGetLocationsRequest($business_id, $filter = nu $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -27565,53 +29811,35 @@ protected function managerLocationGetLocationsRequest($business_id, $filter = nu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27632,10 +29860,11 @@ protected function managerLocationGetLocationsRequest($business_id, $filter = nu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27647,14 +29876,15 @@ protected function managerLocationGetLocationsRequest($business_id, $filter = nu * Get Rounding Rules * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesGetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimesheetRoundingRulesModel + * @return \OpenAPI\Client\Model\TimesheetRoundingRulesModel */ - public function managerRoundingRulesGetRoundingRules($business_id) + public function managerRoundingRulesGetRoundingRules($business_id, string $contentType = self::contentTypes['managerRoundingRulesGetRoundingRules'][0]) { - list($response) = $this->managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id); + list($response) = $this->managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id, $contentType); return $response; } @@ -27664,15 +29894,15 @@ public function managerRoundingRulesGetRoundingRules($business_id) * Get Rounding Rules * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesGetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimesheetRoundingRulesModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimesheetRoundingRulesModel, HTTP status code, HTTP response headers (array of strings) */ - public function managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id) + public function managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id, string $contentType = self::contentTypes['managerRoundingRulesGetRoundingRules'][0]) { - $returnType = '\Swagger\Client\Model\TimesheetRoundingRulesModel'; - $request = $this->managerRoundingRulesGetRoundingRulesRequest($business_id); + $request = $this->managerRoundingRulesGetRoundingRulesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -27681,9 +29911,16 @@ public function managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27694,19 +29931,37 @@ public function managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimesheetRoundingRulesModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimesheetRoundingRulesModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimesheetRoundingRulesModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimesheetRoundingRulesModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27723,7 +29978,7 @@ public function managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimesheetRoundingRulesModel', + '\OpenAPI\Client\Model\TimesheetRoundingRulesModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -27739,13 +29994,14 @@ public function managerRoundingRulesGetRoundingRulesWithHttpInfo($business_id) * Get Rounding Rules * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesGetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerRoundingRulesGetRoundingRulesAsync($business_id) + public function managerRoundingRulesGetRoundingRulesAsync($business_id, string $contentType = self::contentTypes['managerRoundingRulesGetRoundingRules'][0]) { - return $this->managerRoundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id) + return $this->managerRoundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -27759,24 +30015,24 @@ function ($response) { * Get Rounding Rules * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesGetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerRoundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id) + public function managerRoundingRulesGetRoundingRulesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['managerRoundingRulesGetRoundingRules'][0]) { - $returnType = '\Swagger\Client\Model\TimesheetRoundingRulesModel'; - $request = $this->managerRoundingRulesGetRoundingRulesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\TimesheetRoundingRulesModel'; + $request = $this->managerRoundingRulesGetRoundingRulesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -27799,7 +30055,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -27809,12 +30065,14 @@ function ($exception) { * Create request for operation 'managerRoundingRulesGetRoundingRules' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesGetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerRoundingRulesGetRoundingRulesRequest($business_id) + public function managerRoundingRulesGetRoundingRulesRequest($business_id, string $contentType = self::contentTypes['managerRoundingRulesGetRoundingRules'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -27822,6 +30080,7 @@ protected function managerRoundingRulesGetRoundingRulesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/manager/roundingrules'; $formParams = []; $queryParams = []; @@ -27830,6 +30089,7 @@ protected function managerRoundingRulesGetRoundingRulesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -27839,53 +30099,35 @@ protected function managerRoundingRulesGetRoundingRulesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -27906,10 +30148,11 @@ protected function managerRoundingRulesGetRoundingRulesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -27920,16 +30163,17 @@ protected function managerRoundingRulesGetRoundingRulesRequest($business_id) * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules rounding_rules (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesSetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function managerRoundingRulesSetRoundingRules($rounding_rules, $business_id) + public function managerRoundingRulesSetRoundingRules($business_id, $rounding_rules, string $contentType = self::contentTypes['managerRoundingRulesSetRoundingRules'][0]) { - $this->managerRoundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $business_id); + $this->managerRoundingRulesSetRoundingRulesWithHttpInfo($business_id, $rounding_rules, $contentType); } /** @@ -27937,17 +30181,17 @@ public function managerRoundingRulesSetRoundingRules($rounding_rules, $business_ * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesSetRoundingRules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function managerRoundingRulesSetRoundingRulesWithHttpInfo($rounding_rules, $business_id) + public function managerRoundingRulesSetRoundingRulesWithHttpInfo($business_id, $rounding_rules, string $contentType = self::contentTypes['managerRoundingRulesSetRoundingRules'][0]) { - $returnType = ''; - $request = $this->managerRoundingRulesSetRoundingRulesRequest($rounding_rules, $business_id); + $request = $this->managerRoundingRulesSetRoundingRulesRequest($business_id, $rounding_rules, $contentType); try { $options = $this->createHttpClientOption(); @@ -27956,9 +30200,16 @@ public function managerRoundingRulesSetRoundingRulesWithHttpInfo($rounding_rules } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -27969,11 +30220,11 @@ public function managerRoundingRulesSetRoundingRulesWithHttpInfo($rounding_rules sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -27991,15 +30242,16 @@ public function managerRoundingRulesSetRoundingRulesWithHttpInfo($rounding_rules * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesSetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerRoundingRulesSetRoundingRulesAsync($rounding_rules, $business_id) + public function managerRoundingRulesSetRoundingRulesAsync($business_id, $rounding_rules, string $contentType = self::contentTypes['managerRoundingRulesSetRoundingRules'][0]) { - return $this->managerRoundingRulesSetRoundingRulesAsyncWithHttpInfo($rounding_rules, $business_id) + return $this->managerRoundingRulesSetRoundingRulesAsyncWithHttpInfo($business_id, $rounding_rules, $contentType) ->then( function ($response) { return $response[0]; @@ -28012,16 +30264,17 @@ function ($response) { * * Set Rounding Rules * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesSetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function managerRoundingRulesSetRoundingRulesAsyncWithHttpInfo($rounding_rules, $business_id) + public function managerRoundingRulesSetRoundingRulesAsyncWithHttpInfo($business_id, $rounding_rules, string $contentType = self::contentTypes['managerRoundingRulesSetRoundingRules'][0]) { $returnType = ''; - $request = $this->managerRoundingRulesSetRoundingRulesRequest($rounding_rules, $business_id); + $request = $this->managerRoundingRulesSetRoundingRulesRequest($business_id, $rounding_rules, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -28040,7 +30293,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -28049,20 +30302,16 @@ function ($exception) { /** * Create request for operation 'managerRoundingRulesSetRoundingRules' * - * @param \Swagger\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimesheetRoundingRulesModel $rounding_rules (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['managerRoundingRulesSetRoundingRules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function managerRoundingRulesSetRoundingRulesRequest($rounding_rules, $business_id) + public function managerRoundingRulesSetRoundingRulesRequest($business_id, $rounding_rules, string $contentType = self::contentTypes['managerRoundingRulesSetRoundingRules'][0]) { - // verify the required parameter 'rounding_rules' is set - if ($rounding_rules === null || (is_array($rounding_rules) && count($rounding_rules) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $rounding_rules when calling managerRoundingRulesSetRoundingRules' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -28070,6 +30319,14 @@ protected function managerRoundingRulesSetRoundingRulesRequest($rounding_rules, ); } + // verify the required parameter 'rounding_rules' is set + if ($rounding_rules === null || (is_array($rounding_rules) && count($rounding_rules) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rounding_rules when calling managerRoundingRulesSetRoundingRules' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/manager/roundingrules'; $formParams = []; $queryParams = []; @@ -28078,6 +30335,7 @@ protected function managerRoundingRulesSetRoundingRulesRequest($rounding_rules, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -28087,56 +30345,42 @@ protected function managerRoundingRulesSetRoundingRulesRequest($rounding_rules, ); } - // body params - $_tempBody = null; - if (isset($rounding_rules)) { - $_tempBody = $rounding_rules; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($rounding_rules)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rounding_rules)); + } else { + $httpBody = $rounding_rules; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -28157,10 +30401,11 @@ protected function managerRoundingRulesSetRoundingRulesRequest($rounding_rules, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/OtherApi.php b/src/lib/Api/OtherApi.php index 5147a1f..586262d 100644 --- a/src/lib/Api/OtherApi.php +++ b/src/lib/Api/OtherApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'reportsPaymentFileGet' => [ + '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 + 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; } /** @@ -92,14 +130,15 @@ public function getConfig() * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDetailsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunDetailsModel + * @return \OpenAPI\Client\Model\AuPayRunDetailsModel */ - public function auPayRunDetailsGet($pay_run_id, $business_id) + public function auPayRunDetailsGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDetailsGet'][0]) { - list($response) = $this->auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -108,15 +147,15 @@ public function auPayRunDetailsGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDetailsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunDetailsModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunDetailsModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDetailsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunDetailsModel'; - $request = $this->auPayRunDetailsGetRequest($pay_run_id, $business_id); + $request = $this->auPayRunDetailsGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -125,9 +164,16 @@ public function auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -138,19 +184,37 @@ public function auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunDetailsModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunDetailsModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunDetailsModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunDetailsModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -167,7 +231,7 @@ public function auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunDetailsModel', + '\OpenAPI\Client\Model\AuPayRunDetailsModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -180,17 +244,16 @@ public function auPayRunDetailsGetWithHttpInfo($pay_run_id, $business_id) /** * Operation auPayRunDetailsGetAsync * - * - * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDetailsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDetailsGetAsync($pay_run_id, $business_id) + public function auPayRunDetailsGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDetailsGet'][0]) { - return $this->auPayRunDetailsGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunDetailsGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -201,28 +264,26 @@ function ($response) { /** * Operation auPayRunDetailsGetAsyncWithHttpInfo * - * - * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDetailsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDetailsGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDetailsGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDetailsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunDetailsModel'; - $request = $this->auPayRunDetailsGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunDetailsModel'; + $request = $this->auPayRunDetailsGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -245,7 +306,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -256,18 +317,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDetailsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDetailsGetRequest($pay_run_id, $business_id) + public function auPayRunDetailsGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDetailsGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDetailsGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -275,6 +339,7 @@ protected function auPayRunDetailsGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/details'; $formParams = []; $queryParams = []; @@ -283,6 +348,7 @@ protected function auPayRunDetailsGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -300,53 +366,35 @@ protected function auPayRunDetailsGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -367,10 +415,11 @@ protected function auPayRunDetailsGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -384,14 +433,15 @@ protected function auPayRunDetailsGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $payment_file_id payment_file_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaymentFileGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function reportsPaymentFileGet($pay_run_id, $payment_file_id, $business_id) + public function reportsPaymentFileGet($pay_run_id, $payment_file_id, $business_id, string $contentType = self::contentTypes['reportsPaymentFileGet'][0]) { - $this->reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, $business_id); + $this->reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, $business_id, $contentType); } /** @@ -402,15 +452,15 @@ public function reportsPaymentFileGet($pay_run_id, $payment_file_id, $business_i * @param int $pay_run_id (required) * @param int $payment_file_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaymentFileGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, $business_id) + public function reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, $business_id, string $contentType = self::contentTypes['reportsPaymentFileGet'][0]) { - $returnType = ''; - $request = $this->reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $business_id); + $request = $this->reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -419,9 +469,16 @@ public function reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -432,11 +489,11 @@ public function reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -457,13 +514,14 @@ public function reportsPaymentFileGetWithHttpInfo($pay_run_id, $payment_file_id, * @param int $pay_run_id (required) * @param int $payment_file_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaymentFileGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsPaymentFileGetAsync($pay_run_id, $payment_file_id, $business_id) + public function reportsPaymentFileGetAsync($pay_run_id, $payment_file_id, $business_id, string $contentType = self::contentTypes['reportsPaymentFileGet'][0]) { - return $this->reportsPaymentFileGetAsyncWithHttpInfo($pay_run_id, $payment_file_id, $business_id) + return $this->reportsPaymentFileGetAsyncWithHttpInfo($pay_run_id, $payment_file_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -479,14 +537,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $payment_file_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaymentFileGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsPaymentFileGetAsyncWithHttpInfo($pay_run_id, $payment_file_id, $business_id) + public function reportsPaymentFileGetAsyncWithHttpInfo($pay_run_id, $payment_file_id, $business_id, string $contentType = self::contentTypes['reportsPaymentFileGet'][0]) { $returnType = ''; - $request = $this->reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $business_id); + $request = $this->reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -505,7 +564,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -517,24 +576,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $payment_file_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaymentFileGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $business_id) + public function reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $business_id, string $contentType = self::contentTypes['reportsPaymentFileGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling reportsPaymentFileGet' ); } + // verify the required parameter 'payment_file_id' is set if ($payment_file_id === null || (is_array($payment_file_id) && count($payment_file_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $payment_file_id when calling reportsPaymentFileGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -542,6 +605,7 @@ protected function reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/report/paymentfile'; $formParams = []; $queryParams = []; @@ -550,13 +614,24 @@ protected function reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $ $multipart = false; // query params - if ($pay_run_id !== null) { - $queryParams['payRunId'] = ObjectSerializer::toQueryValue($pay_run_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $pay_run_id, + 'payRunId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($payment_file_id !== null) { - $queryParams['paymentFileId'] = ObjectSerializer::toQueryValue($payment_file_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $payment_file_id, + 'paymentFileId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -567,53 +642,35 @@ protected function reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -634,10 +691,11 @@ protected function reportsPaymentFileGetRequest($pay_run_id, $payment_file_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/PayCategoryApi.php b/src/lib/Api/PayCategoryApi.php index b00e3f1..ed294a4 100644 --- a/src/lib/Api/PayCategoryApi.php +++ b/src/lib/Api/PayCategoryApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auPayCategoryGet' => [ + 'application/json', + ], + 'auPayCategoryGetPayCategories' => [ + 'application/json', + ], + 'auPayCategoryPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayCategoryPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayCategoryDelete($id, $business_id) + public function auPayCategoryDelete($id, $business_id, string $contentType = self::contentTypes['auPayCategoryDelete'][0]) { - $this->auPayCategoryDeleteWithHttpInfo($id, $business_id); + $this->auPayCategoryDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auPayCategoryDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayCategoryDeleteWithHttpInfo($id, $business_id) + public function auPayCategoryDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayCategoryDelete'][0]) { - $returnType = ''; - $request = $this->auPayCategoryDeleteRequest($id, $business_id); + $request = $this->auPayCategoryDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auPayCategoryDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auPayCategoryDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auPayCategoryDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryDeleteAsync($id, $business_id) + public function auPayCategoryDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auPayCategoryDelete'][0]) { - return $this->auPayCategoryDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auPayCategoryDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryDeleteAsyncWithHttpInfo($id, $business_id) + public function auPayCategoryDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayCategoryDelete'][0]) { $returnType = ''; - $request = $this->auPayCategoryDeleteRequest($id, $business_id); + $request = $this->auPayCategoryDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayCategoryDeleteRequest($id, $business_id) + public function auPayCategoryDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auPayCategoryDelete'][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 auPayCategoryDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auPayCategoryDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/paycategory/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auPayCategoryDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auPayCategoryDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auPayCategoryDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auPayCategoryDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayCategoryModel + * @return \OpenAPI\Client\Model\AuPayCategoryModel */ - public function auPayCategoryGet($id, $business_id) + public function auPayCategoryGet($id, $business_id, string $contentType = self::contentTypes['auPayCategoryGet'][0]) { - list($response) = $this->auPayCategoryGetWithHttpInfo($id, $business_id); + list($response) = $this->auPayCategoryGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auPayCategoryGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayCategoryGetWithHttpInfo($id, $business_id) + public function auPayCategoryGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel'; - $request = $this->auPayCategoryGetRequest($id, $business_id); + $request = $this->auPayCategoryGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auPayCategoryGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auPayCategoryGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auPayCategoryGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayCategoryModel', + '\OpenAPI\Client\Model\AuPayCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auPayCategoryGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryGetAsync($id, $business_id) + public function auPayCategoryGetAsync($id, $business_id, string $contentType = self::contentTypes['auPayCategoryGet'][0]) { - return $this->auPayCategoryGetAsyncWithHttpInfo($id, $business_id) + return $this->auPayCategoryGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryGetAsyncWithHttpInfo($id, $business_id) + public function auPayCategoryGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayCategoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel'; - $request = $this->auPayCategoryGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel'; + $request = $this->auPayCategoryGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayCategoryGetRequest($id, $business_id) + public function auPayCategoryGetRequest($id, $business_id, string $contentType = self::contentTypes['auPayCategoryGet'][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 auPayCategoryGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auPayCategoryGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/paycategory/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auPayCategoryGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auPayCategoryGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auPayCategoryGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auPayCategoryGetRequest($id, $business_id) * List Pay Categories * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGetPayCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayCategoryModel[] + * @return \OpenAPI\Client\Model\AuPayCategoryModel[] */ - public function auPayCategoryGetPayCategories($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayCategoryGetPayCategories($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayCategoryGetPayCategories'][0]) { - list($response) = $this->auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auPayCategoryGetPayCategories($business_id, $filter = null, $ord * List Pay Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGetPayCategories'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayCategoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayCategoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayCategoryGetPayCategories'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel[]'; - $request = $this->auPayCategoryGetPayCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auPayCategoryGetPayCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $filter } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $filter sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayCategoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayCategoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayCategoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $filter case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayCategoryModel[]', + '\OpenAPI\Client\Model\AuPayCategoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auPayCategoryGetPayCategoriesWithHttpInfo($business_id, $filter * List Pay Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGetPayCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryGetPayCategoriesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayCategoryGetPayCategoriesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayCategoryGetPayCategories'][0]) { - return $this->auPayCategoryGetPayCategoriesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auPayCategoryGetPayCategoriesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Pay Categories * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGetPayCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryGetPayCategoriesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayCategoryGetPayCategoriesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayCategoryGetPayCategories'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel[]'; - $request = $this->auPayCategoryGetPayCategoriesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel[]'; + $request = $this->auPayCategoryGetPayCategoriesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auPayCategoryGetPayCategories' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryGetPayCategories'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayCategoryGetPayCategoriesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayCategoryGetPayCategoriesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayCategoryGetPayCategories'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auPayCategoryGetPayCategoriesRequest($business_id, $filter = ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/paycategory'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auPayCategoryGetPayCategoriesRequest($business_id, $filter = $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auPayCategoryGetPayCategoriesRequest($business_id, $filter = ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auPayCategoryGetPayCategoriesRequest($business_id, $filter = $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auPayCategoryGetPayCategoriesRequest($business_id, $filter = * * Create Pay Category * - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category pay_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayCategoryModel + * @return \OpenAPI\Client\Model\AuPayCategoryModel */ - public function auPayCategoryPost($pay_category, $business_id) + public function auPayCategoryPost($business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPost'][0]) { - list($response) = $this->auPayCategoryPostWithHttpInfo($pay_category, $business_id); + list($response) = $this->auPayCategoryPostWithHttpInfo($business_id, $pay_category, $contentType); return $response; } @@ -969,17 +1086,17 @@ public function auPayCategoryPost($pay_category, $business_id) * * Create Pay Category * - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayCategoryPostWithHttpInfo($pay_category, $business_id) + public function auPayCategoryPostWithHttpInfo($business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel'; - $request = $this->auPayCategoryPostRequest($pay_category, $business_id); + $request = $this->auPayCategoryPostRequest($business_id, $pay_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1105,16 @@ public function auPayCategoryPostWithHttpInfo($pay_category, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1125,37 @@ public function auPayCategoryPostWithHttpInfo($pay_category, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1172,7 @@ public function auPayCategoryPostWithHttpInfo($pay_category, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayCategoryModel', + '\OpenAPI\Client\Model\AuPayCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1187,16 @@ public function auPayCategoryPostWithHttpInfo($pay_category, $business_id) * * Create Pay Category * - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryPostAsync($pay_category, $business_id) + public function auPayCategoryPostAsync($business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPost'][0]) { - return $this->auPayCategoryPostAsyncWithHttpInfo($pay_category, $business_id) + return $this->auPayCategoryPostAsyncWithHttpInfo($business_id, $pay_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1209,26 @@ function ($response) { * * Create Pay Category * - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryPostAsyncWithHttpInfo($pay_category, $business_id) + public function auPayCategoryPostAsyncWithHttpInfo($business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPost'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel'; - $request = $this->auPayCategoryPostRequest($pay_category, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel'; + $request = $this->auPayCategoryPostRequest($business_id, $pay_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1260,16 @@ function ($exception) { /** * Create request for operation 'auPayCategoryPost' * - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayCategoryPostRequest($pay_category, $business_id) + public function auPayCategoryPostRequest($business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPost'][0]) { - // verify the required parameter 'pay_category' is set - if ($pay_category === null || (is_array($pay_category) && count($pay_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_category when calling auPayCategoryPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1277,14 @@ protected function auPayCategoryPostRequest($pay_category, $business_id) ); } + // verify the required parameter 'pay_category' is set + if ($pay_category === null || (is_array($pay_category) && count($pay_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pay_category when calling auPayCategoryPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/paycategory'; $formParams = []; $queryParams = []; @@ -1146,6 +1293,7 @@ protected function auPayCategoryPostRequest($pay_category, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1303,42 @@ protected function auPayCategoryPostRequest($pay_category, $business_id) ); } - // body params - $_tempBody = null; - if (isset($pay_category)) { - $_tempBody = $pay_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($pay_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pay_category)); + } else { + $httpBody = $pay_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1359,11 @@ protected function auPayCategoryPostRequest($pay_category, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1375,17 @@ protected function auPayCategoryPostRequest($pay_category, $business_id) * Update Pay Category * * @param int $id id (required) - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category pay_category (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayCategoryModel + * @return \OpenAPI\Client\Model\AuPayCategoryModel */ - public function auPayCategoryPut($id, $pay_category, $business_id) + public function auPayCategoryPut($id, $business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPut'][0]) { - list($response) = $this->auPayCategoryPutWithHttpInfo($id, $pay_category, $business_id); + list($response) = $this->auPayCategoryPutWithHttpInfo($id, $business_id, $pay_category, $contentType); return $response; } @@ -1259,17 +1395,17 @@ public function auPayCategoryPut($id, $pay_category, $business_id) * Update Pay Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayCategoryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayCategoryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayCategoryPutWithHttpInfo($id, $pay_category, $business_id) + public function auPayCategoryPutWithHttpInfo($id, $business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPut'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel'; - $request = $this->auPayCategoryPutRequest($id, $pay_category, $business_id); + $request = $this->auPayCategoryPutRequest($id, $business_id, $pay_category, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1414,16 @@ public function auPayCategoryPutWithHttpInfo($id, $pay_category, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1434,37 @@ public function auPayCategoryPutWithHttpInfo($id, $pay_category, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayCategoryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayCategoryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayCategoryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1481,7 @@ public function auPayCategoryPutWithHttpInfo($id, $pay_category, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayCategoryModel', + '\OpenAPI\Client\Model\AuPayCategoryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1497,16 @@ public function auPayCategoryPutWithHttpInfo($id, $pay_category, $business_id) * Update Pay Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryPutAsync($id, $pay_category, $business_id) + public function auPayCategoryPutAsync($id, $business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPut'][0]) { - return $this->auPayCategoryPutAsyncWithHttpInfo($id, $pay_category, $business_id) + return $this->auPayCategoryPutAsyncWithHttpInfo($id, $business_id, $pay_category, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1520,26 @@ function ($response) { * Update Pay Category * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayCategoryPutAsyncWithHttpInfo($id, $pay_category, $business_id) + public function auPayCategoryPutAsyncWithHttpInfo($id, $business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPut'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoryModel'; - $request = $this->auPayCategoryPutRequest($id, $pay_category, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayCategoryModel'; + $request = $this->auPayCategoryPutRequest($id, $business_id, $pay_category, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1572,23 @@ function ($exception) { * Create request for operation 'auPayCategoryPut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayCategoryModel $pay_category (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayCategoryModel $pay_category (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayCategoryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayCategoryPutRequest($id, $pay_category, $business_id) + public function auPayCategoryPutRequest($id, $business_id, $pay_category, string $contentType = self::contentTypes['auPayCategoryPut'][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 auPayCategoryPut' ); } - // verify the required parameter 'pay_category' is set - if ($pay_category === null || (is_array($pay_category) && count($pay_category) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_category when calling auPayCategoryPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1596,14 @@ protected function auPayCategoryPutRequest($id, $pay_category, $business_id) ); } + // verify the required parameter 'pay_category' is set + if ($pay_category === null || (is_array($pay_category) && count($pay_category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pay_category when calling auPayCategoryPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/paycategory/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1612,7 @@ protected function auPayCategoryPutRequest($id, $pay_category, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1630,42 @@ protected function auPayCategoryPutRequest($id, $pay_category, $business_id) ); } - // body params - $_tempBody = null; - if (isset($pay_category)) { - $_tempBody = $pay_category; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($pay_category)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pay_category)); + } else { + $httpBody = $pay_category; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1686,11 @@ protected function auPayCategoryPutRequest($id, $pay_category, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/PayRateTemplateApi.php b/src/lib/Api/PayRateTemplateApi.php index 43c12fd..6702aa1 100644 --- a/src/lib/Api/PayRateTemplateApi.php +++ b/src/lib/Api/PayRateTemplateApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auPayRateTemplateGet' => [ + 'application/json', + ], + 'auPayRateTemplateGetPayRateTemplates' => [ + 'application/json', + ], + 'auPayRateTemplatePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRateTemplatePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRateTemplateDelete($id, $business_id) + public function auPayRateTemplateDelete($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateDelete'][0]) { - $this->auPayRateTemplateDeleteWithHttpInfo($id, $business_id); + $this->auPayRateTemplateDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auPayRateTemplateDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRateTemplateDeleteWithHttpInfo($id, $business_id) + public function auPayRateTemplateDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateDelete'][0]) { - $returnType = ''; - $request = $this->auPayRateTemplateDeleteRequest($id, $business_id); + $request = $this->auPayRateTemplateDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auPayRateTemplateDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auPayRateTemplateDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auPayRateTemplateDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplateDeleteAsync($id, $business_id) + public function auPayRateTemplateDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateDelete'][0]) { - return $this->auPayRateTemplateDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auPayRateTemplateDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplateDeleteAsyncWithHttpInfo($id, $business_id) + public function auPayRateTemplateDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateDelete'][0]) { $returnType = ''; - $request = $this->auPayRateTemplateDeleteRequest($id, $business_id); + $request = $this->auPayRateTemplateDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRateTemplateDeleteRequest($id, $business_id) + public function auPayRateTemplateDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateDelete'][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 auPayRateTemplateDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auPayRateTemplateDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payratetemplate/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auPayRateTemplateDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auPayRateTemplateDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auPayRateTemplateDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auPayRateTemplateDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRateTemplateModel + * @return \OpenAPI\Client\Model\AuPayRateTemplateModel */ - public function auPayRateTemplateGet($id, $business_id) + public function auPayRateTemplateGet($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateGet'][0]) { - list($response) = $this->auPayRateTemplateGetWithHttpInfo($id, $business_id); + list($response) = $this->auPayRateTemplateGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auPayRateTemplateGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRateTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRateTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRateTemplateGetWithHttpInfo($id, $business_id) + public function auPayRateTemplateGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel'; - $request = $this->auPayRateTemplateGetRequest($id, $business_id); + $request = $this->auPayRateTemplateGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auPayRateTemplateGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auPayRateTemplateGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRateTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auPayRateTemplateGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRateTemplateModel', + '\OpenAPI\Client\Model\AuPayRateTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auPayRateTemplateGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplateGetAsync($id, $business_id) + public function auPayRateTemplateGetAsync($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateGet'][0]) { - return $this->auPayRateTemplateGetAsyncWithHttpInfo($id, $business_id) + return $this->auPayRateTemplateGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplateGetAsyncWithHttpInfo($id, $business_id) + public function auPayRateTemplateGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel'; - $request = $this->auPayRateTemplateGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel'; + $request = $this->auPayRateTemplateGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRateTemplateGetRequest($id, $business_id) + public function auPayRateTemplateGetRequest($id, $business_id, string $contentType = self::contentTypes['auPayRateTemplateGet'][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 auPayRateTemplateGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auPayRateTemplateGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payratetemplate/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auPayRateTemplateGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auPayRateTemplateGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auPayRateTemplateGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auPayRateTemplateGetRequest($id, $business_id) * List Pay Rate Templates * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGetPayRateTemplates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRateTemplateModel[] + * @return \OpenAPI\Client\Model\AuPayRateTemplateModel[] */ - public function auPayRateTemplateGetPayRateTemplates($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRateTemplateGetPayRateTemplates($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRateTemplateGetPayRateTemplates'][0]) { - list($response) = $this->auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auPayRateTemplateGetPayRateTemplates($business_id, $filter = nul * List Pay Rate Templates * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGetPayRateTemplates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRateTemplateModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRateTemplateModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRateTemplateGetPayRateTemplates'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel[]'; - $request = $this->auPayRateTemplateGetPayRateTemplatesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auPayRateTemplateGetPayRateTemplatesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRateTemplateModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRateTemplateModel[]', + '\OpenAPI\Client\Model\AuPayRateTemplateModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auPayRateTemplateGetPayRateTemplatesWithHttpInfo($business_id, $ * List Pay Rate Templates * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGetPayRateTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplateGetPayRateTemplatesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRateTemplateGetPayRateTemplatesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRateTemplateGetPayRateTemplates'][0]) { - return $this->auPayRateTemplateGetPayRateTemplatesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auPayRateTemplateGetPayRateTemplatesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Pay Rate Templates * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGetPayRateTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplateGetPayRateTemplatesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRateTemplateGetPayRateTemplatesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRateTemplateGetPayRateTemplates'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel[]'; - $request = $this->auPayRateTemplateGetPayRateTemplatesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel[]'; + $request = $this->auPayRateTemplateGetPayRateTemplatesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auPayRateTemplateGetPayRateTemplates' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplateGetPayRateTemplates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRateTemplateGetPayRateTemplates'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $fi ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/payratetemplate'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $fi $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $fi ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $fi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auPayRateTemplateGetPayRateTemplatesRequest($business_id, $fi * * Create Pay Rate Template * - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template pay_rate_template (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRateTemplateModel + * @return \OpenAPI\Client\Model\AuPayRateTemplateModel */ - public function auPayRateTemplatePost($pay_rate_template, $business_id) + public function auPayRateTemplatePost($business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePost'][0]) { - list($response) = $this->auPayRateTemplatePostWithHttpInfo($pay_rate_template, $business_id); + list($response) = $this->auPayRateTemplatePostWithHttpInfo($business_id, $pay_rate_template, $contentType); return $response; } @@ -969,17 +1086,17 @@ public function auPayRateTemplatePost($pay_rate_template, $business_id) * * Create Pay Rate Template * - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRateTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRateTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRateTemplatePostWithHttpInfo($pay_rate_template, $business_id) + public function auPayRateTemplatePostWithHttpInfo($business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePost'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel'; - $request = $this->auPayRateTemplatePostRequest($pay_rate_template, $business_id); + $request = $this->auPayRateTemplatePostRequest($business_id, $pay_rate_template, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1105,16 @@ public function auPayRateTemplatePostWithHttpInfo($pay_rate_template, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1125,37 @@ public function auPayRateTemplatePostWithHttpInfo($pay_rate_template, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRateTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1172,7 @@ public function auPayRateTemplatePostWithHttpInfo($pay_rate_template, $business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRateTemplateModel', + '\OpenAPI\Client\Model\AuPayRateTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1187,16 @@ public function auPayRateTemplatePostWithHttpInfo($pay_rate_template, $business_ * * Create Pay Rate Template * - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplatePostAsync($pay_rate_template, $business_id) + public function auPayRateTemplatePostAsync($business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePost'][0]) { - return $this->auPayRateTemplatePostAsyncWithHttpInfo($pay_rate_template, $business_id) + return $this->auPayRateTemplatePostAsyncWithHttpInfo($business_id, $pay_rate_template, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1209,26 @@ function ($response) { * * Create Pay Rate Template * - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplatePostAsyncWithHttpInfo($pay_rate_template, $business_id) + public function auPayRateTemplatePostAsyncWithHttpInfo($business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePost'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel'; - $request = $this->auPayRateTemplatePostRequest($pay_rate_template, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel'; + $request = $this->auPayRateTemplatePostRequest($business_id, $pay_rate_template, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1260,16 @@ function ($exception) { /** * Create request for operation 'auPayRateTemplatePost' * - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRateTemplatePostRequest($pay_rate_template, $business_id) + public function auPayRateTemplatePostRequest($business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePost'][0]) { - // verify the required parameter 'pay_rate_template' is set - if ($pay_rate_template === null || (is_array($pay_rate_template) && count($pay_rate_template) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_rate_template when calling auPayRateTemplatePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1277,14 @@ protected function auPayRateTemplatePostRequest($pay_rate_template, $business_id ); } + // verify the required parameter 'pay_rate_template' is set + if ($pay_rate_template === null || (is_array($pay_rate_template) && count($pay_rate_template) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pay_rate_template when calling auPayRateTemplatePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payratetemplate'; $formParams = []; $queryParams = []; @@ -1146,6 +1293,7 @@ protected function auPayRateTemplatePostRequest($pay_rate_template, $business_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1303,42 @@ protected function auPayRateTemplatePostRequest($pay_rate_template, $business_id ); } - // body params - $_tempBody = null; - if (isset($pay_rate_template)) { - $_tempBody = $pay_rate_template; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($pay_rate_template)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pay_rate_template)); + } else { + $httpBody = $pay_rate_template; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1359,11 @@ protected function auPayRateTemplatePostRequest($pay_rate_template, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1375,17 @@ protected function auPayRateTemplatePostRequest($pay_rate_template, $business_id * Update Pay Rate Template * * @param int $id id (required) - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template pay_rate_template (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRateTemplateModel + * @return \OpenAPI\Client\Model\AuPayRateTemplateModel */ - public function auPayRateTemplatePut($id, $pay_rate_template, $business_id) + public function auPayRateTemplatePut($id, $business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePut'][0]) { - list($response) = $this->auPayRateTemplatePutWithHttpInfo($id, $pay_rate_template, $business_id); + list($response) = $this->auPayRateTemplatePutWithHttpInfo($id, $business_id, $pay_rate_template, $contentType); return $response; } @@ -1259,17 +1395,17 @@ public function auPayRateTemplatePut($id, $pay_rate_template, $business_id) * Update Pay Rate Template * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRateTemplateModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRateTemplateModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRateTemplatePutWithHttpInfo($id, $pay_rate_template, $business_id) + public function auPayRateTemplatePutWithHttpInfo($id, $business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePut'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel'; - $request = $this->auPayRateTemplatePutRequest($id, $pay_rate_template, $business_id); + $request = $this->auPayRateTemplatePutRequest($id, $business_id, $pay_rate_template, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1414,16 @@ public function auPayRateTemplatePutWithHttpInfo($id, $pay_rate_template, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1434,37 @@ public function auPayRateTemplatePutWithHttpInfo($id, $pay_rate_template, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRateTemplateModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRateTemplateModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1481,7 @@ public function auPayRateTemplatePutWithHttpInfo($id, $pay_rate_template, $busin case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRateTemplateModel', + '\OpenAPI\Client\Model\AuPayRateTemplateModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1497,16 @@ public function auPayRateTemplatePutWithHttpInfo($id, $pay_rate_template, $busin * Update Pay Rate Template * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplatePutAsync($id, $pay_rate_template, $business_id) + public function auPayRateTemplatePutAsync($id, $business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePut'][0]) { - return $this->auPayRateTemplatePutAsyncWithHttpInfo($id, $pay_rate_template, $business_id) + return $this->auPayRateTemplatePutAsyncWithHttpInfo($id, $business_id, $pay_rate_template, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1520,26 @@ function ($response) { * Update Pay Rate Template * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRateTemplatePutAsyncWithHttpInfo($id, $pay_rate_template, $business_id) + public function auPayRateTemplatePutAsyncWithHttpInfo($id, $business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePut'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRateTemplateModel'; - $request = $this->auPayRateTemplatePutRequest($id, $pay_rate_template, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRateTemplateModel'; + $request = $this->auPayRateTemplatePutRequest($id, $business_id, $pay_rate_template, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1572,23 @@ function ($exception) { * Create request for operation 'auPayRateTemplatePut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayRateTemplateModel $pay_rate_template (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRateTemplatePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRateTemplatePutRequest($id, $pay_rate_template, $business_id) + public function auPayRateTemplatePutRequest($id, $business_id, $pay_rate_template, string $contentType = self::contentTypes['auPayRateTemplatePut'][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 auPayRateTemplatePut' ); } - // verify the required parameter 'pay_rate_template' is set - if ($pay_rate_template === null || (is_array($pay_rate_template) && count($pay_rate_template) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_rate_template when calling auPayRateTemplatePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1596,14 @@ protected function auPayRateTemplatePutRequest($id, $pay_rate_template, $busines ); } + // verify the required parameter 'pay_rate_template' is set + if ($pay_rate_template === null || (is_array($pay_rate_template) && count($pay_rate_template) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pay_rate_template when calling auPayRateTemplatePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payratetemplate/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1612,7 @@ protected function auPayRateTemplatePutRequest($id, $pay_rate_template, $busines $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1630,42 @@ protected function auPayRateTemplatePutRequest($id, $pay_rate_template, $busines ); } - // body params - $_tempBody = null; - if (isset($pay_rate_template)) { - $_tempBody = $pay_rate_template; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($pay_rate_template)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pay_rate_template)); + } else { + $httpBody = $pay_rate_template; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1686,11 @@ protected function auPayRateTemplatePutRequest($id, $pay_rate_template, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/PayRunApi.php b/src/lib/Api/PayRunApi.php index f30a061..332172f 100644 --- a/src/lib/Api/PayRunApi.php +++ b/src/lib/Api/PayRunApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auPayRunAbaFile' => [ + 'application/json', + ], + 'auPayRunAsync' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunBulkApplyLeaveRequests' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunCreationStatus' => [ + 'application/json', + ], + 'auPayRunDeductionsDelete' => [ + 'application/json', + ], + 'auPayRunDeductionsGet' => [ + 'application/json', + ], + 'auPayRunDeductionsGetByEmployee' => [ + 'application/json', + ], + 'auPayRunDeductionsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunDelete' => [ + 'application/json', + ], + 'auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation' => [ + 'application/json', + ], + 'auPayRunEarningsLineDelete' => [ + 'application/json', + ], + 'auPayRunEarningsLineGet' => [ + 'application/json', + ], + 'auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId' => [ + 'application/json', + ], + 'auPayRunEarningsLinePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunGet' => [ + 'application/json', + ], + 'auPayRunGetPayRunSummaries' => [ + 'application/json', + ], + 'auPayRunGetPayRunSummary' => [ + 'application/json', + ], + 'auPayRunGetPayRuns' => [ + 'application/json', + ], + 'auPayRunGetWarnings' => [ + 'application/json', + ], + 'auPayRunIncludeEmployee' => [ + 'application/json', + ], + 'auPayRunNetToGross' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunNotation' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunPaySlipFile' => [ + 'application/json', + ], + 'auPayRunPaySlipGet' => [ + 'application/json', + ], + 'auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId' => [ + 'application/json', + ], + 'auPayRunPayments' => [ + 'application/json', + ], + 'auPayRunPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunRecalculate' => [ + 'application/json', + ], + 'auPayRunRemoveEmployee' => [ + 'application/json', + ], + 'auPayRunTaxAdjustmentsDelete' => [ + 'application/json', + ], + 'auPayRunTaxAdjustmentsGet' => [ + 'application/json', + ], + 'auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId' => [ + 'application/json', + ], + 'auPayRunTaxAdjustmentsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunTerminatePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId' => [ + 'application/json', + ], + 'auPayRunTotalsGet' => [ + 'application/json', + ], + 'auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId' => [ + 'application/json', + ], + 'auPayRunTotalsNotation' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'employeePayRunTotalGet' => [ + 'application/json', + ], + 'payRunApprovalStartApprovalProcess' => [ + 'application/json', + ], + 'payRunEmployeeExpensesDelete' => [ + 'application/json', + ], + 'payRunEmployeeExpensesGet' => [ + 'application/json', + ], + 'payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId' => [ + 'application/json', + ], + 'payRunEmployeeExpensesPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payRunEmployerLiabilitiesDelete' => [ + 'application/json', + ], + 'payRunEmployerLiabilitiesGet' => [ + 'application/json', + ], + 'payRunEmployerLiabilitiesGetAll' => [ + 'application/json', + ], + 'payRunEmployerLiabilitiesPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payRunFinalisePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payRunLeaveAccruedDelete' => [ + 'application/json', + ], + 'payRunLeaveAccruedGet' => [ + 'application/json', + ], + 'payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId' => [ + 'application/json', + ], + 'payRunLeaveAccruedPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payRunSuperAdjustmentsDelete' => [ + 'application/json', + ], + 'payRunSuperAdjustmentsGet' => [ + 'application/json', + ], + 'payRunSuperAdjustmentsGetAll' => [ + 'application/json', + ], + 'payRunSuperAdjustmentsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payRunUnlockPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payRunUnlockStatePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +374,15 @@ public function getConfig() * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auJournalGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuJournalItemResponse[] + * @return \OpenAPI\Client\Model\AuJournalItemResponse[] */ - public function auJournalGet($pay_run_id, $business_id) + public function auJournalGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auJournalGet'][0]) { - list($response) = $this->auJournalGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auJournalGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -112,15 +393,15 @@ public function auJournalGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auJournalGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuJournalItemResponse[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuJournalItemResponse[], HTTP status code, HTTP response headers (array of strings) */ - public function auJournalGetWithHttpInfo($pay_run_id, $business_id) + public function auJournalGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auJournalGet'][0]) { - $returnType = '\Swagger\Client\Model\AuJournalItemResponse[]'; - $request = $this->auJournalGetRequest($pay_run_id, $business_id); + $request = $this->auJournalGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,9 +410,16 @@ public function auJournalGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -142,19 +430,37 @@ public function auJournalGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuJournalItemResponse[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuJournalItemResponse[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuJournalItemResponse[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuJournalItemResponse[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -171,7 +477,7 @@ public function auJournalGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuJournalItemResponse[]', + '\OpenAPI\Client\Model\AuJournalItemResponse[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -188,13 +494,14 @@ public function auJournalGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auJournalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auJournalGetAsync($pay_run_id, $business_id) + public function auJournalGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auJournalGet'][0]) { - return $this->auJournalGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auJournalGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -209,24 +516,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auJournalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auJournalGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auJournalGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auJournalGet'][0]) { - $returnType = '\Swagger\Client\Model\AuJournalItemResponse[]'; - $request = $this->auJournalGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuJournalItemResponse[]'; + $request = $this->auJournalGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -249,7 +556,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -260,18 +567,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auJournalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auJournalGetRequest($pay_run_id, $business_id) + public function auJournalGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auJournalGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auJournalGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -279,6 +589,7 @@ protected function auJournalGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/journal/{payRunId}'; $formParams = []; $queryParams = []; @@ -287,6 +598,7 @@ protected function auJournalGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -304,53 +616,35 @@ protected function auJournalGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -371,10 +665,11 @@ protected function auJournalGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -388,14 +683,15 @@ protected function auJournalGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $aba_id aba_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAbaFile'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function auPayRunAbaFile($pay_run_id, $aba_id, $business_id) + public function auPayRunAbaFile($pay_run_id, $aba_id, $business_id, string $contentType = self::contentTypes['auPayRunAbaFile'][0]) { - list($response) = $this->auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id); + list($response) = $this->auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id, $contentType); return $response; } @@ -407,15 +703,15 @@ public function auPayRunAbaFile($pay_run_id, $aba_id, $business_id) * @param int $pay_run_id (required) * @param int $aba_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAbaFile'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id) + public function auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id, string $contentType = self::contentTypes['auPayRunAbaFile'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id); + $request = $this->auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -424,9 +720,16 @@ public function auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -437,19 +740,37 @@ public function auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -466,7 +787,7 @@ public function auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -484,13 +805,14 @@ public function auPayRunAbaFileWithHttpInfo($pay_run_id, $aba_id, $business_id) * @param int $pay_run_id (required) * @param int $aba_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAbaFile'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunAbaFileAsync($pay_run_id, $aba_id, $business_id) + public function auPayRunAbaFileAsync($pay_run_id, $aba_id, $business_id, string $contentType = self::contentTypes['auPayRunAbaFile'][0]) { - return $this->auPayRunAbaFileAsyncWithHttpInfo($pay_run_id, $aba_id, $business_id) + return $this->auPayRunAbaFileAsyncWithHttpInfo($pay_run_id, $aba_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -506,24 +828,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $aba_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAbaFile'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunAbaFileAsyncWithHttpInfo($pay_run_id, $aba_id, $business_id) + public function auPayRunAbaFileAsyncWithHttpInfo($pay_run_id, $aba_id, $business_id, string $contentType = self::contentTypes['auPayRunAbaFile'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -546,7 +868,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -558,24 +880,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $aba_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAbaFile'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id) + public function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id, string $contentType = self::contentTypes['auPayRunAbaFile'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunAbaFile' ); } + // verify the required parameter 'aba_id' is set if ($aba_id === null || (is_array($aba_id) && count($aba_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $aba_id when calling auPayRunAbaFile' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -583,6 +909,7 @@ protected function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/file/aba/{abaId}'; $formParams = []; $queryParams = []; @@ -591,6 +918,7 @@ protected function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -616,53 +944,35 @@ protected function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -683,10 +993,11 @@ protected function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -697,16 +1008,17 @@ protected function auPayRunAbaFileRequest($pay_run_id, $aba_id, $business_id) * * Create Pay Run (Async) * - * @param \Swagger\Client\Model\PayRunCreateRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAsync'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunJobModel + * @return \OpenAPI\Client\Model\PayRunJobModel */ - public function auPayRunAsync($request, $business_id) + public function auPayRunAsync($business_id, $request, string $contentType = self::contentTypes['auPayRunAsync'][0]) { - list($response) = $this->auPayRunAsyncWithHttpInfo($request, $business_id); + list($response) = $this->auPayRunAsyncWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -715,17 +1027,17 @@ public function auPayRunAsync($request, $business_id) * * Create Pay Run (Async) * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAsync'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunJobModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunJobModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunAsyncWithHttpInfo($request, $business_id) + public function auPayRunAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auPayRunAsync'][0]) { - $returnType = '\Swagger\Client\Model\PayRunJobModel'; - $request = $this->auPayRunAsyncRequest($request, $business_id); + $request = $this->auPayRunAsyncRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -734,9 +1046,16 @@ public function auPayRunAsyncWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -747,19 +1066,37 @@ public function auPayRunAsyncWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunJobModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunJobModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunJobModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunJobModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -776,7 +1113,7 @@ public function auPayRunAsyncWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunJobModel', + '\OpenAPI\Client\Model\PayRunJobModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -791,15 +1128,16 @@ public function auPayRunAsyncWithHttpInfo($request, $business_id) * * Create Pay Run (Async) * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAsync'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunAsyncAsync($request, $business_id) + public function auPayRunAsyncAsync($business_id, $request, string $contentType = self::contentTypes['auPayRunAsync'][0]) { - return $this->auPayRunAsyncAsyncWithHttpInfo($request, $business_id) + return $this->auPayRunAsyncAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -812,26 +1150,26 @@ function ($response) { * * Create Pay Run (Async) * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAsync'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunAsyncAsyncWithHttpInfo($request, $business_id) + public function auPayRunAsyncAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auPayRunAsync'][0]) { - $returnType = '\Swagger\Client\Model\PayRunJobModel'; - $request = $this->auPayRunAsyncRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunJobModel'; + $request = $this->auPayRunAsyncRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -854,7 +1192,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -863,20 +1201,16 @@ function ($exception) { /** * Create request for operation 'auPayRunAsync' * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunAsync'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunAsyncRequest($request, $business_id) + public function auPayRunAsyncRequest($business_id, $request, string $contentType = self::contentTypes['auPayRunAsync'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auPayRunAsync' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -884,6 +1218,14 @@ protected function auPayRunAsyncRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auPayRunAsync' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/async'; $formParams = []; $queryParams = []; @@ -892,6 +1234,7 @@ protected function auPayRunAsyncRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -901,56 +1244,42 @@ protected function auPayRunAsyncRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -971,10 +1300,11 @@ protected function auPayRunAsyncRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -986,16 +1316,17 @@ protected function auPayRunAsyncRequest($request, $business_id) * Bulk Apply Leave Requests * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model bulk_apply_leave_request_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model bulk_apply_leave_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunBulkApplyLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ApplyLeaveRequestResult + * @return \OpenAPI\Client\Model\ApplyLeaveRequestResult */ - public function auPayRunBulkApplyLeaveRequests($pay_run_id, $bulk_apply_leave_request_model, $business_id) + public function auPayRunBulkApplyLeaveRequests($pay_run_id, $business_id, $bulk_apply_leave_request_model, string $contentType = self::contentTypes['auPayRunBulkApplyLeaveRequests'][0]) { - list($response) = $this->auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $bulk_apply_leave_request_model, $business_id); + list($response) = $this->auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $business_id, $bulk_apply_leave_request_model, $contentType); return $response; } @@ -1005,17 +1336,17 @@ public function auPayRunBulkApplyLeaveRequests($pay_run_id, $bulk_apply_leave_re * Bulk Apply Leave Requests * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunBulkApplyLeaveRequests'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ApplyLeaveRequestResult, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ApplyLeaveRequestResult, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $bulk_apply_leave_request_model, $business_id) + public function auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $business_id, $bulk_apply_leave_request_model, string $contentType = self::contentTypes['auPayRunBulkApplyLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\ApplyLeaveRequestResult'; - $request = $this->auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_apply_leave_request_model, $business_id); + $request = $this->auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $business_id, $bulk_apply_leave_request_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1024,9 +1355,16 @@ public function auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $bulk_ap } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1037,19 +1375,37 @@ public function auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $bulk_ap sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ApplyLeaveRequestResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ApplyLeaveRequestResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApplyLeaveRequestResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ApplyLeaveRequestResult'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1066,7 +1422,7 @@ public function auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $bulk_ap case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ApplyLeaveRequestResult', + '\OpenAPI\Client\Model\ApplyLeaveRequestResult', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1082,15 +1438,16 @@ public function auPayRunBulkApplyLeaveRequestsWithHttpInfo($pay_run_id, $bulk_ap * Bulk Apply Leave Requests * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunBulkApplyLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunBulkApplyLeaveRequestsAsync($pay_run_id, $bulk_apply_leave_request_model, $business_id) + public function auPayRunBulkApplyLeaveRequestsAsync($pay_run_id, $business_id, $bulk_apply_leave_request_model, string $contentType = self::contentTypes['auPayRunBulkApplyLeaveRequests'][0]) { - return $this->auPayRunBulkApplyLeaveRequestsAsyncWithHttpInfo($pay_run_id, $bulk_apply_leave_request_model, $business_id) + return $this->auPayRunBulkApplyLeaveRequestsAsyncWithHttpInfo($pay_run_id, $business_id, $bulk_apply_leave_request_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1104,26 +1461,26 @@ function ($response) { * Bulk Apply Leave Requests * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunBulkApplyLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunBulkApplyLeaveRequestsAsyncWithHttpInfo($pay_run_id, $bulk_apply_leave_request_model, $business_id) + public function auPayRunBulkApplyLeaveRequestsAsyncWithHttpInfo($pay_run_id, $business_id, $bulk_apply_leave_request_model, string $contentType = self::contentTypes['auPayRunBulkApplyLeaveRequests'][0]) { - $returnType = '\Swagger\Client\Model\ApplyLeaveRequestResult'; - $request = $this->auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_apply_leave_request_model, $business_id); + $returnType = '\OpenAPI\Client\Model\ApplyLeaveRequestResult'; + $request = $this->auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $business_id, $bulk_apply_leave_request_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1146,7 +1503,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1156,26 +1513,23 @@ function ($exception) { * Create request for operation 'auPayRunBulkApplyLeaveRequests' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\BulkApplyLeaveRequestModel $bulk_apply_leave_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunBulkApplyLeaveRequests'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_apply_leave_request_model, $business_id) + public function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $business_id, $bulk_apply_leave_request_model, string $contentType = self::contentTypes['auPayRunBulkApplyLeaveRequests'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunBulkApplyLeaveRequests' ); } - // verify the required parameter 'bulk_apply_leave_request_model' is set - if ($bulk_apply_leave_request_model === null || (is_array($bulk_apply_leave_request_model) && count($bulk_apply_leave_request_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $bulk_apply_leave_request_model when calling auPayRunBulkApplyLeaveRequests' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1183,6 +1537,14 @@ protected function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_appl ); } + // verify the required parameter 'bulk_apply_leave_request_model' is set + if ($bulk_apply_leave_request_model === null || (is_array($bulk_apply_leave_request_model) && count($bulk_apply_leave_request_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $bulk_apply_leave_request_model when calling auPayRunBulkApplyLeaveRequests' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/bulkapplyleaverequests'; $formParams = []; $queryParams = []; @@ -1191,6 +1553,7 @@ protected function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_appl $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -1208,56 +1571,42 @@ protected function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_appl ); } - // body params - $_tempBody = null; - if (isset($bulk_apply_leave_request_model)) { - $_tempBody = $bulk_apply_leave_request_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($bulk_apply_leave_request_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($bulk_apply_leave_request_model)); + } else { + $httpBody = $bulk_apply_leave_request_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1278,10 +1627,11 @@ protected function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_appl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1294,14 +1644,15 @@ protected function auPayRunBulkApplyLeaveRequestsRequest($pay_run_id, $bulk_appl * * @param string $job_id job_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunCreationStatus'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunJobStatusModel + * @return \OpenAPI\Client\Model\PayRunJobStatusModel */ - public function auPayRunCreationStatus($job_id, $business_id) + public function auPayRunCreationStatus($job_id, $business_id, string $contentType = self::contentTypes['auPayRunCreationStatus'][0]) { - list($response) = $this->auPayRunCreationStatusWithHttpInfo($job_id, $business_id); + list($response) = $this->auPayRunCreationStatusWithHttpInfo($job_id, $business_id, $contentType); return $response; } @@ -1312,15 +1663,15 @@ public function auPayRunCreationStatus($job_id, $business_id) * * @param string $job_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunCreationStatus'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunJobStatusModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunJobStatusModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunCreationStatusWithHttpInfo($job_id, $business_id) + public function auPayRunCreationStatusWithHttpInfo($job_id, $business_id, string $contentType = self::contentTypes['auPayRunCreationStatus'][0]) { - $returnType = '\Swagger\Client\Model\PayRunJobStatusModel'; - $request = $this->auPayRunCreationStatusRequest($job_id, $business_id); + $request = $this->auPayRunCreationStatusRequest($job_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1329,9 +1680,16 @@ public function auPayRunCreationStatusWithHttpInfo($job_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1342,19 +1700,37 @@ public function auPayRunCreationStatusWithHttpInfo($job_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunJobStatusModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunJobStatusModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunJobStatusModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunJobStatusModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1371,7 +1747,7 @@ public function auPayRunCreationStatusWithHttpInfo($job_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunJobStatusModel', + '\OpenAPI\Client\Model\PayRunJobStatusModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1388,13 +1764,14 @@ public function auPayRunCreationStatusWithHttpInfo($job_id, $business_id) * * @param string $job_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunCreationStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunCreationStatusAsync($job_id, $business_id) + public function auPayRunCreationStatusAsync($job_id, $business_id, string $contentType = self::contentTypes['auPayRunCreationStatus'][0]) { - return $this->auPayRunCreationStatusAsyncWithHttpInfo($job_id, $business_id) + return $this->auPayRunCreationStatusAsyncWithHttpInfo($job_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1409,24 +1786,24 @@ function ($response) { * * @param string $job_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunCreationStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunCreationStatusAsyncWithHttpInfo($job_id, $business_id) + public function auPayRunCreationStatusAsyncWithHttpInfo($job_id, $business_id, string $contentType = self::contentTypes['auPayRunCreationStatus'][0]) { - $returnType = '\Swagger\Client\Model\PayRunJobStatusModel'; - $request = $this->auPayRunCreationStatusRequest($job_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunJobStatusModel'; + $request = $this->auPayRunCreationStatusRequest($job_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1449,7 +1826,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1460,18 +1837,21 @@ function ($exception) { * * @param string $job_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunCreationStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunCreationStatusRequest($job_id, $business_id) + public function auPayRunCreationStatusRequest($job_id, $business_id, string $contentType = self::contentTypes['auPayRunCreationStatus'][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 auPayRunCreationStatus' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1479,6 +1859,7 @@ protected function auPayRunCreationStatusRequest($job_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/creationstatus/{jobId}'; $formParams = []; $queryParams = []; @@ -1487,6 +1868,7 @@ protected function auPayRunCreationStatusRequest($job_id, $business_id) $multipart = false; + // path params if ($job_id !== null) { $resourcePath = str_replace( @@ -1504,53 +1886,35 @@ protected function auPayRunCreationStatusRequest($job_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1571,10 +1935,11 @@ protected function auPayRunCreationStatusRequest($job_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1588,14 +1953,15 @@ protected function auPayRunCreationStatusRequest($job_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunDeductionsDelete($pay_run_id, $id, $business_id) + public function auPayRunDeductionsDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsDelete'][0]) { - $this->auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -1606,15 +1972,15 @@ public function auPayRunDeductionsDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsDelete'][0]) { - $returnType = ''; - $request = $this->auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1623,9 +1989,16 @@ public function auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1636,11 +2009,11 @@ public function auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1661,13 +2034,14 @@ public function auPayRunDeductionsDeleteWithHttpInfo($pay_run_id, $id, $business * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsDeleteAsync($pay_run_id, $id, $business_id) + public function auPayRunDeductionsDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsDelete'][0]) { - return $this->auPayRunDeductionsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->auPayRunDeductionsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1683,14 +2057,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function auPayRunDeductionsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsDelete'][0]) { $returnType = ''; - $request = $this->auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1709,7 +2084,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1721,24 +2096,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_id) + public function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDeductionsDelete' ); } + // 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 auPayRunDeductionsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1746,6 +2125,7 @@ protected function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_i ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/deductions'; $formParams = []; $queryParams = []; @@ -1754,9 +2134,15 @@ protected function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_i $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -1775,53 +2161,35 @@ protected function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1842,10 +2210,11 @@ protected function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1858,14 +2227,15 @@ protected function auPayRunDeductionsDeleteRequest($pay_run_id, $id, $business_i * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunDeductionResponse + * @return \OpenAPI\Client\Model\AuPayRunDeductionResponse */ - public function auPayRunDeductionsGet($pay_run_id, $business_id) + public function auPayRunDeductionsGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGet'][0]) { - list($response) = $this->auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -1876,15 +2246,15 @@ public function auPayRunDeductionsGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunDeductionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunDeductionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunDeductionResponse'; - $request = $this->auPayRunDeductionsGetRequest($pay_run_id, $business_id); + $request = $this->auPayRunDeductionsGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1893,9 +2263,16 @@ public function auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1906,19 +2283,37 @@ public function auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunDeductionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunDeductionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunDeductionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunDeductionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1935,7 +2330,7 @@ public function auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunDeductionResponse', + '\OpenAPI\Client\Model\AuPayRunDeductionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1952,13 +2347,14 @@ public function auPayRunDeductionsGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsGetAsync($pay_run_id, $business_id) + public function auPayRunDeductionsGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGet'][0]) { - return $this->auPayRunDeductionsGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunDeductionsGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1973,24 +2369,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDeductionsGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunDeductionResponse'; - $request = $this->auPayRunDeductionsGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunDeductionResponse'; + $request = $this->auPayRunDeductionsGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2013,7 +2409,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2024,18 +2420,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDeductionsGetRequest($pay_run_id, $business_id) + public function auPayRunDeductionsGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDeductionsGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2043,6 +2442,7 @@ protected function auPayRunDeductionsGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/deductions'; $formParams = []; $queryParams = []; @@ -2051,6 +2451,7 @@ protected function auPayRunDeductionsGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -2068,53 +2469,35 @@ protected function auPayRunDeductionsGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2135,10 +2518,11 @@ protected function auPayRunDeductionsGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2152,14 +2536,15 @@ protected function auPayRunDeductionsGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGetByEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunDeductionResponse + * @return \OpenAPI\Client\Model\AuPayRunDeductionResponse */ - public function auPayRunDeductionsGetByEmployee($pay_run_id, $employee_id, $business_id) + public function auPayRunDeductionsGetByEmployee($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGetByEmployee'][0]) { - list($response) = $this->auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -2171,15 +2556,15 @@ public function auPayRunDeductionsGetByEmployee($pay_run_id, $employee_id, $busi * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGetByEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunDeductionResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunDeductionResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGetByEmployee'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunDeductionResponse'; - $request = $this->auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2188,9 +2573,16 @@ public function auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2201,19 +2593,37 @@ public function auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunDeductionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunDeductionResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunDeductionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunDeductionResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2230,7 +2640,7 @@ public function auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunDeductionResponse', + '\OpenAPI\Client\Model\AuPayRunDeductionResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2248,13 +2658,14 @@ public function auPayRunDeductionsGetByEmployeeWithHttpInfo($pay_run_id, $employ * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGetByEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsGetByEmployeeAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunDeductionsGetByEmployeeAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGetByEmployee'][0]) { - return $this->auPayRunDeductionsGetByEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunDeductionsGetByEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2270,24 +2681,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGetByEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsGetByEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunDeductionsGetByEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGetByEmployee'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunDeductionResponse'; - $request = $this->auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunDeductionResponse'; + $request = $this->auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2310,7 +2721,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2322,24 +2733,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsGetByEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunDeductionsGetByEmployee'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDeductionsGetByEmployee' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunDeductionsGetByEmployee' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2347,6 +2762,7 @@ protected function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/deductions/{employeeId}'; $formParams = []; $queryParams = []; @@ -2355,6 +2771,7 @@ protected function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -2380,53 +2797,35 @@ protected function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2447,10 +2846,11 @@ protected function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2462,16 +2862,17 @@ protected function auPayRunDeductionsGetByEmployeeRequest($pay_run_id, $employee * Create Deductions * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunDeductionRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunDeductionRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunDeductionsPost($pay_run_id, $request, $business_id) + public function auPayRunDeductionsPost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunDeductionsPost'][0]) { - $this->auPayRunDeductionsPostWithHttpInfo($pay_run_id, $request, $business_id); + $this->auPayRunDeductionsPostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -2480,17 +2881,17 @@ public function auPayRunDeductionsPost($pay_run_id, $request, $business_id) * Create Deductions * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunDeductionRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunDeductionRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDeductionsPostWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunDeductionsPostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunDeductionsPost'][0]) { - $returnType = ''; - $request = $this->auPayRunDeductionsPostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunDeductionsPostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2499,9 +2900,16 @@ public function auPayRunDeductionsPostWithHttpInfo($pay_run_id, $request, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2512,11 +2920,11 @@ public function auPayRunDeductionsPostWithHttpInfo($pay_run_id, $request, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2535,15 +2943,16 @@ public function auPayRunDeductionsPostWithHttpInfo($pay_run_id, $request, $busin * Create Deductions * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunDeductionRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunDeductionRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsPostAsync($pay_run_id, $request, $business_id) + public function auPayRunDeductionsPostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunDeductionsPost'][0]) { - return $this->auPayRunDeductionsPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->auPayRunDeductionsPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2557,16 +2966,17 @@ function ($response) { * Create Deductions * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunDeductionRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunDeductionRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeductionsPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunDeductionsPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunDeductionsPost'][0]) { $returnType = ''; - $request = $this->auPayRunDeductionsPostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunDeductionsPostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2585,7 +2995,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2595,26 +3005,23 @@ function ($exception) { * Create request for operation 'auPayRunDeductionsPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunDeductionRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunDeductionRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeductionsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDeductionsPostRequest($pay_run_id, $request, $business_id) + public function auPayRunDeductionsPostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunDeductionsPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDeductionsPost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auPayRunDeductionsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2622,6 +3029,14 @@ protected function auPayRunDeductionsPostRequest($pay_run_id, $request, $busines ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auPayRunDeductionsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/deductions'; $formParams = []; $queryParams = []; @@ -2630,6 +3045,7 @@ protected function auPayRunDeductionsPostRequest($pay_run_id, $request, $busines $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -2647,56 +3063,42 @@ protected function auPayRunDeductionsPostRequest($pay_run_id, $request, $busines ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2717,10 +3119,11 @@ protected function auPayRunDeductionsPostRequest($pay_run_id, $request, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2733,14 +3136,15 @@ protected function auPayRunDeductionsPostRequest($pay_run_id, $request, $busines * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunDelete($pay_run_id, $business_id) + public function auPayRunDelete($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDelete'][0]) { - $this->auPayRunDeleteWithHttpInfo($pay_run_id, $business_id); + $this->auPayRunDeleteWithHttpInfo($pay_run_id, $business_id, $contentType); } /** @@ -2750,15 +3154,15 @@ public function auPayRunDelete($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDeleteWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDeleteWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDelete'][0]) { - $returnType = ''; - $request = $this->auPayRunDeleteRequest($pay_run_id, $business_id); + $request = $this->auPayRunDeleteRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2767,9 +3171,16 @@ public function auPayRunDeleteWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2780,11 +3191,11 @@ public function auPayRunDeleteWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2804,13 +3215,14 @@ public function auPayRunDeleteWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeleteAsync($pay_run_id, $business_id) + public function auPayRunDeleteAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDelete'][0]) { - return $this->auPayRunDeleteAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunDeleteAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2825,14 +3237,15 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeleteAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDeleteAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDelete'][0]) { $returnType = ''; - $request = $this->auPayRunDeleteRequest($pay_run_id, $business_id); + $request = $this->auPayRunDeleteRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2851,7 +3264,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2862,18 +3275,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDeleteRequest($pay_run_id, $business_id) + public function auPayRunDeleteRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2881,6 +3297,7 @@ protected function auPayRunDeleteRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}'; $formParams = []; $queryParams = []; @@ -2889,6 +3306,7 @@ protected function auPayRunDeleteRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -2906,53 +3324,35 @@ protected function auPayRunDeleteRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2973,10 +3373,11 @@ protected function auPayRunDeleteRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2989,14 +3390,15 @@ protected function auPayRunDeleteRequest($pay_run_id, $business_id) * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation($pay_run_id, $business_id) + public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'][0]) { - $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationWithHttpInfo($pay_run_id, $business_id); + $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationWithHttpInfo($pay_run_id, $business_id, $contentType); } /** @@ -3006,15 +3408,15 @@ public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation( * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'][0]) { - $returnType = ''; - $request = $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationRequest($pay_run_id, $business_id); + $request = $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3023,9 +3425,16 @@ public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationW } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3036,11 +3445,11 @@ public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationW sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3060,13 +3469,14 @@ public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationW * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationAsync($pay_run_id, $business_id) + public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'][0]) { - return $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3081,14 +3491,15 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'][0]) { $returnType = ''; - $request = $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationRequest($pay_run_id, $business_id); + $request = $this->auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3107,7 +3518,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3118,18 +3529,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationRequest($pay_run_id, $business_id) + public function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotation' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3137,6 +3551,7 @@ protected function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotati ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/notation'; $formParams = []; $queryParams = []; @@ -3145,6 +3560,7 @@ protected function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotati $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -3162,53 +3578,35 @@ protected function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotati ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3229,10 +3627,11 @@ protected function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotati $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3246,14 +3645,15 @@ protected function auPayRunDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotati * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunEarningsLineDelete($pay_run_id, $id, $business_id) + public function auPayRunEarningsLineDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineDelete'][0]) { - $this->auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -3264,15 +3664,15 @@ public function auPayRunEarningsLineDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineDelete'][0]) { - $returnType = ''; - $request = $this->auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3281,9 +3681,16 @@ public function auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3294,11 +3701,11 @@ public function auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3319,13 +3726,14 @@ public function auPayRunEarningsLineDeleteWithHttpInfo($pay_run_id, $id, $busine * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLineDeleteAsync($pay_run_id, $id, $business_id) + public function auPayRunEarningsLineDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineDelete'][0]) { - return $this->auPayRunEarningsLineDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->auPayRunEarningsLineDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3341,14 +3749,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLineDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function auPayRunEarningsLineDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineDelete'][0]) { $returnType = ''; - $request = $this->auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3367,7 +3776,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3379,24 +3788,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business_id) + public function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunEarningsLineDelete' ); } + // 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 auPayRunEarningsLineDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3404,6 +3817,7 @@ protected function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/earningslines'; $formParams = []; $queryParams = []; @@ -3412,9 +3826,15 @@ protected function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -3433,53 +3853,35 @@ protected function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3500,10 +3902,11 @@ protected function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3516,14 +3919,15 @@ protected function auPayRunEarningsLineDeleteRequest($pay_run_id, $id, $business * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunEarningsLineResponseModel + * @return \OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel */ - public function auPayRunEarningsLineGet($pay_run_id, $business_id) + public function auPayRunEarningsLineGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGet'][0]) { - list($response) = $this->auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -3534,15 +3938,15 @@ public function auPayRunEarningsLineGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunEarningsLineResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id) + public function auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunEarningsLineResponseModel'; - $request = $this->auPayRunEarningsLineGetRequest($pay_run_id, $business_id); + $request = $this->auPayRunEarningsLineGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3551,9 +3955,16 @@ public function auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3564,19 +3975,37 @@ public function auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3593,7 +4022,7 @@ public function auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunEarningsLineResponseModel', + '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3610,13 +4039,14 @@ public function auPayRunEarningsLineGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLineGetAsync($pay_run_id, $business_id) + public function auPayRunEarningsLineGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGet'][0]) { - return $this->auPayRunEarningsLineGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunEarningsLineGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3631,24 +4061,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLineGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunEarningsLineGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunEarningsLineResponseModel'; - $request = $this->auPayRunEarningsLineGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel'; + $request = $this->auPayRunEarningsLineGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3671,7 +4101,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3682,18 +4112,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunEarningsLineGetRequest($pay_run_id, $business_id) + public function auPayRunEarningsLineGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunEarningsLineGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3701,6 +4134,7 @@ protected function auPayRunEarningsLineGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/earningslines'; $formParams = []; $queryParams = []; @@ -3709,6 +4143,7 @@ protected function auPayRunEarningsLineGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -3726,53 +4161,35 @@ protected function auPayRunEarningsLineGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3793,10 +4210,11 @@ protected function auPayRunEarningsLineGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3810,14 +4228,15 @@ protected function auPayRunEarningsLineGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunEarningsLineResponseModel + * @return \OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel */ - public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId($pay_run_id, $employee_id, $business_id) + public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'][0]) { - list($response) = $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -3829,15 +4248,15 @@ public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunId * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunEarningsLineResponseModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunEarningsLineResponseModel'; - $request = $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3846,9 +4265,16 @@ public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunId } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3859,19 +4285,37 @@ public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunId sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3888,7 +4332,7 @@ public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunId case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunEarningsLineResponseModel', + '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3906,13 +4350,14 @@ public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunId * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'][0]) { - return $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3928,24 +4373,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunEarningsLineResponseModel'; - $request = $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunEarningsLineResponseModel'; + $request = $this->auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3968,7 +4413,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3980,24 +4425,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRunIdEarningslinesByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4005,6 +4454,7 @@ protected function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRu ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/earningslines/{employeeId}'; $formParams = []; $queryParams = []; @@ -4013,6 +4463,7 @@ protected function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRu $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -4038,53 +4489,35 @@ protected function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4105,10 +4538,11 @@ protected function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4120,16 +4554,17 @@ protected function auPayRunEarningsLineGetApiV2BusinessByBusinessIdPayrunByPayRu * Create Earnings Lines * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\AuSubmitPayRunEarningsLineRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitPayRunEarningsLineRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLinePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunEarningsLinePost($pay_run_id, $request, $business_id) + public function auPayRunEarningsLinePost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunEarningsLinePost'][0]) { - $this->auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $request, $business_id); + $this->auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -4138,17 +4573,17 @@ public function auPayRunEarningsLinePost($pay_run_id, $request, $business_id) * Create Earnings Lines * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLinePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunEarningsLinePost'][0]) { - $returnType = ''; - $request = $this->auPayRunEarningsLinePostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunEarningsLinePostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -4157,9 +4592,16 @@ public function auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $request, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4170,11 +4612,11 @@ public function auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $request, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -4193,15 +4635,16 @@ public function auPayRunEarningsLinePostWithHttpInfo($pay_run_id, $request, $bus * Create Earnings Lines * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLinePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLinePostAsync($pay_run_id, $request, $business_id) + public function auPayRunEarningsLinePostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunEarningsLinePost'][0]) { - return $this->auPayRunEarningsLinePostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->auPayRunEarningsLinePostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -4215,16 +4658,17 @@ function ($response) { * Create Earnings Lines * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLinePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunEarningsLinePostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunEarningsLinePostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunEarningsLinePost'][0]) { $returnType = ''; - $request = $this->auPayRunEarningsLinePostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunEarningsLinePostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4243,7 +4687,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4253,26 +4697,23 @@ function ($exception) { * Create request for operation 'auPayRunEarningsLinePost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitPayRunEarningsLineRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunEarningsLinePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunEarningsLinePostRequest($pay_run_id, $request, $business_id) + public function auPayRunEarningsLinePostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunEarningsLinePost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunEarningsLinePost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auPayRunEarningsLinePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4280,6 +4721,14 @@ protected function auPayRunEarningsLinePostRequest($pay_run_id, $request, $busin ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auPayRunEarningsLinePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/earningslines'; $formParams = []; $queryParams = []; @@ -4288,6 +4737,7 @@ protected function auPayRunEarningsLinePostRequest($pay_run_id, $request, $busin $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -4305,56 +4755,42 @@ protected function auPayRunEarningsLinePostRequest($pay_run_id, $request, $busin ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4375,10 +4811,11 @@ protected function auPayRunEarningsLinePostRequest($pay_run_id, $request, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4391,14 +4828,15 @@ protected function auPayRunEarningsLinePostRequest($pay_run_id, $request, $busin * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunModel + * @return \OpenAPI\Client\Model\PayRunModel */ - public function auPayRunGet($pay_run_id, $business_id) + public function auPayRunGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGet'][0]) { - list($response) = $this->auPayRunGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -4409,15 +4847,15 @@ public function auPayRunGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunGetWithHttpInfo($pay_run_id, $business_id) + public function auPayRunGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunModel'; - $request = $this->auPayRunGetRequest($pay_run_id, $business_id); + $request = $this->auPayRunGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4426,9 +4864,16 @@ public function auPayRunGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4439,19 +4884,37 @@ public function auPayRunGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4468,7 +4931,7 @@ public function auPayRunGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunModel', + '\OpenAPI\Client\Model\PayRunModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4485,13 +4948,14 @@ public function auPayRunGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetAsync($pay_run_id, $business_id) + public function auPayRunGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGet'][0]) { - return $this->auPayRunGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4506,24 +4970,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunModel'; - $request = $this->auPayRunGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunModel'; + $request = $this->auPayRunGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4546,7 +5010,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4557,18 +5021,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunGetRequest($pay_run_id, $business_id) + public function auPayRunGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4576,6 +5043,7 @@ protected function auPayRunGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}'; $formParams = []; $queryParams = []; @@ -4584,6 +5052,7 @@ protected function auPayRunGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -4601,53 +5070,35 @@ protected function auPayRunGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4668,10 +5119,11 @@ protected function auPayRunGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4683,18 +5135,20 @@ protected function auPayRunGetRequest($pay_run_id, $business_id) * List Pay Runs Summaries * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummaries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunSummaryModel[] + * @return \OpenAPI\Client\Model\PayRunSummaryModel[] */ - public function auPayRunGetPayRunSummaries($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunSummaries($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRunSummaries'][0]) { - list($response) = $this->auPayRunGetPayRunSummariesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auPayRunGetPayRunSummariesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -4704,19 +5158,20 @@ public function auPayRunGetPayRunSummaries($business_id, $filter = null, $orderb * List Pay Runs Summaries * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummaries'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunSummaryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunSummaryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunGetPayRunSummariesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunSummariesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRunSummaries'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSummaryModel[]'; - $request = $this->auPayRunGetPayRunSummariesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auPayRunGetPayRunSummariesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -4725,9 +5180,16 @@ public function auPayRunGetPayRunSummariesWithHttpInfo($business_id, $filter = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4738,19 +5200,37 @@ public function auPayRunGetPayRunSummariesWithHttpInfo($business_id, $filter = n sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunSummaryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunSummaryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunSummaryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunSummaryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4767,7 +5247,7 @@ public function auPayRunGetPayRunSummariesWithHttpInfo($business_id, $filter = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunSummaryModel[]', + '\OpenAPI\Client\Model\PayRunSummaryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4783,17 +5263,19 @@ public function auPayRunGetPayRunSummariesWithHttpInfo($business_id, $filter = n * List Pay Runs Summaries * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummaries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetPayRunSummariesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunSummariesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRunSummaries'][0]) { - return $this->auPayRunGetPayRunSummariesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auPayRunGetPayRunSummariesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -4807,28 +5289,29 @@ function ($response) { * List Pay Runs Summaries * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummaries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetPayRunSummariesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunSummariesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRunSummaries'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSummaryModel[]'; - $request = $this->auPayRunGetPayRunSummariesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\PayRunSummaryModel[]'; + $request = $this->auPayRunGetPayRunSummariesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4851,7 +5334,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4861,16 +5344,19 @@ function ($exception) { * Create request for operation 'auPayRunGetPayRunSummaries' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummaries'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunGetPayRunSummariesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunSummariesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRunSummaries'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4878,6 +5364,12 @@ protected function auPayRunGetPayRunSummariesRequest($business_id, $filter = nul ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/payrun/summary'; $formParams = []; $queryParams = []; @@ -4886,20 +5378,45 @@ protected function auPayRunGetPayRunSummariesRequest($business_id, $filter = nul $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -4911,53 +5428,35 @@ protected function auPayRunGetPayRunSummariesRequest($business_id, $filter = nul ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4978,10 +5477,11 @@ protected function auPayRunGetPayRunSummariesRequest($business_id, $filter = nul $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4994,14 +5494,15 @@ protected function auPayRunGetPayRunSummariesRequest($business_id, $filter = nul * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummary'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunSummaryModel + * @return \OpenAPI\Client\Model\PayRunSummaryModel */ - public function auPayRunGetPayRunSummary($pay_run_id, $business_id) + public function auPayRunGetPayRunSummary($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetPayRunSummary'][0]) { - list($response) = $this->auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -5012,15 +5513,15 @@ public function auPayRunGetPayRunSummary($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummary'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunSummaryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunSummaryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id) + public function auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetPayRunSummary'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSummaryModel'; - $request = $this->auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id); + $request = $this->auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5029,9 +5530,16 @@ public function auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5042,19 +5550,37 @@ public function auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunSummaryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunSummaryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunSummaryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunSummaryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5071,7 +5597,7 @@ public function auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunSummaryModel', + '\OpenAPI\Client\Model\PayRunSummaryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5088,13 +5614,14 @@ public function auPayRunGetPayRunSummaryWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetPayRunSummaryAsync($pay_run_id, $business_id) + public function auPayRunGetPayRunSummaryAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetPayRunSummary'][0]) { - return $this->auPayRunGetPayRunSummaryAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunGetPayRunSummaryAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5109,24 +5636,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetPayRunSummaryAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunGetPayRunSummaryAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetPayRunSummary'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSummaryModel'; - $request = $this->auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunSummaryModel'; + $request = $this->auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5149,7 +5676,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5160,18 +5687,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRunSummary'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id) + public function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetPayRunSummary'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunGetPayRunSummary' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5179,6 +5709,7 @@ protected function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/summary'; $formParams = []; $queryParams = []; @@ -5187,6 +5718,7 @@ protected function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -5204,53 +5736,35 @@ protected function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5271,10 +5785,11 @@ protected function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5286,18 +5801,20 @@ protected function auPayRunGetPayRunSummaryRequest($pay_run_id, $business_id) * List Pay Runs * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRuns'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunModel[] + * @return \OpenAPI\Client\Model\PayRunModel[] */ - public function auPayRunGetPayRuns($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRuns($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRuns'][0]) { - list($response) = $this->auPayRunGetPayRunsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auPayRunGetPayRunsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -5307,19 +5824,20 @@ public function auPayRunGetPayRuns($business_id, $filter = null, $orderby = null * List Pay Runs * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRuns'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunGetPayRunsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRuns'][0]) { - $returnType = '\Swagger\Client\Model\PayRunModel[]'; - $request = $this->auPayRunGetPayRunsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auPayRunGetPayRunsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -5328,9 +5846,16 @@ public function auPayRunGetPayRunsWithHttpInfo($business_id, $filter = null, $or } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5341,19 +5866,37 @@ public function auPayRunGetPayRunsWithHttpInfo($business_id, $filter = null, $or sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5370,7 +5913,7 @@ public function auPayRunGetPayRunsWithHttpInfo($business_id, $filter = null, $or case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunModel[]', + '\OpenAPI\Client\Model\PayRunModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5386,17 +5929,19 @@ public function auPayRunGetPayRunsWithHttpInfo($business_id, $filter = null, $or * List Pay Runs * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRuns'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetPayRunsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRuns'][0]) { - return $this->auPayRunGetPayRunsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auPayRunGetPayRunsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -5410,28 +5955,29 @@ function ($response) { * List Pay Runs * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRuns'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetPayRunsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRuns'][0]) { - $returnType = '\Swagger\Client\Model\PayRunModel[]'; - $request = $this->auPayRunGetPayRunsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\PayRunModel[]'; + $request = $this->auPayRunGetPayRunsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5454,7 +6000,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5464,16 +6010,19 @@ function ($exception) { * Create request for operation 'auPayRunGetPayRuns' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetPayRuns'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunGetPayRunsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayRunGetPayRunsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayRunGetPayRuns'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5481,6 +6030,12 @@ protected function auPayRunGetPayRunsRequest($business_id, $filter = null, $orde ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/payrun'; $formParams = []; $queryParams = []; @@ -5489,20 +6044,45 @@ protected function auPayRunGetPayRunsRequest($business_id, $filter = null, $orde $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -5514,53 +6094,35 @@ protected function auPayRunGetPayRunsRequest($business_id, $filter = null, $orde ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5581,10 +6143,11 @@ protected function auPayRunGetPayRunsRequest($business_id, $filter = null, $orde $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5597,14 +6160,15 @@ protected function auPayRunGetPayRunsRequest($business_id, $filter = null, $orde * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetWarnings'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DetailedPayRunWarningModel[] + * @return \OpenAPI\Client\Model\DetailedPayRunWarningModel[] */ - public function auPayRunGetWarnings($pay_run_id, $business_id) + public function auPayRunGetWarnings($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetWarnings'][0]) { - list($response) = $this->auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -5615,15 +6179,15 @@ public function auPayRunGetWarnings($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetWarnings'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DetailedPayRunWarningModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DetailedPayRunWarningModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id) + public function auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetWarnings'][0]) { - $returnType = '\Swagger\Client\Model\DetailedPayRunWarningModel[]'; - $request = $this->auPayRunGetWarningsRequest($pay_run_id, $business_id); + $request = $this->auPayRunGetWarningsRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5632,9 +6196,16 @@ public function auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5645,19 +6216,37 @@ public function auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DetailedPayRunWarningModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DetailedPayRunWarningModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DetailedPayRunWarningModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DetailedPayRunWarningModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5674,7 +6263,7 @@ public function auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DetailedPayRunWarningModel[]', + '\OpenAPI\Client\Model\DetailedPayRunWarningModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5691,13 +6280,14 @@ public function auPayRunGetWarningsWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetWarnings'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetWarningsAsync($pay_run_id, $business_id) + public function auPayRunGetWarningsAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetWarnings'][0]) { - return $this->auPayRunGetWarningsAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunGetWarningsAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5712,24 +6302,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetWarnings'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunGetWarningsAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunGetWarningsAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetWarnings'][0]) { - $returnType = '\Swagger\Client\Model\DetailedPayRunWarningModel[]'; - $request = $this->auPayRunGetWarningsRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\DetailedPayRunWarningModel[]'; + $request = $this->auPayRunGetWarningsRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5752,7 +6342,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5763,18 +6353,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunGetWarnings'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunGetWarningsRequest($pay_run_id, $business_id) + public function auPayRunGetWarningsRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunGetWarnings'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunGetWarnings' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5782,6 +6375,7 @@ protected function auPayRunGetWarningsRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/warnings'; $formParams = []; $queryParams = []; @@ -5790,6 +6384,7 @@ protected function auPayRunGetWarningsRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -5807,53 +6402,35 @@ protected function auPayRunGetWarningsRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5874,10 +6451,11 @@ protected function auPayRunGetWarningsRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5891,14 +6469,15 @@ protected function auPayRunGetWarningsRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunIncludeEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunTotalModel + * @return \OpenAPI\Client\Model\PayRunTotalModel */ - public function auPayRunIncludeEmployee($pay_run_id, $employee_id, $business_id) + public function auPayRunIncludeEmployee($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunIncludeEmployee'][0]) { - list($response) = $this->auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -5910,15 +6489,15 @@ public function auPayRunIncludeEmployee($pay_run_id, $employee_id, $business_id) * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunIncludeEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunTotalModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunTotalModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunIncludeEmployee'][0]) { - $returnType = '\Swagger\Client\Model\PayRunTotalModel'; - $request = $this->auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5927,9 +6506,16 @@ public function auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5940,19 +6526,37 @@ public function auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunTotalModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunTotalModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunTotalModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunTotalModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5969,7 +6573,7 @@ public function auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunTotalModel', + '\OpenAPI\Client\Model\PayRunTotalModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5987,13 +6591,14 @@ public function auPayRunIncludeEmployeeWithHttpInfo($pay_run_id, $employee_id, $ * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunIncludeEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunIncludeEmployeeAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunIncludeEmployeeAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunIncludeEmployee'][0]) { - return $this->auPayRunIncludeEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunIncludeEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6009,24 +6614,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunIncludeEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunIncludeEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunIncludeEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunIncludeEmployee'][0]) { - $returnType = '\Swagger\Client\Model\PayRunTotalModel'; - $request = $this->auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunTotalModel'; + $request = $this->auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6049,7 +6654,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6061,24 +6666,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunIncludeEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunIncludeEmployee'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunIncludeEmployee' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunIncludeEmployee' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6086,6 +6695,7 @@ protected function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $bu ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/employee/{employeeId}'; $formParams = []; $queryParams = []; @@ -6094,6 +6704,7 @@ protected function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $bu $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -6119,53 +6730,35 @@ protected function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $bu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6186,10 +6779,11 @@ protected function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $bu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6200,17 +6794,18 @@ protected function auPayRunIncludeEmployeeRequest($pay_run_id, $employee_id, $bu * * Net to Gross * - * @param \Swagger\Client\Model\NetToGrossRequest $net_to_gross_request net_to_gross_request (required) * @param string $business_id business_id (required) * @param string $pay_run_id pay_run_id (required) + * @param \OpenAPI\Client\Model\NetToGrossRequest $net_to_gross_request net_to_gross_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNetToGross'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NetToGrossModel + * @return \OpenAPI\Client\Model\NetToGrossModel */ - public function auPayRunNetToGross($net_to_gross_request, $business_id, $pay_run_id) + public function auPayRunNetToGross($business_id, $pay_run_id, $net_to_gross_request, string $contentType = self::contentTypes['auPayRunNetToGross'][0]) { - list($response) = $this->auPayRunNetToGrossWithHttpInfo($net_to_gross_request, $business_id, $pay_run_id); + list($response) = $this->auPayRunNetToGrossWithHttpInfo($business_id, $pay_run_id, $net_to_gross_request, $contentType); return $response; } @@ -6219,18 +6814,18 @@ public function auPayRunNetToGross($net_to_gross_request, $business_id, $pay_run * * Net to Gross * - * @param \Swagger\Client\Model\NetToGrossRequest $net_to_gross_request (required) * @param string $business_id (required) * @param string $pay_run_id (required) + * @param \OpenAPI\Client\Model\NetToGrossRequest $net_to_gross_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNetToGross'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NetToGrossModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NetToGrossModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunNetToGrossWithHttpInfo($net_to_gross_request, $business_id, $pay_run_id) + public function auPayRunNetToGrossWithHttpInfo($business_id, $pay_run_id, $net_to_gross_request, string $contentType = self::contentTypes['auPayRunNetToGross'][0]) { - $returnType = '\Swagger\Client\Model\NetToGrossModel'; - $request = $this->auPayRunNetToGrossRequest($net_to_gross_request, $business_id, $pay_run_id); + $request = $this->auPayRunNetToGrossRequest($business_id, $pay_run_id, $net_to_gross_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -6239,9 +6834,16 @@ public function auPayRunNetToGrossWithHttpInfo($net_to_gross_request, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6252,19 +6854,37 @@ public function auPayRunNetToGrossWithHttpInfo($net_to_gross_request, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NetToGrossModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NetToGrossModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NetToGrossModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NetToGrossModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6281,7 +6901,7 @@ public function auPayRunNetToGrossWithHttpInfo($net_to_gross_request, $business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NetToGrossModel', + '\OpenAPI\Client\Model\NetToGrossModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6296,16 +6916,17 @@ public function auPayRunNetToGrossWithHttpInfo($net_to_gross_request, $business_ * * Net to Gross * - * @param \Swagger\Client\Model\NetToGrossRequest $net_to_gross_request (required) * @param string $business_id (required) * @param string $pay_run_id (required) + * @param \OpenAPI\Client\Model\NetToGrossRequest $net_to_gross_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNetToGross'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunNetToGrossAsync($net_to_gross_request, $business_id, $pay_run_id) + public function auPayRunNetToGrossAsync($business_id, $pay_run_id, $net_to_gross_request, string $contentType = self::contentTypes['auPayRunNetToGross'][0]) { - return $this->auPayRunNetToGrossAsyncWithHttpInfo($net_to_gross_request, $business_id, $pay_run_id) + return $this->auPayRunNetToGrossAsyncWithHttpInfo($business_id, $pay_run_id, $net_to_gross_request, $contentType) ->then( function ($response) { return $response[0]; @@ -6318,27 +6939,27 @@ function ($response) { * * Net to Gross * - * @param \Swagger\Client\Model\NetToGrossRequest $net_to_gross_request (required) * @param string $business_id (required) * @param string $pay_run_id (required) + * @param \OpenAPI\Client\Model\NetToGrossRequest $net_to_gross_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNetToGross'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunNetToGrossAsyncWithHttpInfo($net_to_gross_request, $business_id, $pay_run_id) + public function auPayRunNetToGrossAsyncWithHttpInfo($business_id, $pay_run_id, $net_to_gross_request, string $contentType = self::contentTypes['auPayRunNetToGross'][0]) { - $returnType = '\Swagger\Client\Model\NetToGrossModel'; - $request = $this->auPayRunNetToGrossRequest($net_to_gross_request, $business_id, $pay_run_id); + $returnType = '\OpenAPI\Client\Model\NetToGrossModel'; + $request = $this->auPayRunNetToGrossRequest($business_id, $pay_run_id, $net_to_gross_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6361,7 +6982,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6370,27 +6991,24 @@ function ($exception) { /** * Create request for operation 'auPayRunNetToGross' * - * @param \Swagger\Client\Model\NetToGrossRequest $net_to_gross_request (required) * @param string $business_id (required) * @param string $pay_run_id (required) + * @param \OpenAPI\Client\Model\NetToGrossRequest $net_to_gross_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNetToGross'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunNetToGrossRequest($net_to_gross_request, $business_id, $pay_run_id) + public function auPayRunNetToGrossRequest($business_id, $pay_run_id, $net_to_gross_request, string $contentType = self::contentTypes['auPayRunNetToGross'][0]) { - // verify the required parameter 'net_to_gross_request' is set - if ($net_to_gross_request === null || (is_array($net_to_gross_request) && count($net_to_gross_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $net_to_gross_request when calling auPayRunNetToGross' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling auPayRunNetToGross' ); } + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( @@ -6398,6 +7016,14 @@ protected function auPayRunNetToGrossRequest($net_to_gross_request, $business_id ); } + // verify the required parameter 'net_to_gross_request' is set + if ($net_to_gross_request === null || (is_array($net_to_gross_request) && count($net_to_gross_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $net_to_gross_request when calling auPayRunNetToGross' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/nettogross'; $formParams = []; $queryParams = []; @@ -6406,6 +7032,7 @@ protected function auPayRunNetToGrossRequest($net_to_gross_request, $business_id $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6423,56 +7050,42 @@ protected function auPayRunNetToGrossRequest($net_to_gross_request, $business_id ); } - // body params - $_tempBody = null; - if (isset($net_to_gross_request)) { - $_tempBody = $net_to_gross_request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($net_to_gross_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($net_to_gross_request)); + } else { + $httpBody = $net_to_gross_request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6493,10 +7106,11 @@ protected function auPayRunNetToGrossRequest($net_to_gross_request, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6508,16 +7122,17 @@ protected function auPayRunNetToGrossRequest($net_to_gross_request, $business_id * Set Pay Run Notation * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\PayRunNotationModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PayRunNotationModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNotation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunNotation($pay_run_id, $model, $business_id) + public function auPayRunNotation($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunNotation'][0]) { - $this->auPayRunNotationWithHttpInfo($pay_run_id, $model, $business_id); + $this->auPayRunNotationWithHttpInfo($pay_run_id, $business_id, $model, $contentType); } /** @@ -6526,17 +7141,17 @@ public function auPayRunNotation($pay_run_id, $model, $business_id) * Set Pay Run Notation * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNotation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunNotationWithHttpInfo($pay_run_id, $model, $business_id) + public function auPayRunNotationWithHttpInfo($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunNotation'][0]) { - $returnType = ''; - $request = $this->auPayRunNotationRequest($pay_run_id, $model, $business_id); + $request = $this->auPayRunNotationRequest($pay_run_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -6545,9 +7160,16 @@ public function auPayRunNotationWithHttpInfo($pay_run_id, $model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6558,11 +7180,11 @@ public function auPayRunNotationWithHttpInfo($pay_run_id, $model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -6581,15 +7203,16 @@ public function auPayRunNotationWithHttpInfo($pay_run_id, $model, $business_id) * Set Pay Run Notation * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunNotationAsync($pay_run_id, $model, $business_id) + public function auPayRunNotationAsync($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunNotation'][0]) { - return $this->auPayRunNotationAsyncWithHttpInfo($pay_run_id, $model, $business_id) + return $this->auPayRunNotationAsyncWithHttpInfo($pay_run_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -6603,16 +7226,17 @@ function ($response) { * Set Pay Run Notation * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunNotationAsyncWithHttpInfo($pay_run_id, $model, $business_id) + public function auPayRunNotationAsyncWithHttpInfo($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunNotation'][0]) { $returnType = ''; - $request = $this->auPayRunNotationRequest($pay_run_id, $model, $business_id); + $request = $this->auPayRunNotationRequest($pay_run_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6631,7 +7255,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6641,26 +7265,23 @@ function ($exception) { * Create request for operation 'auPayRunNotation' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunNotationRequest($pay_run_id, $model, $business_id) + public function auPayRunNotationRequest($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunNotation'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunNotation' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auPayRunNotation' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6668,6 +7289,14 @@ protected function auPayRunNotationRequest($pay_run_id, $model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auPayRunNotation' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/notation'; $formParams = []; $queryParams = []; @@ -6676,6 +7305,7 @@ protected function auPayRunNotationRequest($pay_run_id, $model, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -6693,56 +7323,42 @@ protected function auPayRunNotationRequest($pay_run_id, $model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6763,10 +7379,11 @@ protected function auPayRunNotationRequest($pay_run_id, $model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6780,14 +7397,15 @@ protected function auPayRunNotationRequest($pay_run_id, $model, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipFile'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ByteArrayContent + * @return \OpenAPI\Client\Model\ByteArrayContent */ - public function auPayRunPaySlipFile($pay_run_id, $employee_id, $business_id) + public function auPayRunPaySlipFile($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunPaySlipFile'][0]) { - list($response) = $this->auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -6799,15 +7417,15 @@ public function auPayRunPaySlipFile($pay_run_id, $employee_id, $business_id) * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipFile'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ByteArrayContent, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunPaySlipFile'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6816,9 +7434,16 @@ public function auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6829,19 +7454,37 @@ public function auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ByteArrayContent' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ByteArrayContent' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ByteArrayContent', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6858,7 +7501,7 @@ public function auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $busi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ByteArrayContent', + '\OpenAPI\Client\Model\ByteArrayContent', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6876,13 +7519,14 @@ public function auPayRunPaySlipFileWithHttpInfo($pay_run_id, $employee_id, $busi * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipFile'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaySlipFileAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunPaySlipFileAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunPaySlipFile'][0]) { - return $this->auPayRunPaySlipFileAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunPaySlipFileAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6898,24 +7542,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipFile'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaySlipFileAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunPaySlipFileAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunPaySlipFile'][0]) { - $returnType = '\Swagger\Client\Model\ByteArrayContent'; - $request = $this->auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\ByteArrayContent'; + $request = $this->auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6938,7 +7582,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6950,24 +7594,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipFile'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunPaySlipFile'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunPaySlipFile' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunPaySlipFile' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6975,6 +7623,7 @@ protected function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $busine ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/file/payslip/{employeeId}'; $formParams = []; $queryParams = []; @@ -6983,6 +7632,7 @@ protected function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $busine $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -7008,53 +7658,35 @@ protected function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7075,10 +7707,11 @@ protected function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7092,14 +7725,15 @@ protected function auPayRunPaySlipFileRequest($pay_run_id, $employee_id, $busine * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) * @param bool $show_all_data show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return map[string,\Swagger\Client\Model\AuApiPaySlipModel] + * @return array */ - public function auPayRunPaySlipGet($pay_run_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGet($pay_run_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGet'][0]) { - list($response) = $this->auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_all_data); + list($response) = $this->auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_all_data, $contentType); return $response; } @@ -7111,15 +7745,15 @@ public function auPayRunPaySlipGet($pay_run_id, $business_id, $show_all_data = ' * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of map[string,\Swagger\Client\Model\AuApiPaySlipModel], HTTP status code, HTTP response headers (array of strings) + * @return array of array, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGet'][0]) { - $returnType = 'map[string,\Swagger\Client\Model\AuApiPaySlipModel]'; - $request = $this->auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_all_data); + $request = $this->auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_all_data, $contentType); try { $options = $this->createHttpClientOption(); @@ -7128,9 +7762,16 @@ public function auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7141,19 +7782,37 @@ public function auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('array' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('array' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'array', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'array'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7170,7 +7829,7 @@ public function auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'map[string,\Swagger\Client\Model\AuApiPaySlipModel]', + 'array', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7188,13 +7847,14 @@ public function auPayRunPaySlipGetWithHttpInfo($pay_run_id, $business_id, $show_ * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaySlipGetAsync($pay_run_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetAsync($pay_run_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGet'][0]) { - return $this->auPayRunPaySlipGetAsyncWithHttpInfo($pay_run_id, $business_id, $show_all_data) + return $this->auPayRunPaySlipGetAsyncWithHttpInfo($pay_run_id, $business_id, $show_all_data, $contentType) ->then( function ($response) { return $response[0]; @@ -7210,24 +7870,24 @@ function ($response) { * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaySlipGetAsyncWithHttpInfo($pay_run_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetAsyncWithHttpInfo($pay_run_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGet'][0]) { - $returnType = 'map[string,\Swagger\Client\Model\AuApiPaySlipModel]'; - $request = $this->auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_all_data); + $returnType = 'array'; + $request = $this->auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_all_data, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7250,7 +7910,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7262,18 +7922,21 @@ function ($exception) { * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunPaySlipGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7281,6 +7944,8 @@ protected function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_al ); } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/payslips'; $formParams = []; $queryParams = []; @@ -7289,9 +7954,15 @@ protected function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_al $multipart = false; // query params - if ($show_all_data !== null) { - $queryParams['showAllData'] = ObjectSerializer::toQueryValue($show_all_data); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $show_all_data, + 'showAllData', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -7310,53 +7981,35 @@ protected function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_al ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7377,10 +8030,11 @@ protected function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_al $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7395,14 +8049,15 @@ protected function auPayRunPaySlipGetRequest($pay_run_id, $business_id, $show_al * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) * @param bool $show_all_data show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuApiPaySlipModel + * @return \OpenAPI\Client\Model\AuApiPaySlipModel */ - public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId($pay_run_id, $employee_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId($pay_run_id, $employee_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'][0]) { - list($response) = $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data); + list($response) = $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data, $contentType); return $response; } @@ -7415,15 +8070,15 @@ public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaysl * @param int $employee_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuApiPaySlipModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuApiPaySlipModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\AuApiPaySlipModel'; - $request = $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $show_all_data); + $request = $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $show_all_data, $contentType); try { $options = $this->createHttpClientOption(); @@ -7432,9 +8087,16 @@ public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaysl } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7445,19 +8107,37 @@ public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaysl sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuApiPaySlipModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuApiPaySlipModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuApiPaySlipModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuApiPaySlipModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7474,7 +8154,7 @@ public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaysl case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuApiPaySlipModel', + '\OpenAPI\Client\Model\AuApiPaySlipModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7493,13 +8173,14 @@ public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaysl * @param int $employee_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'][0]) { - return $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data) + return $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data, $contentType) ->then( function ($response) { return $response[0]; @@ -7516,24 +8197,24 @@ function ($response) { * @param int $employee_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\AuApiPaySlipModel'; - $request = $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $show_all_data); + $returnType = '\OpenAPI\Client\Model\AuApiPaySlipModel'; + $request = $this->auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $show_all_data, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7556,7 +8237,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7569,24 +8250,28 @@ function ($exception) { * @param int $employee_id (required) * @param string $business_id (required) * @param bool $show_all_data (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $show_all_data = 'false') + public function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $show_all_data = false, string $contentType = self::contentTypes['auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPayslipsByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7594,6 +8279,8 @@ protected function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPa ); } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/payslips/{employeeId}'; $formParams = []; $queryParams = []; @@ -7602,9 +8289,15 @@ protected function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPa $multipart = false; // query params - if ($show_all_data !== null) { - $queryParams['showAllData'] = ObjectSerializer::toQueryValue($show_all_data); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $show_all_data, + 'showAllData', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -7631,53 +8324,35 @@ protected function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPa ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7698,10 +8373,11 @@ protected function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPa $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7714,14 +8390,15 @@ protected function auPayRunPaySlipGetApiV2BusinessByBusinessIdPayrunByPayRunIdPa * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPayments'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuBankPaymentModel[] + * @return \OpenAPI\Client\Model\AuBankPaymentModel[] */ - public function auPayRunPayments($pay_run_id, $business_id) + public function auPayRunPayments($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunPayments'][0]) { - list($response) = $this->auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -7732,15 +8409,15 @@ public function auPayRunPayments($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPayments'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuBankPaymentModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuBankPaymentModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id) + public function auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunPayments'][0]) { - $returnType = '\Swagger\Client\Model\AuBankPaymentModel[]'; - $request = $this->auPayRunPaymentsRequest($pay_run_id, $business_id); + $request = $this->auPayRunPaymentsRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7749,9 +8426,16 @@ public function auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + (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 ); } @@ -7762,19 +8446,37 @@ public function auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuBankPaymentModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuBankPaymentModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuBankPaymentModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuBankPaymentModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7791,7 +8493,7 @@ public function auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuBankPaymentModel[]', + '\OpenAPI\Client\Model\AuBankPaymentModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7808,13 +8510,14 @@ public function auPayRunPaymentsWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPayments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaymentsAsync($pay_run_id, $business_id) + public function auPayRunPaymentsAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunPayments'][0]) { - return $this->auPayRunPaymentsAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunPaymentsAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7829,24 +8532,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPayments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPaymentsAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunPaymentsAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunPayments'][0]) { - $returnType = '\Swagger\Client\Model\AuBankPaymentModel[]'; - $request = $this->auPayRunPaymentsRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuBankPaymentModel[]'; + $request = $this->auPayRunPaymentsRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7869,7 +8572,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7880,18 +8583,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPayments'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunPaymentsRequest($pay_run_id, $business_id) + public function auPayRunPaymentsRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunPayments'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunPayments' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7899,6 +8605,7 @@ protected function auPayRunPaymentsRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/payments'; $formParams = []; $queryParams = []; @@ -7907,6 +8614,7 @@ protected function auPayRunPaymentsRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -7924,53 +8632,35 @@ protected function auPayRunPaymentsRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7991,10 +8681,11 @@ protected function auPayRunPaymentsRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8005,16 +8696,17 @@ protected function auPayRunPaymentsRequest($pay_run_id, $business_id) * * Create Pay Run * - * @param \Swagger\Client\Model\PayRunCreateRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunModel + * @return \OpenAPI\Client\Model\PayRunModel */ - public function auPayRunPost($request, $business_id) + public function auPayRunPost($business_id, $request, string $contentType = self::contentTypes['auPayRunPost'][0]) { - list($response) = $this->auPayRunPostWithHttpInfo($request, $business_id); + list($response) = $this->auPayRunPostWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -8023,17 +8715,17 @@ public function auPayRunPost($request, $business_id) * * Create Pay Run * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunPostWithHttpInfo($request, $business_id) + public function auPayRunPostWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auPayRunPost'][0]) { - $returnType = '\Swagger\Client\Model\PayRunModel'; - $request = $this->auPayRunPostRequest($request, $business_id); + $request = $this->auPayRunPostRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -8042,9 +8734,16 @@ public function auPayRunPostWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8055,19 +8754,37 @@ public function auPayRunPostWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8084,7 +8801,7 @@ public function auPayRunPostWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunModel', + '\OpenAPI\Client\Model\PayRunModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8099,15 +8816,16 @@ public function auPayRunPostWithHttpInfo($request, $business_id) * * Create Pay Run * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPostAsync($request, $business_id) + public function auPayRunPostAsync($business_id, $request, string $contentType = self::contentTypes['auPayRunPost'][0]) { - return $this->auPayRunPostAsyncWithHttpInfo($request, $business_id) + return $this->auPayRunPostAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -8120,26 +8838,26 @@ function ($response) { * * Create Pay Run * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunPostAsyncWithHttpInfo($request, $business_id) + public function auPayRunPostAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auPayRunPost'][0]) { - $returnType = '\Swagger\Client\Model\PayRunModel'; - $request = $this->auPayRunPostRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunModel'; + $request = $this->auPayRunPostRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8162,7 +8880,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8171,20 +8889,16 @@ function ($exception) { /** * Create request for operation 'auPayRunPost' * - * @param \Swagger\Client\Model\PayRunCreateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunCreateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunPostRequest($request, $business_id) + public function auPayRunPostRequest($business_id, $request, string $contentType = self::contentTypes['auPayRunPost'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auPayRunPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8192,6 +8906,14 @@ protected function auPayRunPostRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auPayRunPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun'; $formParams = []; $queryParams = []; @@ -8200,6 +8922,7 @@ protected function auPayRunPostRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -8209,56 +8932,42 @@ protected function auPayRunPostRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8279,10 +8988,11 @@ protected function auPayRunPostRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8295,14 +9005,15 @@ protected function auPayRunPostRequest($request, $business_id) * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRecalculate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunRecalculate($pay_run_id, $business_id) + public function auPayRunRecalculate($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunRecalculate'][0]) { - $this->auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id); + $this->auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id, $contentType); } /** @@ -8312,15 +9023,15 @@ public function auPayRunRecalculate($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRecalculate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id) + public function auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunRecalculate'][0]) { - $returnType = ''; - $request = $this->auPayRunRecalculateRequest($pay_run_id, $business_id); + $request = $this->auPayRunRecalculateRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8329,9 +9040,16 @@ public function auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8342,11 +9060,11 @@ public function auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -8366,13 +9084,14 @@ public function auPayRunRecalculateWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRecalculate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunRecalculateAsync($pay_run_id, $business_id) + public function auPayRunRecalculateAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunRecalculate'][0]) { - return $this->auPayRunRecalculateAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunRecalculateAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8387,14 +9106,15 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRecalculate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunRecalculateAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunRecalculateAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunRecalculate'][0]) { $returnType = ''; - $request = $this->auPayRunRecalculateRequest($pay_run_id, $business_id); + $request = $this->auPayRunRecalculateRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8413,7 +9133,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8424,18 +9144,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRecalculate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunRecalculateRequest($pay_run_id, $business_id) + public function auPayRunRecalculateRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunRecalculate'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunRecalculate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8443,6 +9166,7 @@ protected function auPayRunRecalculateRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/recalculate'; $formParams = []; $queryParams = []; @@ -8451,6 +9175,7 @@ protected function auPayRunRecalculateRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -8468,53 +9193,35 @@ protected function auPayRunRecalculateRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8535,10 +9242,11 @@ protected function auPayRunRecalculateRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8552,14 +9260,15 @@ protected function auPayRunRecalculateRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRemoveEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunRemoveEmployee($pay_run_id, $employee_id, $business_id) + public function auPayRunRemoveEmployee($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunRemoveEmployee'][0]) { - $this->auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id); + $this->auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); } /** @@ -8570,15 +9279,15 @@ public function auPayRunRemoveEmployee($pay_run_id, $employee_id, $business_id) * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRemoveEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunRemoveEmployee'][0]) { - $returnType = ''; - $request = $this->auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8587,9 +9296,16 @@ public function auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8600,11 +9316,11 @@ public function auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -8625,13 +9341,14 @@ public function auPayRunRemoveEmployeeWithHttpInfo($pay_run_id, $employee_id, $b * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRemoveEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunRemoveEmployeeAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunRemoveEmployeeAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunRemoveEmployee'][0]) { - return $this->auPayRunRemoveEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunRemoveEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8647,14 +9364,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRemoveEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunRemoveEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunRemoveEmployeeAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunRemoveEmployee'][0]) { $returnType = ''; - $request = $this->auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8673,7 +9391,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8685,24 +9403,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunRemoveEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunRemoveEmployee'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunRemoveEmployee' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunRemoveEmployee' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8710,6 +9432,7 @@ protected function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $bus ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/employee/{employeeId}'; $formParams = []; $queryParams = []; @@ -8718,6 +9441,7 @@ protected function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $bus $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -8743,53 +9467,35 @@ protected function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $bus ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8810,10 +9516,11 @@ protected function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8827,14 +9534,15 @@ protected function auPayRunRemoveEmployeeRequest($pay_run_id, $employee_id, $bus * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunTaxAdjustmentsDelete($pay_run_id, $id, $business_id) + public function auPayRunTaxAdjustmentsDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsDelete'][0]) { - $this->auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -8845,15 +9553,15 @@ public function auPayRunTaxAdjustmentsDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsDelete'][0]) { - $returnType = ''; - $request = $this->auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8862,9 +9570,16 @@ public function auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8875,11 +9590,11 @@ public function auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -8900,13 +9615,14 @@ public function auPayRunTaxAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $busi * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsDeleteAsync($pay_run_id, $id, $business_id) + public function auPayRunTaxAdjustmentsDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsDelete'][0]) { - return $this->auPayRunTaxAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->auPayRunTaxAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8922,14 +9638,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function auPayRunTaxAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsDelete'][0]) { $returnType = ''; - $request = $this->auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8948,7 +9665,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8960,24 +9677,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $business_id) + public function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTaxAdjustmentsDelete' ); } + // 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 auPayRunTaxAdjustmentsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8985,6 +9706,7 @@ protected function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $busine ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/paygadjustments'; $formParams = []; $queryParams = []; @@ -8993,9 +9715,15 @@ protected function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $busine $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -9014,53 +9742,35 @@ protected function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9081,10 +9791,11 @@ protected function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9097,14 +9808,15 @@ protected function auPayRunTaxAdjustmentsDeleteRequest($pay_run_id, $id, $busine * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunPaygAdjustmentResponse + * @return \OpenAPI\Client\Model\PayRunPaygAdjustmentResponse */ - public function auPayRunTaxAdjustmentsGet($pay_run_id, $business_id) + public function auPayRunTaxAdjustmentsGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGet'][0]) { - list($response) = $this->auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -9115,15 +9827,15 @@ public function auPayRunTaxAdjustmentsGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunPaygAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunPaygAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id) + public function auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunPaygAdjustmentResponse'; - $request = $this->auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id); + $request = $this->auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -9132,9 +9844,16 @@ public function auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9145,19 +9864,37 @@ public function auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9174,7 +9911,7 @@ public function auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunPaygAdjustmentResponse', + '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9191,13 +9928,14 @@ public function auPayRunTaxAdjustmentsGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsGetAsync($pay_run_id, $business_id) + public function auPayRunTaxAdjustmentsGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGet'][0]) { - return $this->auPayRunTaxAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunTaxAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -9212,24 +9950,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunTaxAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunPaygAdjustmentResponse'; - $request = $this->auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse'; + $request = $this->auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9252,7 +9990,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9263,18 +10001,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id) + public function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTaxAdjustmentsGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9282,6 +10023,7 @@ protected function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/paygadjustments'; $formParams = []; $queryParams = []; @@ -9290,6 +10032,7 @@ protected function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -9307,53 +10050,35 @@ protected function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9374,10 +10099,11 @@ protected function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9391,14 +10117,15 @@ protected function auPayRunTaxAdjustmentsGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunPaygAdjustmentResponse + * @return \OpenAPI\Client\Model\PayRunPaygAdjustmentResponse */ - public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId($pay_run_id, $employee_id, $business_id) + public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'][0]) { - list($response) = $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -9410,15 +10137,15 @@ public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRun * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunPaygAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunPaygAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\PayRunPaygAdjustmentResponse'; - $request = $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -9427,9 +10154,16 @@ public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRun } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9440,19 +10174,37 @@ public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRun sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9469,7 +10221,7 @@ public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRun case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunPaygAdjustmentResponse', + '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9487,13 +10239,14 @@ public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRun * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'][0]) { - return $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -9509,24 +10262,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\PayRunPaygAdjustmentResponse'; - $request = $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunPaygAdjustmentResponse'; + $request = $this->auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9549,7 +10302,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9561,24 +10314,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPayRunIdPaygadjustmentsByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9586,6 +10343,7 @@ protected function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPay ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/paygadjustments/{employeeId}'; $formParams = []; $queryParams = []; @@ -9594,6 +10352,7 @@ protected function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPay $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -9619,53 +10378,35 @@ protected function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPay ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9686,10 +10427,11 @@ protected function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPay $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9701,16 +10443,17 @@ protected function auPayRunTaxAdjustmentsGetApiV2BusinessByBusinessIdPayrunByPay * Create PAYG Adjustments * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunPaygAdjustmentRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunPaygAdjustmentRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunTaxAdjustmentsPost($pay_run_id, $request, $business_id) + public function auPayRunTaxAdjustmentsPost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsPost'][0]) { - $this->auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $request, $business_id); + $this->auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -9719,17 +10462,17 @@ public function auPayRunTaxAdjustmentsPost($pay_run_id, $request, $business_id) * Create PAYG Adjustments * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsPost'][0]) { - $returnType = ''; - $request = $this->auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunTaxAdjustmentsPostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -9738,9 +10481,16 @@ public function auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $request, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -9751,11 +10501,11 @@ public function auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $request, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -9774,15 +10524,16 @@ public function auPayRunTaxAdjustmentsPostWithHttpInfo($pay_run_id, $request, $b * Create PAYG Adjustments * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsPostAsync($pay_run_id, $request, $business_id) + public function auPayRunTaxAdjustmentsPostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsPost'][0]) { - return $this->auPayRunTaxAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->auPayRunTaxAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -9796,16 +10547,17 @@ function ($response) { * Create PAYG Adjustments * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTaxAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunTaxAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsPost'][0]) { $returnType = ''; - $request = $this->auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunTaxAdjustmentsPostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9824,7 +10576,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9834,26 +10586,23 @@ function ($exception) { * Create request for operation 'auPayRunTaxAdjustmentsPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunPaygAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTaxAdjustmentsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $business_id) + public function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTaxAdjustmentsPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTaxAdjustmentsPost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auPayRunTaxAdjustmentsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9861,6 +10610,14 @@ protected function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $bus ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auPayRunTaxAdjustmentsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/paygadjustments'; $formParams = []; $queryParams = []; @@ -9869,6 +10626,7 @@ protected function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $bus $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -9886,56 +10644,42 @@ protected function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $bus ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9956,10 +10700,11 @@ protected function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -9971,16 +10716,17 @@ protected function auPayRunTaxAdjustmentsPostRequest($pay_run_id, $request, $bus * Terminate Employee in Pay Run * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\TerminateEmployeeRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\TerminateEmployeeRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTerminatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunTerminatePost($pay_run_id, $request, $business_id) + public function auPayRunTerminatePost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTerminatePost'][0]) { - $this->auPayRunTerminatePostWithHttpInfo($pay_run_id, $request, $business_id); + $this->auPayRunTerminatePostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -9989,17 +10735,17 @@ public function auPayRunTerminatePost($pay_run_id, $request, $business_id) * Terminate Employee in Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\TerminateEmployeeRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TerminateEmployeeRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTerminatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTerminatePostWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunTerminatePostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTerminatePost'][0]) { - $returnType = ''; - $request = $this->auPayRunTerminatePostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunTerminatePostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -10008,9 +10754,16 @@ public function auPayRunTerminatePostWithHttpInfo($pay_run_id, $request, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10021,11 +10774,11 @@ public function auPayRunTerminatePostWithHttpInfo($pay_run_id, $request, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -10044,15 +10797,16 @@ public function auPayRunTerminatePostWithHttpInfo($pay_run_id, $request, $busine * Terminate Employee in Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\TerminateEmployeeRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TerminateEmployeeRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTerminatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTerminatePostAsync($pay_run_id, $request, $business_id) + public function auPayRunTerminatePostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTerminatePost'][0]) { - return $this->auPayRunTerminatePostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->auPayRunTerminatePostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -10066,16 +10820,17 @@ function ($response) { * Terminate Employee in Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\TerminateEmployeeRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TerminateEmployeeRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTerminatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTerminatePostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function auPayRunTerminatePostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTerminatePost'][0]) { $returnType = ''; - $request = $this->auPayRunTerminatePostRequest($pay_run_id, $request, $business_id); + $request = $this->auPayRunTerminatePostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10094,7 +10849,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10104,26 +10859,23 @@ function ($exception) { * Create request for operation 'auPayRunTerminatePost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\TerminateEmployeeRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TerminateEmployeeRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTerminatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTerminatePostRequest($pay_run_id, $request, $business_id) + public function auPayRunTerminatePostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['auPayRunTerminatePost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTerminatePost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auPayRunTerminatePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -10131,6 +10883,14 @@ protected function auPayRunTerminatePostRequest($pay_run_id, $request, $business ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auPayRunTerminatePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/terminate'; $formParams = []; $queryParams = []; @@ -10139,6 +10899,7 @@ protected function auPayRunTerminatePostRequest($pay_run_id, $request, $business $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -10156,56 +10917,42 @@ protected function auPayRunTerminatePostRequest($pay_run_id, $request, $business ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10226,10 +10973,11 @@ protected function auPayRunTerminatePostRequest($pay_run_id, $request, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10243,14 +10991,15 @@ protected function auPayRunTerminatePostRequest($pay_run_id, $request, $business * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'][0]) { - $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id); + $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); } /** @@ -10261,15 +11010,15 @@ public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNot * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'][0]) { - $returnType = ''; - $request = $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -10278,9 +11027,16 @@ public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNot } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10291,11 +11047,11 @@ public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNot sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -10316,13 +11072,14 @@ public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNot * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'][0]) { - return $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -10338,14 +11095,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'][0]) { $returnType = ''; - $request = $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10364,7 +11122,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10376,24 +11134,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunIdNotationByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -10401,6 +11163,7 @@ protected function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunId ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/notation/{employeeId}'; $formParams = []; $queryParams = []; @@ -10409,6 +11172,7 @@ protected function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunId $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -10434,53 +11198,35 @@ protected function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunId ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10501,10 +11247,11 @@ protected function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunId $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10517,14 +11264,15 @@ protected function auPayRunTotalsDeleteApiV2BusinessByBusinessIdPayrunByPayRunId * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunTotalResponse + * @return \OpenAPI\Client\Model\AuPayRunTotalResponse */ - public function auPayRunTotalsGet($pay_run_id, $business_id) + public function auPayRunTotalsGet($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGet'][0]) { - list($response) = $this->auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -10535,15 +11283,15 @@ public function auPayRunTotalsGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunTotalResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunTotalResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id) + public function auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunTotalResponse'; - $request = $this->auPayRunTotalsGetRequest($pay_run_id, $business_id); + $request = $this->auPayRunTotalsGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -10552,9 +11300,16 @@ public function auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10565,19 +11320,37 @@ public function auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunTotalResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunTotalResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunTotalResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunTotalResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10594,7 +11367,7 @@ public function auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunTotalResponse', + '\OpenAPI\Client\Model\AuPayRunTotalResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10611,13 +11384,14 @@ public function auPayRunTotalsGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsGetAsync($pay_run_id, $business_id) + public function auPayRunTotalsGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGet'][0]) { - return $this->auPayRunTotalsGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->auPayRunTotalsGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -10632,24 +11406,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function auPayRunTotalsGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunTotalResponse'; - $request = $this->auPayRunTotalsGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunTotalResponse'; + $request = $this->auPayRunTotalsGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10672,7 +11446,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10683,18 +11457,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTotalsGetRequest($pay_run_id, $business_id) + public function auPayRunTotalsGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTotalsGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -10702,6 +11479,7 @@ protected function auPayRunTotalsGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/totals'; $formParams = []; $queryParams = []; @@ -10710,6 +11488,7 @@ protected function auPayRunTotalsGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -10727,53 +11506,35 @@ protected function auPayRunTotalsGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -10794,10 +11555,11 @@ protected function auPayRunTotalsGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -10811,14 +11573,15 @@ protected function auPayRunTotalsGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunTotalResponse + * @return \OpenAPI\Client\Model\AuPayRunTotalResponse */ - public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'][0]) { - list($response) = $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -10830,15 +11593,15 @@ public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotals * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunTotalResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunTotalResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunTotalResponse'; - $request = $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $request = $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -10847,9 +11610,16 @@ public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotals } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -10860,19 +11630,37 @@ public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotals sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunTotalResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunTotalResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunTotalResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunTotalResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10889,7 +11677,7 @@ public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotals case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunTotalResponse', + '\OpenAPI\Client\Model\AuPayRunTotalResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10907,13 +11695,14 @@ public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotals * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdAsync($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'][0]) { - return $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -10929,24 +11718,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunTotalResponse'; - $request = $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunTotalResponse'; + $request = $this->auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -10969,7 +11758,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -10981,24 +11770,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id) + public function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTotalsByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -11006,6 +11799,7 @@ protected function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTot ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/totals/{employeeId}'; $formParams = []; $queryParams = []; @@ -11014,6 +11808,7 @@ protected function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTot $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -11039,53 +11834,35 @@ protected function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTot ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11106,10 +11883,11 @@ protected function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTot $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11122,16 +11900,17 @@ protected function auPayRunTotalsGetApiV2BusinessByBusinessIdPayrunByPayRunIdTot * * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) - * @param \Swagger\Client\Model\PayRunTotalNotationModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PayRunTotalNotationModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsNotation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunTotalNotationModel + * @return \OpenAPI\Client\Model\PayRunTotalNotationModel */ - public function auPayRunTotalsNotation($pay_run_id, $employee_id, $model, $business_id) + public function auPayRunTotalsNotation($pay_run_id, $employee_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunTotalsNotation'][0]) { - list($response) = $this->auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $model, $business_id); + list($response) = $this->auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $business_id, $model, $contentType); return $response; } @@ -11142,17 +11921,17 @@ public function auPayRunTotalsNotation($pay_run_id, $employee_id, $model, $busin * * @param int $pay_run_id (required) * @param int $employee_id (required) - * @param \Swagger\Client\Model\PayRunTotalNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunTotalNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsNotation'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunTotalNotationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunTotalNotationModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $model, $business_id) + public function auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunTotalsNotation'][0]) { - $returnType = '\Swagger\Client\Model\PayRunTotalNotationModel'; - $request = $this->auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $model, $business_id); + $request = $this->auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -11161,9 +11940,16 @@ public function auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $m } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11174,19 +11960,37 @@ public function auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $m sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunTotalNotationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunTotalNotationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunTotalNotationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunTotalNotationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11203,7 +12007,7 @@ public function auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $m case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunTotalNotationModel', + '\OpenAPI\Client\Model\PayRunTotalNotationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11220,15 +12024,16 @@ public function auPayRunTotalsNotationWithHttpInfo($pay_run_id, $employee_id, $m * * @param int $pay_run_id (required) * @param int $employee_id (required) - * @param \Swagger\Client\Model\PayRunTotalNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunTotalNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsNotationAsync($pay_run_id, $employee_id, $model, $business_id) + public function auPayRunTotalsNotationAsync($pay_run_id, $employee_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunTotalsNotation'][0]) { - return $this->auPayRunTotalsNotationAsyncWithHttpInfo($pay_run_id, $employee_id, $model, $business_id) + return $this->auPayRunTotalsNotationAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -11243,26 +12048,26 @@ function ($response) { * * @param int $pay_run_id (required) * @param int $employee_id (required) - * @param \Swagger\Client\Model\PayRunTotalNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunTotalNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayRunTotalsNotationAsyncWithHttpInfo($pay_run_id, $employee_id, $model, $business_id) + public function auPayRunTotalsNotationAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunTotalsNotation'][0]) { - $returnType = '\Swagger\Client\Model\PayRunTotalNotationModel'; - $request = $this->auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunTotalNotationModel'; + $request = $this->auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11285,7 +12090,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11296,32 +12101,30 @@ function ($exception) { * * @param int $pay_run_id (required) * @param int $employee_id (required) - * @param \Swagger\Client\Model\PayRunTotalNotationModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunTotalNotationModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayRunTotalsNotation'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $model, $business_id) + public function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $business_id, $model, string $contentType = self::contentTypes['auPayRunTotalsNotation'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling auPayRunTotalsNotation' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auPayRunTotalsNotation' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auPayRunTotalsNotation' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -11329,6 +12132,14 @@ protected function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $mod ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auPayRunTotalsNotation' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/notation/{employeeId}'; $formParams = []; $queryParams = []; @@ -11337,6 +12148,7 @@ protected function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $mod $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -11362,56 +12174,42 @@ protected function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $mod ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11432,10 +12230,11 @@ protected function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $mod $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11448,14 +12247,15 @@ protected function auPayRunTotalsNotationRequest($pay_run_id, $employee_id, $mod * * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRunTotalGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunTotalModel[] + * @return \OpenAPI\Client\Model\PayRunTotalModel[] */ - public function employeePayRunTotalGet($employee_id, $business_id) + public function employeePayRunTotalGet($employee_id, $business_id, string $contentType = self::contentTypes['employeePayRunTotalGet'][0]) { - list($response) = $this->employeePayRunTotalGetWithHttpInfo($employee_id, $business_id); + list($response) = $this->employeePayRunTotalGetWithHttpInfo($employee_id, $business_id, $contentType); return $response; } @@ -11466,15 +12266,15 @@ public function employeePayRunTotalGet($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRunTotalGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunTotalModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunTotalModel[], HTTP status code, HTTP response headers (array of strings) */ - public function employeePayRunTotalGetWithHttpInfo($employee_id, $business_id) + public function employeePayRunTotalGetWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeePayRunTotalGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunTotalModel[]'; - $request = $this->employeePayRunTotalGetRequest($employee_id, $business_id); + $request = $this->employeePayRunTotalGetRequest($employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -11483,9 +12283,16 @@ public function employeePayRunTotalGetWithHttpInfo($employee_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11496,19 +12303,37 @@ public function employeePayRunTotalGetWithHttpInfo($employee_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunTotalModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunTotalModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunTotalModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunTotalModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11525,7 +12350,7 @@ public function employeePayRunTotalGetWithHttpInfo($employee_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunTotalModel[]', + '\OpenAPI\Client\Model\PayRunTotalModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11542,13 +12367,14 @@ public function employeePayRunTotalGetWithHttpInfo($employee_id, $business_id) * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRunTotalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRunTotalGetAsync($employee_id, $business_id) + public function employeePayRunTotalGetAsync($employee_id, $business_id, string $contentType = self::contentTypes['employeePayRunTotalGet'][0]) { - return $this->employeePayRunTotalGetAsyncWithHttpInfo($employee_id, $business_id) + return $this->employeePayRunTotalGetAsyncWithHttpInfo($employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -11563,24 +12389,24 @@ function ($response) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRunTotalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function employeePayRunTotalGetAsyncWithHttpInfo($employee_id, $business_id) + public function employeePayRunTotalGetAsyncWithHttpInfo($employee_id, $business_id, string $contentType = self::contentTypes['employeePayRunTotalGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunTotalModel[]'; - $request = $this->employeePayRunTotalGetRequest($employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunTotalModel[]'; + $request = $this->employeePayRunTotalGetRequest($employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -11603,7 +12429,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11614,18 +12440,21 @@ function ($exception) { * * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['employeePayRunTotalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function employeePayRunTotalGetRequest($employee_id, $business_id) + public function employeePayRunTotalGetRequest($employee_id, $business_id, string $contentType = self::contentTypes['employeePayRunTotalGet'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling employeePayRunTotalGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -11633,6 +12462,7 @@ protected function employeePayRunTotalGetRequest($employee_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/employee/{employeeId}/payruntotals'; $formParams = []; $queryParams = []; @@ -11641,6 +12471,7 @@ protected function employeePayRunTotalGetRequest($employee_id, $business_id) $multipart = false; + // path params if ($employee_id !== null) { $resourcePath = str_replace( @@ -11658,53 +12489,35 @@ protected function employeePayRunTotalGetRequest($employee_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11725,10 +12538,11 @@ protected function employeePayRunTotalGetRequest($employee_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11741,14 +12555,15 @@ protected function employeePayRunTotalGetRequest($employee_id, $business_id) * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunApprovalStartApprovalProcess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunApprovalStartApprovalProcess($pay_run_id, $business_id) + public function payRunApprovalStartApprovalProcess($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunApprovalStartApprovalProcess'][0]) { - $this->payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $business_id); + $this->payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $business_id, $contentType); } /** @@ -11758,15 +12573,15 @@ public function payRunApprovalStartApprovalProcess($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunApprovalStartApprovalProcess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $business_id) + public function payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunApprovalStartApprovalProcess'][0]) { - $returnType = ''; - $request = $this->payRunApprovalStartApprovalProcessRequest($pay_run_id, $business_id); + $request = $this->payRunApprovalStartApprovalProcessRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -11775,9 +12590,16 @@ public function payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -11788,11 +12610,11 @@ public function payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -11812,13 +12634,14 @@ public function payRunApprovalStartApprovalProcessWithHttpInfo($pay_run_id, $bus * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunApprovalStartApprovalProcess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunApprovalStartApprovalProcessAsync($pay_run_id, $business_id) + public function payRunApprovalStartApprovalProcessAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunApprovalStartApprovalProcess'][0]) { - return $this->payRunApprovalStartApprovalProcessAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->payRunApprovalStartApprovalProcessAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -11833,14 +12656,15 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunApprovalStartApprovalProcess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunApprovalStartApprovalProcessAsyncWithHttpInfo($pay_run_id, $business_id) + public function payRunApprovalStartApprovalProcessAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunApprovalStartApprovalProcess'][0]) { $returnType = ''; - $request = $this->payRunApprovalStartApprovalProcessRequest($pay_run_id, $business_id); + $request = $this->payRunApprovalStartApprovalProcessRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -11859,7 +12683,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -11870,18 +12694,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunApprovalStartApprovalProcess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunApprovalStartApprovalProcessRequest($pay_run_id, $business_id) + public function payRunApprovalStartApprovalProcessRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunApprovalStartApprovalProcess'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunApprovalStartApprovalProcess' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -11889,6 +12716,7 @@ protected function payRunApprovalStartApprovalProcessRequest($pay_run_id, $busin ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/approval/start'; $formParams = []; $queryParams = []; @@ -11897,6 +12725,7 @@ protected function payRunApprovalStartApprovalProcessRequest($pay_run_id, $busin $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -11914,53 +12743,35 @@ protected function payRunApprovalStartApprovalProcessRequest($pay_run_id, $busin ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -11981,10 +12792,11 @@ protected function payRunApprovalStartApprovalProcessRequest($pay_run_id, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -11998,14 +12810,15 @@ protected function payRunApprovalStartApprovalProcessRequest($pay_run_id, $busin * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunEmployeeExpensesDelete($pay_run_id, $id, $business_id) + public function payRunEmployeeExpensesDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesDelete'][0]) { - $this->payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -12016,15 +12829,15 @@ public function payRunEmployeeExpensesDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesDelete'][0]) { - $returnType = ''; - $request = $this->payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -12033,9 +12846,16 @@ public function payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12046,11 +12866,11 @@ public function payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -12071,13 +12891,14 @@ public function payRunEmployeeExpensesDeleteWithHttpInfo($pay_run_id, $id, $busi * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesDeleteAsync($pay_run_id, $id, $business_id) + public function payRunEmployeeExpensesDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesDelete'][0]) { - return $this->payRunEmployeeExpensesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->payRunEmployeeExpensesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -12093,14 +12914,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunEmployeeExpensesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesDelete'][0]) { $returnType = ''; - $request = $this->payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12119,7 +12941,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12131,24 +12953,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $business_id) + public function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployeeExpensesDelete' ); } + // 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 payRunEmployeeExpensesDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -12156,6 +12982,7 @@ protected function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $busine ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/EmployeeExpenses'; $formParams = []; $queryParams = []; @@ -12164,9 +12991,15 @@ protected function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $busine $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -12185,53 +13018,35 @@ protected function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12252,10 +13067,11 @@ protected function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12268,14 +13084,15 @@ protected function payRunEmployeeExpensesDeleteRequest($pay_run_id, $id, $busine * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunEmployeeExpenseResponse + * @return \OpenAPI\Client\Model\PayRunEmployeeExpenseResponse */ - public function payRunEmployeeExpensesGet($pay_run_id, $business_id) + public function payRunEmployeeExpensesGet($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGet'][0]) { - list($response) = $this->payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -12286,15 +13103,15 @@ public function payRunEmployeeExpensesGet($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunEmployeeExpenseResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunEmployeeExpenseResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id) + public function payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployeeExpenseResponse'; - $request = $this->payRunEmployeeExpensesGetRequest($pay_run_id, $business_id); + $request = $this->payRunEmployeeExpensesGetRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -12303,9 +13120,16 @@ public function payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12316,19 +13140,37 @@ public function payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12345,7 +13187,7 @@ public function payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunEmployeeExpenseResponse', + '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12362,13 +13204,14 @@ public function payRunEmployeeExpensesGetWithHttpInfo($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesGetAsync($pay_run_id, $business_id) + public function payRunEmployeeExpensesGetAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGet'][0]) { - return $this->payRunEmployeeExpensesGetAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->payRunEmployeeExpensesGetAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -12383,24 +13226,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesGetAsyncWithHttpInfo($pay_run_id, $business_id) + public function payRunEmployeeExpensesGetAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployeeExpenseResponse'; - $request = $this->payRunEmployeeExpensesGetRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse'; + $request = $this->payRunEmployeeExpensesGetRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12423,7 +13266,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12434,18 +13277,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id) + public function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployeeExpensesGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -12453,6 +13299,7 @@ protected function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/EmployeeExpenses'; $formParams = []; $queryParams = []; @@ -12461,6 +13308,7 @@ protected function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -12478,53 +13326,35 @@ protected function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12545,10 +13375,11 @@ protected function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12562,14 +13393,15 @@ protected function payRunEmployeeExpensesGetRequest($pay_run_id, $business_id) * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunEmployeeExpenseResponse + * @return \OpenAPI\Client\Model\PayRunEmployeeExpenseResponse */ - public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId($pay_run_id, $employee_id, $business_id) + public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'][0]) { - list($response) = $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -12581,15 +13413,15 @@ public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRun * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunEmployeeExpenseResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunEmployeeExpenseResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployeeExpenseResponse'; - $request = $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $request = $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -12598,9 +13430,16 @@ public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRun } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12611,19 +13450,37 @@ public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRun sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12640,7 +13497,7 @@ public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRun case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunEmployeeExpenseResponse', + '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12658,13 +13515,14 @@ public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRun * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdAsync($pay_run_id, $employee_id, $business_id) + public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'][0]) { - return $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -12680,24 +13538,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployeeExpenseResponse'; - $request = $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunEmployeeExpenseResponse'; + $request = $this->payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -12720,7 +13578,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -12732,24 +13590,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id) + public function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPayRunIdEmployeeExpensesByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -12757,6 +13619,7 @@ protected function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPay ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/EmployeeExpenses/{employeeId}'; $formParams = []; $queryParams = []; @@ -12765,6 +13628,7 @@ protected function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPay $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -12790,53 +13654,35 @@ protected function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPay ); } - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -12857,10 +13703,11 @@ protected function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPay $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -12872,16 +13719,17 @@ protected function payRunEmployeeExpensesGetApiV2BusinessByBusinessIdPayrunByPay * Create Employee Expenses * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployeeExpenseRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployeeExpenseRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunEmployeeExpensesPost($pay_run_id, $request, $business_id) + public function payRunEmployeeExpensesPost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployeeExpensesPost'][0]) { - $this->payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $request, $business_id); + $this->payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -12890,17 +13738,17 @@ public function payRunEmployeeExpensesPost($pay_run_id, $request, $business_id) * Create Employee Expenses * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployeeExpensesPost'][0]) { - $returnType = ''; - $request = $this->payRunEmployeeExpensesPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunEmployeeExpensesPostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -12909,9 +13757,16 @@ public function payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $request, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -12922,11 +13777,11 @@ public function payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $request, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -12945,15 +13800,16 @@ public function payRunEmployeeExpensesPostWithHttpInfo($pay_run_id, $request, $b * Create Employee Expenses * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesPostAsync($pay_run_id, $request, $business_id) + public function payRunEmployeeExpensesPostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployeeExpensesPost'][0]) { - return $this->payRunEmployeeExpensesPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->payRunEmployeeExpensesPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -12967,16 +13823,17 @@ function ($response) { * Create Employee Expenses * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployeeExpensesPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunEmployeeExpensesPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployeeExpensesPost'][0]) { $returnType = ''; - $request = $this->payRunEmployeeExpensesPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunEmployeeExpensesPostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12995,7 +13852,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13005,26 +13862,23 @@ function ($exception) { * Create request for operation 'payRunEmployeeExpensesPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployeeExpenseRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployeeExpensesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployeeExpensesPostRequest($pay_run_id, $request, $business_id) + public function payRunEmployeeExpensesPostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployeeExpensesPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployeeExpensesPost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling payRunEmployeeExpensesPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13032,6 +13886,14 @@ protected function payRunEmployeeExpensesPostRequest($pay_run_id, $request, $bus ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling payRunEmployeeExpensesPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/EmployeeExpenses'; $formParams = []; $queryParams = []; @@ -13040,6 +13902,7 @@ protected function payRunEmployeeExpensesPostRequest($pay_run_id, $request, $bus $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -13057,56 +13920,42 @@ protected function payRunEmployeeExpensesPostRequest($pay_run_id, $request, $bus ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13127,10 +13976,11 @@ protected function payRunEmployeeExpensesPostRequest($pay_run_id, $request, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13144,14 +13994,15 @@ protected function payRunEmployeeExpensesPostRequest($pay_run_id, $request, $bus * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunEmployerLiabilitiesDelete($pay_run_id, $id, $business_id) + public function payRunEmployerLiabilitiesDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesDelete'][0]) { - $this->payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -13162,15 +14013,15 @@ public function payRunEmployerLiabilitiesDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesDelete'][0]) { - $returnType = ''; - $request = $this->payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13179,9 +14030,16 @@ public function payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13192,11 +14050,11 @@ public function payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -13217,13 +14075,14 @@ public function payRunEmployerLiabilitiesDeleteWithHttpInfo($pay_run_id, $id, $b * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesDeleteAsync($pay_run_id, $id, $business_id) + public function payRunEmployerLiabilitiesDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesDelete'][0]) { - return $this->payRunEmployerLiabilitiesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->payRunEmployerLiabilitiesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13239,14 +14098,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunEmployerLiabilitiesDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesDelete'][0]) { $returnType = ''; - $request = $this->payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -13265,7 +14125,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13277,24 +14137,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $business_id) + public function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployerLiabilitiesDelete' ); } + // 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 payRunEmployerLiabilitiesDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13302,6 +14166,7 @@ protected function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $bus ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/employerliabilities'; $formParams = []; $queryParams = []; @@ -13310,9 +14175,15 @@ protected function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $bus $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -13331,53 +14202,35 @@ protected function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $bus ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13398,10 +14251,11 @@ protected function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13415,14 +14269,15 @@ protected function payRunEmployerLiabilitiesDeleteRequest($pay_run_id, $id, $bus * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunEmployerLiabilityResponse + * @return \OpenAPI\Client\Model\PayRunEmployerLiabilityResponse */ - public function payRunEmployerLiabilitiesGet($pay_run_id, $employee_id, $business_id) + public function payRunEmployerLiabilitiesGet($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGet'][0]) { - list($response) = $this->payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -13434,15 +14289,15 @@ public function payRunEmployerLiabilitiesGet($pay_run_id, $employee_id, $busines * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunEmployerLiabilityResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunEmployerLiabilityResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployerLiabilityResponse'; - $request = $this->payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id, $business_id); + $request = $this->payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13451,9 +14306,16 @@ public function payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13464,19 +14326,37 @@ public function payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13493,7 +14373,7 @@ public function payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunEmployerLiabilityResponse', + '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13511,13 +14391,14 @@ public function payRunEmployerLiabilitiesGetWithHttpInfo($pay_run_id, $employee_ * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesGetAsync($pay_run_id, $employee_id, $business_id) + public function payRunEmployerLiabilitiesGetAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGet'][0]) { - return $this->payRunEmployerLiabilitiesGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->payRunEmployerLiabilitiesGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13533,24 +14414,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function payRunEmployerLiabilitiesGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployerLiabilityResponse'; - $request = $this->payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse'; + $request = $this->payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13573,7 +14454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13585,24 +14466,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id, $business_id) + public function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployerLiabilitiesGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling payRunEmployerLiabilitiesGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13610,6 +14495,7 @@ protected function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/employerliabilities/{employeeId}'; $formParams = []; $queryParams = []; @@ -13618,6 +14504,7 @@ protected function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -13643,53 +14530,35 @@ protected function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -13710,10 +14579,11 @@ protected function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -13726,14 +14596,15 @@ protected function payRunEmployerLiabilitiesGetRequest($pay_run_id, $employee_id * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunEmployerLiabilityResponse + * @return \OpenAPI\Client\Model\PayRunEmployerLiabilityResponse */ - public function payRunEmployerLiabilitiesGetAll($pay_run_id, $business_id) + public function payRunEmployerLiabilitiesGetAll($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGetAll'][0]) { - list($response) = $this->payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -13744,15 +14615,15 @@ public function payRunEmployerLiabilitiesGetAll($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunEmployerLiabilityResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunEmployerLiabilityResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $business_id) + public function payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGetAll'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployerLiabilityResponse'; - $request = $this->payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business_id); + $request = $this->payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -13761,9 +14632,16 @@ public function payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -13774,19 +14652,37 @@ public function payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13803,7 +14699,7 @@ public function payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunEmployerLiabilityResponse', + '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13820,13 +14716,14 @@ public function payRunEmployerLiabilitiesGetAllWithHttpInfo($pay_run_id, $busine * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesGetAllAsync($pay_run_id, $business_id) + public function payRunEmployerLiabilitiesGetAllAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGetAll'][0]) { - return $this->payRunEmployerLiabilitiesGetAllAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->payRunEmployerLiabilitiesGetAllAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -13841,24 +14738,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesGetAllAsyncWithHttpInfo($pay_run_id, $business_id) + public function payRunEmployerLiabilitiesGetAllAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGetAll'][0]) { - $returnType = '\Swagger\Client\Model\PayRunEmployerLiabilityResponse'; - $request = $this->payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunEmployerLiabilityResponse'; + $request = $this->payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -13881,7 +14778,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -13892,18 +14789,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business_id) + public function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunEmployerLiabilitiesGetAll'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployerLiabilitiesGetAll' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -13911,6 +14811,7 @@ protected function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/employerliabilities'; $formParams = []; $queryParams = []; @@ -13919,6 +14820,7 @@ protected function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -13936,53 +14838,35 @@ protected function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14003,10 +14887,11 @@ protected function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14018,16 +14903,17 @@ protected function payRunEmployerLiabilitiesGetAllRequest($pay_run_id, $business * Create Employer Liabilities * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployerLiabilityRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployerLiabilityRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunEmployerLiabilitiesPost($pay_run_id, $request, $business_id) + public function payRunEmployerLiabilitiesPost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployerLiabilitiesPost'][0]) { - $this->payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $request, $business_id); + $this->payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -14036,17 +14922,17 @@ public function payRunEmployerLiabilitiesPost($pay_run_id, $request, $business_i * Create Employer Liabilities * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployerLiabilitiesPost'][0]) { - $returnType = ''; - $request = $this->payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunEmployerLiabilitiesPostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -14055,9 +14941,16 @@ public function payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $request, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14068,11 +14961,11 @@ public function payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $request, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -14091,15 +14984,16 @@ public function payRunEmployerLiabilitiesPostWithHttpInfo($pay_run_id, $request, * Create Employer Liabilities * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesPostAsync($pay_run_id, $request, $business_id) + public function payRunEmployerLiabilitiesPostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployerLiabilitiesPost'][0]) { - return $this->payRunEmployerLiabilitiesPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->payRunEmployerLiabilitiesPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -14113,16 +15007,17 @@ function ($response) { * Create Employer Liabilities * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunEmployerLiabilitiesPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunEmployerLiabilitiesPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployerLiabilitiesPost'][0]) { $returnType = ''; - $request = $this->payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunEmployerLiabilitiesPostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -14141,7 +15036,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14151,26 +15046,23 @@ function ($exception) { * Create request for operation 'payRunEmployerLiabilitiesPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunEmployerLiabilityRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunEmployerLiabilitiesPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $business_id) + public function payRunEmployerLiabilitiesPostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunEmployerLiabilitiesPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunEmployerLiabilitiesPost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling payRunEmployerLiabilitiesPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -14178,6 +15070,14 @@ protected function payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $ ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling payRunEmployerLiabilitiesPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/employerliabilities'; $formParams = []; $queryParams = []; @@ -14186,6 +15086,7 @@ protected function payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $ $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -14203,56 +15104,42 @@ protected function payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $ ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14273,10 +15160,11 @@ protected function payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14288,16 +15176,17 @@ protected function payRunEmployerLiabilitiesPostRequest($pay_run_id, $request, $ * Finalise Pay Run * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\FinalisePayRunOptions $options options (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\FinalisePayRunOptions $options options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunFinalisePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunFinaliseResult + * @return \OpenAPI\Client\Model\PayRunFinaliseResult */ - public function payRunFinalisePost($pay_run_id, $options, $business_id) + public function payRunFinalisePost($pay_run_id, $business_id, $options, string $contentType = self::contentTypes['payRunFinalisePost'][0]) { - list($response) = $this->payRunFinalisePostWithHttpInfo($pay_run_id, $options, $business_id); + list($response) = $this->payRunFinalisePostWithHttpInfo($pay_run_id, $business_id, $options, $contentType); return $response; } @@ -14307,17 +15196,17 @@ public function payRunFinalisePost($pay_run_id, $options, $business_id) * Finalise Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\FinalisePayRunOptions $options (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\FinalisePayRunOptions $options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunFinalisePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunFinaliseResult, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunFinaliseResult, HTTP status code, HTTP response headers (array of strings) */ - public function payRunFinalisePostWithHttpInfo($pay_run_id, $options, $business_id) + public function payRunFinalisePostWithHttpInfo($pay_run_id, $business_id, $options, string $contentType = self::contentTypes['payRunFinalisePost'][0]) { - $returnType = '\Swagger\Client\Model\PayRunFinaliseResult'; - $request = $this->payRunFinalisePostRequest($pay_run_id, $options, $business_id); + $request = $this->payRunFinalisePostRequest($pay_run_id, $business_id, $options, $contentType); try { $options = $this->createHttpClientOption(); @@ -14326,9 +15215,16 @@ public function payRunFinalisePostWithHttpInfo($pay_run_id, $options, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14339,19 +15235,37 @@ public function payRunFinalisePostWithHttpInfo($pay_run_id, $options, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunFinaliseResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunFinaliseResult' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunFinaliseResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunFinaliseResult'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14368,7 +15282,7 @@ public function payRunFinalisePostWithHttpInfo($pay_run_id, $options, $business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunFinaliseResult', + '\OpenAPI\Client\Model\PayRunFinaliseResult', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14384,15 +15298,16 @@ public function payRunFinalisePostWithHttpInfo($pay_run_id, $options, $business_ * Finalise Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\FinalisePayRunOptions $options (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\FinalisePayRunOptions $options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunFinalisePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunFinalisePostAsync($pay_run_id, $options, $business_id) + public function payRunFinalisePostAsync($pay_run_id, $business_id, $options, string $contentType = self::contentTypes['payRunFinalisePost'][0]) { - return $this->payRunFinalisePostAsyncWithHttpInfo($pay_run_id, $options, $business_id) + return $this->payRunFinalisePostAsyncWithHttpInfo($pay_run_id, $business_id, $options, $contentType) ->then( function ($response) { return $response[0]; @@ -14406,26 +15321,26 @@ function ($response) { * Finalise Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\FinalisePayRunOptions $options (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\FinalisePayRunOptions $options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunFinalisePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunFinalisePostAsyncWithHttpInfo($pay_run_id, $options, $business_id) + public function payRunFinalisePostAsyncWithHttpInfo($pay_run_id, $business_id, $options, string $contentType = self::contentTypes['payRunFinalisePost'][0]) { - $returnType = '\Swagger\Client\Model\PayRunFinaliseResult'; - $request = $this->payRunFinalisePostRequest($pay_run_id, $options, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunFinaliseResult'; + $request = $this->payRunFinalisePostRequest($pay_run_id, $business_id, $options, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14448,7 +15363,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14458,26 +15373,23 @@ function ($exception) { * Create request for operation 'payRunFinalisePost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\FinalisePayRunOptions $options (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\FinalisePayRunOptions $options (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunFinalisePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunFinalisePostRequest($pay_run_id, $options, $business_id) + public function payRunFinalisePostRequest($pay_run_id, $business_id, $options, string $contentType = self::contentTypes['payRunFinalisePost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunFinalisePost' ); } - // verify the required parameter 'options' is set - if ($options === null || (is_array($options) && count($options) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $options when calling payRunFinalisePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -14485,6 +15397,14 @@ protected function payRunFinalisePostRequest($pay_run_id, $options, $business_id ); } + // verify the required parameter 'options' is set + if ($options === null || (is_array($options) && count($options) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $options when calling payRunFinalisePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/finalise'; $formParams = []; $queryParams = []; @@ -14493,6 +15413,7 @@ protected function payRunFinalisePostRequest($pay_run_id, $options, $business_id $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -14510,56 +15431,42 @@ protected function payRunFinalisePostRequest($pay_run_id, $options, $business_id ); } - // body params - $_tempBody = null; - if (isset($options)) { - $_tempBody = $options; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($options)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($options)); + } else { + $httpBody = $options; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14580,10 +15487,11 @@ protected function payRunFinalisePostRequest($pay_run_id, $options, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14597,14 +15505,15 @@ protected function payRunFinalisePostRequest($pay_run_id, $options, $business_id * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunLeaveAccruedDelete($pay_run_id, $id, $business_id) + public function payRunLeaveAccruedDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunLeaveAccruedDelete'][0]) { - $this->payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -14615,15 +15524,15 @@ public function payRunLeaveAccruedDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunLeaveAccruedDelete'][0]) { - $returnType = ''; - $request = $this->payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -14632,9 +15541,16 @@ public function payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14645,11 +15561,11 @@ public function payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -14670,13 +15586,14 @@ public function payRunLeaveAccruedDeleteWithHttpInfo($pay_run_id, $id, $business * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedDeleteAsync($pay_run_id, $id, $business_id) + public function payRunLeaveAccruedDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunLeaveAccruedDelete'][0]) { - return $this->payRunLeaveAccruedDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->payRunLeaveAccruedDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -14692,14 +15609,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunLeaveAccruedDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunLeaveAccruedDelete'][0]) { $returnType = ''; - $request = $this->payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -14718,7 +15636,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -14730,24 +15648,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_id) + public function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunLeaveAccruedDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunLeaveAccruedDelete' ); } + // 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 payRunLeaveAccruedDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -14755,6 +15677,7 @@ protected function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_i ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/leaveaccrued'; $formParams = []; $queryParams = []; @@ -14763,9 +15686,15 @@ protected function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_i $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -14784,53 +15713,35 @@ protected function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -14851,10 +15762,11 @@ protected function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -14868,14 +15780,15 @@ protected function payRunLeaveAccruedDeleteRequest($pay_run_id, $id, $business_i * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) * @param bool $include_leave_taken include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LeaveAccrualResponse + * @return \OpenAPI\Client\Model\LeaveAccrualResponse */ - public function payRunLeaveAccruedGet($pay_run_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGet($pay_run_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGet'][0]) { - list($response) = $this->payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $include_leave_taken); + list($response) = $this->payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $include_leave_taken, $contentType); return $response; } @@ -14887,15 +15800,15 @@ public function payRunLeaveAccruedGet($pay_run_id, $business_id, $include_leave_ * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LeaveAccrualResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LeaveAccrualResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGet'][0]) { - $returnType = '\Swagger\Client\Model\LeaveAccrualResponse'; - $request = $this->payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $include_leave_taken); + $request = $this->payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $include_leave_taken, $contentType); try { $options = $this->createHttpClientOption(); @@ -14904,9 +15817,16 @@ public function payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $in } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -14917,19 +15837,37 @@ public function payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $in sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LeaveAccrualResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LeaveAccrualResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LeaveAccrualResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LeaveAccrualResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -14946,7 +15884,7 @@ public function payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $in case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LeaveAccrualResponse', + '\OpenAPI\Client\Model\LeaveAccrualResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14964,13 +15902,14 @@ public function payRunLeaveAccruedGetWithHttpInfo($pay_run_id, $business_id, $in * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedGetAsync($pay_run_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetAsync($pay_run_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGet'][0]) { - return $this->payRunLeaveAccruedGetAsyncWithHttpInfo($pay_run_id, $business_id, $include_leave_taken) + return $this->payRunLeaveAccruedGetAsyncWithHttpInfo($pay_run_id, $business_id, $include_leave_taken, $contentType) ->then( function ($response) { return $response[0]; @@ -14986,24 +15925,24 @@ function ($response) { * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedGetAsyncWithHttpInfo($pay_run_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetAsyncWithHttpInfo($pay_run_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGet'][0]) { - $returnType = '\Swagger\Client\Model\LeaveAccrualResponse'; - $request = $this->payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $include_leave_taken); + $returnType = '\OpenAPI\Client\Model\LeaveAccrualResponse'; + $request = $this->payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $include_leave_taken, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15026,7 +15965,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15038,18 +15977,21 @@ function ($exception) { * @param int $pay_run_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunLeaveAccruedGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15057,6 +15999,8 @@ protected function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $incl ); } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/leaveaccrued'; $formParams = []; $queryParams = []; @@ -15065,9 +16009,15 @@ protected function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $incl $multipart = false; // query params - if ($include_leave_taken !== null) { - $queryParams['includeLeaveTaken'] = ObjectSerializer::toQueryValue($include_leave_taken); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_leave_taken, + 'includeLeaveTaken', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -15086,53 +16036,35 @@ protected function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $incl ); } - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15153,10 +16085,11 @@ protected function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $incl $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15171,14 +16104,15 @@ protected function payRunLeaveAccruedGetRequest($pay_run_id, $business_id, $incl * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) * @param bool $include_leave_taken include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LeaveAccrualResponse + * @return \OpenAPI\Client\Model\LeaveAccrualResponse */ - public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId($pay_run_id, $employee_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId($pay_run_id, $employee_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'][0]) { - list($response) = $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken); + list($response) = $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken, $contentType); return $response; } @@ -15191,15 +16125,15 @@ public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLe * @param int $employee_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LeaveAccrualResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LeaveAccrualResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\LeaveAccrualResponse'; - $request = $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $include_leave_taken); + $request = $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $include_leave_taken, $contentType); try { $options = $this->createHttpClientOption(); @@ -15208,9 +16142,16 @@ public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15221,19 +16162,37 @@ public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LeaveAccrualResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LeaveAccrualResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LeaveAccrualResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LeaveAccrualResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15250,7 +16209,7 @@ public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LeaveAccrualResponse', + '\OpenAPI\Client\Model\LeaveAccrualResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15269,13 +16228,14 @@ public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLe * @param int $employee_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdAsync($pay_run_id, $employee_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'][0]) { - return $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken) + return $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken, $contentType) ->then( function ($response) { return $response[0]; @@ -15292,24 +16252,24 @@ function ($response) { * @param int $employee_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'][0]) { - $returnType = '\Swagger\Client\Model\LeaveAccrualResponse'; - $request = $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $include_leave_taken); + $returnType = '\OpenAPI\Client\Model\LeaveAccrualResponse'; + $request = $this->payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $include_leave_taken, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -15332,7 +16292,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15345,24 +16305,28 @@ function ($exception) { * @param int $employee_id (required) * @param string $business_id (required) * @param bool $include_leave_taken (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $include_leave_taken = 'false') + public function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeIdRequest($pay_run_id, $employee_id, $business_id, $include_leave_taken = false, string $contentType = self::contentTypes['payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunIdLeaveaccruedByEmployeeId' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15370,6 +16334,8 @@ protected function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunI ); } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/leaveaccrued/{employeeId}'; $formParams = []; $queryParams = []; @@ -15378,9 +16344,15 @@ protected function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunI $multipart = false; // query params - if ($include_leave_taken !== null) { - $queryParams['includeLeaveTaken'] = ObjectSerializer::toQueryValue($include_leave_taken); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_leave_taken, + 'includeLeaveTaken', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -15407,53 +16379,35 @@ protected function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunI ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15474,10 +16428,11 @@ protected function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunI $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15489,16 +16444,17 @@ protected function payRunLeaveAccruedGetApiV2BusinessByBusinessIdPayrunByPayRunI * Save Leave Accruals * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SubmitLeaveAccrualsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SubmitLeaveAccrualsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunLeaveAccruedPost($pay_run_id, $model, $business_id) + public function payRunLeaveAccruedPost($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['payRunLeaveAccruedPost'][0]) { - $this->payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $model, $business_id); + $this->payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $business_id, $model, $contentType); } /** @@ -15507,17 +16463,17 @@ public function payRunLeaveAccruedPost($pay_run_id, $model, $business_id) * Save Leave Accruals * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitLeaveAccrualsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitLeaveAccrualsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $model, $business_id) + public function payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['payRunLeaveAccruedPost'][0]) { - $returnType = ''; - $request = $this->payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_id); + $request = $this->payRunLeaveAccruedPostRequest($pay_run_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -15526,9 +16482,16 @@ public function payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $model, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15539,11 +16502,11 @@ public function payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $model, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -15562,15 +16525,16 @@ public function payRunLeaveAccruedPostWithHttpInfo($pay_run_id, $model, $busines * Save Leave Accruals * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitLeaveAccrualsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitLeaveAccrualsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedPostAsync($pay_run_id, $model, $business_id) + public function payRunLeaveAccruedPostAsync($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['payRunLeaveAccruedPost'][0]) { - return $this->payRunLeaveAccruedPostAsyncWithHttpInfo($pay_run_id, $model, $business_id) + return $this->payRunLeaveAccruedPostAsyncWithHttpInfo($pay_run_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -15584,16 +16548,17 @@ function ($response) { * Save Leave Accruals * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitLeaveAccrualsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitLeaveAccrualsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunLeaveAccruedPostAsyncWithHttpInfo($pay_run_id, $model, $business_id) + public function payRunLeaveAccruedPostAsyncWithHttpInfo($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['payRunLeaveAccruedPost'][0]) { $returnType = ''; - $request = $this->payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_id); + $request = $this->payRunLeaveAccruedPostRequest($pay_run_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -15612,7 +16577,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15622,26 +16587,23 @@ function ($exception) { * Create request for operation 'payRunLeaveAccruedPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitLeaveAccrualsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitLeaveAccrualsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunLeaveAccruedPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_id) + public function payRunLeaveAccruedPostRequest($pay_run_id, $business_id, $model, string $contentType = self::contentTypes['payRunLeaveAccruedPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunLeaveAccruedPost' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling payRunLeaveAccruedPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15649,6 +16611,14 @@ protected function payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling payRunLeaveAccruedPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/leaveaccrued'; $formParams = []; $queryParams = []; @@ -15657,6 +16627,7 @@ protected function payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_ $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -15674,56 +16645,42 @@ protected function payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -15744,10 +16701,11 @@ protected function payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -15761,14 +16719,15 @@ protected function payRunLeaveAccruedPostRequest($pay_run_id, $model, $business_ * @param int $pay_run_id pay_run_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunSuperAdjustmentsDelete($pay_run_id, $id, $business_id) + public function payRunSuperAdjustmentsDelete($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsDelete'][0]) { - $this->payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id); + $this->payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id, $contentType); } /** @@ -15779,15 +16738,15 @@ public function payRunSuperAdjustmentsDelete($pay_run_id, $id, $business_id) * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsDelete'][0]) { - $returnType = ''; - $request = $this->payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -15796,9 +16755,16 @@ public function payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -15809,11 +16775,11 @@ public function payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -15834,13 +16800,14 @@ public function payRunSuperAdjustmentsDeleteWithHttpInfo($pay_run_id, $id, $busi * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsDeleteAsync($pay_run_id, $id, $business_id) + public function payRunSuperAdjustmentsDeleteAsync($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsDelete'][0]) { - return $this->payRunSuperAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + return $this->payRunSuperAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -15856,14 +16823,15 @@ function ($response) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id) + public function payRunSuperAdjustmentsDeleteAsyncWithHttpInfo($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsDelete'][0]) { $returnType = ''; - $request = $this->payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $business_id); + $request = $this->payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -15882,7 +16850,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -15894,24 +16862,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $business_id) + public function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsDelete'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunSuperAdjustmentsDelete' ); } + // 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 payRunSuperAdjustmentsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -15919,6 +16891,7 @@ protected function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $busine ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/superadjustments'; $formParams = []; $queryParams = []; @@ -15927,9 +16900,15 @@ protected function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $busine $multipart = false; // query params - if ($id !== null) { - $queryParams['id'] = ObjectSerializer::toQueryValue($id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id, + 'id', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($pay_run_id !== null) { @@ -15948,53 +16927,35 @@ protected function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16015,10 +16976,11 @@ protected function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16032,14 +16994,15 @@ protected function payRunSuperAdjustmentsDeleteRequest($pay_run_id, $id, $busine * @param int $pay_run_id pay_run_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunSuperAdjustmentResponse + * @return \OpenAPI\Client\Model\PayRunSuperAdjustmentResponse */ - public function payRunSuperAdjustmentsGet($pay_run_id, $employee_id, $business_id) + public function payRunSuperAdjustmentsGet($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGet'][0]) { - list($response) = $this->payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, $business_id); + list($response) = $this->payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType); return $response; } @@ -16051,15 +17014,15 @@ public function payRunSuperAdjustmentsGet($pay_run_id, $employee_id, $business_i * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunSuperAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunSuperAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSuperAdjustmentResponse'; - $request = $this->payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $business_id); + $request = $this->payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -16068,9 +17031,16 @@ public function payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16081,19 +17051,37 @@ public function payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16110,7 +17098,7 @@ public function payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunSuperAdjustmentResponse', + '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16128,13 +17116,14 @@ public function payRunSuperAdjustmentsGetWithHttpInfo($pay_run_id, $employee_id, * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsGetAsync($pay_run_id, $employee_id, $business_id) + public function payRunSuperAdjustmentsGetAsync($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGet'][0]) { - return $this->payRunSuperAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + return $this->payRunSuperAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -16150,24 +17139,24 @@ function ($response) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id) + public function payRunSuperAdjustmentsGetAsyncWithHttpInfo($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGet'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSuperAdjustmentResponse'; - $request = $this->payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse'; + $request = $this->payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16190,7 +17179,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16202,24 +17191,28 @@ function ($exception) { * @param int $pay_run_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $business_id) + public function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunSuperAdjustmentsGet' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling payRunSuperAdjustmentsGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -16227,6 +17220,7 @@ protected function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $ ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/superadjustments/{employeeId}'; $formParams = []; $queryParams = []; @@ -16235,6 +17229,7 @@ protected function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $ $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -16260,53 +17255,35 @@ protected function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16327,10 +17304,11 @@ protected function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16343,14 +17321,15 @@ protected function payRunSuperAdjustmentsGetRequest($pay_run_id, $employee_id, $ * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayRunSuperAdjustmentResponse + * @return \OpenAPI\Client\Model\PayRunSuperAdjustmentResponse */ - public function payRunSuperAdjustmentsGetAll($pay_run_id, $business_id) + public function payRunSuperAdjustmentsGetAll($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGetAll'][0]) { - list($response) = $this->payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_id); + list($response) = $this->payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_id, $contentType); return $response; } @@ -16361,15 +17340,15 @@ public function payRunSuperAdjustmentsGetAll($pay_run_id, $business_id) * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayRunSuperAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayRunSuperAdjustmentResponse, HTTP status code, HTTP response headers (array of strings) */ - public function payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_id) + public function payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGetAll'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSuperAdjustmentResponse'; - $request = $this->payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id); + $request = $this->payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -16378,9 +17357,16 @@ public function payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16391,19 +17377,37 @@ public function payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16420,7 +17424,7 @@ public function payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayRunSuperAdjustmentResponse', + '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16437,13 +17441,14 @@ public function payRunSuperAdjustmentsGetAllWithHttpInfo($pay_run_id, $business_ * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsGetAllAsync($pay_run_id, $business_id) + public function payRunSuperAdjustmentsGetAllAsync($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGetAll'][0]) { - return $this->payRunSuperAdjustmentsGetAllAsyncWithHttpInfo($pay_run_id, $business_id) + return $this->payRunSuperAdjustmentsGetAllAsyncWithHttpInfo($pay_run_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -16458,24 +17463,24 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsGetAllAsyncWithHttpInfo($pay_run_id, $business_id) + public function payRunSuperAdjustmentsGetAllAsyncWithHttpInfo($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGetAll'][0]) { - $returnType = '\Swagger\Client\Model\PayRunSuperAdjustmentResponse'; - $request = $this->payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayRunSuperAdjustmentResponse'; + $request = $this->payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -16498,7 +17503,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16509,18 +17514,21 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id) + public function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id, string $contentType = self::contentTypes['payRunSuperAdjustmentsGetAll'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunSuperAdjustmentsGetAll' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -16528,6 +17536,7 @@ protected function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id ); } + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/superadjustments'; $formParams = []; $queryParams = []; @@ -16536,6 +17545,7 @@ protected function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -16553,53 +17563,35 @@ protected function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16620,10 +17612,11 @@ protected function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16635,16 +17628,17 @@ protected function payRunSuperAdjustmentsGetAllRequest($pay_run_id, $business_id * Create Super Adjustments * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunSuperAdjustmentRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunSuperAdjustmentRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunSuperAdjustmentsPost($pay_run_id, $request, $business_id) + public function payRunSuperAdjustmentsPost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunSuperAdjustmentsPost'][0]) { - $this->payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $request, $business_id); + $this->payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -16653,17 +17647,17 @@ public function payRunSuperAdjustmentsPost($pay_run_id, $request, $business_id) * Create Super Adjustments * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunSuperAdjustmentsPost'][0]) { - $returnType = ''; - $request = $this->payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunSuperAdjustmentsPostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -16672,9 +17666,16 @@ public function payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $request, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16685,11 +17686,11 @@ public function payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $request, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -16708,15 +17709,16 @@ public function payRunSuperAdjustmentsPostWithHttpInfo($pay_run_id, $request, $b * Create Super Adjustments * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsPostAsync($pay_run_id, $request, $business_id) + public function payRunSuperAdjustmentsPostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunSuperAdjustmentsPost'][0]) { - return $this->payRunSuperAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->payRunSuperAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -16730,16 +17732,17 @@ function ($response) { * Create Super Adjustments * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunSuperAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunSuperAdjustmentsPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunSuperAdjustmentsPost'][0]) { $returnType = ''; - $request = $this->payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunSuperAdjustmentsPostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -16758,7 +17761,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -16768,26 +17771,23 @@ function ($exception) { * Create request for operation 'payRunSuperAdjustmentsPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SubmitPayRunSuperAdjustmentRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunSuperAdjustmentsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $business_id) + public function payRunSuperAdjustmentsPostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunSuperAdjustmentsPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunSuperAdjustmentsPost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling payRunSuperAdjustmentsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -16795,6 +17795,14 @@ protected function payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $bus ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling payRunSuperAdjustmentsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/superadjustments'; $formParams = []; $queryParams = []; @@ -16803,6 +17811,7 @@ protected function payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $bus $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -16820,56 +17829,42 @@ protected function payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $bus ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -16890,10 +17885,11 @@ protected function payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -16905,16 +17901,17 @@ protected function payRunSuperAdjustmentsPostRequest($pay_run_id, $request, $bus * Unlock Pay Run * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\PayRunUnlockRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PayRunUnlockRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunUnlockPost($pay_run_id, $request, $business_id) + public function payRunUnlockPost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockPost'][0]) { - $this->payRunUnlockPostWithHttpInfo($pay_run_id, $request, $business_id); + $this->payRunUnlockPostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -16923,17 +17920,17 @@ public function payRunUnlockPost($pay_run_id, $request, $business_id) * Unlock Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunUnlockRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunUnlockRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunUnlockPostWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunUnlockPostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockPost'][0]) { - $returnType = ''; - $request = $this->payRunUnlockPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunUnlockPostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -16942,9 +17939,16 @@ public function payRunUnlockPostWithHttpInfo($pay_run_id, $request, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -16955,11 +17959,11 @@ public function payRunUnlockPostWithHttpInfo($pay_run_id, $request, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -16978,15 +17982,16 @@ public function payRunUnlockPostWithHttpInfo($pay_run_id, $request, $business_id * Unlock Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunUnlockRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunUnlockRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunUnlockPostAsync($pay_run_id, $request, $business_id) + public function payRunUnlockPostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockPost'][0]) { - return $this->payRunUnlockPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->payRunUnlockPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -17000,16 +18005,17 @@ function ($response) { * Unlock Pay Run * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunUnlockRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunUnlockRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunUnlockPostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunUnlockPostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockPost'][0]) { $returnType = ''; - $request = $this->payRunUnlockPostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunUnlockPostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -17028,7 +18034,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17038,26 +18044,23 @@ function ($exception) { * Create request for operation 'payRunUnlockPost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\PayRunUnlockRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PayRunUnlockRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunUnlockPostRequest($pay_run_id, $request, $business_id) + public function payRunUnlockPostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockPost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunUnlockPost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling payRunUnlockPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -17065,6 +18068,14 @@ protected function payRunUnlockPostRequest($pay_run_id, $request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling payRunUnlockPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/unlock'; $formParams = []; $queryParams = []; @@ -17073,6 +18084,7 @@ protected function payRunUnlockPostRequest($pay_run_id, $request, $business_id) $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -17090,56 +18102,42 @@ protected function payRunUnlockPostRequest($pay_run_id, $request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17160,10 +18158,11 @@ protected function payRunUnlockPostRequest($pay_run_id, $request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -17175,16 +18174,17 @@ protected function payRunUnlockPostRequest($pay_run_id, $request, $business_id) * Set UI Unlock enabled * * @param int $pay_run_id pay_run_id (required) - * @param \Swagger\Client\Model\SetPayRunUIUnlockStateRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SetPayRunUIUnlockStateRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockStatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function payRunUnlockStatePost($pay_run_id, $request, $business_id) + public function payRunUnlockStatePost($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockStatePost'][0]) { - $this->payRunUnlockStatePostWithHttpInfo($pay_run_id, $request, $business_id); + $this->payRunUnlockStatePostWithHttpInfo($pay_run_id, $business_id, $request, $contentType); } /** @@ -17193,17 +18193,17 @@ public function payRunUnlockStatePost($pay_run_id, $request, $business_id) * Set UI Unlock enabled * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SetPayRunUIUnlockStateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SetPayRunUIUnlockStateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockStatePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function payRunUnlockStatePostWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunUnlockStatePostWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockStatePost'][0]) { - $returnType = ''; - $request = $this->payRunUnlockStatePostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunUnlockStatePostRequest($pay_run_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -17212,9 +18212,16 @@ public function payRunUnlockStatePostWithHttpInfo($pay_run_id, $request, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -17225,11 +18232,11 @@ public function payRunUnlockStatePostWithHttpInfo($pay_run_id, $request, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -17248,15 +18255,16 @@ public function payRunUnlockStatePostWithHttpInfo($pay_run_id, $request, $busine * Set UI Unlock enabled * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SetPayRunUIUnlockStateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SetPayRunUIUnlockStateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockStatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunUnlockStatePostAsync($pay_run_id, $request, $business_id) + public function payRunUnlockStatePostAsync($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockStatePost'][0]) { - return $this->payRunUnlockStatePostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + return $this->payRunUnlockStatePostAsyncWithHttpInfo($pay_run_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -17270,16 +18278,17 @@ function ($response) { * Set UI Unlock enabled * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SetPayRunUIUnlockStateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SetPayRunUIUnlockStateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockStatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payRunUnlockStatePostAsyncWithHttpInfo($pay_run_id, $request, $business_id) + public function payRunUnlockStatePostAsyncWithHttpInfo($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockStatePost'][0]) { $returnType = ''; - $request = $this->payRunUnlockStatePostRequest($pay_run_id, $request, $business_id); + $request = $this->payRunUnlockStatePostRequest($pay_run_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -17298,7 +18307,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -17308,26 +18317,23 @@ function ($exception) { * Create request for operation 'payRunUnlockStatePost' * * @param int $pay_run_id (required) - * @param \Swagger\Client\Model\SetPayRunUIUnlockStateRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SetPayRunUIUnlockStateRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payRunUnlockStatePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payRunUnlockStatePostRequest($pay_run_id, $request, $business_id) + public function payRunUnlockStatePostRequest($pay_run_id, $business_id, $request, string $contentType = self::contentTypes['payRunUnlockStatePost'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling payRunUnlockStatePost' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling payRunUnlockStatePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -17335,6 +18341,14 @@ protected function payRunUnlockStatePostRequest($pay_run_id, $request, $business ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling payRunUnlockStatePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payrun/{payRunId}/setuiunlockstate'; $formParams = []; $queryParams = []; @@ -17343,6 +18357,7 @@ protected function payRunUnlockStatePostRequest($pay_run_id, $request, $business $multipart = false; + // path params if ($pay_run_id !== null) { $resourcePath = str_replace( @@ -17360,56 +18375,42 @@ protected function payRunUnlockStatePostRequest($pay_run_id, $request, $business ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -17430,10 +18431,11 @@ protected function payRunUnlockStatePostRequest($pay_run_id, $request, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/PayScheduleApi.php b/src/lib/Api/PayScheduleApi.php index 83f545f..2553f78 100644 --- a/src/lib/Api/PayScheduleApi.php +++ b/src/lib/Api/PayScheduleApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auPayScheduleGet' => [ + 'application/json', + ], + 'auPayScheduleGetMetaData' => [ + 'application/json', + ], + 'auPayScheduleGetPaySchedules' => [ + 'application/json', + ], + 'auPaySchedulePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPaySchedulePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'payScheduleGetNextPayDate' => [ + 'application/json', + ], + 'payScheduleListNextPayDates' => [ + '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 + 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; } /** @@ -94,14 +158,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPayScheduleDelete($id, $business_id) + public function auPayScheduleDelete($id, $business_id, string $contentType = self::contentTypes['auPayScheduleDelete'][0]) { - $this->auPayScheduleDeleteWithHttpInfo($id, $business_id); + $this->auPayScheduleDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +176,15 @@ public function auPayScheduleDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPayScheduleDeleteWithHttpInfo($id, $business_id) + public function auPayScheduleDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayScheduleDelete'][0]) { - $returnType = ''; - $request = $this->auPayScheduleDeleteRequest($id, $business_id); + $request = $this->auPayScheduleDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +193,16 @@ public function auPayScheduleDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +213,11 @@ public function auPayScheduleDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +237,14 @@ public function auPayScheduleDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleDeleteAsync($id, $business_id) + public function auPayScheduleDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auPayScheduleDelete'][0]) { - return $this->auPayScheduleDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auPayScheduleDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +259,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleDeleteAsyncWithHttpInfo($id, $business_id) + public function auPayScheduleDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayScheduleDelete'][0]) { $returnType = ''; - $request = $this->auPayScheduleDeleteRequest($id, $business_id); + $request = $this->auPayScheduleDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +286,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +297,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayScheduleDeleteRequest($id, $business_id) + public function auPayScheduleDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auPayScheduleDelete'][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 auPayScheduleDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +319,7 @@ protected function auPayScheduleDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payschedule/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +328,7 @@ protected function auPayScheduleDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +346,35 @@ protected function auPayScheduleDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +395,11 @@ protected function auPayScheduleDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +412,15 @@ protected function auPayScheduleDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayScheduleModel + * @return \OpenAPI\Client\Model\AuPayScheduleModel */ - public function auPayScheduleGet($id, $business_id) + public function auPayScheduleGet($id, $business_id, string $contentType = self::contentTypes['auPayScheduleGet'][0]) { - list($response) = $this->auPayScheduleGetWithHttpInfo($id, $business_id); + list($response) = $this->auPayScheduleGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +431,15 @@ public function auPayScheduleGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayScheduleModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayScheduleModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayScheduleGetWithHttpInfo($id, $business_id) + public function auPayScheduleGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayScheduleGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel'; - $request = $this->auPayScheduleGetRequest($id, $business_id); + $request = $this->auPayScheduleGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +448,16 @@ public function auPayScheduleGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +468,37 @@ public function auPayScheduleGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayScheduleModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayScheduleModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayScheduleModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +515,7 @@ public function auPayScheduleGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayScheduleModel', + '\OpenAPI\Client\Model\AuPayScheduleModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +532,14 @@ public function auPayScheduleGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleGetAsync($id, $business_id) + public function auPayScheduleGetAsync($id, $business_id, string $contentType = self::contentTypes['auPayScheduleGet'][0]) { - return $this->auPayScheduleGetAsyncWithHttpInfo($id, $business_id) + return $this->auPayScheduleGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +554,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleGetAsyncWithHttpInfo($id, $business_id) + public function auPayScheduleGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPayScheduleGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel'; - $request = $this->auPayScheduleGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel'; + $request = $this->auPayScheduleGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +594,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +605,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayScheduleGetRequest($id, $business_id) + public function auPayScheduleGetRequest($id, $business_id, string $contentType = self::contentTypes['auPayScheduleGet'][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 auPayScheduleGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +627,7 @@ protected function auPayScheduleGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payschedule/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +636,7 @@ protected function auPayScheduleGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +654,35 @@ protected function auPayScheduleGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +703,11 @@ protected function auPayScheduleGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,14 +719,15 @@ protected function auPayScheduleGetRequest($id, $business_id) * Get Pay Schedule Metadata * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetMetaData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayScheduleMetaDataModel + * @return \OpenAPI\Client\Model\PayScheduleMetaDataModel */ - public function auPayScheduleGetMetaData($business_id) + public function auPayScheduleGetMetaData($business_id, string $contentType = self::contentTypes['auPayScheduleGetMetaData'][0]) { - list($response) = $this->auPayScheduleGetMetaDataWithHttpInfo($business_id); + list($response) = $this->auPayScheduleGetMetaDataWithHttpInfo($business_id, $contentType); return $response; } @@ -659,15 +737,15 @@ public function auPayScheduleGetMetaData($business_id) * Get Pay Schedule Metadata * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetMetaData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayScheduleMetaDataModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayScheduleMetaDataModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPayScheduleGetMetaDataWithHttpInfo($business_id) + public function auPayScheduleGetMetaDataWithHttpInfo($business_id, string $contentType = self::contentTypes['auPayScheduleGetMetaData'][0]) { - $returnType = '\Swagger\Client\Model\PayScheduleMetaDataModel'; - $request = $this->auPayScheduleGetMetaDataRequest($business_id); + $request = $this->auPayScheduleGetMetaDataRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -676,9 +754,16 @@ public function auPayScheduleGetMetaDataWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -689,19 +774,37 @@ public function auPayScheduleGetMetaDataWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayScheduleMetaDataModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayScheduleMetaDataModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayScheduleMetaDataModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayScheduleMetaDataModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -718,7 +821,7 @@ public function auPayScheduleGetMetaDataWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayScheduleMetaDataModel', + '\OpenAPI\Client\Model\PayScheduleMetaDataModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -734,13 +837,14 @@ public function auPayScheduleGetMetaDataWithHttpInfo($business_id) * Get Pay Schedule Metadata * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetMetaData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleGetMetaDataAsync($business_id) + public function auPayScheduleGetMetaDataAsync($business_id, string $contentType = self::contentTypes['auPayScheduleGetMetaData'][0]) { - return $this->auPayScheduleGetMetaDataAsyncWithHttpInfo($business_id) + return $this->auPayScheduleGetMetaDataAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -754,24 +858,24 @@ function ($response) { * Get Pay Schedule Metadata * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetMetaData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleGetMetaDataAsyncWithHttpInfo($business_id) + public function auPayScheduleGetMetaDataAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auPayScheduleGetMetaData'][0]) { - $returnType = '\Swagger\Client\Model\PayScheduleMetaDataModel'; - $request = $this->auPayScheduleGetMetaDataRequest($business_id); + $returnType = '\OpenAPI\Client\Model\PayScheduleMetaDataModel'; + $request = $this->auPayScheduleGetMetaDataRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -794,7 +898,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -804,12 +908,14 @@ function ($exception) { * Create request for operation 'auPayScheduleGetMetaData' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetMetaData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayScheduleGetMetaDataRequest($business_id) + public function auPayScheduleGetMetaDataRequest($business_id, string $contentType = self::contentTypes['auPayScheduleGetMetaData'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -817,6 +923,7 @@ protected function auPayScheduleGetMetaDataRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payschedule/metadata'; $formParams = []; $queryParams = []; @@ -825,6 +932,7 @@ protected function auPayScheduleGetMetaDataRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -834,53 +942,35 @@ protected function auPayScheduleGetMetaDataRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -901,10 +991,11 @@ protected function auPayScheduleGetMetaDataRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -916,18 +1007,20 @@ protected function auPayScheduleGetMetaDataRequest($business_id) * List Pay Schedules * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetPaySchedules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayScheduleModel[] + * @return \OpenAPI\Client\Model\AuPayScheduleModel[] */ - public function auPayScheduleGetPaySchedules($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayScheduleGetPaySchedules($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayScheduleGetPaySchedules'][0]) { - list($response) = $this->auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -937,19 +1030,20 @@ public function auPayScheduleGetPaySchedules($business_id, $filter = null, $orde * List Pay Schedules * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetPaySchedules'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayScheduleModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayScheduleModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayScheduleGetPaySchedules'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel[]'; - $request = $this->auPayScheduleGetPaySchedulesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auPayScheduleGetPaySchedulesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -958,9 +1052,16 @@ public function auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $filter = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -971,19 +1072,37 @@ public function auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $filter = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayScheduleModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayScheduleModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayScheduleModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1000,7 +1119,7 @@ public function auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $filter = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayScheduleModel[]', + '\OpenAPI\Client\Model\AuPayScheduleModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1016,17 +1135,19 @@ public function auPayScheduleGetPaySchedulesWithHttpInfo($business_id, $filter = * List Pay Schedules * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetPaySchedules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleGetPaySchedulesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayScheduleGetPaySchedulesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayScheduleGetPaySchedules'][0]) { - return $this->auPayScheduleGetPaySchedulesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auPayScheduleGetPaySchedulesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -1040,28 +1161,29 @@ function ($response) { * List Pay Schedules * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetPaySchedules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPayScheduleGetPaySchedulesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayScheduleGetPaySchedulesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayScheduleGetPaySchedules'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel[]'; - $request = $this->auPayScheduleGetPaySchedulesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel[]'; + $request = $this->auPayScheduleGetPaySchedulesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1084,7 +1206,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1094,16 +1216,19 @@ function ($exception) { * Create request for operation 'auPayScheduleGetPaySchedules' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPayScheduleGetPaySchedules'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPayScheduleGetPaySchedulesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPayScheduleGetPaySchedulesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPayScheduleGetPaySchedules'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1111,6 +1236,12 @@ protected function auPayScheduleGetPaySchedulesRequest($business_id, $filter = n ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/payschedule'; $formParams = []; $queryParams = []; @@ -1119,20 +1250,45 @@ protected function auPayScheduleGetPaySchedulesRequest($business_id, $filter = n $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -1144,53 +1300,35 @@ protected function auPayScheduleGetPaySchedulesRequest($business_id, $filter = n ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1211,10 +1349,11 @@ protected function auPayScheduleGetPaySchedulesRequest($business_id, $filter = n $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1225,16 +1364,17 @@ protected function auPayScheduleGetPaySchedulesRequest($business_id, $filter = n * * Create Pay Schedule * - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule pay_schedule (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayScheduleModel + * @return \OpenAPI\Client\Model\AuPayScheduleModel */ - public function auPaySchedulePost($pay_schedule, $business_id) + public function auPaySchedulePost($business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePost'][0]) { - list($response) = $this->auPaySchedulePostWithHttpInfo($pay_schedule, $business_id); + list($response) = $this->auPaySchedulePostWithHttpInfo($business_id, $pay_schedule, $contentType); return $response; } @@ -1243,17 +1383,17 @@ public function auPaySchedulePost($pay_schedule, $business_id) * * Create Pay Schedule * - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayScheduleModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayScheduleModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPaySchedulePostWithHttpInfo($pay_schedule, $business_id) + public function auPaySchedulePostWithHttpInfo($business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePost'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel'; - $request = $this->auPaySchedulePostRequest($pay_schedule, $business_id); + $request = $this->auPaySchedulePostRequest($business_id, $pay_schedule, $contentType); try { $options = $this->createHttpClientOption(); @@ -1262,9 +1402,16 @@ public function auPaySchedulePostWithHttpInfo($pay_schedule, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1275,19 +1422,37 @@ public function auPaySchedulePostWithHttpInfo($pay_schedule, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayScheduleModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayScheduleModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayScheduleModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1304,7 +1469,7 @@ public function auPaySchedulePostWithHttpInfo($pay_schedule, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayScheduleModel', + '\OpenAPI\Client\Model\AuPayScheduleModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1319,15 +1484,16 @@ public function auPaySchedulePostWithHttpInfo($pay_schedule, $business_id) * * Create Pay Schedule * - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySchedulePostAsync($pay_schedule, $business_id) + public function auPaySchedulePostAsync($business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePost'][0]) { - return $this->auPaySchedulePostAsyncWithHttpInfo($pay_schedule, $business_id) + return $this->auPaySchedulePostAsyncWithHttpInfo($business_id, $pay_schedule, $contentType) ->then( function ($response) { return $response[0]; @@ -1340,26 +1506,26 @@ function ($response) { * * Create Pay Schedule * - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySchedulePostAsyncWithHttpInfo($pay_schedule, $business_id) + public function auPaySchedulePostAsyncWithHttpInfo($business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePost'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel'; - $request = $this->auPaySchedulePostRequest($pay_schedule, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel'; + $request = $this->auPaySchedulePostRequest($business_id, $pay_schedule, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1382,7 +1548,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1391,20 +1557,16 @@ function ($exception) { /** * Create request for operation 'auPaySchedulePost' * - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaySchedulePostRequest($pay_schedule, $business_id) + public function auPaySchedulePostRequest($business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePost'][0]) { - // verify the required parameter 'pay_schedule' is set - if ($pay_schedule === null || (is_array($pay_schedule) && count($pay_schedule) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_schedule when calling auPaySchedulePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1412,6 +1574,14 @@ protected function auPaySchedulePostRequest($pay_schedule, $business_id) ); } + // verify the required parameter 'pay_schedule' is set + if ($pay_schedule === null || (is_array($pay_schedule) && count($pay_schedule) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pay_schedule when calling auPaySchedulePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payschedule'; $formParams = []; $queryParams = []; @@ -1420,6 +1590,7 @@ protected function auPaySchedulePostRequest($pay_schedule, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1429,56 +1600,42 @@ protected function auPaySchedulePostRequest($pay_schedule, $business_id) ); } - // body params - $_tempBody = null; - if (isset($pay_schedule)) { - $_tempBody = $pay_schedule; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($pay_schedule)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pay_schedule)); + } else { + $httpBody = $pay_schedule; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1499,10 +1656,11 @@ protected function auPaySchedulePostRequest($pay_schedule, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1514,16 +1672,17 @@ protected function auPaySchedulePostRequest($pay_schedule, $business_id) * Update Pay Schedule * * @param int $id id (required) - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule pay_schedule (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayScheduleModel + * @return \OpenAPI\Client\Model\AuPayScheduleModel */ - public function auPaySchedulePut($id, $pay_schedule, $business_id) + public function auPaySchedulePut($id, $business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePut'][0]) { - list($response) = $this->auPaySchedulePutWithHttpInfo($id, $pay_schedule, $business_id); + list($response) = $this->auPaySchedulePutWithHttpInfo($id, $business_id, $pay_schedule, $contentType); return $response; } @@ -1533,17 +1692,17 @@ public function auPaySchedulePut($id, $pay_schedule, $business_id) * Update Pay Schedule * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayScheduleModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayScheduleModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPaySchedulePutWithHttpInfo($id, $pay_schedule, $business_id) + public function auPaySchedulePutWithHttpInfo($id, $business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePut'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel'; - $request = $this->auPaySchedulePutRequest($id, $pay_schedule, $business_id); + $request = $this->auPaySchedulePutRequest($id, $business_id, $pay_schedule, $contentType); try { $options = $this->createHttpClientOption(); @@ -1552,9 +1711,16 @@ public function auPaySchedulePutWithHttpInfo($id, $pay_schedule, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1565,19 +1731,37 @@ public function auPaySchedulePutWithHttpInfo($id, $pay_schedule, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayScheduleModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayScheduleModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayScheduleModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1594,7 +1778,7 @@ public function auPaySchedulePutWithHttpInfo($id, $pay_schedule, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayScheduleModel', + '\OpenAPI\Client\Model\AuPayScheduleModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1610,15 +1794,16 @@ public function auPaySchedulePutWithHttpInfo($id, $pay_schedule, $business_id) * Update Pay Schedule * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySchedulePutAsync($id, $pay_schedule, $business_id) + public function auPaySchedulePutAsync($id, $business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePut'][0]) { - return $this->auPaySchedulePutAsyncWithHttpInfo($id, $pay_schedule, $business_id) + return $this->auPaySchedulePutAsyncWithHttpInfo($id, $business_id, $pay_schedule, $contentType) ->then( function ($response) { return $response[0]; @@ -1632,26 +1817,26 @@ function ($response) { * Update Pay Schedule * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaySchedulePutAsyncWithHttpInfo($id, $pay_schedule, $business_id) + public function auPaySchedulePutAsyncWithHttpInfo($id, $business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePut'][0]) { - $returnType = '\Swagger\Client\Model\AuPayScheduleModel'; - $request = $this->auPaySchedulePutRequest($id, $pay_schedule, $business_id); + $returnType = '\OpenAPI\Client\Model\AuPayScheduleModel'; + $request = $this->auPaySchedulePutRequest($id, $business_id, $pay_schedule, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1674,7 +1859,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1684,26 +1869,23 @@ function ($exception) { * Create request for operation 'auPaySchedulePut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuPayScheduleModel $pay_schedule (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuPayScheduleModel $pay_schedule (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaySchedulePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaySchedulePutRequest($id, $pay_schedule, $business_id) + public function auPaySchedulePutRequest($id, $business_id, $pay_schedule, string $contentType = self::contentTypes['auPaySchedulePut'][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 auPaySchedulePut' ); } - // verify the required parameter 'pay_schedule' is set - if ($pay_schedule === null || (is_array($pay_schedule) && count($pay_schedule) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $pay_schedule when calling auPaySchedulePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1711,6 +1893,14 @@ protected function auPaySchedulePutRequest($id, $pay_schedule, $business_id) ); } + // verify the required parameter 'pay_schedule' is set + if ($pay_schedule === null || (is_array($pay_schedule) && count($pay_schedule) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pay_schedule when calling auPaySchedulePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/payschedule/{id}'; $formParams = []; $queryParams = []; @@ -1719,6 +1909,7 @@ protected function auPaySchedulePutRequest($id, $pay_schedule, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1736,56 +1927,42 @@ protected function auPaySchedulePutRequest($id, $pay_schedule, $business_id) ); } - // body params - $_tempBody = null; - if (isset($pay_schedule)) { - $_tempBody = $pay_schedule; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($pay_schedule)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pay_schedule)); + } else { + $httpBody = $pay_schedule; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1806,10 +1983,11 @@ protected function auPaySchedulePutRequest($id, $pay_schedule, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1822,14 +2000,15 @@ protected function auPaySchedulePutRequest($id, $pay_schedule, $business_id) * * @param int $pay_schedule_id pay_schedule_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleGetNextPayDate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayScheduleDateForecastResultApiModel + * @return \OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel */ - public function payScheduleGetNextPayDate($pay_schedule_id, $business_id) + public function payScheduleGetNextPayDate($pay_schedule_id, $business_id, string $contentType = self::contentTypes['payScheduleGetNextPayDate'][0]) { - list($response) = $this->payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $business_id); + list($response) = $this->payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $business_id, $contentType); return $response; } @@ -1840,15 +2019,15 @@ public function payScheduleGetNextPayDate($pay_schedule_id, $business_id) * * @param int $pay_schedule_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleGetNextPayDate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayScheduleDateForecastResultApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $business_id) + public function payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $business_id, string $contentType = self::contentTypes['payScheduleGetNextPayDate'][0]) { - $returnType = '\Swagger\Client\Model\PayScheduleDateForecastResultApiModel'; - $request = $this->payScheduleGetNextPayDateRequest($pay_schedule_id, $business_id); + $request = $this->payScheduleGetNextPayDateRequest($pay_schedule_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1857,9 +2036,16 @@ public function payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1870,19 +2056,37 @@ public function payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1899,7 +2103,7 @@ public function payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayScheduleDateForecastResultApiModel', + '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1916,13 +2120,14 @@ public function payScheduleGetNextPayDateWithHttpInfo($pay_schedule_id, $busines * * @param int $pay_schedule_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleGetNextPayDate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payScheduleGetNextPayDateAsync($pay_schedule_id, $business_id) + public function payScheduleGetNextPayDateAsync($pay_schedule_id, $business_id, string $contentType = self::contentTypes['payScheduleGetNextPayDate'][0]) { - return $this->payScheduleGetNextPayDateAsyncWithHttpInfo($pay_schedule_id, $business_id) + return $this->payScheduleGetNextPayDateAsyncWithHttpInfo($pay_schedule_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1937,24 +2142,24 @@ function ($response) { * * @param int $pay_schedule_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleGetNextPayDate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payScheduleGetNextPayDateAsyncWithHttpInfo($pay_schedule_id, $business_id) + public function payScheduleGetNextPayDateAsyncWithHttpInfo($pay_schedule_id, $business_id, string $contentType = self::contentTypes['payScheduleGetNextPayDate'][0]) { - $returnType = '\Swagger\Client\Model\PayScheduleDateForecastResultApiModel'; - $request = $this->payScheduleGetNextPayDateRequest($pay_schedule_id, $business_id); + $returnType = '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel'; + $request = $this->payScheduleGetNextPayDateRequest($pay_schedule_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1977,7 +2182,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1988,18 +2193,21 @@ function ($exception) { * * @param int $pay_schedule_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleGetNextPayDate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_id) + public function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_id, string $contentType = self::contentTypes['payScheduleGetNextPayDate'][0]) { + // verify the required parameter 'pay_schedule_id' is set if ($pay_schedule_id === null || (is_array($pay_schedule_id) && count($pay_schedule_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_schedule_id when calling payScheduleGetNextPayDate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2007,6 +2215,7 @@ protected function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_ ); } + $resourcePath = '/api/v2/business/{businessId}/payschedule/{payScheduleId}/nextpaydate'; $formParams = []; $queryParams = []; @@ -2015,6 +2224,7 @@ protected function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_ $multipart = false; + // path params if ($pay_schedule_id !== null) { $resourcePath = str_replace( @@ -2032,53 +2242,35 @@ protected function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2099,10 +2291,11 @@ protected function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2114,14 +2307,15 @@ protected function payScheduleGetNextPayDateRequest($pay_schedule_id, $business_ * List Next Pay Dates * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleListNextPayDates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayScheduleDateForecastResultApiModel[] + * @return \OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[] */ - public function payScheduleListNextPayDates($business_id) + public function payScheduleListNextPayDates($business_id, string $contentType = self::contentTypes['payScheduleListNextPayDates'][0]) { - list($response) = $this->payScheduleListNextPayDatesWithHttpInfo($business_id); + list($response) = $this->payScheduleListNextPayDatesWithHttpInfo($business_id, $contentType); return $response; } @@ -2131,15 +2325,15 @@ public function payScheduleListNextPayDates($business_id) * List Next Pay Dates * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleListNextPayDates'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayScheduleDateForecastResultApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function payScheduleListNextPayDatesWithHttpInfo($business_id) + public function payScheduleListNextPayDatesWithHttpInfo($business_id, string $contentType = self::contentTypes['payScheduleListNextPayDates'][0]) { - $returnType = '\Swagger\Client\Model\PayScheduleDateForecastResultApiModel[]'; - $request = $this->payScheduleListNextPayDatesRequest($business_id); + $request = $this->payScheduleListNextPayDatesRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2148,9 +2342,16 @@ public function payScheduleListNextPayDatesWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2161,19 +2362,37 @@ public function payScheduleListNextPayDatesWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2190,7 +2409,7 @@ public function payScheduleListNextPayDatesWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayScheduleDateForecastResultApiModel[]', + '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2206,13 +2425,14 @@ public function payScheduleListNextPayDatesWithHttpInfo($business_id) * List Next Pay Dates * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleListNextPayDates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payScheduleListNextPayDatesAsync($business_id) + public function payScheduleListNextPayDatesAsync($business_id, string $contentType = self::contentTypes['payScheduleListNextPayDates'][0]) { - return $this->payScheduleListNextPayDatesAsyncWithHttpInfo($business_id) + return $this->payScheduleListNextPayDatesAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2226,24 +2446,24 @@ function ($response) { * List Next Pay Dates * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleListNextPayDates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function payScheduleListNextPayDatesAsyncWithHttpInfo($business_id) + public function payScheduleListNextPayDatesAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['payScheduleListNextPayDates'][0]) { - $returnType = '\Swagger\Client\Model\PayScheduleDateForecastResultApiModel[]'; - $request = $this->payScheduleListNextPayDatesRequest($business_id); + $returnType = '\OpenAPI\Client\Model\PayScheduleDateForecastResultApiModel[]'; + $request = $this->payScheduleListNextPayDatesRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2266,7 +2486,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2276,12 +2496,14 @@ function ($exception) { * Create request for operation 'payScheduleListNextPayDates' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['payScheduleListNextPayDates'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function payScheduleListNextPayDatesRequest($business_id) + public function payScheduleListNextPayDatesRequest($business_id, string $contentType = self::contentTypes['payScheduleListNextPayDates'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2289,6 +2511,7 @@ protected function payScheduleListNextPayDatesRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/payschedule/nextpaydates'; $formParams = []; $queryParams = []; @@ -2297,6 +2520,7 @@ protected function payScheduleListNextPayDatesRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2306,53 +2530,35 @@ protected function payScheduleListNextPayDatesRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2373,10 +2579,11 @@ protected function payScheduleListNextPayDatesRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/PaymentSummaryApi.php b/src/lib/Api/PaymentSummaryApi.php index 10b559b..0eb3b1d 100644 --- a/src/lib/Api/PaymentSummaryApi.php +++ b/src/lib/Api/PaymentSummaryApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auPaymentSummaryGet' => [ + 'application/json', + ], + 'auPaymentSummaryPost' => [ + 'application/json', + ], + 'auPaymentSummaryPut' => [ + '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 + 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; } /** @@ -97,14 +141,15 @@ public function getConfig() * @param int $employee_id employee_id (optional) * @param int $employing_entity_id employing_entity_id (optional) * @param int $location_id location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPaymentSummaryDelete($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryDelete($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryDelete'][0]) { - $this->auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $this->auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); } /** @@ -117,15 +162,15 @@ public function auPaymentSummaryDelete($financial_year_ending, $business_id, $em * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryDelete'][0]) { - $returnType = ''; - $request = $this->auPaymentSummaryDeleteRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $request = $this->auPaymentSummaryDeleteRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -134,9 +179,16 @@ public function auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -147,11 +199,11 @@ public function auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -174,13 +226,14 @@ public function auPaymentSummaryDeleteWithHttpInfo($financial_year_ending, $busi * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryDeleteAsync($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryDeleteAsync($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryDelete'][0]) { - return $this->auPaymentSummaryDeleteAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id) + return $this->auPaymentSummaryDeleteAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -198,14 +251,15 @@ function ($response) { * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryDeleteAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryDeleteAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryDelete'][0]) { $returnType = ''; - $request = $this->auPaymentSummaryDeleteRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $request = $this->auPaymentSummaryDeleteRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -224,7 +278,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -238,18 +292,21 @@ function ($exception) { * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaymentSummaryDeleteRequest($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryDeleteRequest($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryDelete'][0]) { + // verify the required parameter 'financial_year_ending' is set if ($financial_year_ending === null || (is_array($financial_year_ending) && count($financial_year_ending) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $financial_year_ending when calling auPaymentSummaryDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -257,6 +314,10 @@ protected function auPaymentSummaryDeleteRequest($financial_year_ending, $busine ); } + + + + $resourcePath = '/api/v2/business/{businessId}/paymentsummary/{financialYearEnding}'; $formParams = []; $queryParams = []; @@ -265,17 +326,33 @@ protected function auPaymentSummaryDeleteRequest($financial_year_ending, $busine $multipart = false; // query params - if ($employee_id !== null) { - $queryParams['employeeId'] = ObjectSerializer::toQueryValue($employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employee_id, + 'employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($employing_entity_id !== null) { - $queryParams['employingEntityId'] = ObjectSerializer::toQueryValue($employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employing_entity_id, + 'employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($financial_year_ending !== null) { @@ -294,53 +371,35 @@ protected function auPaymentSummaryDeleteRequest($financial_year_ending, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -361,10 +420,11 @@ protected function auPaymentSummaryDeleteRequest($financial_year_ending, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -377,18 +437,20 @@ protected function auPaymentSummaryDeleteRequest($financial_year_ending, $busine * * @param int $financial_year_ending financial_year_ending (required) * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PaygPaymentSummaryModel[] + * @return \OpenAPI\Client\Model\PaygPaymentSummaryModel[] */ - public function auPaymentSummaryGet($financial_year_ending, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPaymentSummaryGet($financial_year_ending, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPaymentSummaryGet'][0]) { - list($response) = $this->auPaymentSummaryGetWithHttpInfo($financial_year_ending, $business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auPaymentSummaryGetWithHttpInfo($financial_year_ending, $business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -399,19 +461,20 @@ public function auPaymentSummaryGet($financial_year_ending, $business_id, $filte * * @param int $financial_year_ending (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PaygPaymentSummaryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PaygPaymentSummaryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPaymentSummaryGetWithHttpInfo($financial_year_ending, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPaymentSummaryGetWithHttpInfo($financial_year_ending, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPaymentSummaryGet'][0]) { - $returnType = '\Swagger\Client\Model\PaygPaymentSummaryModel[]'; - $request = $this->auPaymentSummaryGetRequest($financial_year_ending, $business_id, $filter, $orderby, $top, $skip); + $request = $this->auPaymentSummaryGetRequest($financial_year_ending, $business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -420,9 +483,16 @@ public function auPaymentSummaryGetWithHttpInfo($financial_year_ending, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -433,19 +503,37 @@ public function auPaymentSummaryGetWithHttpInfo($financial_year_ending, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PaygPaymentSummaryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PaygPaymentSummaryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PaygPaymentSummaryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PaygPaymentSummaryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -462,7 +550,7 @@ public function auPaymentSummaryGetWithHttpInfo($financial_year_ending, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PaygPaymentSummaryModel[]', + '\OpenAPI\Client\Model\PaygPaymentSummaryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -479,17 +567,19 @@ public function auPaymentSummaryGetWithHttpInfo($financial_year_ending, $busines * * @param int $financial_year_ending (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryGetAsync($financial_year_ending, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPaymentSummaryGetAsync($financial_year_ending, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPaymentSummaryGet'][0]) { - return $this->auPaymentSummaryGetAsyncWithHttpInfo($financial_year_ending, $business_id, $filter, $orderby, $top, $skip) + return $this->auPaymentSummaryGetAsyncWithHttpInfo($financial_year_ending, $business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -504,28 +594,29 @@ function ($response) { * * @param int $financial_year_ending (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryGetAsyncWithHttpInfo($financial_year_ending, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPaymentSummaryGetAsyncWithHttpInfo($financial_year_ending, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPaymentSummaryGet'][0]) { - $returnType = '\Swagger\Client\Model\PaygPaymentSummaryModel[]'; - $request = $this->auPaymentSummaryGetRequest($financial_year_ending, $business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\PaygPaymentSummaryModel[]'; + $request = $this->auPaymentSummaryGetRequest($financial_year_ending, $business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -548,7 +639,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -559,22 +650,26 @@ function ($exception) { * * @param int $financial_year_ending (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaymentSummaryGetRequest($financial_year_ending, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auPaymentSummaryGetRequest($financial_year_ending, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auPaymentSummaryGet'][0]) { + // verify the required parameter 'financial_year_ending' is set if ($financial_year_ending === null || (is_array($financial_year_ending) && count($financial_year_ending) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $financial_year_ending when calling auPaymentSummaryGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -582,6 +677,12 @@ protected function auPaymentSummaryGetRequest($financial_year_ending, $business_ ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/paymentsummary/{financialYearEnding}'; $formParams = []; $queryParams = []; @@ -590,20 +691,45 @@ protected function auPaymentSummaryGetRequest($financial_year_ending, $business_ $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -623,53 +749,35 @@ protected function auPaymentSummaryGetRequest($financial_year_ending, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -690,10 +798,11 @@ protected function auPaymentSummaryGetRequest($financial_year_ending, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -709,14 +818,15 @@ protected function auPaymentSummaryGetRequest($financial_year_ending, $business_ * @param int $employee_id employee_id (optional) * @param int $employing_entity_id employing_entity_id (optional) * @param int $location_id location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPaymentSummaryPost($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPost($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPost'][0]) { - $this->auPaymentSummaryPostWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $this->auPaymentSummaryPostWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); } /** @@ -729,15 +839,15 @@ public function auPaymentSummaryPost($financial_year_ending, $business_id, $empl * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPaymentSummaryPostWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPostWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPost'][0]) { - $returnType = ''; - $request = $this->auPaymentSummaryPostRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $request = $this->auPaymentSummaryPostRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -746,9 +856,16 @@ public function auPaymentSummaryPostWithHttpInfo($financial_year_ending, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -759,11 +876,11 @@ public function auPaymentSummaryPostWithHttpInfo($financial_year_ending, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -786,13 +903,14 @@ public function auPaymentSummaryPostWithHttpInfo($financial_year_ending, $busine * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryPostAsync($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPostAsync($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPost'][0]) { - return $this->auPaymentSummaryPostAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id) + return $this->auPaymentSummaryPostAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -810,14 +928,15 @@ function ($response) { * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryPostAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPostAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPost'][0]) { $returnType = ''; - $request = $this->auPaymentSummaryPostRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $request = $this->auPaymentSummaryPostRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -836,7 +955,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -850,18 +969,21 @@ function ($exception) { * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaymentSummaryPostRequest($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPostRequest($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPost'][0]) { + // verify the required parameter 'financial_year_ending' is set if ($financial_year_ending === null || (is_array($financial_year_ending) && count($financial_year_ending) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $financial_year_ending when calling auPaymentSummaryPost' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -869,6 +991,10 @@ protected function auPaymentSummaryPostRequest($financial_year_ending, $business ); } + + + + $resourcePath = '/api/v2/business/{businessId}/paymentsummary/{financialYearEnding}'; $formParams = []; $queryParams = []; @@ -877,17 +1003,33 @@ protected function auPaymentSummaryPostRequest($financial_year_ending, $business $multipart = false; // query params - if ($employee_id !== null) { - $queryParams['employeeId'] = ObjectSerializer::toQueryValue($employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employee_id, + 'employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($employing_entity_id !== null) { - $queryParams['employingEntityId'] = ObjectSerializer::toQueryValue($employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employing_entity_id, + 'employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($financial_year_ending !== null) { @@ -906,53 +1048,35 @@ protected function auPaymentSummaryPostRequest($financial_year_ending, $business ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -973,10 +1097,11 @@ protected function auPaymentSummaryPostRequest($financial_year_ending, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -992,14 +1117,15 @@ protected function auPaymentSummaryPostRequest($financial_year_ending, $business * @param int $employee_id employee_id (optional) * @param int $employing_entity_id employing_entity_id (optional) * @param int $location_id location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PaygPaymentSummaryModel + * @return \OpenAPI\Client\Model\PaygPaymentSummaryModel */ - public function auPaymentSummaryPut($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPut($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPut'][0]) { - list($response) = $this->auPaymentSummaryPutWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + list($response) = $this->auPaymentSummaryPutWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); return $response; } @@ -1013,15 +1139,15 @@ public function auPaymentSummaryPut($financial_year_ending, $business_id, $emplo * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PaygPaymentSummaryModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PaygPaymentSummaryModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPaymentSummaryPutWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPutWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPut'][0]) { - $returnType = '\Swagger\Client\Model\PaygPaymentSummaryModel'; - $request = $this->auPaymentSummaryPutRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $request = $this->auPaymentSummaryPutRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1030,9 +1156,16 @@ public function auPaymentSummaryPutWithHttpInfo($financial_year_ending, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1043,19 +1176,37 @@ public function auPaymentSummaryPutWithHttpInfo($financial_year_ending, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PaygPaymentSummaryModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PaygPaymentSummaryModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PaygPaymentSummaryModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PaygPaymentSummaryModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1072,7 +1223,7 @@ public function auPaymentSummaryPutWithHttpInfo($financial_year_ending, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PaygPaymentSummaryModel', + '\OpenAPI\Client\Model\PaygPaymentSummaryModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1092,13 +1243,14 @@ public function auPaymentSummaryPutWithHttpInfo($financial_year_ending, $busines * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryPutAsync($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPutAsync($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPut'][0]) { - return $this->auPaymentSummaryPutAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id) + return $this->auPaymentSummaryPutAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1116,24 +1268,24 @@ function ($response) { * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPaymentSummaryPutAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPutAsyncWithHttpInfo($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPut'][0]) { - $returnType = '\Swagger\Client\Model\PaygPaymentSummaryModel'; - $request = $this->auPaymentSummaryPutRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id); + $returnType = '\OpenAPI\Client\Model\PaygPaymentSummaryModel'; + $request = $this->auPaymentSummaryPutRequest($financial_year_ending, $business_id, $employee_id, $employing_entity_id, $location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1156,7 +1308,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1170,18 +1322,21 @@ function ($exception) { * @param int $employee_id (optional) * @param int $employing_entity_id (optional) * @param int $location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPaymentSummaryPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPaymentSummaryPutRequest($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null) + public function auPaymentSummaryPutRequest($financial_year_ending, $business_id, $employee_id = null, $employing_entity_id = null, $location_id = null, string $contentType = self::contentTypes['auPaymentSummaryPut'][0]) { + // verify the required parameter 'financial_year_ending' is set if ($financial_year_ending === null || (is_array($financial_year_ending) && count($financial_year_ending) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $financial_year_ending when calling auPaymentSummaryPut' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1189,6 +1344,10 @@ protected function auPaymentSummaryPutRequest($financial_year_ending, $business_ ); } + + + + $resourcePath = '/api/v2/business/{businessId}/paymentsummary/{financialYearEnding}'; $formParams = []; $queryParams = []; @@ -1197,17 +1356,33 @@ protected function auPaymentSummaryPutRequest($financial_year_ending, $business_ $multipart = false; // query params - if ($employee_id !== null) { - $queryParams['employeeId'] = ObjectSerializer::toQueryValue($employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employee_id, + 'employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($employing_entity_id !== null) { - $queryParams['employingEntityId'] = ObjectSerializer::toQueryValue($employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employing_entity_id, + 'employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($financial_year_ending !== null) { @@ -1226,53 +1401,35 @@ protected function auPaymentSummaryPutRequest($financial_year_ending, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1293,10 +1450,11 @@ protected function auPaymentSummaryPutRequest($financial_year_ending, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/PublicHolidayApi.php b/src/lib/Api/PublicHolidayApi.php index aa865d8..4863578 100644 --- a/src/lib/Api/PublicHolidayApi.php +++ b/src/lib/Api/PublicHolidayApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auPublicHolidayDeleteById' => [ + 'application/json', + ], + 'auPublicHolidayGetById' => [ + 'application/json', + ], + 'auPublicHolidayGetPublicHolidaysByYear' => [ + 'application/json', + ], + 'auPublicHolidayPostPublicHoliday' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auPublicHolidayPutPublicHoliday' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +152,15 @@ public function getConfig() * * @param \DateTime $date date (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteByDate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPublicHolidayDeleteByDate($date, $business_id) + public function auPublicHolidayDeleteByDate($date, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteByDate'][0]) { - $this->auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id); + $this->auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id, $contentType); } /** @@ -111,15 +170,15 @@ public function auPublicHolidayDeleteByDate($date, $business_id) * * @param \DateTime $date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteByDate'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id) + public function auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteByDate'][0]) { - $returnType = ''; - $request = $this->auPublicHolidayDeleteByDateRequest($date, $business_id); + $request = $this->auPublicHolidayDeleteByDateRequest($date, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +187,16 @@ public function auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +207,11 @@ public function auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +231,14 @@ public function auPublicHolidayDeleteByDateWithHttpInfo($date, $business_id) * * @param \DateTime $date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteByDate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayDeleteByDateAsync($date, $business_id) + public function auPublicHolidayDeleteByDateAsync($date, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteByDate'][0]) { - return $this->auPublicHolidayDeleteByDateAsyncWithHttpInfo($date, $business_id) + return $this->auPublicHolidayDeleteByDateAsyncWithHttpInfo($date, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +253,15 @@ function ($response) { * * @param \DateTime $date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteByDate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayDeleteByDateAsyncWithHttpInfo($date, $business_id) + public function auPublicHolidayDeleteByDateAsyncWithHttpInfo($date, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteByDate'][0]) { $returnType = ''; - $request = $this->auPublicHolidayDeleteByDateRequest($date, $business_id); + $request = $this->auPublicHolidayDeleteByDateRequest($date, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +280,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +291,21 @@ function ($exception) { * * @param \DateTime $date (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteByDate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPublicHolidayDeleteByDateRequest($date, $business_id) + public function auPublicHolidayDeleteByDateRequest($date, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteByDate'][0]) { + // verify the required parameter 'date' is set if ($date === null || (is_array($date) && count($date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $date when calling auPublicHolidayDeleteByDate' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +313,7 @@ protected function auPublicHolidayDeleteByDateRequest($date, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/publicholiday'; $formParams = []; $queryParams = []; @@ -250,9 +322,15 @@ protected function auPublicHolidayDeleteByDateRequest($date, $business_id) $multipart = false; // query params - if ($date !== null) { - $queryParams['date'] = ObjectSerializer::toQueryValue($date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $date, + 'date', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -263,53 +341,35 @@ protected function auPublicHolidayDeleteByDateRequest($date, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -330,10 +390,11 @@ protected function auPublicHolidayDeleteByDateRequest($date, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -346,14 +407,15 @@ protected function auPublicHolidayDeleteByDateRequest($date, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auPublicHolidayDeleteById($id, $business_id) + public function auPublicHolidayDeleteById($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteById'][0]) { - $this->auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id); + $this->auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id, $contentType); } /** @@ -363,15 +425,15 @@ public function auPublicHolidayDeleteById($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id) + public function auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteById'][0]) { - $returnType = ''; - $request = $this->auPublicHolidayDeleteByIdRequest($id, $business_id); + $request = $this->auPublicHolidayDeleteByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -380,9 +442,16 @@ public function auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -393,11 +462,11 @@ public function auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -417,13 +486,14 @@ public function auPublicHolidayDeleteByIdWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayDeleteByIdAsync($id, $business_id) + public function auPublicHolidayDeleteByIdAsync($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteById'][0]) { - return $this->auPublicHolidayDeleteByIdAsyncWithHttpInfo($id, $business_id) + return $this->auPublicHolidayDeleteByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -438,14 +508,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayDeleteByIdAsyncWithHttpInfo($id, $business_id) + public function auPublicHolidayDeleteByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteById'][0]) { $returnType = ''; - $request = $this->auPublicHolidayDeleteByIdRequest($id, $business_id); + $request = $this->auPublicHolidayDeleteByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -464,7 +535,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -475,18 +546,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayDeleteById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPublicHolidayDeleteByIdRequest($id, $business_id) + public function auPublicHolidayDeleteByIdRequest($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayDeleteById'][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 auPublicHolidayDeleteById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -494,6 +568,7 @@ protected function auPublicHolidayDeleteByIdRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/publicholiday/{id}'; $formParams = []; $queryParams = []; @@ -502,6 +577,7 @@ protected function auPublicHolidayDeleteByIdRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -519,53 +595,35 @@ protected function auPublicHolidayDeleteByIdRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -586,10 +644,11 @@ protected function auPublicHolidayDeleteByIdRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -602,14 +661,15 @@ protected function auPublicHolidayDeleteByIdRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PublicHolidayModel + * @return \OpenAPI\Client\Model\PublicHolidayModel */ - public function auPublicHolidayGetById($id, $business_id) + public function auPublicHolidayGetById($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetById'][0]) { - list($response) = $this->auPublicHolidayGetByIdWithHttpInfo($id, $business_id); + list($response) = $this->auPublicHolidayGetByIdWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -620,15 +680,15 @@ public function auPublicHolidayGetById($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PublicHolidayModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PublicHolidayModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPublicHolidayGetByIdWithHttpInfo($id, $business_id) + public function auPublicHolidayGetByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetById'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel'; - $request = $this->auPublicHolidayGetByIdRequest($id, $business_id); + $request = $this->auPublicHolidayGetByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -637,9 +697,16 @@ public function auPublicHolidayGetByIdWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -650,19 +717,37 @@ public function auPublicHolidayGetByIdWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PublicHolidayModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicHolidayModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicHolidayModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -679,7 +764,7 @@ public function auPublicHolidayGetByIdWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PublicHolidayModel', + '\OpenAPI\Client\Model\PublicHolidayModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -696,13 +781,14 @@ public function auPublicHolidayGetByIdWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayGetByIdAsync($id, $business_id) + public function auPublicHolidayGetByIdAsync($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetById'][0]) { - return $this->auPublicHolidayGetByIdAsyncWithHttpInfo($id, $business_id) + return $this->auPublicHolidayGetByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -717,24 +803,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayGetByIdAsyncWithHttpInfo($id, $business_id) + public function auPublicHolidayGetByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetById'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel'; - $request = $this->auPublicHolidayGetByIdRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel'; + $request = $this->auPublicHolidayGetByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -757,7 +843,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -768,18 +854,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPublicHolidayGetByIdRequest($id, $business_id) + public function auPublicHolidayGetByIdRequest($id, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetById'][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 auPublicHolidayGetById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -787,6 +876,7 @@ protected function auPublicHolidayGetByIdRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/publicholiday/{id}'; $formParams = []; $queryParams = []; @@ -795,6 +885,7 @@ protected function auPublicHolidayGetByIdRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -812,53 +903,35 @@ protected function auPublicHolidayGetByIdRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -879,10 +952,11 @@ protected function auPublicHolidayGetByIdRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -895,14 +969,15 @@ protected function auPublicHolidayGetByIdRequest($id, $business_id) * * @param int $year year (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PublicHolidayModel[] + * @return \OpenAPI\Client\Model\PublicHolidayModel[] */ - public function auPublicHolidayGetPublicHolidaysByYear($year, $business_id) + public function auPublicHolidayGetPublicHolidaysByYear($year, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'][0]) { - list($response) = $this->auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $business_id); + list($response) = $this->auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $business_id, $contentType); return $response; } @@ -913,15 +988,15 @@ public function auPublicHolidayGetPublicHolidaysByYear($year, $business_id) * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PublicHolidayModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PublicHolidayModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $business_id) + public function auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel[]'; - $request = $this->auPublicHolidayGetPublicHolidaysByYearRequest($year, $business_id); + $request = $this->auPublicHolidayGetPublicHolidaysByYearRequest($year, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -930,9 +1005,16 @@ public function auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -943,19 +1025,37 @@ public function auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PublicHolidayModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicHolidayModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicHolidayModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -972,7 +1072,7 @@ public function auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $busin case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PublicHolidayModel[]', + '\OpenAPI\Client\Model\PublicHolidayModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -989,13 +1089,14 @@ public function auPublicHolidayGetPublicHolidaysByYearWithHttpInfo($year, $busin * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayGetPublicHolidaysByYearAsync($year, $business_id) + public function auPublicHolidayGetPublicHolidaysByYearAsync($year, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'][0]) { - return $this->auPublicHolidayGetPublicHolidaysByYearAsyncWithHttpInfo($year, $business_id) + return $this->auPublicHolidayGetPublicHolidaysByYearAsyncWithHttpInfo($year, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1010,24 +1111,24 @@ function ($response) { * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayGetPublicHolidaysByYearAsyncWithHttpInfo($year, $business_id) + public function auPublicHolidayGetPublicHolidaysByYearAsyncWithHttpInfo($year, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel[]'; - $request = $this->auPublicHolidayGetPublicHolidaysByYearRequest($year, $business_id); + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel[]'; + $request = $this->auPublicHolidayGetPublicHolidaysByYearRequest($year, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1050,7 +1151,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1061,18 +1162,21 @@ function ($exception) { * * @param int $year (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPublicHolidayGetPublicHolidaysByYearRequest($year, $business_id) + public function auPublicHolidayGetPublicHolidaysByYearRequest($year, $business_id, string $contentType = self::contentTypes['auPublicHolidayGetPublicHolidaysByYear'][0]) { + // verify the required parameter 'year' is set if ($year === null || (is_array($year) && count($year) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $year when calling auPublicHolidayGetPublicHolidaysByYear' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1080,6 +1184,7 @@ protected function auPublicHolidayGetPublicHolidaysByYearRequest($year, $busines ); } + $resourcePath = '/api/v2/business/{businessId}/publicholiday'; $formParams = []; $queryParams = []; @@ -1088,9 +1193,15 @@ protected function auPublicHolidayGetPublicHolidaysByYearRequest($year, $busines $multipart = false; // query params - if ($year !== null) { - $queryParams['year'] = ObjectSerializer::toQueryValue($year); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $year, + 'year', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1101,53 +1212,35 @@ protected function auPublicHolidayGetPublicHolidaysByYearRequest($year, $busines ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1168,10 +1261,11 @@ protected function auPublicHolidayGetPublicHolidaysByYearRequest($year, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1182,16 +1276,17 @@ protected function auPublicHolidayGetPublicHolidaysByYearRequest($year, $busines * * Add a public holiday * - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday public_holiday (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPostPublicHoliday'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PublicHolidayModel + * @return \OpenAPI\Client\Model\PublicHolidayModel */ - public function auPublicHolidayPostPublicHoliday($public_holiday, $business_id) + public function auPublicHolidayPostPublicHoliday($business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPostPublicHoliday'][0]) { - list($response) = $this->auPublicHolidayPostPublicHolidayWithHttpInfo($public_holiday, $business_id); + list($response) = $this->auPublicHolidayPostPublicHolidayWithHttpInfo($business_id, $public_holiday, $contentType); return $response; } @@ -1200,17 +1295,17 @@ public function auPublicHolidayPostPublicHoliday($public_holiday, $business_id) * * Add a public holiday * - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPostPublicHoliday'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PublicHolidayModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PublicHolidayModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPublicHolidayPostPublicHolidayWithHttpInfo($public_holiday, $business_id) + public function auPublicHolidayPostPublicHolidayWithHttpInfo($business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPostPublicHoliday'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel'; - $request = $this->auPublicHolidayPostPublicHolidayRequest($public_holiday, $business_id); + $request = $this->auPublicHolidayPostPublicHolidayRequest($business_id, $public_holiday, $contentType); try { $options = $this->createHttpClientOption(); @@ -1219,9 +1314,16 @@ public function auPublicHolidayPostPublicHolidayWithHttpInfo($public_holiday, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1232,19 +1334,37 @@ public function auPublicHolidayPostPublicHolidayWithHttpInfo($public_holiday, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PublicHolidayModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicHolidayModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicHolidayModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1261,7 +1381,7 @@ public function auPublicHolidayPostPublicHolidayWithHttpInfo($public_holiday, $b case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PublicHolidayModel', + '\OpenAPI\Client\Model\PublicHolidayModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1276,15 +1396,16 @@ public function auPublicHolidayPostPublicHolidayWithHttpInfo($public_holiday, $b * * Add a public holiday * - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPostPublicHoliday'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayPostPublicHolidayAsync($public_holiday, $business_id) + public function auPublicHolidayPostPublicHolidayAsync($business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPostPublicHoliday'][0]) { - return $this->auPublicHolidayPostPublicHolidayAsyncWithHttpInfo($public_holiday, $business_id) + return $this->auPublicHolidayPostPublicHolidayAsyncWithHttpInfo($business_id, $public_holiday, $contentType) ->then( function ($response) { return $response[0]; @@ -1297,26 +1418,26 @@ function ($response) { * * Add a public holiday * - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPostPublicHoliday'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayPostPublicHolidayAsyncWithHttpInfo($public_holiday, $business_id) + public function auPublicHolidayPostPublicHolidayAsyncWithHttpInfo($business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPostPublicHoliday'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel'; - $request = $this->auPublicHolidayPostPublicHolidayRequest($public_holiday, $business_id); + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel'; + $request = $this->auPublicHolidayPostPublicHolidayRequest($business_id, $public_holiday, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1339,7 +1460,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1348,20 +1469,16 @@ function ($exception) { /** * Create request for operation 'auPublicHolidayPostPublicHoliday' * - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPostPublicHoliday'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPublicHolidayPostPublicHolidayRequest($public_holiday, $business_id) + public function auPublicHolidayPostPublicHolidayRequest($business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPostPublicHoliday'][0]) { - // verify the required parameter 'public_holiday' is set - if ($public_holiday === null || (is_array($public_holiday) && count($public_holiday) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_holiday when calling auPublicHolidayPostPublicHoliday' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1369,6 +1486,14 @@ protected function auPublicHolidayPostPublicHolidayRequest($public_holiday, $bus ); } + // verify the required parameter 'public_holiday' is set + if ($public_holiday === null || (is_array($public_holiday) && count($public_holiday) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_holiday when calling auPublicHolidayPostPublicHoliday' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/publicholiday'; $formParams = []; $queryParams = []; @@ -1377,6 +1502,7 @@ protected function auPublicHolidayPostPublicHolidayRequest($public_holiday, $bus $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1386,56 +1512,42 @@ protected function auPublicHolidayPostPublicHolidayRequest($public_holiday, $bus ); } - // body params - $_tempBody = null; - if (isset($public_holiday)) { - $_tempBody = $public_holiday; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($public_holiday)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_holiday)); + } else { + $httpBody = $public_holiday; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1456,10 +1568,11 @@ protected function auPublicHolidayPostPublicHolidayRequest($public_holiday, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1471,16 +1584,17 @@ protected function auPublicHolidayPostPublicHolidayRequest($public_holiday, $bus * Update Public Holiday * * @param int $id id (required) - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday public_holiday (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPutPublicHoliday'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PublicHolidayModel + * @return \OpenAPI\Client\Model\PublicHolidayModel */ - public function auPublicHolidayPutPublicHoliday($id, $public_holiday, $business_id) + public function auPublicHolidayPutPublicHoliday($id, $business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPutPublicHoliday'][0]) { - list($response) = $this->auPublicHolidayPutPublicHolidayWithHttpInfo($id, $public_holiday, $business_id); + list($response) = $this->auPublicHolidayPutPublicHolidayWithHttpInfo($id, $business_id, $public_holiday, $contentType); return $response; } @@ -1490,17 +1604,17 @@ public function auPublicHolidayPutPublicHoliday($id, $public_holiday, $business_ * Update Public Holiday * * @param int $id (required) - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPutPublicHoliday'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PublicHolidayModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PublicHolidayModel, HTTP status code, HTTP response headers (array of strings) */ - public function auPublicHolidayPutPublicHolidayWithHttpInfo($id, $public_holiday, $business_id) + public function auPublicHolidayPutPublicHolidayWithHttpInfo($id, $business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPutPublicHoliday'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel'; - $request = $this->auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, $business_id); + $request = $this->auPublicHolidayPutPublicHolidayRequest($id, $business_id, $public_holiday, $contentType); try { $options = $this->createHttpClientOption(); @@ -1509,9 +1623,16 @@ public function auPublicHolidayPutPublicHolidayWithHttpInfo($id, $public_holiday } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1522,19 +1643,37 @@ public function auPublicHolidayPutPublicHolidayWithHttpInfo($id, $public_holiday sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PublicHolidayModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicHolidayModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicHolidayModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1551,7 +1690,7 @@ public function auPublicHolidayPutPublicHolidayWithHttpInfo($id, $public_holiday case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PublicHolidayModel', + '\OpenAPI\Client\Model\PublicHolidayModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1567,15 +1706,16 @@ public function auPublicHolidayPutPublicHolidayWithHttpInfo($id, $public_holiday * Update Public Holiday * * @param int $id (required) - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPutPublicHoliday'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayPutPublicHolidayAsync($id, $public_holiday, $business_id) + public function auPublicHolidayPutPublicHolidayAsync($id, $business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPutPublicHoliday'][0]) { - return $this->auPublicHolidayPutPublicHolidayAsyncWithHttpInfo($id, $public_holiday, $business_id) + return $this->auPublicHolidayPutPublicHolidayAsyncWithHttpInfo($id, $business_id, $public_holiday, $contentType) ->then( function ($response) { return $response[0]; @@ -1589,26 +1729,26 @@ function ($response) { * Update Public Holiday * * @param int $id (required) - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPutPublicHoliday'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auPublicHolidayPutPublicHolidayAsyncWithHttpInfo($id, $public_holiday, $business_id) + public function auPublicHolidayPutPublicHolidayAsyncWithHttpInfo($id, $business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPutPublicHoliday'][0]) { - $returnType = '\Swagger\Client\Model\PublicHolidayModel'; - $request = $this->auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, $business_id); + $returnType = '\OpenAPI\Client\Model\PublicHolidayModel'; + $request = $this->auPublicHolidayPutPublicHolidayRequest($id, $business_id, $public_holiday, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1631,7 +1771,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1641,26 +1781,23 @@ function ($exception) { * Create request for operation 'auPublicHolidayPutPublicHoliday' * * @param int $id (required) - * @param \Swagger\Client\Model\PublicHolidayModel $public_holiday (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\PublicHolidayModel $public_holiday (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auPublicHolidayPutPublicHoliday'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, $business_id) + public function auPublicHolidayPutPublicHolidayRequest($id, $business_id, $public_holiday, string $contentType = self::contentTypes['auPublicHolidayPutPublicHoliday'][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 auPublicHolidayPutPublicHoliday' ); } - // verify the required parameter 'public_holiday' is set - if ($public_holiday === null || (is_array($public_holiday) && count($public_holiday) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_holiday when calling auPublicHolidayPutPublicHoliday' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1668,6 +1805,14 @@ protected function auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, ); } + // verify the required parameter 'public_holiday' is set + if ($public_holiday === null || (is_array($public_holiday) && count($public_holiday) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_holiday when calling auPublicHolidayPutPublicHoliday' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/publicholiday/{id}'; $formParams = []; $queryParams = []; @@ -1676,6 +1821,7 @@ protected function auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1693,56 +1839,42 @@ protected function auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, ); } - // body params - $_tempBody = null; - if (isset($public_holiday)) { - $_tempBody = $public_holiday; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($public_holiday)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_holiday)); + } else { + $httpBody = $public_holiday; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1763,10 +1895,11 @@ protected function auPublicHolidayPutPublicHolidayRequest($id, $public_holiday, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/QualificationsApi.php b/src/lib/Api/QualificationsApi.php index d853519..bbbd5de 100644 --- a/src/lib/Api/QualificationsApi.php +++ b/src/lib/Api/QualificationsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'qualificationGet' => [ + 'application/json', + ], + 'qualificationGetQualifications' => [ + 'application/json', + ], + 'qualificationPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'qualificationPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function qualificationDelete($id, $business_id) + public function qualificationDelete($id, $business_id, string $contentType = self::contentTypes['qualificationDelete'][0]) { - $this->qualificationDeleteWithHttpInfo($id, $business_id); + $this->qualificationDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function qualificationDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function qualificationDeleteWithHttpInfo($id, $business_id) + public function qualificationDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['qualificationDelete'][0]) { - $returnType = ''; - $request = $this->qualificationDeleteRequest($id, $business_id); + $request = $this->qualificationDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function qualificationDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function qualificationDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function qualificationDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationDeleteAsync($id, $business_id) + public function qualificationDeleteAsync($id, $business_id, string $contentType = self::contentTypes['qualificationDelete'][0]) { - return $this->qualificationDeleteAsyncWithHttpInfo($id, $business_id) + return $this->qualificationDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationDeleteAsyncWithHttpInfo($id, $business_id) + public function qualificationDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['qualificationDelete'][0]) { $returnType = ''; - $request = $this->qualificationDeleteRequest($id, $business_id); + $request = $this->qualificationDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function qualificationDeleteRequest($id, $business_id) + public function qualificationDeleteRequest($id, $business_id, string $contentType = self::contentTypes['qualificationDelete'][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 qualificationDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function qualificationDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function qualificationDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function qualificationDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function qualificationDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function qualificationDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\QualificationModel + * @return \OpenAPI\Client\Model\QualificationModel */ - public function qualificationGet($id, $business_id) + public function qualificationGet($id, $business_id, string $contentType = self::contentTypes['qualificationGet'][0]) { - list($response) = $this->qualificationGetWithHttpInfo($id, $business_id); + list($response) = $this->qualificationGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function qualificationGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\QualificationModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\QualificationModel, HTTP status code, HTTP response headers (array of strings) */ - public function qualificationGetWithHttpInfo($id, $business_id) + public function qualificationGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['qualificationGet'][0]) { - $returnType = '\Swagger\Client\Model\QualificationModel'; - $request = $this->qualificationGetRequest($id, $business_id); + $request = $this->qualificationGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function qualificationGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function qualificationGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\QualificationModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\QualificationModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\QualificationModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\QualificationModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function qualificationGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\QualificationModel', + '\OpenAPI\Client\Model\QualificationModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function qualificationGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationGetAsync($id, $business_id) + public function qualificationGetAsync($id, $business_id, string $contentType = self::contentTypes['qualificationGet'][0]) { - return $this->qualificationGetAsyncWithHttpInfo($id, $business_id) + return $this->qualificationGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationGetAsyncWithHttpInfo($id, $business_id) + public function qualificationGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['qualificationGet'][0]) { - $returnType = '\Swagger\Client\Model\QualificationModel'; - $request = $this->qualificationGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\QualificationModel'; + $request = $this->qualificationGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function qualificationGetRequest($id, $business_id) + public function qualificationGetRequest($id, $business_id, string $contentType = self::contentTypes['qualificationGet'][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 qualificationGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function qualificationGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function qualificationGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function qualificationGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function qualificationGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function qualificationGetRequest($id, $business_id) * List Qualifications * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGetQualifications'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[] */ - public function qualificationGetQualifications($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function qualificationGetQualifications($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['qualificationGetQualifications'][0]) { - list($response) = $this->qualificationGetQualificationsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->qualificationGetQualificationsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function qualificationGetQualifications($business_id, $filter = null, $or * List Qualifications * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGetQualifications'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\QualificationModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\QualificationModel[], HTTP status code, HTTP response headers (array of strings) */ - public function qualificationGetQualificationsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function qualificationGetQualificationsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['qualificationGetQualifications'][0]) { - $returnType = '\Swagger\Client\Model\QualificationModel[]'; - $request = $this->qualificationGetQualificationsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->qualificationGetQualificationsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function qualificationGetQualificationsWithHttpInfo($business_id, $filter } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function qualificationGetQualificationsWithHttpInfo($business_id, $filter sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\QualificationModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\QualificationModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\QualificationModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\QualificationModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function qualificationGetQualificationsWithHttpInfo($business_id, $filter case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\QualificationModel[]', + '\OpenAPI\Client\Model\QualificationModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function qualificationGetQualificationsWithHttpInfo($business_id, $filter * List Qualifications * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationGetQualificationsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function qualificationGetQualificationsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['qualificationGetQualifications'][0]) { - return $this->qualificationGetQualificationsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->qualificationGetQualificationsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Qualifications * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationGetQualificationsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function qualificationGetQualificationsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['qualificationGetQualifications'][0]) { - $returnType = '\Swagger\Client\Model\QualificationModel[]'; - $request = $this->qualificationGetQualificationsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\QualificationModel[]'; + $request = $this->qualificationGetQualificationsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'qualificationGetQualifications' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationGetQualifications'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function qualificationGetQualificationsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function qualificationGetQualificationsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['qualificationGetQualifications'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function qualificationGetQualificationsRequest($business_id, $filter = ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/qualification'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function qualificationGetQualificationsRequest($business_id, $filter = $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function qualificationGetQualificationsRequest($business_id, $filter = ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function qualificationGetQualificationsRequest($business_id, $filter = $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function qualificationGetQualificationsRequest($business_id, $filter = * * Create Qualification * - * @param \Swagger\Client\Model\QualificationModel $qualification qualification (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function qualificationPost($qualification, $business_id) + public function qualificationPost($business_id, $qualification, string $contentType = self::contentTypes['qualificationPost'][0]) { - $this->qualificationPostWithHttpInfo($qualification, $business_id); + $this->qualificationPostWithHttpInfo($business_id, $qualification, $contentType); } /** @@ -968,17 +1085,17 @@ public function qualificationPost($qualification, $business_id) * * Create Qualification * - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function qualificationPostWithHttpInfo($qualification, $business_id) + public function qualificationPostWithHttpInfo($business_id, $qualification, string $contentType = self::contentTypes['qualificationPost'][0]) { - $returnType = ''; - $request = $this->qualificationPostRequest($qualification, $business_id); + $request = $this->qualificationPostRequest($business_id, $qualification, $contentType); try { $options = $this->createHttpClientOption(); @@ -987,9 +1104,16 @@ public function qualificationPostWithHttpInfo($qualification, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1000,11 +1124,11 @@ public function qualificationPostWithHttpInfo($qualification, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1022,15 +1146,16 @@ public function qualificationPostWithHttpInfo($qualification, $business_id) * * Create Qualification * - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationPostAsync($qualification, $business_id) + public function qualificationPostAsync($business_id, $qualification, string $contentType = self::contentTypes['qualificationPost'][0]) { - return $this->qualificationPostAsyncWithHttpInfo($qualification, $business_id) + return $this->qualificationPostAsyncWithHttpInfo($business_id, $qualification, $contentType) ->then( function ($response) { return $response[0]; @@ -1043,16 +1168,17 @@ function ($response) { * * Create Qualification * - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationPostAsyncWithHttpInfo($qualification, $business_id) + public function qualificationPostAsyncWithHttpInfo($business_id, $qualification, string $contentType = self::contentTypes['qualificationPost'][0]) { $returnType = ''; - $request = $this->qualificationPostRequest($qualification, $business_id); + $request = $this->qualificationPostRequest($business_id, $qualification, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1071,7 +1197,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1080,20 +1206,16 @@ function ($exception) { /** * Create request for operation 'qualificationPost' * - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function qualificationPostRequest($qualification, $business_id) + public function qualificationPostRequest($business_id, $qualification, string $contentType = self::contentTypes['qualificationPost'][0]) { - // verify the required parameter 'qualification' is set - if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $qualification when calling qualificationPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1101,6 +1223,14 @@ protected function qualificationPostRequest($qualification, $business_id) ); } + // verify the required parameter 'qualification' is set + if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $qualification when calling qualificationPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/qualification'; $formParams = []; $queryParams = []; @@ -1109,6 +1239,7 @@ protected function qualificationPostRequest($qualification, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1118,56 +1249,42 @@ protected function qualificationPostRequest($qualification, $business_id) ); } - // body params - $_tempBody = null; - if (isset($qualification)) { - $_tempBody = $qualification; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($qualification)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($qualification)); + } else { + $httpBody = $qualification; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1188,10 +1305,11 @@ protected function qualificationPostRequest($qualification, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1203,16 +1321,17 @@ protected function qualificationPostRequest($qualification, $business_id) * Update Qualification * * @param int $id id (required) - * @param \Swagger\Client\Model\QualificationModel $qualification qualification (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function qualificationPut($id, $qualification, $business_id) + public function qualificationPut($id, $business_id, $qualification, string $contentType = self::contentTypes['qualificationPut'][0]) { - $this->qualificationPutWithHttpInfo($id, $qualification, $business_id); + $this->qualificationPutWithHttpInfo($id, $business_id, $qualification, $contentType); } /** @@ -1221,17 +1340,17 @@ public function qualificationPut($id, $qualification, $business_id) * Update Qualification * * @param int $id (required) - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function qualificationPutWithHttpInfo($id, $qualification, $business_id) + public function qualificationPutWithHttpInfo($id, $business_id, $qualification, string $contentType = self::contentTypes['qualificationPut'][0]) { - $returnType = ''; - $request = $this->qualificationPutRequest($id, $qualification, $business_id); + $request = $this->qualificationPutRequest($id, $business_id, $qualification, $contentType); try { $options = $this->createHttpClientOption(); @@ -1240,9 +1359,16 @@ public function qualificationPutWithHttpInfo($id, $qualification, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1253,11 +1379,11 @@ public function qualificationPutWithHttpInfo($id, $qualification, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1276,15 +1402,16 @@ public function qualificationPutWithHttpInfo($id, $qualification, $business_id) * Update Qualification * * @param int $id (required) - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationPutAsync($id, $qualification, $business_id) + public function qualificationPutAsync($id, $business_id, $qualification, string $contentType = self::contentTypes['qualificationPut'][0]) { - return $this->qualificationPutAsyncWithHttpInfo($id, $qualification, $business_id) + return $this->qualificationPutAsyncWithHttpInfo($id, $business_id, $qualification, $contentType) ->then( function ($response) { return $response[0]; @@ -1298,16 +1425,17 @@ function ($response) { * Update Qualification * * @param int $id (required) - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function qualificationPutAsyncWithHttpInfo($id, $qualification, $business_id) + public function qualificationPutAsyncWithHttpInfo($id, $business_id, $qualification, string $contentType = self::contentTypes['qualificationPut'][0]) { $returnType = ''; - $request = $this->qualificationPutRequest($id, $qualification, $business_id); + $request = $this->qualificationPutRequest($id, $business_id, $qualification, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1326,7 +1454,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1336,26 +1464,23 @@ function ($exception) { * Create request for operation 'qualificationPut' * * @param int $id (required) - * @param \Swagger\Client\Model\QualificationModel $qualification (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\QualificationModel $qualification (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['qualificationPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function qualificationPutRequest($id, $qualification, $business_id) + public function qualificationPutRequest($id, $business_id, $qualification, string $contentType = self::contentTypes['qualificationPut'][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 qualificationPut' ); } - // verify the required parameter 'qualification' is set - if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $qualification when calling qualificationPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1363,6 +1488,14 @@ protected function qualificationPutRequest($id, $qualification, $business_id) ); } + // verify the required parameter 'qualification' is set + if ($qualification === null || (is_array($qualification) && count($qualification) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $qualification when calling qualificationPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/qualification/{id}'; $formParams = []; $queryParams = []; @@ -1371,6 +1504,7 @@ protected function qualificationPutRequest($id, $qualification, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1388,56 +1522,42 @@ protected function qualificationPutRequest($id, $qualification, $business_id) ); } - // body params - $_tempBody = null; - if (isset($qualification)) { - $_tempBody = $qualification; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($qualification)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($qualification)); + } else { + $httpBody = $qualification; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1458,10 +1578,11 @@ protected function qualificationPutRequest($id, $qualification, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/ReportingApi.php b/src/lib/Api/ReportingApi.php index 157010a..617f353 100644 --- a/src/lib/Api/ReportingApi.php +++ b/src/lib/Api/ReportingApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auReportsDetailedActivityGet' => [ + 'application/json', + ], + 'auReportsEmployeeDetailsFieldsGet' => [ + 'application/json', + ], + 'auReportsEmployeePaymentHistoryGet' => [ + 'application/json', + ], + 'auReportsGrossToNetGet' => [ + 'application/json', + ], + 'auReportsLeaveBalancesGet' => [ + 'application/json', + ], + 'auReportsLeaveHistoryReportGet' => [ + 'application/json', + ], + 'auReportsLeaveLiabilityGet' => [ + 'application/json', + ], + 'auReportsOrdinaryTimeEarningsGet' => [ + 'application/json', + ], + 'auReportsPayCategoriesGet' => [ + 'application/json', + ], + 'auReportsPayRunActivityGet' => [ + 'application/json', + ], + 'auReportsPayRunInclusionsGet' => [ + 'application/json', + ], + 'auReportsPaygGet' => [ + 'application/json', + ], + 'auReportsPayrollTaxGet' => [ + 'application/json', + ], + 'auReportsRosterTimesheetComparisonGet' => [ + 'application/json', + ], + 'auReportsSuperContributionsByEmployee' => [ + 'application/json', + ], + 'auReportsSuperContributionsBySuperFund' => [ + 'application/json', + ], + 'auReportsTimesheetGet' => [ + 'application/json', + ], + 'reportsBirthdayGet' => [ + 'application/json', + ], + 'reportsDeductionsGet' => [ + 'application/json', + ], + 'reportsDocumentAcknowledgementsGet' => [ + 'application/json', + ], + 'reportsEmployeeAuditGet' => [ + 'application/json', + ], + 'reportsEmployeeDetailsGet' => [ + 'application/json', + ], + 'reportsEmployeeDetailsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'reportsJournalGet' => [ + 'application/json', + ], + 'reportsPaySlipGet' => [ + 'application/json', + ], + 'reportsShiftSwappingGet' => [ + 'application/json', + ], + 'reportsTasksReportGet' => [ + '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 + 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; } /** @@ -93,21 +213,22 @@ public function getConfig() * Costing Report * * @param string $business_id business_id (required) - * @param bool $request_show_zero_pay_categories (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param bool $request_show_zero_pay_categories request_show_zero_pay_categories (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsCostingGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuCostingReportApiModel[] + * @return \OpenAPI\Client\Model\AuCostingReportApiModel[] */ - public function auReportsCostingGet($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsCostingGet($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsCostingGet'][0]) { - list($response) = $this->auReportsCostingGetWithHttpInfo($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsCostingGetWithHttpInfo($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -117,22 +238,22 @@ public function auReportsCostingGet($business_id, $request_show_zero_pay_categor * Costing Report * * @param string $business_id (required) - * @param bool $request_show_zero_pay_categories (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param bool $request_show_zero_pay_categories (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsCostingGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuCostingReportApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuCostingReportApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsCostingGetWithHttpInfo($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsCostingGetWithHttpInfo($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsCostingGet'][0]) { - $returnType = '\Swagger\Client\Model\AuCostingReportApiModel[]'; - $request = $this->auReportsCostingGetRequest($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsCostingGetRequest($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -141,9 +262,16 @@ public function auReportsCostingGetWithHttpInfo($business_id, $request_show_zero } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -154,19 +282,37 @@ public function auReportsCostingGetWithHttpInfo($business_id, $request_show_zero sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuCostingReportApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuCostingReportApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuCostingReportApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuCostingReportApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -183,7 +329,7 @@ public function auReportsCostingGetWithHttpInfo($business_id, $request_show_zero case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuCostingReportApiModel[]', + '\OpenAPI\Client\Model\AuCostingReportApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -199,20 +345,21 @@ public function auReportsCostingGetWithHttpInfo($business_id, $request_show_zero * Costing Report * * @param string $business_id (required) - * @param bool $request_show_zero_pay_categories (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param bool $request_show_zero_pay_categories (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsCostingGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsCostingGetAsync($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsCostingGetAsync($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsCostingGet'][0]) { - return $this->auReportsCostingGetAsyncWithHttpInfo($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsCostingGetAsyncWithHttpInfo($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -226,31 +373,31 @@ function ($response) { * Costing Report * * @param string $business_id (required) - * @param bool $request_show_zero_pay_categories (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param bool $request_show_zero_pay_categories (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsCostingGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsCostingGetAsyncWithHttpInfo($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsCostingGetAsyncWithHttpInfo($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsCostingGet'][0]) { - $returnType = '\Swagger\Client\Model\AuCostingReportApiModel[]'; - $request = $this->auReportsCostingGetRequest($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuCostingReportApiModel[]'; + $request = $this->auReportsCostingGetRequest($business_id, $request_show_zero_pay_categories, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -273,7 +420,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -283,19 +430,21 @@ function ($exception) { * Create request for operation 'auReportsCostingGet' * * @param string $business_id (required) - * @param bool $request_show_zero_pay_categories (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param bool $request_show_zero_pay_categories (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsCostingGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsCostingGetRequest($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsCostingGetRequest($business_id, $request_show_zero_pay_categories = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsCostingGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -303,6 +452,14 @@ protected function auReportsCostingGetRequest($business_id, $request_show_zero_p ); } + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/costing'; $formParams = []; $queryParams = []; @@ -311,33 +468,69 @@ protected function auReportsCostingGetRequest($business_id, $request_show_zero_p $multipart = false; // query params - if ($request_show_zero_pay_categories !== null) { - $queryParams['request.showZeroPayCategories'] = ObjectSerializer::toQueryValue($request_show_zero_pay_categories); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_show_zero_pay_categories, + 'request.showZeroPayCategories', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -348,53 +541,35 @@ protected function auReportsCostingGetRequest($business_id, $request_show_zero_p ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -415,10 +590,11 @@ protected function auReportsCostingGetRequest($business_id, $request_show_zero_p $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -430,20 +606,21 @@ protected function auReportsCostingGetRequest($business_id, $request_show_zero_p * Detailed Activity Report * * @param string $business_id business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsDetailedActivityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuDetailedActivityReportExportModel[] + * @return \OpenAPI\Client\Model\AuDetailedActivityReportExportModel[] */ - public function auReportsDetailedActivityGet($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsDetailedActivityGet($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsDetailedActivityGet'][0]) { - list($response) = $this->auReportsDetailedActivityGetWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsDetailedActivityGetWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -453,21 +630,21 @@ public function auReportsDetailedActivityGet($business_id, $request_pay_schedule * Detailed Activity Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsDetailedActivityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuDetailedActivityReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuDetailedActivityReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsDetailedActivityGetWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsDetailedActivityGetWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsDetailedActivityGet'][0]) { - $returnType = '\Swagger\Client\Model\AuDetailedActivityReportExportModel[]'; - $request = $this->auReportsDetailedActivityGetRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsDetailedActivityGetRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -476,9 +653,16 @@ public function auReportsDetailedActivityGetWithHttpInfo($business_id, $request_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -489,19 +673,37 @@ public function auReportsDetailedActivityGetWithHttpInfo($business_id, $request_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuDetailedActivityReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuDetailedActivityReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuDetailedActivityReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuDetailedActivityReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -518,7 +720,7 @@ public function auReportsDetailedActivityGetWithHttpInfo($business_id, $request_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuDetailedActivityReportExportModel[]', + '\OpenAPI\Client\Model\AuDetailedActivityReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -534,19 +736,20 @@ public function auReportsDetailedActivityGetWithHttpInfo($business_id, $request_ * Detailed Activity Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsDetailedActivityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsDetailedActivityGetAsync($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsDetailedActivityGetAsync($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsDetailedActivityGet'][0]) { - return $this->auReportsDetailedActivityGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsDetailedActivityGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -560,30 +763,30 @@ function ($response) { * Detailed Activity Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsDetailedActivityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsDetailedActivityGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsDetailedActivityGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsDetailedActivityGet'][0]) { - $returnType = '\Swagger\Client\Model\AuDetailedActivityReportExportModel[]'; - $request = $this->auReportsDetailedActivityGetRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuDetailedActivityReportExportModel[]'; + $request = $this->auReportsDetailedActivityGetRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -606,7 +809,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -616,18 +819,20 @@ function ($exception) { * Create request for operation 'auReportsDetailedActivityGet' * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsDetailedActivityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsDetailedActivityGetRequest($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsDetailedActivityGetRequest($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsDetailedActivityGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -635,6 +840,13 @@ protected function auReportsDetailedActivityGetRequest($business_id, $request_pa ); } + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/detailedactivity'; $formParams = []; $queryParams = []; @@ -643,29 +855,60 @@ protected function auReportsDetailedActivityGetRequest($business_id, $request_pa $multipart = false; // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -676,53 +919,35 @@ protected function auReportsDetailedActivityGetRequest($business_id, $request_pa ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -743,10 +968,11 @@ protected function auReportsDetailedActivityGetRequest($business_id, $request_pa $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -758,14 +984,15 @@ protected function auReportsDetailedActivityGetRequest($business_id, $request_pa * Employee Details Report Fields * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeeDetailsFieldsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDetailsReportField[] + * @return \OpenAPI\Client\Model\EmployeeDetailsReportField[] */ - public function auReportsEmployeeDetailsFieldsGet($business_id) + public function auReportsEmployeeDetailsFieldsGet($business_id, string $contentType = self::contentTypes['auReportsEmployeeDetailsFieldsGet'][0]) { - list($response) = $this->auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id); + list($response) = $this->auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -775,15 +1002,15 @@ public function auReportsEmployeeDetailsFieldsGet($business_id) * Employee Details Report Fields * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeeDetailsFieldsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDetailsReportField[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDetailsReportField[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id) + public function auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['auReportsEmployeeDetailsFieldsGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsReportField[]'; - $request = $this->auReportsEmployeeDetailsFieldsGetRequest($business_id); + $request = $this->auReportsEmployeeDetailsFieldsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -792,9 +1019,16 @@ public function auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -805,19 +1039,37 @@ public function auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDetailsReportField[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDetailsReportField[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDetailsReportField[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsReportField[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -834,7 +1086,7 @@ public function auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDetailsReportField[]', + '\OpenAPI\Client\Model\EmployeeDetailsReportField[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -850,13 +1102,14 @@ public function auReportsEmployeeDetailsFieldsGetWithHttpInfo($business_id) * Employee Details Report Fields * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeeDetailsFieldsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsEmployeeDetailsFieldsGetAsync($business_id) + public function auReportsEmployeeDetailsFieldsGetAsync($business_id, string $contentType = self::contentTypes['auReportsEmployeeDetailsFieldsGet'][0]) { - return $this->auReportsEmployeeDetailsFieldsGetAsyncWithHttpInfo($business_id) + return $this->auReportsEmployeeDetailsFieldsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -870,24 +1123,24 @@ function ($response) { * Employee Details Report Fields * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeeDetailsFieldsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsEmployeeDetailsFieldsGetAsyncWithHttpInfo($business_id) + public function auReportsEmployeeDetailsFieldsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auReportsEmployeeDetailsFieldsGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsReportField[]'; - $request = $this->auReportsEmployeeDetailsFieldsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsReportField[]'; + $request = $this->auReportsEmployeeDetailsFieldsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -910,7 +1163,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -920,12 +1173,14 @@ function ($exception) { * Create request for operation 'auReportsEmployeeDetailsFieldsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeeDetailsFieldsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsEmployeeDetailsFieldsGetRequest($business_id) + public function auReportsEmployeeDetailsFieldsGetRequest($business_id, string $contentType = self::contentTypes['auReportsEmployeeDetailsFieldsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -933,6 +1188,7 @@ protected function auReportsEmployeeDetailsFieldsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/report/employeedetails/fields'; $formParams = []; $queryParams = []; @@ -941,6 +1197,7 @@ protected function auReportsEmployeeDetailsFieldsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -950,53 +1207,35 @@ protected function auReportsEmployeeDetailsFieldsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1017,10 +1256,11 @@ protected function auReportsEmployeeDetailsFieldsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1032,19 +1272,20 @@ protected function auReportsEmployeeDetailsFieldsGetRequest($business_id) * Employee Payment History Report * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeePaymentHistoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPaymentHistoryModel[] + * @return \OpenAPI\Client\Model\AuPaymentHistoryModel[] */ - public function auReportsEmployeePaymentHistoryGet($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsEmployeePaymentHistoryGet($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsEmployeePaymentHistoryGet'][0]) { - list($response) = $this->auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -1054,20 +1295,20 @@ public function auReportsEmployeePaymentHistoryGet($business_id, $request_employ * Employee Payment History Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeePaymentHistoryGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPaymentHistoryModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPaymentHistoryModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsEmployeePaymentHistoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPaymentHistoryModel[]'; - $request = $this->auReportsEmployeePaymentHistoryGetRequest($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsEmployeePaymentHistoryGetRequest($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1076,9 +1317,16 @@ public function auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $re } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1089,19 +1337,37 @@ public function auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $re sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPaymentHistoryModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPaymentHistoryModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPaymentHistoryModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPaymentHistoryModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1118,7 +1384,7 @@ public function auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $re case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPaymentHistoryModel[]', + '\OpenAPI\Client\Model\AuPaymentHistoryModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1134,18 +1400,19 @@ public function auReportsEmployeePaymentHistoryGetWithHttpInfo($business_id, $re * Employee Payment History Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeePaymentHistoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsEmployeePaymentHistoryGetAsync($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsEmployeePaymentHistoryGetAsync($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsEmployeePaymentHistoryGet'][0]) { - return $this->auReportsEmployeePaymentHistoryGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsEmployeePaymentHistoryGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1159,29 +1426,29 @@ function ($response) { * Employee Payment History Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeePaymentHistoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsEmployeePaymentHistoryGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsEmployeePaymentHistoryGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsEmployeePaymentHistoryGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPaymentHistoryModel[]'; - $request = $this->auReportsEmployeePaymentHistoryGetRequest($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuPaymentHistoryModel[]'; + $request = $this->auReportsEmployeePaymentHistoryGetRequest($business_id, $request_employee_id, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1204,7 +1471,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1214,17 +1481,19 @@ function ($exception) { * Create request for operation 'auReportsEmployeePaymentHistoryGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsEmployeePaymentHistoryGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsEmployeePaymentHistoryGetRequest($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsEmployeePaymentHistoryGetRequest($business_id, $request_employee_id = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsEmployeePaymentHistoryGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1232,6 +1501,12 @@ protected function auReportsEmployeePaymentHistoryGetRequest($business_id, $requ ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/paymenthistory'; $formParams = []; $queryParams = []; @@ -1240,25 +1515,51 @@ protected function auReportsEmployeePaymentHistoryGetRequest($business_id, $requ $multipart = false; // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1269,53 +1570,35 @@ protected function auReportsEmployeePaymentHistoryGetRequest($business_id, $requ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1336,10 +1619,11 @@ protected function auReportsEmployeePaymentHistoryGetRequest($business_id, $requ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1351,22 +1635,23 @@ protected function auReportsEmployeePaymentHistoryGetRequest($business_id, $requ * Gross To Net Report * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param int[] $request_pay_category_ids (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param int[] $request_pay_category_ids request_pay_category_ids (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsGrossToNetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuGrossToNetResponseModel[] + * @return \OpenAPI\Client\Model\AuGrossToNetResponseModel[] */ - public function auReportsGrossToNetGet($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsGrossToNetGet($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsGrossToNetGet'][0]) { - list($response) = $this->auReportsGrossToNetGetWithHttpInfo($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsGrossToNetGetWithHttpInfo($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -1376,23 +1661,23 @@ public function auReportsGrossToNetGet($business_id, $request_employee_id = null * Gross To Net Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int[] $request_pay_category_ids (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int[] $request_pay_category_ids (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsGrossToNetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuGrossToNetResponseModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuGrossToNetResponseModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsGrossToNetGetWithHttpInfo($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsGrossToNetGetWithHttpInfo($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsGrossToNetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuGrossToNetResponseModel[]'; - $request = $this->auReportsGrossToNetGetRequest($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsGrossToNetGetRequest($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1401,9 +1686,16 @@ public function auReportsGrossToNetGetWithHttpInfo($business_id, $request_employ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1414,19 +1706,37 @@ public function auReportsGrossToNetGetWithHttpInfo($business_id, $request_employ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuGrossToNetResponseModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuGrossToNetResponseModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuGrossToNetResponseModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuGrossToNetResponseModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1443,7 +1753,7 @@ public function auReportsGrossToNetGetWithHttpInfo($business_id, $request_employ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuGrossToNetResponseModel[]', + '\OpenAPI\Client\Model\AuGrossToNetResponseModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1459,21 +1769,22 @@ public function auReportsGrossToNetGetWithHttpInfo($business_id, $request_employ * Gross To Net Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int[] $request_pay_category_ids (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int[] $request_pay_category_ids (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsGrossToNetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsGrossToNetGetAsync($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsGrossToNetGetAsync($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsGrossToNetGet'][0]) { - return $this->auReportsGrossToNetGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsGrossToNetGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1487,32 +1798,32 @@ function ($response) { * Gross To Net Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int[] $request_pay_category_ids (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int[] $request_pay_category_ids (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsGrossToNetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsGrossToNetGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsGrossToNetGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsGrossToNetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuGrossToNetResponseModel[]'; - $request = $this->auReportsGrossToNetGetRequest($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuGrossToNetResponseModel[]'; + $request = $this->auReportsGrossToNetGetRequest($business_id, $request_employee_id, $request_pay_category_ids, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1535,7 +1846,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1545,20 +1856,22 @@ function ($exception) { * Create request for operation 'auReportsGrossToNetGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int[] $request_pay_category_ids (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int[] $request_pay_category_ids (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsGrossToNetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsGrossToNetGetRequest($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsGrossToNetGetRequest($business_id, $request_employee_id = null, $request_pay_category_ids = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsGrossToNetGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1566,6 +1879,15 @@ protected function auReportsGrossToNetGetRequest($business_id, $request_employee ); } + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/grosstonet'; $formParams = []; $queryParams = []; @@ -1574,40 +1896,78 @@ protected function auReportsGrossToNetGetRequest($business_id, $request_employee $multipart = false; // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if (is_array($request_pay_category_ids)) { - $queryParams['request.payCategoryIds'] = $request_pay_category_ids; - } else - if ($request_pay_category_ids !== null) { - $queryParams['request.payCategoryIds'] = ObjectSerializer::toQueryValue($request_pay_category_ids); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_category_ids, + 'request.payCategoryIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1618,53 +1978,35 @@ protected function auReportsGrossToNetGetRequest($business_id, $request_employee ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1685,10 +2027,11 @@ protected function auReportsGrossToNetGetRequest($business_id, $request_employee $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1700,19 +2043,20 @@ protected function auReportsGrossToNetGetRequest($business_id, $request_employee * Leave Balances Report * * @param string $business_id business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param string $request_group_by (optional) - * @param int $request_employing_entity_id (optional) - * @param \DateTime $request_as_at_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_leave_type_id request_leave_type_id (optional) + * @param string $request_group_by request_group_by (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param \DateTime $request_as_at_date request_as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveBalancesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveBalancesExportModel[] + * @return \OpenAPI\Client\Model\AuLeaveBalancesExportModel[] */ - public function auReportsLeaveBalancesGet($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null) + public function auReportsLeaveBalancesGet($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null, string $contentType = self::contentTypes['auReportsLeaveBalancesGet'][0]) { - list($response) = $this->auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date); + list($response) = $this->auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date, $contentType); return $response; } @@ -1722,20 +2066,20 @@ public function auReportsLeaveBalancesGet($business_id, $request_location_id = n * Leave Balances Report * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param string $request_group_by (optional) - * @param int $request_employing_entity_id (optional) - * @param \DateTime $request_as_at_date (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param string $request_group_by (optional) + * @param int $request_employing_entity_id (optional) + * @param \DateTime $request_as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveBalancesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveBalancesExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveBalancesExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null) + public function auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null, string $contentType = self::contentTypes['auReportsLeaveBalancesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveBalancesExportModel[]'; - $request = $this->auReportsLeaveBalancesGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date); + $request = $this->auReportsLeaveBalancesGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date, $contentType); try { $options = $this->createHttpClientOption(); @@ -1744,9 +2088,16 @@ public function auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_loc } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1757,19 +2108,37 @@ public function auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_loc sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveBalancesExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveBalancesExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveBalancesExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveBalancesExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1786,7 +2155,7 @@ public function auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_loc case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveBalancesExportModel[]', + '\OpenAPI\Client\Model\AuLeaveBalancesExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1802,18 +2171,19 @@ public function auReportsLeaveBalancesGetWithHttpInfo($business_id, $request_loc * Leave Balances Report * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param string $request_group_by (optional) - * @param int $request_employing_entity_id (optional) - * @param \DateTime $request_as_at_date (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param string $request_group_by (optional) + * @param int $request_employing_entity_id (optional) + * @param \DateTime $request_as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveBalancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsLeaveBalancesGetAsync($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null) + public function auReportsLeaveBalancesGetAsync($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null, string $contentType = self::contentTypes['auReportsLeaveBalancesGet'][0]) { - return $this->auReportsLeaveBalancesGetAsyncWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date) + return $this->auReportsLeaveBalancesGetAsyncWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date, $contentType) ->then( function ($response) { return $response[0]; @@ -1827,29 +2197,29 @@ function ($response) { * Leave Balances Report * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param string $request_group_by (optional) - * @param int $request_employing_entity_id (optional) - * @param \DateTime $request_as_at_date (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param string $request_group_by (optional) + * @param int $request_employing_entity_id (optional) + * @param \DateTime $request_as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveBalancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsLeaveBalancesGetAsyncWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null) + public function auReportsLeaveBalancesGetAsyncWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null, string $contentType = self::contentTypes['auReportsLeaveBalancesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveBalancesExportModel[]'; - $request = $this->auReportsLeaveBalancesGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date); + $returnType = '\OpenAPI\Client\Model\AuLeaveBalancesExportModel[]'; + $request = $this->auReportsLeaveBalancesGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_group_by, $request_employing_entity_id, $request_as_at_date, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1872,7 +2242,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1882,17 +2252,19 @@ function ($exception) { * Create request for operation 'auReportsLeaveBalancesGet' * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param string $request_group_by (optional) - * @param int $request_employing_entity_id (optional) - * @param \DateTime $request_as_at_date (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param string $request_group_by (optional) + * @param int $request_employing_entity_id (optional) + * @param \DateTime $request_as_at_date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveBalancesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsLeaveBalancesGetRequest($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null) + public function auReportsLeaveBalancesGetRequest($business_id, $request_location_id = null, $request_leave_type_id = null, $request_group_by = null, $request_employing_entity_id = null, $request_as_at_date = null, string $contentType = self::contentTypes['auReportsLeaveBalancesGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1900,6 +2272,12 @@ protected function auReportsLeaveBalancesGetRequest($business_id, $request_locat ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/leavebalances'; $formParams = []; $queryParams = []; @@ -1908,25 +2286,51 @@ protected function auReportsLeaveBalancesGetRequest($business_id, $request_locat $multipart = false; // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_leave_type_id !== null) { - $queryParams['request.leaveTypeId'] = ObjectSerializer::toQueryValue($request_leave_type_id); - } - // query params - if ($request_group_by !== null) { - $queryParams['request.groupBy'] = ObjectSerializer::toQueryValue($request_group_by); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } - // query params - if ($request_as_at_date !== null) { - $queryParams['request.asAtDate'] = ObjectSerializer::toQueryValue($request_as_at_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_leave_type_id, + 'request.leaveTypeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_group_by, + 'request.groupBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_as_at_date, + 'request.asAtDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1937,53 +2341,35 @@ protected function auReportsLeaveBalancesGetRequest($business_id, $request_locat ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2004,10 +2390,11 @@ protected function auReportsLeaveBalancesGetRequest($business_id, $request_locat $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2019,21 +2406,22 @@ protected function auReportsLeaveBalancesGetRequest($business_id, $request_locat * Leave History Report * * @param string $business_id business_id (required) - * @param \DateTime $model_from_date (optional) - * @param \DateTime $model_to_date (optional) - * @param int $model_pay_schedule_id (optional) - * @param int $model_location_id (optional) - * @param string[] $model_employee_id (optional) - * @param int $model_leave_category_id (optional) - * @param int $model_employing_entity_id (optional) + * @param \DateTime $model_from_date model_from_date (optional) + * @param \DateTime $model_to_date model_to_date (optional) + * @param int $model_pay_schedule_id model_pay_schedule_id (optional) + * @param int $model_location_id model_location_id (optional) + * @param string[] $model_employee_id model_employee_id (optional) + * @param int $model_leave_category_id model_leave_category_id (optional) + * @param int $model_employing_entity_id model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveHistoryReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\LeaveHistoryReportGroupModel[] + * @return \OpenAPI\Client\Model\LeaveHistoryReportGroupModel[] */ - public function auReportsLeaveHistoryReportGet($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null) + public function auReportsLeaveHistoryReportGet($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveHistoryReportGet'][0]) { - list($response) = $this->auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id); + list($response) = $this->auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id, $contentType); return $response; } @@ -2043,22 +2431,22 @@ public function auReportsLeaveHistoryReportGet($business_id, $model_from_date = * Leave History Report * * @param string $business_id (required) - * @param \DateTime $model_from_date (optional) - * @param \DateTime $model_to_date (optional) - * @param int $model_pay_schedule_id (optional) - * @param int $model_location_id (optional) - * @param string[] $model_employee_id (optional) - * @param int $model_leave_category_id (optional) - * @param int $model_employing_entity_id (optional) + * @param \DateTime $model_from_date (optional) + * @param \DateTime $model_to_date (optional) + * @param int $model_pay_schedule_id (optional) + * @param int $model_location_id (optional) + * @param string[] $model_employee_id (optional) + * @param int $model_leave_category_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveHistoryReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\LeaveHistoryReportGroupModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\LeaveHistoryReportGroupModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null) + public function auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveHistoryReportGet'][0]) { - $returnType = '\Swagger\Client\Model\LeaveHistoryReportGroupModel[]'; - $request = $this->auReportsLeaveHistoryReportGetRequest($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id); + $request = $this->auReportsLeaveHistoryReportGetRequest($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2067,9 +2455,16 @@ public function auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2080,19 +2475,37 @@ public function auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\LeaveHistoryReportGroupModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LeaveHistoryReportGroupModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LeaveHistoryReportGroupModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LeaveHistoryReportGroupModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2109,7 +2522,7 @@ public function auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\LeaveHistoryReportGroupModel[]', + '\OpenAPI\Client\Model\LeaveHistoryReportGroupModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2125,20 +2538,21 @@ public function auReportsLeaveHistoryReportGetWithHttpInfo($business_id, $model_ * Leave History Report * * @param string $business_id (required) - * @param \DateTime $model_from_date (optional) - * @param \DateTime $model_to_date (optional) - * @param int $model_pay_schedule_id (optional) - * @param int $model_location_id (optional) - * @param string[] $model_employee_id (optional) - * @param int $model_leave_category_id (optional) - * @param int $model_employing_entity_id (optional) + * @param \DateTime $model_from_date (optional) + * @param \DateTime $model_to_date (optional) + * @param int $model_pay_schedule_id (optional) + * @param int $model_location_id (optional) + * @param string[] $model_employee_id (optional) + * @param int $model_leave_category_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveHistoryReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsLeaveHistoryReportGetAsync($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null) + public function auReportsLeaveHistoryReportGetAsync($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveHistoryReportGet'][0]) { - return $this->auReportsLeaveHistoryReportGetAsyncWithHttpInfo($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id) + return $this->auReportsLeaveHistoryReportGetAsyncWithHttpInfo($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2152,31 +2566,31 @@ function ($response) { * Leave History Report * * @param string $business_id (required) - * @param \DateTime $model_from_date (optional) - * @param \DateTime $model_to_date (optional) - * @param int $model_pay_schedule_id (optional) - * @param int $model_location_id (optional) - * @param string[] $model_employee_id (optional) - * @param int $model_leave_category_id (optional) - * @param int $model_employing_entity_id (optional) + * @param \DateTime $model_from_date (optional) + * @param \DateTime $model_to_date (optional) + * @param int $model_pay_schedule_id (optional) + * @param int $model_location_id (optional) + * @param string[] $model_employee_id (optional) + * @param int $model_leave_category_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveHistoryReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsLeaveHistoryReportGetAsyncWithHttpInfo($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null) + public function auReportsLeaveHistoryReportGetAsyncWithHttpInfo($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveHistoryReportGet'][0]) { - $returnType = '\Swagger\Client\Model\LeaveHistoryReportGroupModel[]'; - $request = $this->auReportsLeaveHistoryReportGetRequest($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\LeaveHistoryReportGroupModel[]'; + $request = $this->auReportsLeaveHistoryReportGetRequest($business_id, $model_from_date, $model_to_date, $model_pay_schedule_id, $model_location_id, $model_employee_id, $model_leave_category_id, $model_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2199,7 +2613,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2209,19 +2623,21 @@ function ($exception) { * Create request for operation 'auReportsLeaveHistoryReportGet' * * @param string $business_id (required) - * @param \DateTime $model_from_date (optional) - * @param \DateTime $model_to_date (optional) - * @param int $model_pay_schedule_id (optional) - * @param int $model_location_id (optional) - * @param string[] $model_employee_id (optional) - * @param int $model_leave_category_id (optional) - * @param int $model_employing_entity_id (optional) + * @param \DateTime $model_from_date (optional) + * @param \DateTime $model_to_date (optional) + * @param int $model_pay_schedule_id (optional) + * @param int $model_location_id (optional) + * @param string[] $model_employee_id (optional) + * @param int $model_leave_category_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveHistoryReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsLeaveHistoryReportGetRequest($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null) + public function auReportsLeaveHistoryReportGetRequest($business_id, $model_from_date = null, $model_to_date = null, $model_pay_schedule_id = null, $model_location_id = null, $model_employee_id = null, $model_leave_category_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveHistoryReportGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2229,6 +2645,14 @@ protected function auReportsLeaveHistoryReportGetRequest($business_id, $model_fr ); } + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/leavehistory'; $formParams = []; $queryParams = []; @@ -2237,36 +2661,69 @@ protected function auReportsLeaveHistoryReportGetRequest($business_id, $model_fr $multipart = false; // query params - if ($model_from_date !== null) { - $queryParams['model.fromDate'] = ObjectSerializer::toQueryValue($model_from_date); - } - // query params - if ($model_to_date !== null) { - $queryParams['model.toDate'] = ObjectSerializer::toQueryValue($model_to_date); - } - // query params - if ($model_pay_schedule_id !== null) { - $queryParams['model.payScheduleId'] = ObjectSerializer::toQueryValue($model_pay_schedule_id); - } - // query params - if ($model_location_id !== null) { - $queryParams['model.locationId'] = ObjectSerializer::toQueryValue($model_location_id); - } - // query params - if (is_array($model_employee_id)) { - $queryParams['model.employeeId'] = $model_employee_id; - } else - if ($model_employee_id !== null) { - $queryParams['model.employeeId'] = ObjectSerializer::toQueryValue($model_employee_id); - } - // query params - if ($model_leave_category_id !== null) { - $queryParams['model.leaveCategoryId'] = ObjectSerializer::toQueryValue($model_leave_category_id); - } - // query params - if ($model_employing_entity_id !== null) { - $queryParams['model.employingEntityId'] = ObjectSerializer::toQueryValue($model_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_from_date, + 'model.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_to_date, + 'model.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_pay_schedule_id, + 'model.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_location_id, + 'model.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employee_id, + 'model.employeeId', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_leave_category_id, + 'model.leaveCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employing_entity_id, + 'model.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -2277,53 +2734,35 @@ protected function auReportsLeaveHistoryReportGetRequest($business_id, $model_fr ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2344,10 +2783,11 @@ protected function auReportsLeaveHistoryReportGetRequest($business_id, $model_fr $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2359,19 +2799,20 @@ protected function auReportsLeaveHistoryReportGetRequest($business_id, $model_fr * Leave Liability Report * * @param string $business_id business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param bool $request_include_approved_leave (optional) - * @param \DateTime $request_as_at_date (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_leave_type_id request_leave_type_id (optional) + * @param bool $request_include_approved_leave request_include_approved_leave (optional) + * @param \DateTime $request_as_at_date request_as_at_date (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveLiabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuLeaveLiabilityExportModel[] + * @return \OpenAPI\Client\Model\AuLeaveLiabilityExportModel[] */ - public function auReportsLeaveLiabilityGet($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null) + public function auReportsLeaveLiabilityGet($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveLiabilityGet'][0]) { - list($response) = $this->auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id); + list($response) = $this->auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id, $contentType); return $response; } @@ -2381,20 +2822,20 @@ public function auReportsLeaveLiabilityGet($business_id, $request_location_id = * Leave Liability Report * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param bool $request_include_approved_leave (optional) - * @param \DateTime $request_as_at_date (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param bool $request_include_approved_leave (optional) + * @param \DateTime $request_as_at_date (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveLiabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuLeaveLiabilityExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuLeaveLiabilityExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null) + public function auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveLiabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveLiabilityExportModel[]'; - $request = $this->auReportsLeaveLiabilityGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id); + $request = $this->auReportsLeaveLiabilityGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2403,9 +2844,16 @@ public function auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_lo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2416,19 +2864,37 @@ public function auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_lo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuLeaveLiabilityExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuLeaveLiabilityExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuLeaveLiabilityExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuLeaveLiabilityExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2445,7 +2911,7 @@ public function auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_lo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuLeaveLiabilityExportModel[]', + '\OpenAPI\Client\Model\AuLeaveLiabilityExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2461,18 +2927,19 @@ public function auReportsLeaveLiabilityGetWithHttpInfo($business_id, $request_lo * Leave Liability Report * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param bool $request_include_approved_leave (optional) - * @param \DateTime $request_as_at_date (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param bool $request_include_approved_leave (optional) + * @param \DateTime $request_as_at_date (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveLiabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsLeaveLiabilityGetAsync($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null) + public function auReportsLeaveLiabilityGetAsync($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveLiabilityGet'][0]) { - return $this->auReportsLeaveLiabilityGetAsyncWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id) + return $this->auReportsLeaveLiabilityGetAsyncWithHttpInfo($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2486,29 +2953,29 @@ function ($response) { * Leave Liability Report * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param bool $request_include_approved_leave (optional) - * @param \DateTime $request_as_at_date (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param bool $request_include_approved_leave (optional) + * @param \DateTime $request_as_at_date (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveLiabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsLeaveLiabilityGetAsyncWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null) + public function auReportsLeaveLiabilityGetAsyncWithHttpInfo($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveLiabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\AuLeaveLiabilityExportModel[]'; - $request = $this->auReportsLeaveLiabilityGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuLeaveLiabilityExportModel[]'; + $request = $this->auReportsLeaveLiabilityGetRequest($business_id, $request_location_id, $request_leave_type_id, $request_include_approved_leave, $request_as_at_date, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2531,7 +2998,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2541,17 +3008,19 @@ function ($exception) { * Create request for operation 'auReportsLeaveLiabilityGet' * * @param string $business_id (required) - * @param int $request_location_id (optional) - * @param int $request_leave_type_id (optional) - * @param bool $request_include_approved_leave (optional) - * @param \DateTime $request_as_at_date (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_location_id (optional) + * @param int $request_leave_type_id (optional) + * @param bool $request_include_approved_leave (optional) + * @param \DateTime $request_as_at_date (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsLeaveLiabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsLeaveLiabilityGetRequest($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null) + public function auReportsLeaveLiabilityGetRequest($business_id, $request_location_id = null, $request_leave_type_id = null, $request_include_approved_leave = null, $request_as_at_date = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsLeaveLiabilityGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2559,6 +3028,12 @@ protected function auReportsLeaveLiabilityGetRequest($business_id, $request_loca ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/leaveliability'; $formParams = []; $queryParams = []; @@ -2567,25 +3042,51 @@ protected function auReportsLeaveLiabilityGetRequest($business_id, $request_loca $multipart = false; // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_leave_type_id !== null) { - $queryParams['request.leaveTypeId'] = ObjectSerializer::toQueryValue($request_leave_type_id); - } - // query params - if ($request_include_approved_leave !== null) { - $queryParams['request.includeApprovedLeave'] = ObjectSerializer::toQueryValue($request_include_approved_leave); - } - // query params - if ($request_as_at_date !== null) { - $queryParams['request.asAtDate'] = ObjectSerializer::toQueryValue($request_as_at_date); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_leave_type_id, + 'request.leaveTypeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_approved_leave, + 'request.includeApprovedLeave', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_as_at_date, + 'request.asAtDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -2596,53 +3097,35 @@ protected function auReportsLeaveLiabilityGetRequest($business_id, $request_loca ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2663,10 +3146,11 @@ protected function auReportsLeaveLiabilityGetRequest($business_id, $request_loca $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2678,17 +3162,18 @@ protected function auReportsLeaveLiabilityGetRequest($business_id, $request_loca * Ordinary Time Earnings Report * * @param string $business_id business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employing_entity_id (optional) - * @param int $request_financial_year_ending (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param int $request_financial_year_ending request_financial_year_ending (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsOrdinaryTimeEarningsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuOrdinaryTimeEarningsApiModel[] + * @return \OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[] */ - public function auReportsOrdinaryTimeEarningsGet($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null) + public function auReportsOrdinaryTimeEarningsGet($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null, string $contentType = self::contentTypes['auReportsOrdinaryTimeEarningsGet'][0]) { - list($response) = $this->auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending); + list($response) = $this->auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending, $contentType); return $response; } @@ -2698,18 +3183,18 @@ public function auReportsOrdinaryTimeEarningsGet($business_id, $request_pay_sche * Ordinary Time Earnings Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employing_entity_id (optional) - * @param int $request_financial_year_ending (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employing_entity_id (optional) + * @param int $request_financial_year_ending (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsOrdinaryTimeEarningsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuOrdinaryTimeEarningsApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null) + public function auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null, string $contentType = self::contentTypes['auReportsOrdinaryTimeEarningsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuOrdinaryTimeEarningsApiModel[]'; - $request = $this->auReportsOrdinaryTimeEarningsGetRequest($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending); + $request = $this->auReportsOrdinaryTimeEarningsGetRequest($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending, $contentType); try { $options = $this->createHttpClientOption(); @@ -2718,9 +3203,16 @@ public function auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $requ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2731,19 +3223,37 @@ public function auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $requ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2760,7 +3270,7 @@ public function auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $requ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuOrdinaryTimeEarningsApiModel[]', + '\OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2776,16 +3286,17 @@ public function auReportsOrdinaryTimeEarningsGetWithHttpInfo($business_id, $requ * Ordinary Time Earnings Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employing_entity_id (optional) - * @param int $request_financial_year_ending (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employing_entity_id (optional) + * @param int $request_financial_year_ending (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsOrdinaryTimeEarningsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsOrdinaryTimeEarningsGetAsync($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null) + public function auReportsOrdinaryTimeEarningsGetAsync($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null, string $contentType = self::contentTypes['auReportsOrdinaryTimeEarningsGet'][0]) { - return $this->auReportsOrdinaryTimeEarningsGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending) + return $this->auReportsOrdinaryTimeEarningsGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending, $contentType) ->then( function ($response) { return $response[0]; @@ -2799,27 +3310,27 @@ function ($response) { * Ordinary Time Earnings Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employing_entity_id (optional) - * @param int $request_financial_year_ending (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employing_entity_id (optional) + * @param int $request_financial_year_ending (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsOrdinaryTimeEarningsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsOrdinaryTimeEarningsGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null) + public function auReportsOrdinaryTimeEarningsGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null, string $contentType = self::contentTypes['auReportsOrdinaryTimeEarningsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuOrdinaryTimeEarningsApiModel[]'; - $request = $this->auReportsOrdinaryTimeEarningsGetRequest($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending); + $returnType = '\OpenAPI\Client\Model\AuOrdinaryTimeEarningsApiModel[]'; + $request = $this->auReportsOrdinaryTimeEarningsGetRequest($business_id, $request_pay_schedule_id, $request_employing_entity_id, $request_financial_year_ending, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2842,7 +3353,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2852,15 +3363,17 @@ function ($exception) { * Create request for operation 'auReportsOrdinaryTimeEarningsGet' * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employing_entity_id (optional) - * @param int $request_financial_year_ending (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employing_entity_id (optional) + * @param int $request_financial_year_ending (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsOrdinaryTimeEarningsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsOrdinaryTimeEarningsGetRequest($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null) + public function auReportsOrdinaryTimeEarningsGetRequest($business_id, $request_pay_schedule_id = null, $request_employing_entity_id = null, $request_financial_year_ending = null, string $contentType = self::contentTypes['auReportsOrdinaryTimeEarningsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2868,6 +3381,10 @@ protected function auReportsOrdinaryTimeEarningsGetRequest($business_id, $reques ); } + + + + $resourcePath = '/api/v2/business/{businessId}/report/ordinarytimeearnings'; $formParams = []; $queryParams = []; @@ -2876,17 +3393,33 @@ protected function auReportsOrdinaryTimeEarningsGetRequest($business_id, $reques $multipart = false; // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } - // query params - if ($request_financial_year_ending !== null) { - $queryParams['request.financialYearEnding'] = ObjectSerializer::toQueryValue($request_financial_year_ending); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_financial_year_ending, + 'request.financialYearEnding', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -2897,53 +3430,35 @@ protected function auReportsOrdinaryTimeEarningsGetRequest($business_id, $reques ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2964,10 +3479,11 @@ protected function auReportsOrdinaryTimeEarningsGetRequest($business_id, $reques $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2979,21 +3495,22 @@ protected function auReportsOrdinaryTimeEarningsGetRequest($business_id, $reques * Pay Categories Report * * @param string $business_id business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_group_by_earnings_location (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param bool $request_group_by_earnings_location request_group_by_earnings_location (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayCategoriesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayCategoriesModel[] + * @return \OpenAPI\Client\Model\AuPayCategoriesModel[] */ - public function auReportsPayCategoriesGet($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayCategoriesGet($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayCategoriesGet'][0]) { - list($response) = $this->auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -3003,22 +3520,22 @@ public function auReportsPayCategoriesGet($business_id, $request_pay_schedule_id * Pay Categories Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_group_by_earnings_location (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_group_by_earnings_location (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayCategoriesGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayCategoriesModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayCategoriesModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayCategoriesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoriesModel[]'; - $request = $this->auReportsPayCategoriesGetRequest($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsPayCategoriesGetRequest($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3027,9 +3544,16 @@ public function auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3040,19 +3564,37 @@ public function auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayCategoriesModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayCategoriesModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayCategoriesModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayCategoriesModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3069,7 +3611,7 @@ public function auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayCategoriesModel[]', + '\OpenAPI\Client\Model\AuPayCategoriesModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3085,20 +3627,21 @@ public function auReportsPayCategoriesGetWithHttpInfo($business_id, $request_pay * Pay Categories Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_group_by_earnings_location (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_group_by_earnings_location (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayCategoriesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayCategoriesGetAsync($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayCategoriesGetAsync($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayCategoriesGet'][0]) { - return $this->auReportsPayCategoriesGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsPayCategoriesGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3112,31 +3655,31 @@ function ($response) { * Pay Categories Report * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_group_by_earnings_location (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_group_by_earnings_location (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayCategoriesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayCategoriesGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayCategoriesGetAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayCategoriesGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayCategoriesModel[]'; - $request = $this->auReportsPayCategoriesGetRequest($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuPayCategoriesModel[]'; + $request = $this->auReportsPayCategoriesGetRequest($business_id, $request_pay_schedule_id, $request_employee_id, $request_group_by_earnings_location, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3159,7 +3702,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3169,19 +3712,21 @@ function ($exception) { * Create request for operation 'auReportsPayCategoriesGet' * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_group_by_earnings_location (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_group_by_earnings_location (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayCategoriesGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsPayCategoriesGetRequest($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayCategoriesGetRequest($business_id, $request_pay_schedule_id = null, $request_employee_id = null, $request_group_by_earnings_location = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayCategoriesGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3189,6 +3734,14 @@ protected function auReportsPayCategoriesGetRequest($business_id, $request_pay_s ); } + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/paycategories'; $formParams = []; $queryParams = []; @@ -3197,33 +3750,69 @@ protected function auReportsPayCategoriesGetRequest($business_id, $request_pay_s $multipart = false; // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_group_by_earnings_location !== null) { - $queryParams['request.groupByEarningsLocation'] = ObjectSerializer::toQueryValue($request_group_by_earnings_location); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_group_by_earnings_location, + 'request.groupByEarningsLocation', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -3234,53 +3823,35 @@ protected function auReportsPayCategoriesGetRequest($business_id, $request_pay_s ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3301,10 +3872,11 @@ protected function auReportsPayCategoriesGetRequest($business_id, $request_pay_s $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3320,14 +3892,15 @@ protected function auReportsPayCategoriesGetRequest($business_id, $request_pay_s * @param string $business_id business_id (required) * @param int $pay_schedule_id pay_schedule_id (optional, default to 0) * @param int $location_id location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunActivityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ActivityReportExportModel[] + * @return \OpenAPI\Client\Model\ActivityReportExportModel[] */ - public function auReportsPayRunActivityGet($from_date, $to_date, $business_id, $pay_schedule_id = '0', $location_id = '0') + public function auReportsPayRunActivityGet($from_date, $to_date, $business_id, $pay_schedule_id = 0, $location_id = 0, string $contentType = self::contentTypes['auReportsPayRunActivityGet'][0]) { - list($response) = $this->auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id, $location_id); + list($response) = $this->auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id, $location_id, $contentType); return $response; } @@ -3341,15 +3914,15 @@ public function auReportsPayRunActivityGet($from_date, $to_date, $business_id, $ * @param string $business_id (required) * @param int $pay_schedule_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunActivityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ActivityReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ActivityReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id = '0', $location_id = '0') + public function auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id = 0, $location_id = 0, string $contentType = self::contentTypes['auReportsPayRunActivityGet'][0]) { - $returnType = '\Swagger\Client\Model\ActivityReportExportModel[]'; - $request = $this->auReportsPayRunActivityGetRequest($from_date, $to_date, $business_id, $pay_schedule_id, $location_id); + $request = $this->auReportsPayRunActivityGetRequest($from_date, $to_date, $business_id, $pay_schedule_id, $location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3358,9 +3931,16 @@ public function auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $bu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3371,19 +3951,37 @@ public function auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $bu sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ActivityReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ActivityReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ActivityReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ActivityReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3400,7 +3998,7 @@ public function auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $bu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ActivityReportExportModel[]', + '\OpenAPI\Client\Model\ActivityReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3420,13 +4018,14 @@ public function auReportsPayRunActivityGetWithHttpInfo($from_date, $to_date, $bu * @param string $business_id (required) * @param int $pay_schedule_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunActivityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayRunActivityGetAsync($from_date, $to_date, $business_id, $pay_schedule_id = '0', $location_id = '0') + public function auReportsPayRunActivityGetAsync($from_date, $to_date, $business_id, $pay_schedule_id = 0, $location_id = 0, string $contentType = self::contentTypes['auReportsPayRunActivityGet'][0]) { - return $this->auReportsPayRunActivityGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id, $location_id) + return $this->auReportsPayRunActivityGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id, $location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3444,24 +4043,24 @@ function ($response) { * @param string $business_id (required) * @param int $pay_schedule_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunActivityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayRunActivityGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id = '0', $location_id = '0') + public function auReportsPayRunActivityGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $pay_schedule_id = 0, $location_id = 0, string $contentType = self::contentTypes['auReportsPayRunActivityGet'][0]) { - $returnType = '\Swagger\Client\Model\ActivityReportExportModel[]'; - $request = $this->auReportsPayRunActivityGetRequest($from_date, $to_date, $business_id, $pay_schedule_id, $location_id); + $returnType = '\OpenAPI\Client\Model\ActivityReportExportModel[]'; + $request = $this->auReportsPayRunActivityGetRequest($from_date, $to_date, $business_id, $pay_schedule_id, $location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3484,7 +4083,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3498,24 +4097,28 @@ function ($exception) { * @param string $business_id (required) * @param int $pay_schedule_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunActivityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsPayRunActivityGetRequest($from_date, $to_date, $business_id, $pay_schedule_id = '0', $location_id = '0') + public function auReportsPayRunActivityGetRequest($from_date, $to_date, $business_id, $pay_schedule_id = 0, $location_id = 0, string $contentType = self::contentTypes['auReportsPayRunActivityGet'][0]) { + // verify the required parameter 'from_date' is set if ($from_date === null || (is_array($from_date) && count($from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $from_date when calling auReportsPayRunActivityGet' ); } + // verify the required parameter 'to_date' is set if ($to_date === null || (is_array($to_date) && count($to_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $to_date when calling auReportsPayRunActivityGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3523,6 +4126,9 @@ protected function auReportsPayRunActivityGetRequest($from_date, $to_date, $busi ); } + + + $resourcePath = '/api/v2/business/{businessId}/report/payrunactivity'; $formParams = []; $queryParams = []; @@ -3531,21 +4137,42 @@ protected function auReportsPayRunActivityGetRequest($from_date, $to_date, $busi $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } - // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } - // query params - if ($pay_schedule_id !== null) { - $queryParams['payScheduleId'] = ObjectSerializer::toQueryValue($pay_schedule_id); - } - // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $pay_schedule_id, + 'payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -3556,53 +4183,35 @@ protected function auReportsPayRunActivityGetRequest($from_date, $to_date, $busi ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3623,10 +4232,11 @@ protected function auReportsPayRunActivityGetRequest($from_date, $to_date, $busi $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3638,20 +4248,21 @@ protected function auReportsPayRunActivityGetRequest($from_date, $to_date, $busi * Pay Run Inclusions Report * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_status (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param string $request_status request_status (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunInclusionsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuPayRunInclusionExportModel[] + * @return \OpenAPI\Client\Model\AuPayRunInclusionExportModel[] */ - public function auReportsPayRunInclusionsGet($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayRunInclusionsGet($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayRunInclusionsGet'][0]) { - list($response) = $this->auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -3661,21 +4272,21 @@ public function auReportsPayRunInclusionsGet($business_id, $request_employee_id * Pay Run Inclusions Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_status (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_status (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunInclusionsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuPayRunInclusionExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuPayRunInclusionExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayRunInclusionsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunInclusionExportModel[]'; - $request = $this->auReportsPayRunInclusionsGetRequest($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsPayRunInclusionsGetRequest($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3684,9 +4295,16 @@ public function auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3697,19 +4315,37 @@ public function auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuPayRunInclusionExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuPayRunInclusionExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuPayRunInclusionExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuPayRunInclusionExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3726,7 +4362,7 @@ public function auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuPayRunInclusionExportModel[]', + '\OpenAPI\Client\Model\AuPayRunInclusionExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3742,19 +4378,20 @@ public function auReportsPayRunInclusionsGetWithHttpInfo($business_id, $request_ * Pay Run Inclusions Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_status (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_status (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunInclusionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayRunInclusionsGetAsync($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayRunInclusionsGetAsync($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayRunInclusionsGet'][0]) { - return $this->auReportsPayRunInclusionsGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsPayRunInclusionsGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3768,30 +4405,30 @@ function ($response) { * Pay Run Inclusions Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_status (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_status (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunInclusionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayRunInclusionsGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayRunInclusionsGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayRunInclusionsGet'][0]) { - $returnType = '\Swagger\Client\Model\AuPayRunInclusionExportModel[]'; - $request = $this->auReportsPayRunInclusionsGetRequest($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuPayRunInclusionExportModel[]'; + $request = $this->auReportsPayRunInclusionsGetRequest($business_id, $request_employee_id, $request_status, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -3814,7 +4451,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3824,18 +4461,20 @@ function ($exception) { * Create request for operation 'auReportsPayRunInclusionsGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_status (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_status (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayRunInclusionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsPayRunInclusionsGetRequest($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayRunInclusionsGetRequest($business_id, $request_employee_id = null, $request_status = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayRunInclusionsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3843,37 +4482,75 @@ protected function auReportsPayRunInclusionsGetRequest($business_id, $request_em ); } - $resourcePath = '/api/v2/business/{businessId}/report/payruninclusions'; - $formParams = []; + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/payruninclusions'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_status !== null) { - $queryParams['request.status'] = ObjectSerializer::toQueryValue($request_status); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_status, + 'request.status', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -3884,53 +4561,35 @@ protected function auReportsPayRunInclusionsGetRequest($business_id, $request_em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3951,10 +4610,11 @@ protected function auReportsPayRunInclusionsGetRequest($business_id, $request_em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3966,19 +4626,20 @@ protected function auReportsPayRunInclusionsGetRequest($business_id, $request_em * PAYG Report * * @param string $business_id business_id (required) - * @param string $request_state (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_state request_state (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPaygGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PaygReportExportModel[] + * @return \OpenAPI\Client\Model\PaygReportExportModel[] */ - public function auReportsPaygGet($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPaygGet($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPaygGet'][0]) { - list($response) = $this->auReportsPaygGetWithHttpInfo($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsPaygGetWithHttpInfo($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -3988,20 +4649,20 @@ public function auReportsPaygGet($business_id, $request_state = null, $request_f * PAYG Report * * @param string $business_id (required) - * @param string $request_state (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_state (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPaygGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PaygReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PaygReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsPaygGetWithHttpInfo($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPaygGetWithHttpInfo($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPaygGet'][0]) { - $returnType = '\Swagger\Client\Model\PaygReportExportModel[]'; - $request = $this->auReportsPaygGetRequest($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsPaygGetRequest($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4010,9 +4671,16 @@ public function auReportsPaygGetWithHttpInfo($business_id, $request_state = null } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4023,19 +4691,37 @@ public function auReportsPaygGetWithHttpInfo($business_id, $request_state = null sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PaygReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PaygReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PaygReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PaygReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4052,7 +4738,7 @@ public function auReportsPaygGetWithHttpInfo($business_id, $request_state = null case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PaygReportExportModel[]', + '\OpenAPI\Client\Model\PaygReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4068,18 +4754,19 @@ public function auReportsPaygGetWithHttpInfo($business_id, $request_state = null * PAYG Report * * @param string $business_id (required) - * @param string $request_state (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_state (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPaygGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPaygGetAsync($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPaygGetAsync($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPaygGet'][0]) { - return $this->auReportsPaygGetAsyncWithHttpInfo($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsPaygGetAsyncWithHttpInfo($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4093,29 +4780,29 @@ function ($response) { * PAYG Report * * @param string $business_id (required) - * @param string $request_state (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_state (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPaygGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPaygGetAsyncWithHttpInfo($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPaygGetAsyncWithHttpInfo($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPaygGet'][0]) { - $returnType = '\Swagger\Client\Model\PaygReportExportModel[]'; - $request = $this->auReportsPaygGetRequest($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\PaygReportExportModel[]'; + $request = $this->auReportsPaygGetRequest($business_id, $request_state, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4138,7 +4825,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4148,17 +4835,19 @@ function ($exception) { * Create request for operation 'auReportsPaygGet' * * @param string $business_id (required) - * @param string $request_state (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_state (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPaygGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsPaygGetRequest($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPaygGetRequest($business_id, $request_state = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPaygGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4166,6 +4855,12 @@ protected function auReportsPaygGetRequest($business_id, $request_state = null, ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/payg'; $formParams = []; $queryParams = []; @@ -4174,25 +4869,51 @@ protected function auReportsPaygGetRequest($business_id, $request_state = null, $multipart = false; // query params - if ($request_state !== null) { - $queryParams['request.state'] = ObjectSerializer::toQueryValue($request_state); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_state, + 'request.state', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -4203,53 +4924,35 @@ protected function auReportsPaygGetRequest($business_id, $request_state = null, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4270,10 +4973,11 @@ protected function auReportsPaygGetRequest($business_id, $request_state = null, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4285,19 +4989,20 @@ protected function auReportsPaygGetRequest($business_id, $request_state = null, * Payroll Tax Report * * @param string $business_id business_id (required) - * @param string $request_group_by (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_group_by request_group_by (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayrollTaxGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\PayrollTaxReportExportModel[] + * @return \OpenAPI\Client\Model\PayrollTaxReportExportModel[] */ - public function auReportsPayrollTaxGet($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayrollTaxGet($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayrollTaxGet'][0]) { - list($response) = $this->auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -4307,20 +5012,20 @@ public function auReportsPayrollTaxGet($business_id, $request_group_by = null, $ * Payroll Tax Report * * @param string $business_id (required) - * @param string $request_group_by (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_group_by (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayrollTaxGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\PayrollTaxReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\PayrollTaxReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayrollTaxGet'][0]) { - $returnType = '\Swagger\Client\Model\PayrollTaxReportExportModel[]'; - $request = $this->auReportsPayrollTaxGetRequest($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsPayrollTaxGetRequest($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4329,9 +5034,16 @@ public function auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4342,19 +5054,37 @@ public function auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\PayrollTaxReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PayrollTaxReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PayrollTaxReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PayrollTaxReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4371,7 +5101,7 @@ public function auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\PayrollTaxReportExportModel[]', + '\OpenAPI\Client\Model\PayrollTaxReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4387,18 +5117,19 @@ public function auReportsPayrollTaxGetWithHttpInfo($business_id, $request_group_ * Payroll Tax Report * * @param string $business_id (required) - * @param string $request_group_by (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_group_by (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayrollTaxGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayrollTaxGetAsync($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayrollTaxGetAsync($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayrollTaxGet'][0]) { - return $this->auReportsPayrollTaxGetAsyncWithHttpInfo($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsPayrollTaxGetAsyncWithHttpInfo($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4412,29 +5143,29 @@ function ($response) { * Payroll Tax Report * * @param string $business_id (required) - * @param string $request_group_by (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_group_by (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayrollTaxGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsPayrollTaxGetAsyncWithHttpInfo($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayrollTaxGetAsyncWithHttpInfo($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayrollTaxGet'][0]) { - $returnType = '\Swagger\Client\Model\PayrollTaxReportExportModel[]'; - $request = $this->auReportsPayrollTaxGetRequest($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\PayrollTaxReportExportModel[]'; + $request = $this->auReportsPayrollTaxGetRequest($business_id, $request_group_by, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4457,7 +5188,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4467,17 +5198,19 @@ function ($exception) { * Create request for operation 'auReportsPayrollTaxGet' * * @param string $business_id (required) - * @param string $request_group_by (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_group_by (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsPayrollTaxGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsPayrollTaxGetRequest($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsPayrollTaxGetRequest($business_id, $request_group_by = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsPayrollTaxGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4485,6 +5218,12 @@ protected function auReportsPayrollTaxGetRequest($business_id, $request_group_by ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/payrolltax'; $formParams = []; $queryParams = []; @@ -4493,25 +5232,51 @@ protected function auReportsPayrollTaxGetRequest($business_id, $request_group_by $multipart = false; // query params - if ($request_group_by !== null) { - $queryParams['request.groupBy'] = ObjectSerializer::toQueryValue($request_group_by); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_group_by, + 'request.groupBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -4522,53 +5287,35 @@ protected function auReportsPayrollTaxGetRequest($business_id, $request_group_by ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4589,10 +5336,11 @@ protected function auReportsPayrollTaxGetRequest($business_id, $request_group_by $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4604,28 +5352,29 @@ protected function auReportsPayrollTaxGetRequest($business_id, $request_group_by * Roster vs Timesheet Comparison Report * * @param string $business_id business_id (required) - * @param int $request_employment_type_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_timesheet_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_roster_location_id (optional) - * @param int $request_timesheet_location_id (optional) - * @param string[] $request_roster_statuses (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterTimesheetComparisonReportExportModel[] - */ - public function auReportsRosterTimesheetComparisonGet($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) - { - list($response) = $this->auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + * @param int $request_employment_type_id request_employment_type_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param bool $request_include_costs request_include_costs (optional) + * @param string[] $request_timesheet_statuses request_timesheet_statuses (optional) + * @param int $request_work_type_id request_work_type_id (optional) + * @param int $request_roster_location_id request_roster_location_id (optional) + * @param int $request_timesheet_location_id request_timesheet_location_id (optional) + * @param string[] $request_roster_statuses request_roster_statuses (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsRosterTimesheetComparisonGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[] + */ + public function auReportsRosterTimesheetComparisonGet($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsRosterTimesheetComparisonGet'][0]) + { + list($response) = $this->auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -4635,29 +5384,29 @@ public function auReportsRosterTimesheetComparisonGet($business_id, $request_emp * Roster vs Timesheet Comparison Report * * @param string $business_id (required) - * @param int $request_employment_type_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_timesheet_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_roster_location_id (optional) - * @param int $request_timesheet_location_id (optional) - * @param string[] $request_roster_statuses (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterTimesheetComparisonReportExportModel[], HTTP status code, HTTP response headers (array of strings) - */ - public function auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) - { - $returnType = '\Swagger\Client\Model\AuRosterTimesheetComparisonReportExportModel[]'; - $request = $this->auReportsRosterTimesheetComparisonGetRequest($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + * @param int $request_employment_type_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_timesheet_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_roster_location_id (optional) + * @param int $request_timesheet_location_id (optional) + * @param string[] $request_roster_statuses (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsRosterTimesheetComparisonGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[], HTTP status code, HTTP response headers (array of strings) + */ + public function auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsRosterTimesheetComparisonGet'][0]) + { + $request = $this->auReportsRosterTimesheetComparisonGetRequest($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -4666,9 +5415,16 @@ public function auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4679,19 +5435,37 @@ public function auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4708,7 +5482,7 @@ public function auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterTimesheetComparisonReportExportModel[]', + '\OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4724,27 +5498,28 @@ public function auReportsRosterTimesheetComparisonGetWithHttpInfo($business_id, * Roster vs Timesheet Comparison Report * * @param string $business_id (required) - * @param int $request_employment_type_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_timesheet_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_roster_location_id (optional) - * @param int $request_timesheet_location_id (optional) - * @param string[] $request_roster_statuses (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employment_type_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_timesheet_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_roster_location_id (optional) + * @param int $request_timesheet_location_id (optional) + * @param string[] $request_roster_statuses (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsRosterTimesheetComparisonGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsRosterTimesheetComparisonGetAsync($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsRosterTimesheetComparisonGetAsync($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsRosterTimesheetComparisonGet'][0]) { - return $this->auReportsRosterTimesheetComparisonGetAsyncWithHttpInfo($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsRosterTimesheetComparisonGetAsyncWithHttpInfo($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4758,38 +5533,38 @@ function ($response) { * Roster vs Timesheet Comparison Report * * @param string $business_id (required) - * @param int $request_employment_type_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_timesheet_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_roster_location_id (optional) - * @param int $request_timesheet_location_id (optional) - * @param string[] $request_roster_statuses (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employment_type_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_timesheet_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_roster_location_id (optional) + * @param int $request_timesheet_location_id (optional) + * @param string[] $request_roster_statuses (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsRosterTimesheetComparisonGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsRosterTimesheetComparisonGetAsyncWithHttpInfo($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsRosterTimesheetComparisonGetAsyncWithHttpInfo($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsRosterTimesheetComparisonGet'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterTimesheetComparisonReportExportModel[]'; - $request = $this->auReportsRosterTimesheetComparisonGetRequest($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuRosterTimesheetComparisonReportExportModel[]'; + $request = $this->auReportsRosterTimesheetComparisonGetRequest($business_id, $request_employment_type_id, $request_employee_id, $request_include_costs, $request_timesheet_statuses, $request_work_type_id, $request_roster_location_id, $request_timesheet_location_id, $request_roster_statuses, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4812,7 +5587,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4822,26 +5597,28 @@ function ($exception) { * Create request for operation 'auReportsRosterTimesheetComparisonGet' * * @param string $business_id (required) - * @param int $request_employment_type_id (optional) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_timesheet_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_roster_location_id (optional) - * @param int $request_timesheet_location_id (optional) - * @param string[] $request_roster_statuses (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employment_type_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_timesheet_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_roster_location_id (optional) + * @param int $request_timesheet_location_id (optional) + * @param string[] $request_roster_statuses (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsRosterTimesheetComparisonGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsRosterTimesheetComparisonGetRequest($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsRosterTimesheetComparisonGetRequest($business_id, $request_employment_type_id = null, $request_employee_id = null, $request_include_costs = null, $request_timesheet_statuses = null, $request_work_type_id = null, $request_roster_location_id = null, $request_timesheet_location_id = null, $request_roster_statuses = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsRosterTimesheetComparisonGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4849,6 +5626,21 @@ protected function auReportsRosterTimesheetComparisonGetRequest($business_id, $r ); } + + + + + + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/rostertimesheetcomparison'; $formParams = []; $queryParams = []; @@ -4857,67 +5649,132 @@ protected function auReportsRosterTimesheetComparisonGetRequest($business_id, $r $multipart = false; // query params - if ($request_employment_type_id !== null) { - $queryParams['request.employmentTypeId'] = ObjectSerializer::toQueryValue($request_employment_type_id); - } - // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_include_costs !== null) { - $queryParams['request.includeCosts'] = ObjectSerializer::toQueryValue($request_include_costs); - } - // query params - if (is_array($request_timesheet_statuses)) { - $queryParams['request.timesheetStatuses'] = $request_timesheet_statuses; - } else - if ($request_timesheet_statuses !== null) { - $queryParams['request.timesheetStatuses'] = ObjectSerializer::toQueryValue($request_timesheet_statuses); - } - // query params - if ($request_work_type_id !== null) { - $queryParams['request.workTypeId'] = ObjectSerializer::toQueryValue($request_work_type_id); - } - // query params - if ($request_roster_location_id !== null) { - $queryParams['request.rosterLocationId'] = ObjectSerializer::toQueryValue($request_roster_location_id); - } - // query params - if ($request_timesheet_location_id !== null) { - $queryParams['request.timesheetLocationId'] = ObjectSerializer::toQueryValue($request_timesheet_location_id); - } - // query params - if (is_array($request_roster_statuses)) { - $queryParams['request.rosterStatuses'] = $request_roster_statuses; - } else - if ($request_roster_statuses !== null) { - $queryParams['request.rosterStatuses'] = ObjectSerializer::toQueryValue($request_roster_statuses); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employment_type_id, + 'request.employmentTypeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_costs, + 'request.includeCosts', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_timesheet_statuses, + 'request.timesheetStatuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_work_type_id, + 'request.workTypeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_roster_location_id, + 'request.rosterLocationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_timesheet_location_id, + 'request.timesheetLocationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_roster_statuses, + 'request.rosterStatuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -4928,53 +5785,35 @@ protected function auReportsRosterTimesheetComparisonGetRequest($business_id, $r ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4995,10 +5834,11 @@ protected function auReportsRosterTimesheetComparisonGetRequest($business_id, $r $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5010,20 +5850,21 @@ protected function auReportsRosterTimesheetComparisonGetRequest($business_id, $r * Super Contribution Report (By Employee) * * @param string $business_id business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsByEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperAccrualExportModel[] + * @return \OpenAPI\Client\Model\SuperAccrualExportModel[] */ - public function auReportsSuperContributionsByEmployee($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsByEmployee($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsByEmployee'][0]) { - list($response) = $this->auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -5033,21 +5874,21 @@ public function auReportsSuperContributionsByEmployee($business_id, $request_pay * Super Contribution Report (By Employee) * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsByEmployee'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperAccrualExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperAccrualExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsByEmployee'][0]) { - $returnType = '\Swagger\Client\Model\SuperAccrualExportModel[]'; - $request = $this->auReportsSuperContributionsByEmployeeRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsSuperContributionsByEmployeeRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5056,9 +5897,16 @@ public function auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5069,19 +5917,37 @@ public function auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperAccrualExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperAccrualExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperAccrualExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperAccrualExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5098,7 +5964,7 @@ public function auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperAccrualExportModel[]', + '\OpenAPI\Client\Model\SuperAccrualExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5114,19 +5980,20 @@ public function auReportsSuperContributionsByEmployeeWithHttpInfo($business_id, * Super Contribution Report (By Employee) * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsByEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsSuperContributionsByEmployeeAsync($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsByEmployeeAsync($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsByEmployee'][0]) { - return $this->auReportsSuperContributionsByEmployeeAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsSuperContributionsByEmployeeAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5140,30 +6007,30 @@ function ($response) { * Super Contribution Report (By Employee) * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsByEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsSuperContributionsByEmployeeAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsByEmployeeAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsByEmployee'][0]) { - $returnType = '\Swagger\Client\Model\SuperAccrualExportModel[]'; - $request = $this->auReportsSuperContributionsByEmployeeRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\SuperAccrualExportModel[]'; + $request = $this->auReportsSuperContributionsByEmployeeRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5186,7 +6053,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5196,18 +6063,20 @@ function ($exception) { * Create request for operation 'auReportsSuperContributionsByEmployee' * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsByEmployee'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsSuperContributionsByEmployeeRequest($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsByEmployeeRequest($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsByEmployee'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5215,6 +6084,13 @@ protected function auReportsSuperContributionsByEmployeeRequest($business_id, $r ); } + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/supercontributions/byemployee'; $formParams = []; $queryParams = []; @@ -5223,29 +6099,60 @@ protected function auReportsSuperContributionsByEmployeeRequest($business_id, $r $multipart = false; // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -5256,53 +6163,35 @@ protected function auReportsSuperContributionsByEmployeeRequest($business_id, $r ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5323,10 +6212,11 @@ protected function auReportsSuperContributionsByEmployeeRequest($business_id, $r $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5338,20 +6228,21 @@ protected function auReportsSuperContributionsByEmployeeRequest($business_id, $r * Super Contribution Report (By Super Fund) * * @param string $business_id business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsBySuperFund'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperContributionsReportExportModel[] + * @return \OpenAPI\Client\Model\SuperContributionsReportExportModel[] */ - public function auReportsSuperContributionsBySuperFund($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsBySuperFund($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsBySuperFund'][0]) { - list($response) = $this->auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -5361,21 +6252,21 @@ public function auReportsSuperContributionsBySuperFund($business_id, $request_pa * Super Contribution Report (By Super Fund) * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsBySuperFund'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperContributionsReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperContributionsReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsBySuperFund'][0]) { - $returnType = '\Swagger\Client\Model\SuperContributionsReportExportModel[]'; - $request = $this->auReportsSuperContributionsBySuperFundRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsSuperContributionsBySuperFundRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5384,9 +6275,16 @@ public function auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5397,19 +6295,37 @@ public function auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperContributionsReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperContributionsReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperContributionsReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperContributionsReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5426,7 +6342,7 @@ public function auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperContributionsReportExportModel[]', + '\OpenAPI\Client\Model\SuperContributionsReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5442,19 +6358,20 @@ public function auReportsSuperContributionsBySuperFundWithHttpInfo($business_id, * Super Contribution Report (By Super Fund) * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsBySuperFund'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsSuperContributionsBySuperFundAsync($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsBySuperFundAsync($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsBySuperFund'][0]) { - return $this->auReportsSuperContributionsBySuperFundAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsSuperContributionsBySuperFundAsyncWithHttpInfo($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5468,30 +6385,30 @@ function ($response) { * Super Contribution Report (By Super Fund) * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsBySuperFund'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsSuperContributionsBySuperFundAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsBySuperFundAsyncWithHttpInfo($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsBySuperFund'][0]) { - $returnType = '\Swagger\Client\Model\SuperContributionsReportExportModel[]'; - $request = $this->auReportsSuperContributionsBySuperFundRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\SuperContributionsReportExportModel[]'; + $request = $this->auReportsSuperContributionsBySuperFundRequest($business_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5514,7 +6431,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5524,18 +6441,20 @@ function ($exception) { * Create request for operation 'auReportsSuperContributionsBySuperFund' * * @param string $business_id (required) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsSuperContributionsBySuperFund'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsSuperContributionsBySuperFundRequest($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsSuperContributionsBySuperFundRequest($business_id, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsSuperContributionsBySuperFund'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5543,6 +6462,13 @@ protected function auReportsSuperContributionsBySuperFundRequest($business_id, $ ); } + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/supercontributions/bysuperfund'; $formParams = []; $queryParams = []; @@ -5551,29 +6477,60 @@ protected function auReportsSuperContributionsBySuperFundRequest($business_id, $ $multipart = false; // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -5584,53 +6541,35 @@ protected function auReportsSuperContributionsBySuperFundRequest($business_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5651,10 +6590,11 @@ protected function auReportsSuperContributionsBySuperFundRequest($business_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5666,24 +6606,25 @@ protected function auReportsSuperContributionsBySuperFundRequest($business_id, $ * Timesheet Report * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param bool $request_include_costs request_include_costs (optional) + * @param string[] $request_statuses request_statuses (optional) + * @param int $request_work_type_id request_work_type_id (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimesheetExportModel[] + * @return \OpenAPI\Client\Model\AuTimesheetExportModel[] */ - public function auReportsTimesheetGet($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsTimesheetGet($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsTimesheetGet'][0]) { - list($response) = $this->auReportsTimesheetGetWithHttpInfo($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auReportsTimesheetGetWithHttpInfo($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -5693,25 +6634,25 @@ public function auReportsTimesheetGet($business_id, $request_employee_id = null, * Timesheet Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimesheetExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimesheetExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auReportsTimesheetGetWithHttpInfo($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsTimesheetGetWithHttpInfo($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuTimesheetExportModel[]'; - $request = $this->auReportsTimesheetGetRequest($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auReportsTimesheetGetRequest($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5720,9 +6661,16 @@ public function auReportsTimesheetGetWithHttpInfo($business_id, $request_employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5733,19 +6681,37 @@ public function auReportsTimesheetGetWithHttpInfo($business_id, $request_employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimesheetExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimesheetExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimesheetExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimesheetExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5762,7 +6728,7 @@ public function auReportsTimesheetGetWithHttpInfo($business_id, $request_employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimesheetExportModel[]', + '\OpenAPI\Client\Model\AuTimesheetExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5778,23 +6744,24 @@ public function auReportsTimesheetGetWithHttpInfo($business_id, $request_employe * Timesheet Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsTimesheetGetAsync($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsTimesheetGetAsync($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsTimesheetGet'][0]) { - return $this->auReportsTimesheetGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auReportsTimesheetGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5808,34 +6775,34 @@ function ($response) { * Timesheet Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auReportsTimesheetGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsTimesheetGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuTimesheetExportModel[]'; - $request = $this->auReportsTimesheetGetRequest($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuTimesheetExportModel[]'; + $request = $this->auReportsTimesheetGetRequest($business_id, $request_employee_id, $request_include_costs, $request_statuses, $request_work_type_id, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5858,7 +6825,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5868,22 +6835,24 @@ function ($exception) { * Create request for operation 'auReportsTimesheetGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param int $request_work_type_id (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param int $request_work_type_id (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auReportsTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auReportsTimesheetGetRequest($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auReportsTimesheetGetRequest($business_id, $request_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_work_type_id = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auReportsTimesheetGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5891,6 +6860,17 @@ protected function auReportsTimesheetGetRequest($business_id, $request_employee_ ); } + + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/timesheet'; $formParams = []; $queryParams = []; @@ -5899,48 +6879,96 @@ protected function auReportsTimesheetGetRequest($business_id, $request_employee_ $multipart = false; // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_include_costs !== null) { - $queryParams['request.includeCosts'] = ObjectSerializer::toQueryValue($request_include_costs); - } - // query params - if (is_array($request_statuses)) { - $queryParams['request.statuses'] = $request_statuses; - } else - if ($request_statuses !== null) { - $queryParams['request.statuses'] = ObjectSerializer::toQueryValue($request_statuses); - } - // query params - if ($request_work_type_id !== null) { - $queryParams['request.workTypeId'] = ObjectSerializer::toQueryValue($request_work_type_id); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_costs, + 'request.includeCosts', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_statuses, + 'request.statuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_work_type_id, + 'request.workTypeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -5951,53 +6979,35 @@ protected function auReportsTimesheetGetRequest($business_id, $request_employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6018,10 +7028,11 @@ protected function auReportsTimesheetGetRequest($business_id, $request_employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6036,14 +7047,15 @@ protected function auReportsTimesheetGetRequest($business_id, $request_employee_ * @param \DateTime $to_date to_date (required) * @param string $business_id business_id (required) * @param int $location_id location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsBirthdayGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BirthdayReportExportModel[] + * @return \OpenAPI\Client\Model\BirthdayReportExportModel[] */ - public function reportsBirthdayGet($from_date, $to_date, $business_id, $location_id = '0') + public function reportsBirthdayGet($from_date, $to_date, $business_id, $location_id = 0, string $contentType = self::contentTypes['reportsBirthdayGet'][0]) { - list($response) = $this->reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_id, $location_id); + list($response) = $this->reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_id, $location_id, $contentType); return $response; } @@ -6056,15 +7068,15 @@ public function reportsBirthdayGet($from_date, $to_date, $business_id, $location * @param \DateTime $to_date (required) * @param string $business_id (required) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsBirthdayGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BirthdayReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BirthdayReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_id, $location_id = '0') + public function reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_id, $location_id = 0, string $contentType = self::contentTypes['reportsBirthdayGet'][0]) { - $returnType = '\Swagger\Client\Model\BirthdayReportExportModel[]'; - $request = $this->reportsBirthdayGetRequest($from_date, $to_date, $business_id, $location_id); + $request = $this->reportsBirthdayGetRequest($from_date, $to_date, $business_id, $location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6073,9 +7085,16 @@ public function reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6086,19 +7105,37 @@ public function reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BirthdayReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BirthdayReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BirthdayReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BirthdayReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6115,7 +7152,7 @@ public function reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BirthdayReportExportModel[]', + '\OpenAPI\Client\Model\BirthdayReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6134,13 +7171,14 @@ public function reportsBirthdayGetWithHttpInfo($from_date, $to_date, $business_i * @param \DateTime $to_date (required) * @param string $business_id (required) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsBirthdayGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsBirthdayGetAsync($from_date, $to_date, $business_id, $location_id = '0') + public function reportsBirthdayGetAsync($from_date, $to_date, $business_id, $location_id = 0, string $contentType = self::contentTypes['reportsBirthdayGet'][0]) { - return $this->reportsBirthdayGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $location_id) + return $this->reportsBirthdayGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6157,24 +7195,24 @@ function ($response) { * @param \DateTime $to_date (required) * @param string $business_id (required) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsBirthdayGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsBirthdayGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $location_id = '0') + public function reportsBirthdayGetAsyncWithHttpInfo($from_date, $to_date, $business_id, $location_id = 0, string $contentType = self::contentTypes['reportsBirthdayGet'][0]) { - $returnType = '\Swagger\Client\Model\BirthdayReportExportModel[]'; - $request = $this->reportsBirthdayGetRequest($from_date, $to_date, $business_id, $location_id); + $returnType = '\OpenAPI\Client\Model\BirthdayReportExportModel[]'; + $request = $this->reportsBirthdayGetRequest($from_date, $to_date, $business_id, $location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6197,7 +7235,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6210,24 +7248,28 @@ function ($exception) { * @param \DateTime $to_date (required) * @param string $business_id (required) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsBirthdayGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsBirthdayGetRequest($from_date, $to_date, $business_id, $location_id = '0') + public function reportsBirthdayGetRequest($from_date, $to_date, $business_id, $location_id = 0, string $contentType = self::contentTypes['reportsBirthdayGet'][0]) { + // verify the required parameter 'from_date' is set if ($from_date === null || (is_array($from_date) && count($from_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $from_date when calling reportsBirthdayGet' ); } + // verify the required parameter 'to_date' is set if ($to_date === null || (is_array($to_date) && count($to_date) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $to_date when calling reportsBirthdayGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6235,6 +7277,8 @@ protected function reportsBirthdayGetRequest($from_date, $to_date, $business_id, ); } + + $resourcePath = '/api/v2/business/{businessId}/report/birthday'; $formParams = []; $queryParams = []; @@ -6243,17 +7287,33 @@ protected function reportsBirthdayGetRequest($from_date, $to_date, $business_id, $multipart = false; // query params - if ($from_date !== null) { - $queryParams['fromDate'] = ObjectSerializer::toQueryValue($from_date); - } - // query params - if ($to_date !== null) { - $queryParams['toDate'] = ObjectSerializer::toQueryValue($to_date); - } - // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date, + 'fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date, + 'toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6264,53 +7324,35 @@ protected function reportsBirthdayGetRequest($from_date, $to_date, $business_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6331,10 +7373,11 @@ protected function reportsBirthdayGetRequest($from_date, $to_date, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6346,23 +7389,24 @@ protected function reportsBirthdayGetRequest($from_date, $to_date, $business_id, * Deductions Report * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_deduction_category_id (optional) - * @param bool $request_disable_rollup_reporting (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param int $request_deduction_category_id request_deduction_category_id (optional) + * @param bool $request_disable_rollup_reporting request_disable_rollup_reporting (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDeductionsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DeductionsReportExportModel[] + * @return \OpenAPI\Client\Model\DeductionsReportExportModel[] */ - public function reportsDeductionsGet($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsDeductionsGet($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsDeductionsGet'][0]) { - list($response) = $this->reportsDeductionsGetWithHttpInfo($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->reportsDeductionsGetWithHttpInfo($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -6372,24 +7416,24 @@ public function reportsDeductionsGet($business_id, $request_employee_id = null, * Deductions Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_deduction_category_id (optional) - * @param bool $request_disable_rollup_reporting (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int $request_deduction_category_id (optional) + * @param bool $request_disable_rollup_reporting (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDeductionsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DeductionsReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DeductionsReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsDeductionsGetWithHttpInfo($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsDeductionsGetWithHttpInfo($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsDeductionsGet'][0]) { - $returnType = '\Swagger\Client\Model\DeductionsReportExportModel[]'; - $request = $this->reportsDeductionsGetRequest($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->reportsDeductionsGetRequest($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6398,9 +7442,16 @@ public function reportsDeductionsGetWithHttpInfo($business_id, $request_employee } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6411,19 +7462,37 @@ public function reportsDeductionsGetWithHttpInfo($business_id, $request_employee sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DeductionsReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DeductionsReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DeductionsReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DeductionsReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6440,7 +7509,7 @@ public function reportsDeductionsGetWithHttpInfo($business_id, $request_employee case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DeductionsReportExportModel[]', + '\OpenAPI\Client\Model\DeductionsReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6456,22 +7525,23 @@ public function reportsDeductionsGetWithHttpInfo($business_id, $request_employee * Deductions Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_deduction_category_id (optional) - * @param bool $request_disable_rollup_reporting (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int $request_deduction_category_id (optional) + * @param bool $request_disable_rollup_reporting (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDeductionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsDeductionsGetAsync($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsDeductionsGetAsync($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsDeductionsGet'][0]) { - return $this->reportsDeductionsGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->reportsDeductionsGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6485,33 +7555,33 @@ function ($response) { * Deductions Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_deduction_category_id (optional) - * @param bool $request_disable_rollup_reporting (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int $request_deduction_category_id (optional) + * @param bool $request_disable_rollup_reporting (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDeductionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsDeductionsGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsDeductionsGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsDeductionsGet'][0]) { - $returnType = '\Swagger\Client\Model\DeductionsReportExportModel[]'; - $request = $this->reportsDeductionsGetRequest($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\DeductionsReportExportModel[]'; + $request = $this->reportsDeductionsGetRequest($business_id, $request_employee_id, $request_deduction_category_id, $request_disable_rollup_reporting, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6534,7 +7604,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6544,21 +7614,23 @@ function ($exception) { * Create request for operation 'reportsDeductionsGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_deduction_category_id (optional) - * @param bool $request_disable_rollup_reporting (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param int $request_deduction_category_id (optional) + * @param bool $request_disable_rollup_reporting (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDeductionsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsDeductionsGetRequest($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsDeductionsGetRequest($business_id, $request_employee_id = null, $request_deduction_category_id = null, $request_disable_rollup_reporting = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsDeductionsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6566,6 +7638,16 @@ protected function reportsDeductionsGetRequest($business_id, $request_employee_i ); } + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/deductions'; $formParams = []; $queryParams = []; @@ -6574,41 +7656,87 @@ protected function reportsDeductionsGetRequest($business_id, $request_employee_i $multipart = false; // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_deduction_category_id !== null) { - $queryParams['request.deductionCategoryId'] = ObjectSerializer::toQueryValue($request_deduction_category_id); - } - // query params - if ($request_disable_rollup_reporting !== null) { - $queryParams['request.disableRollupReporting'] = ObjectSerializer::toQueryValue($request_disable_rollup_reporting); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_deduction_category_id, + 'request.deductionCategoryId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_disable_rollup_reporting, + 'request.disableRollupReporting', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6619,53 +7747,35 @@ protected function reportsDeductionsGetRequest($business_id, $request_employee_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6686,10 +7796,11 @@ protected function reportsDeductionsGetRequest($business_id, $request_employee_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6706,14 +7817,15 @@ protected function reportsDeductionsGetRequest($business_id, $request_employee_i * @param int $document_status document_status (optional, default to 0) * @param int $employing_entity_id employing_entity_id (optional, default to 0) * @param int $location_id location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDocumentAcknowledgementsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\DocumentAcknowledgementsReportExportModel[] + * @return \OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[] */ - public function reportsDocumentAcknowledgementsGet($business_id, $document_id = null, $employee_ids = null, $document_status = '0', $employing_entity_id = '0', $location_id = '0') + public function reportsDocumentAcknowledgementsGet($business_id, $document_id = null, $employee_ids = null, $document_status = 0, $employing_entity_id = 0, $location_id = 0, string $contentType = self::contentTypes['reportsDocumentAcknowledgementsGet'][0]) { - list($response) = $this->reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id); + list($response) = $this->reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id, $contentType); return $response; } @@ -6728,15 +7840,15 @@ public function reportsDocumentAcknowledgementsGet($business_id, $document_id = * @param int $document_status (optional, default to 0) * @param int $employing_entity_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDocumentAcknowledgementsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\DocumentAcknowledgementsReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $document_id = null, $employee_ids = null, $document_status = '0', $employing_entity_id = '0', $location_id = '0') + public function reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $document_id = null, $employee_ids = null, $document_status = 0, $employing_entity_id = 0, $location_id = 0, string $contentType = self::contentTypes['reportsDocumentAcknowledgementsGet'][0]) { - $returnType = '\Swagger\Client\Model\DocumentAcknowledgementsReportExportModel[]'; - $request = $this->reportsDocumentAcknowledgementsGetRequest($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id); + $request = $this->reportsDocumentAcknowledgementsGetRequest($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6745,9 +7857,16 @@ public function reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $do } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6758,19 +7877,37 @@ public function reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $do sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6787,7 +7924,7 @@ public function reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $do case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\DocumentAcknowledgementsReportExportModel[]', + '\OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6808,13 +7945,14 @@ public function reportsDocumentAcknowledgementsGetWithHttpInfo($business_id, $do * @param int $document_status (optional, default to 0) * @param int $employing_entity_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDocumentAcknowledgementsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsDocumentAcknowledgementsGetAsync($business_id, $document_id = null, $employee_ids = null, $document_status = '0', $employing_entity_id = '0', $location_id = '0') + public function reportsDocumentAcknowledgementsGetAsync($business_id, $document_id = null, $employee_ids = null, $document_status = 0, $employing_entity_id = 0, $location_id = 0, string $contentType = self::contentTypes['reportsDocumentAcknowledgementsGet'][0]) { - return $this->reportsDocumentAcknowledgementsGetAsyncWithHttpInfo($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id) + return $this->reportsDocumentAcknowledgementsGetAsyncWithHttpInfo($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6833,24 +7971,24 @@ function ($response) { * @param int $document_status (optional, default to 0) * @param int $employing_entity_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDocumentAcknowledgementsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsDocumentAcknowledgementsGetAsyncWithHttpInfo($business_id, $document_id = null, $employee_ids = null, $document_status = '0', $employing_entity_id = '0', $location_id = '0') + public function reportsDocumentAcknowledgementsGetAsyncWithHttpInfo($business_id, $document_id = null, $employee_ids = null, $document_status = 0, $employing_entity_id = 0, $location_id = 0, string $contentType = self::contentTypes['reportsDocumentAcknowledgementsGet'][0]) { - $returnType = '\Swagger\Client\Model\DocumentAcknowledgementsReportExportModel[]'; - $request = $this->reportsDocumentAcknowledgementsGetRequest($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id); + $returnType = '\OpenAPI\Client\Model\DocumentAcknowledgementsReportExportModel[]'; + $request = $this->reportsDocumentAcknowledgementsGetRequest($business_id, $document_id, $employee_ids, $document_status, $employing_entity_id, $location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6873,7 +8011,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6888,12 +8026,14 @@ function ($exception) { * @param int $document_status (optional, default to 0) * @param int $employing_entity_id (optional, default to 0) * @param int $location_id (optional, default to 0) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsDocumentAcknowledgementsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsDocumentAcknowledgementsGetRequest($business_id, $document_id = null, $employee_ids = null, $document_status = '0', $employing_entity_id = '0', $location_id = '0') + public function reportsDocumentAcknowledgementsGetRequest($business_id, $document_id = null, $employee_ids = null, $document_status = 0, $employing_entity_id = 0, $location_id = 0, string $contentType = self::contentTypes['reportsDocumentAcknowledgementsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6901,6 +8041,12 @@ protected function reportsDocumentAcknowledgementsGetRequest($business_id, $docu ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/documentAcknowledgements'; $formParams = []; $queryParams = []; @@ -6909,28 +8055,51 @@ protected function reportsDocumentAcknowledgementsGetRequest($business_id, $docu $multipart = false; // query params - if ($document_id !== null) { - $queryParams['documentId'] = ObjectSerializer::toQueryValue($document_id); - } - // query params - if (is_array($employee_ids)) { - $queryParams['employeeIds'] = $employee_ids; - } else - if ($employee_ids !== null) { - $queryParams['employeeIds'] = ObjectSerializer::toQueryValue($employee_ids); - } - // query params - if ($document_status !== null) { - $queryParams['documentStatus'] = ObjectSerializer::toQueryValue($document_status); - } - // query params - if ($employing_entity_id !== null) { - $queryParams['employingEntityId'] = ObjectSerializer::toQueryValue($employing_entity_id); - } - // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $document_id, + 'documentId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employee_ids, + 'employeeIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $document_status, + 'documentStatus', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employing_entity_id, + 'employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6941,53 +8110,35 @@ protected function reportsDocumentAcknowledgementsGetRequest($business_id, $docu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7008,10 +8159,11 @@ protected function reportsDocumentAcknowledgementsGetRequest($business_id, $docu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7023,22 +8175,23 @@ protected function reportsDocumentAcknowledgementsGetRequest($business_id, $docu * Employee Audit Report * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_section (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param string $request_section request_section (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeAuditGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\EmployeeDetailsAuditReportApiModel[] + * @return \OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[] */ - public function reportsEmployeeAuditGet($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsEmployeeAuditGet($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsEmployeeAuditGet'][0]) { - list($response) = $this->reportsEmployeeAuditGetWithHttpInfo($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->reportsEmployeeAuditGetWithHttpInfo($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -7048,23 +8201,23 @@ public function reportsEmployeeAuditGet($business_id, $request_employee_id = nul * Employee Audit Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_section (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_section (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeAuditGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\EmployeeDetailsAuditReportApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsEmployeeAuditGetWithHttpInfo($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsEmployeeAuditGetWithHttpInfo($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsEmployeeAuditGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsAuditReportApiModel[]'; - $request = $this->reportsEmployeeAuditGetRequest($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->reportsEmployeeAuditGetRequest($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -7073,9 +8226,16 @@ public function reportsEmployeeAuditGetWithHttpInfo($business_id, $request_emplo } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7086,19 +8246,37 @@ public function reportsEmployeeAuditGetWithHttpInfo($business_id, $request_emplo sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7115,7 +8293,7 @@ public function reportsEmployeeAuditGetWithHttpInfo($business_id, $request_emplo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\EmployeeDetailsAuditReportApiModel[]', + '\OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7131,21 +8309,22 @@ public function reportsEmployeeAuditGetWithHttpInfo($business_id, $request_emplo * Employee Audit Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_section (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_section (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeAuditGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsEmployeeAuditGetAsync($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsEmployeeAuditGetAsync($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsEmployeeAuditGet'][0]) { - return $this->reportsEmployeeAuditGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->reportsEmployeeAuditGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -7159,32 +8338,32 @@ function ($response) { * Employee Audit Report * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_section (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_section (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeAuditGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsEmployeeAuditGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsEmployeeAuditGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsEmployeeAuditGet'][0]) { - $returnType = '\Swagger\Client\Model\EmployeeDetailsAuditReportApiModel[]'; - $request = $this->reportsEmployeeAuditGetRequest($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\EmployeeDetailsAuditReportApiModel[]'; + $request = $this->reportsEmployeeAuditGetRequest($business_id, $request_employee_id, $request_section, $request_pay_schedule_id, $request_include_post_tax_deductions, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7207,7 +8386,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7217,20 +8396,22 @@ function ($exception) { * Create request for operation 'reportsEmployeeAuditGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param string $request_section (optional) - * @param int $request_pay_schedule_id (optional) - * @param bool $request_include_post_tax_deductions (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_employee_id (optional) + * @param string $request_section (optional) + * @param int $request_pay_schedule_id (optional) + * @param bool $request_include_post_tax_deductions (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeAuditGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsEmployeeAuditGetRequest($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsEmployeeAuditGetRequest($business_id, $request_employee_id = null, $request_section = null, $request_pay_schedule_id = null, $request_include_post_tax_deductions = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsEmployeeAuditGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7238,45 +8419,95 @@ protected function reportsEmployeeAuditGetRequest($business_id, $request_employe ); } + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/employeeaudit'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - - // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_section !== null) { - $queryParams['request.section'] = ObjectSerializer::toQueryValue($request_section); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_include_post_tax_deductions !== null) { - $queryParams['request.includePostTaxDeductions'] = ObjectSerializer::toQueryValue($request_include_post_tax_deductions); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } + // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_section, + 'request.section', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_post_tax_deductions, + 'request.includePostTaxDeductions', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -7287,53 +8518,35 @@ protected function reportsEmployeeAuditGetRequest($business_id, $request_employe ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7354,10 +8567,11 @@ protected function reportsEmployeeAuditGetRequest($business_id, $request_employe $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7374,14 +8588,15 @@ protected function reportsEmployeeAuditGetRequest($business_id, $request_employe * @param int $employing_entity_id employing_entity_id (optional) * @param bool $include_active include_active (optional, default to true) * @param bool $include_inactive include_inactive (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object[] */ - public function reportsEmployeeDetailsGet($business_id, $selected_columns = null, $location_id = '0', $employing_entity_id = null, $include_active = 'true', $include_inactive = 'true') + public function reportsEmployeeDetailsGet($business_id, $selected_columns = null, $location_id = 0, $employing_entity_id = null, $include_active = true, $include_inactive = true, string $contentType = self::contentTypes['reportsEmployeeDetailsGet'][0]) { - list($response) = $this->reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive); + list($response) = $this->reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive, $contentType); return $response; } @@ -7396,15 +8611,15 @@ public function reportsEmployeeDetailsGet($business_id, $selected_columns = null * @param int $employing_entity_id (optional) * @param bool $include_active (optional, default to true) * @param bool $include_inactive (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_columns = null, $location_id = '0', $employing_entity_id = null, $include_active = 'true', $include_inactive = 'true') + public function reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_columns = null, $location_id = 0, $employing_entity_id = null, $include_active = true, $include_inactive = true, string $contentType = self::contentTypes['reportsEmployeeDetailsGet'][0]) { - $returnType = 'object[]'; - $request = $this->reportsEmployeeDetailsGetRequest($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive); + $request = $this->reportsEmployeeDetailsGetRequest($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive, $contentType); try { $options = $this->createHttpClientOption(); @@ -7413,9 +8628,16 @@ public function reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_co } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7426,19 +8648,37 @@ public function reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_co sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7476,13 +8716,14 @@ public function reportsEmployeeDetailsGetWithHttpInfo($business_id, $selected_co * @param int $employing_entity_id (optional) * @param bool $include_active (optional, default to true) * @param bool $include_inactive (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsEmployeeDetailsGetAsync($business_id, $selected_columns = null, $location_id = '0', $employing_entity_id = null, $include_active = 'true', $include_inactive = 'true') + public function reportsEmployeeDetailsGetAsync($business_id, $selected_columns = null, $location_id = 0, $employing_entity_id = null, $include_active = true, $include_inactive = true, string $contentType = self::contentTypes['reportsEmployeeDetailsGet'][0]) { - return $this->reportsEmployeeDetailsGetAsyncWithHttpInfo($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive) + return $this->reportsEmployeeDetailsGetAsyncWithHttpInfo($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive, $contentType) ->then( function ($response) { return $response[0]; @@ -7501,24 +8742,24 @@ function ($response) { * @param int $employing_entity_id (optional) * @param bool $include_active (optional, default to true) * @param bool $include_inactive (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsEmployeeDetailsGetAsyncWithHttpInfo($business_id, $selected_columns = null, $location_id = '0', $employing_entity_id = null, $include_active = 'true', $include_inactive = 'true') + public function reportsEmployeeDetailsGetAsyncWithHttpInfo($business_id, $selected_columns = null, $location_id = 0, $employing_entity_id = null, $include_active = true, $include_inactive = true, string $contentType = self::contentTypes['reportsEmployeeDetailsGet'][0]) { $returnType = 'object[]'; - $request = $this->reportsEmployeeDetailsGetRequest($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive); + $request = $this->reportsEmployeeDetailsGetRequest($business_id, $selected_columns, $location_id, $employing_entity_id, $include_active, $include_inactive, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7541,7 +8782,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7556,12 +8797,14 @@ function ($exception) { * @param int $employing_entity_id (optional) * @param bool $include_active (optional, default to true) * @param bool $include_inactive (optional, default to true) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsEmployeeDetailsGetRequest($business_id, $selected_columns = null, $location_id = '0', $employing_entity_id = null, $include_active = 'true', $include_inactive = 'true') + public function reportsEmployeeDetailsGetRequest($business_id, $selected_columns = null, $location_id = 0, $employing_entity_id = null, $include_active = true, $include_inactive = true, string $contentType = self::contentTypes['reportsEmployeeDetailsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7569,6 +8812,12 @@ protected function reportsEmployeeDetailsGetRequest($business_id, $selected_colu ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/employeedetails'; $formParams = []; $queryParams = []; @@ -7577,28 +8826,51 @@ protected function reportsEmployeeDetailsGetRequest($business_id, $selected_colu $multipart = false; // query params - if (is_array($selected_columns)) { - $queryParams['selectedColumns'] = $selected_columns; - } else - if ($selected_columns !== null) { - $queryParams['selectedColumns'] = ObjectSerializer::toQueryValue($selected_columns); - } - // query params - if ($location_id !== null) { - $queryParams['locationId'] = ObjectSerializer::toQueryValue($location_id); - } - // query params - if ($employing_entity_id !== null) { - $queryParams['employingEntityId'] = ObjectSerializer::toQueryValue($employing_entity_id); - } - // query params - if ($include_active !== null) { - $queryParams['includeActive'] = ObjectSerializer::toQueryValue($include_active); - } - // query params - if ($include_inactive !== null) { - $queryParams['includeInactive'] = ObjectSerializer::toQueryValue($include_inactive); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $selected_columns, + 'selectedColumns', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location_id, + 'locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $employing_entity_id, + 'employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_active, + 'includeActive', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_inactive, + 'includeInactive', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -7609,53 +8881,35 @@ protected function reportsEmployeeDetailsGetRequest($business_id, $selected_colu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7676,10 +8930,11 @@ protected function reportsEmployeeDetailsGetRequest($business_id, $selected_colu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7690,16 +8945,17 @@ protected function reportsEmployeeDetailsGetRequest($business_id, $selected_colu * * Employee Details Report * - * @param \Swagger\Client\Model\EmployeeDetailsReportRequestModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EmployeeDetailsReportRequestModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object[] */ - public function reportsEmployeeDetailsPost($model, $business_id) + public function reportsEmployeeDetailsPost($business_id, $model, string $contentType = self::contentTypes['reportsEmployeeDetailsPost'][0]) { - list($response) = $this->reportsEmployeeDetailsPostWithHttpInfo($model, $business_id); + list($response) = $this->reportsEmployeeDetailsPostWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -7708,17 +8964,17 @@ public function reportsEmployeeDetailsPost($model, $business_id) * * Employee Details Report * - * @param \Swagger\Client\Model\EmployeeDetailsReportRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeDetailsReportRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsEmployeeDetailsPostWithHttpInfo($model, $business_id) + public function reportsEmployeeDetailsPostWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['reportsEmployeeDetailsPost'][0]) { - $returnType = 'object[]'; - $request = $this->reportsEmployeeDetailsPostRequest($model, $business_id); + $request = $this->reportsEmployeeDetailsPostRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -7727,9 +8983,16 @@ public function reportsEmployeeDetailsPostWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -7740,19 +9003,37 @@ public function reportsEmployeeDetailsPostWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7784,15 +9065,16 @@ public function reportsEmployeeDetailsPostWithHttpInfo($model, $business_id) * * Employee Details Report * - * @param \Swagger\Client\Model\EmployeeDetailsReportRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeDetailsReportRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsEmployeeDetailsPostAsync($model, $business_id) + public function reportsEmployeeDetailsPostAsync($business_id, $model, string $contentType = self::contentTypes['reportsEmployeeDetailsPost'][0]) { - return $this->reportsEmployeeDetailsPostAsyncWithHttpInfo($model, $business_id) + return $this->reportsEmployeeDetailsPostAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -7805,26 +9087,26 @@ function ($response) { * * Employee Details Report * - * @param \Swagger\Client\Model\EmployeeDetailsReportRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeDetailsReportRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsEmployeeDetailsPostAsyncWithHttpInfo($model, $business_id) + public function reportsEmployeeDetailsPostAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['reportsEmployeeDetailsPost'][0]) { $returnType = 'object[]'; - $request = $this->reportsEmployeeDetailsPostRequest($model, $business_id); + $request = $this->reportsEmployeeDetailsPostRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7847,7 +9129,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7856,20 +9138,16 @@ function ($exception) { /** * Create request for operation 'reportsEmployeeDetailsPost' * - * @param \Swagger\Client\Model\EmployeeDetailsReportRequestModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EmployeeDetailsReportRequestModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsEmployeeDetailsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsEmployeeDetailsPostRequest($model, $business_id) + public function reportsEmployeeDetailsPostRequest($business_id, $model, string $contentType = self::contentTypes['reportsEmployeeDetailsPost'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling reportsEmployeeDetailsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7877,6 +9155,14 @@ protected function reportsEmployeeDetailsPostRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling reportsEmployeeDetailsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/report/employeedetails'; $formParams = []; $queryParams = []; @@ -7885,6 +9171,7 @@ protected function reportsEmployeeDetailsPostRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -7894,56 +9181,42 @@ protected function reportsEmployeeDetailsPostRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7964,10 +9237,11 @@ protected function reportsEmployeeDetailsPostRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -7980,16 +9254,17 @@ protected function reportsEmployeeDetailsPostRequest($model, $business_id) * * @param int $pay_run_id pay_run_id (required) * @param string $business_id business_id (required) - * @param string $journal_view journal_view (optional, default to 0) - * @param string $journal_service journal_service (optional, default to 9) + * @param string $journal_view journal_view (optional, default to '0') + * @param string $journal_service journal_service (optional, default to '9') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsJournalGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function reportsJournalGet($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9') + public function reportsJournalGet($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9', string $contentType = self::contentTypes['reportsJournalGet'][0]) { - $this->reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journal_view, $journal_service); + $this->reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journal_view, $journal_service, $contentType); } /** @@ -7999,17 +9274,17 @@ public function reportsJournalGet($pay_run_id, $business_id, $journal_view = '0' * * @param int $pay_run_id (required) * @param string $business_id (required) - * @param string $journal_view (optional, default to 0) - * @param string $journal_service (optional, default to 9) + * @param string $journal_view (optional, default to '0') + * @param string $journal_service (optional, default to '9') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsJournalGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9') + public function reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9', string $contentType = self::contentTypes['reportsJournalGet'][0]) { - $returnType = ''; - $request = $this->reportsJournalGetRequest($pay_run_id, $business_id, $journal_view, $journal_service); + $request = $this->reportsJournalGetRequest($pay_run_id, $business_id, $journal_view, $journal_service, $contentType); try { $options = $this->createHttpClientOption(); @@ -8018,9 +9293,16 @@ public function reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journa } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8031,11 +9313,11 @@ public function reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journa sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -8055,15 +9337,16 @@ public function reportsJournalGetWithHttpInfo($pay_run_id, $business_id, $journa * * @param int $pay_run_id (required) * @param string $business_id (required) - * @param string $journal_view (optional, default to 0) - * @param string $journal_service (optional, default to 9) + * @param string $journal_view (optional, default to '0') + * @param string $journal_service (optional, default to '9') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsJournalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsJournalGetAsync($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9') + public function reportsJournalGetAsync($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9', string $contentType = self::contentTypes['reportsJournalGet'][0]) { - return $this->reportsJournalGetAsyncWithHttpInfo($pay_run_id, $business_id, $journal_view, $journal_service) + return $this->reportsJournalGetAsyncWithHttpInfo($pay_run_id, $business_id, $journal_view, $journal_service, $contentType) ->then( function ($response) { return $response[0]; @@ -8078,16 +9361,17 @@ function ($response) { * * @param int $pay_run_id (required) * @param string $business_id (required) - * @param string $journal_view (optional, default to 0) - * @param string $journal_service (optional, default to 9) + * @param string $journal_view (optional, default to '0') + * @param string $journal_service (optional, default to '9') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsJournalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsJournalGetAsyncWithHttpInfo($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9') + public function reportsJournalGetAsyncWithHttpInfo($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9', string $contentType = self::contentTypes['reportsJournalGet'][0]) { $returnType = ''; - $request = $this->reportsJournalGetRequest($pay_run_id, $business_id, $journal_view, $journal_service); + $request = $this->reportsJournalGetRequest($pay_run_id, $business_id, $journal_view, $journal_service, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8106,7 +9390,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8117,20 +9401,23 @@ function ($exception) { * * @param int $pay_run_id (required) * @param string $business_id (required) - * @param string $journal_view (optional, default to 0) - * @param string $journal_service (optional, default to 9) + * @param string $journal_view (optional, default to '0') + * @param string $journal_service (optional, default to '9') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsJournalGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsJournalGetRequest($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9') + public function reportsJournalGetRequest($pay_run_id, $business_id, $journal_view = '0', $journal_service = '9', string $contentType = self::contentTypes['reportsJournalGet'][0]) { + // verify the required parameter 'pay_run_id' is set if ($pay_run_id === null || (is_array($pay_run_id) && count($pay_run_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $pay_run_id when calling reportsJournalGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8138,6 +9425,9 @@ protected function reportsJournalGetRequest($pay_run_id, $business_id, $journal_ ); } + + + $resourcePath = '/api/v2/business/{businessId}/report/journal'; $formParams = []; $queryParams = []; @@ -8146,17 +9436,33 @@ protected function reportsJournalGetRequest($pay_run_id, $business_id, $journal_ $multipart = false; // query params - if ($pay_run_id !== null) { - $queryParams['payRunId'] = ObjectSerializer::toQueryValue($pay_run_id); - } - // query params - if ($journal_view !== null) { - $queryParams['journalView'] = ObjectSerializer::toQueryValue($journal_view); - } - // query params - if ($journal_service !== null) { - $queryParams['journalService'] = ObjectSerializer::toQueryValue($journal_service); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $pay_run_id, + 'payRunId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $journal_view, + 'journalView', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $journal_service, + 'journalService', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -8167,53 +9473,35 @@ protected function reportsJournalGetRequest($pay_run_id, $business_id, $journal_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8234,10 +9522,11 @@ protected function reportsJournalGetRequest($pay_run_id, $business_id, $journal_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8249,18 +9538,19 @@ protected function reportsJournalGetRequest($pay_run_id, $business_id, $journal_ * Get Pay Slips by Finalised Pay Run Id * * @param string $business_id business_id (required) - * @param int $model_pay_run_id (optional) - * @param int $model_employee_id (optional) - * @param int $model_location_id (optional) - * @param int $model_employing_entity_id (optional) + * @param int $model_pay_run_id model_pay_run_id (optional) + * @param int $model_employee_id model_employee_id (optional) + * @param int $model_location_id model_location_id (optional) + * @param int $model_employing_entity_id model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaySlipGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function reportsPaySlipGet($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null) + public function reportsPaySlipGet($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['reportsPaySlipGet'][0]) { - $this->reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id); + $this->reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id, $contentType); } /** @@ -8269,19 +9559,19 @@ public function reportsPaySlipGet($business_id, $model_pay_run_id = null, $model * Get Pay Slips by Finalised Pay Run Id * * @param string $business_id (required) - * @param int $model_pay_run_id (optional) - * @param int $model_employee_id (optional) - * @param int $model_location_id (optional) - * @param int $model_employing_entity_id (optional) + * @param int $model_pay_run_id (optional) + * @param int $model_employee_id (optional) + * @param int $model_location_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaySlipGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null) + public function reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['reportsPaySlipGet'][0]) { - $returnType = ''; - $request = $this->reportsPaySlipGetRequest($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id); + $request = $this->reportsPaySlipGetRequest($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8290,9 +9580,16 @@ public function reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8303,11 +9600,11 @@ public function reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -8326,17 +9623,18 @@ public function reportsPaySlipGetWithHttpInfo($business_id, $model_pay_run_id = * Get Pay Slips by Finalised Pay Run Id * * @param string $business_id (required) - * @param int $model_pay_run_id (optional) - * @param int $model_employee_id (optional) - * @param int $model_location_id (optional) - * @param int $model_employing_entity_id (optional) + * @param int $model_pay_run_id (optional) + * @param int $model_employee_id (optional) + * @param int $model_location_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsPaySlipGetAsync($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null) + public function reportsPaySlipGetAsync($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['reportsPaySlipGet'][0]) { - return $this->reportsPaySlipGetAsyncWithHttpInfo($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id) + return $this->reportsPaySlipGetAsyncWithHttpInfo($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8350,18 +9648,19 @@ function ($response) { * Get Pay Slips by Finalised Pay Run Id * * @param string $business_id (required) - * @param int $model_pay_run_id (optional) - * @param int $model_employee_id (optional) - * @param int $model_location_id (optional) - * @param int $model_employing_entity_id (optional) + * @param int $model_pay_run_id (optional) + * @param int $model_employee_id (optional) + * @param int $model_location_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsPaySlipGetAsyncWithHttpInfo($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null) + public function reportsPaySlipGetAsyncWithHttpInfo($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['reportsPaySlipGet'][0]) { $returnType = ''; - $request = $this->reportsPaySlipGetRequest($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id); + $request = $this->reportsPaySlipGetRequest($business_id, $model_pay_run_id, $model_employee_id, $model_location_id, $model_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8380,7 +9679,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8390,16 +9689,18 @@ function ($exception) { * Create request for operation 'reportsPaySlipGet' * * @param string $business_id (required) - * @param int $model_pay_run_id (optional) - * @param int $model_employee_id (optional) - * @param int $model_location_id (optional) - * @param int $model_employing_entity_id (optional) + * @param int $model_pay_run_id (optional) + * @param int $model_employee_id (optional) + * @param int $model_location_id (optional) + * @param int $model_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsPaySlipGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsPaySlipGetRequest($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null) + public function reportsPaySlipGetRequest($business_id, $model_pay_run_id = null, $model_employee_id = null, $model_location_id = null, $model_employing_entity_id = null, string $contentType = self::contentTypes['reportsPaySlipGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8407,6 +9708,11 @@ protected function reportsPaySlipGetRequest($business_id, $model_pay_run_id = nu ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/report/payslip'; $formParams = []; $queryParams = []; @@ -8415,21 +9721,42 @@ protected function reportsPaySlipGetRequest($business_id, $model_pay_run_id = nu $multipart = false; // query params - if ($model_pay_run_id !== null) { - $queryParams['model.payRunId'] = ObjectSerializer::toQueryValue($model_pay_run_id); - } - // query params - if ($model_employee_id !== null) { - $queryParams['model.employeeId'] = ObjectSerializer::toQueryValue($model_employee_id); - } - // query params - if ($model_location_id !== null) { - $queryParams['model.locationId'] = ObjectSerializer::toQueryValue($model_location_id); - } - // query params - if ($model_employing_entity_id !== null) { - $queryParams['model.employingEntityId'] = ObjectSerializer::toQueryValue($model_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_pay_run_id, + 'model.payRunId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employee_id, + 'model.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_location_id, + 'model.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employing_entity_id, + 'model.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -8440,53 +9767,35 @@ protected function reportsPaySlipGetRequest($business_id, $model_pay_run_id = nu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8507,10 +9816,11 @@ protected function reportsPaySlipGetRequest($business_id, $model_pay_run_id = nu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8522,22 +9832,23 @@ protected function reportsPaySlipGetRequest($business_id, $model_pay_run_id = nu * Get shift swapping report by business id * * @param string $business_id business_id (required) - * @param int $request_from_employee_id (optional) - * @param int $request_to_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_from_employee_id request_from_employee_id (optional) + * @param int $request_to_employee_id request_to_employee_id (optional) + * @param bool $request_include_costs request_include_costs (optional) + * @param string[] $request_statuses request_statuses (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsShiftSwappingGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ShiftSwappingReportExportModel[] + * @return \OpenAPI\Client\Model\ShiftSwappingReportExportModel[] */ - public function reportsShiftSwappingGet($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsShiftSwappingGet($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsShiftSwappingGet'][0]) { - list($response) = $this->reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -8547,23 +9858,23 @@ public function reportsShiftSwappingGet($business_id, $request_from_employee_id * Get shift swapping report by business id * * @param string $business_id (required) - * @param int $request_from_employee_id (optional) - * @param int $request_to_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_from_employee_id (optional) + * @param int $request_to_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsShiftSwappingGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ShiftSwappingReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ShiftSwappingReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsShiftSwappingGet'][0]) { - $returnType = '\Swagger\Client\Model\ShiftSwappingReportExportModel[]'; - $request = $this->reportsShiftSwappingGetRequest($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->reportsShiftSwappingGetRequest($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -8572,9 +9883,16 @@ public function reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8585,19 +9903,37 @@ public function reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ShiftSwappingReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ShiftSwappingReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ShiftSwappingReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ShiftSwappingReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8614,7 +9950,7 @@ public function reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ShiftSwappingReportExportModel[]', + '\OpenAPI\Client\Model\ShiftSwappingReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8630,21 +9966,22 @@ public function reportsShiftSwappingGetWithHttpInfo($business_id, $request_from_ * Get shift swapping report by business id * * @param string $business_id (required) - * @param int $request_from_employee_id (optional) - * @param int $request_to_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_from_employee_id (optional) + * @param int $request_to_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsShiftSwappingGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsShiftSwappingGetAsync($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsShiftSwappingGetAsync($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsShiftSwappingGet'][0]) { - return $this->reportsShiftSwappingGetAsyncWithHttpInfo($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->reportsShiftSwappingGetAsyncWithHttpInfo($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -8658,32 +9995,32 @@ function ($response) { * Get shift swapping report by business id * * @param string $business_id (required) - * @param int $request_from_employee_id (optional) - * @param int $request_to_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_from_employee_id (optional) + * @param int $request_to_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsShiftSwappingGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsShiftSwappingGetAsyncWithHttpInfo($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsShiftSwappingGetAsyncWithHttpInfo($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsShiftSwappingGet'][0]) { - $returnType = '\Swagger\Client\Model\ShiftSwappingReportExportModel[]'; - $request = $this->reportsShiftSwappingGetRequest($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\ShiftSwappingReportExportModel[]'; + $request = $this->reportsShiftSwappingGetRequest($business_id, $request_from_employee_id, $request_to_employee_id, $request_include_costs, $request_statuses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8706,7 +10043,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -8716,20 +10053,22 @@ function ($exception) { * Create request for operation 'reportsShiftSwappingGet' * * @param string $business_id (required) - * @param int $request_from_employee_id (optional) - * @param int $request_to_employee_id (optional) - * @param bool $request_include_costs (optional) - * @param string[] $request_statuses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param int $request_from_employee_id (optional) + * @param int $request_to_employee_id (optional) + * @param bool $request_include_costs (optional) + * @param string[] $request_statuses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsShiftSwappingGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsShiftSwappingGetRequest($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function reportsShiftSwappingGetRequest($business_id, $request_from_employee_id = null, $request_to_employee_id = null, $request_include_costs = null, $request_statuses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['reportsShiftSwappingGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -8737,6 +10076,15 @@ protected function reportsShiftSwappingGetRequest($business_id, $request_from_em ); } + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/shiftswapping'; $formParams = []; $queryParams = []; @@ -8745,40 +10093,78 @@ protected function reportsShiftSwappingGetRequest($business_id, $request_from_em $multipart = false; // query params - if ($request_from_employee_id !== null) { - $queryParams['request.fromEmployeeId'] = ObjectSerializer::toQueryValue($request_from_employee_id); - } - // query params - if ($request_to_employee_id !== null) { - $queryParams['request.toEmployeeId'] = ObjectSerializer::toQueryValue($request_to_employee_id); - } - // query params - if ($request_include_costs !== null) { - $queryParams['request.includeCosts'] = ObjectSerializer::toQueryValue($request_include_costs); - } - // query params - if (is_array($request_statuses)) { - $queryParams['request.statuses'] = $request_statuses; - } else - if ($request_statuses !== null) { - $queryParams['request.statuses'] = ObjectSerializer::toQueryValue($request_statuses); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } - // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_employee_id, + 'request.fromEmployeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_employee_id, + 'request.toEmployeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_costs, + 'request.includeCosts', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_statuses, + 'request.statuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -8789,53 +10175,35 @@ protected function reportsShiftSwappingGetRequest($business_id, $request_from_em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -8856,10 +10224,11 @@ protected function reportsShiftSwappingGetRequest($business_id, $request_from_em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -8871,20 +10240,21 @@ protected function reportsShiftSwappingGetRequest($business_id, $request_from_em * Get tasks by business id * * @param string $business_id business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_pay_run_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_pay_schedule_id (optional) - * @param string $request_status (optional) + * @param int $request_employee_id request_employee_id (optional) + * @param int $request_pay_run_id request_pay_run_id (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_pay_schedule_id request_pay_schedule_id (optional) + * @param string $request_status request_status (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsTasksReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TasksReportExportModel[] + * @return \OpenAPI\Client\Model\TasksReportExportModel[] */ - public function reportsTasksReportGet($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null) + public function reportsTasksReportGet($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null, string $contentType = self::contentTypes['reportsTasksReportGet'][0]) { - list($response) = $this->reportsTasksReportGetWithHttpInfo($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status); + list($response) = $this->reportsTasksReportGetWithHttpInfo($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status, $contentType); return $response; } @@ -8894,21 +10264,21 @@ public function reportsTasksReportGet($business_id, $request_employee_id = null, * Get tasks by business id * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_pay_run_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_pay_schedule_id (optional) - * @param string $request_status (optional) + * @param int $request_employee_id (optional) + * @param int $request_pay_run_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_pay_schedule_id (optional) + * @param string $request_status (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsTasksReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TasksReportExportModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TasksReportExportModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportsTasksReportGetWithHttpInfo($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null) + public function reportsTasksReportGetWithHttpInfo($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null, string $contentType = self::contentTypes['reportsTasksReportGet'][0]) { - $returnType = '\Swagger\Client\Model\TasksReportExportModel[]'; - $request = $this->reportsTasksReportGetRequest($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status); + $request = $this->reportsTasksReportGetRequest($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status, $contentType); try { $options = $this->createHttpClientOption(); @@ -8917,9 +10287,16 @@ public function reportsTasksReportGetWithHttpInfo($business_id, $request_employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -8930,19 +10307,37 @@ public function reportsTasksReportGetWithHttpInfo($business_id, $request_employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TasksReportExportModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TasksReportExportModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TasksReportExportModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TasksReportExportModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -8959,7 +10354,7 @@ public function reportsTasksReportGetWithHttpInfo($business_id, $request_employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TasksReportExportModel[]', + '\OpenAPI\Client\Model\TasksReportExportModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8975,19 +10370,20 @@ public function reportsTasksReportGetWithHttpInfo($business_id, $request_employe * Get tasks by business id * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_pay_run_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_pay_schedule_id (optional) - * @param string $request_status (optional) + * @param int $request_employee_id (optional) + * @param int $request_pay_run_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_pay_schedule_id (optional) + * @param string $request_status (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsTasksReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsTasksReportGetAsync($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null) + public function reportsTasksReportGetAsync($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null, string $contentType = self::contentTypes['reportsTasksReportGet'][0]) { - return $this->reportsTasksReportGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status) + return $this->reportsTasksReportGetAsyncWithHttpInfo($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status, $contentType) ->then( function ($response) { return $response[0]; @@ -9001,30 +10397,30 @@ function ($response) { * Get tasks by business id * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_pay_run_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_pay_schedule_id (optional) - * @param string $request_status (optional) + * @param int $request_employee_id (optional) + * @param int $request_pay_run_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_pay_schedule_id (optional) + * @param string $request_status (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsTasksReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportsTasksReportGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null) + public function reportsTasksReportGetAsyncWithHttpInfo($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null, string $contentType = self::contentTypes['reportsTasksReportGet'][0]) { - $returnType = '\Swagger\Client\Model\TasksReportExportModel[]'; - $request = $this->reportsTasksReportGetRequest($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status); + $returnType = '\OpenAPI\Client\Model\TasksReportExportModel[]'; + $request = $this->reportsTasksReportGetRequest($business_id, $request_employee_id, $request_pay_run_id, $request_from_date, $request_to_date, $request_pay_schedule_id, $request_status, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -9047,7 +10443,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -9057,18 +10453,20 @@ function ($exception) { * Create request for operation 'reportsTasksReportGet' * * @param string $business_id (required) - * @param int $request_employee_id (optional) - * @param int $request_pay_run_id (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_pay_schedule_id (optional) - * @param string $request_status (optional) + * @param int $request_employee_id (optional) + * @param int $request_pay_run_id (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_pay_schedule_id (optional) + * @param string $request_status (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportsTasksReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportsTasksReportGetRequest($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null) + public function reportsTasksReportGetRequest($business_id, $request_employee_id = null, $request_pay_run_id = null, $request_from_date = null, $request_to_date = null, $request_pay_schedule_id = null, $request_status = null, string $contentType = self::contentTypes['reportsTasksReportGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -9076,6 +10474,13 @@ protected function reportsTasksReportGetRequest($business_id, $request_employee_ ); } + + + + + + + $resourcePath = '/api/v2/business/{businessId}/report/tasks'; $formParams = []; $queryParams = []; @@ -9084,29 +10489,60 @@ protected function reportsTasksReportGetRequest($business_id, $request_employee_ $multipart = false; // query params - if ($request_employee_id !== null) { - $queryParams['request.employeeId'] = ObjectSerializer::toQueryValue($request_employee_id); - } - // query params - if ($request_pay_run_id !== null) { - $queryParams['request.payRunId'] = ObjectSerializer::toQueryValue($request_pay_run_id); - } - // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } - // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } - // query params - if ($request_pay_schedule_id !== null) { - $queryParams['request.payScheduleId'] = ObjectSerializer::toQueryValue($request_pay_schedule_id); - } - // query params - if ($request_status !== null) { - $queryParams['request.status'] = ObjectSerializer::toQueryValue($request_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employee_id, + 'request.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_run_id, + 'request.payRunId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_pay_schedule_id, + 'request.payScheduleId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_status, + 'request.status', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -9117,53 +10553,35 @@ protected function reportsTasksReportGetRequest($business_id, $request_employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -9184,10 +10602,11 @@ protected function reportsTasksReportGetRequest($business_id, $request_employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/ReportingDimensionsApi.php b/src/lib/Api/ReportingDimensionsApi.php index b4e37fa..406799e 100644 --- a/src/lib/Api/ReportingDimensionsApi.php +++ b/src/lib/Api/ReportingDimensionsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'reportingDimensionGet' => [ + 'application/json', + ], + 'reportingDimensionGetDimensions' => [ + 'application/json', + ], + 'reportingDimensionPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'reportingDimensionPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'reportingDimensionValueDelete' => [ + 'application/json', + ], + 'reportingDimensionValueGet' => [ + 'application/json', + ], + 'reportingDimensionValueGetDimensionValues' => [ + 'application/json', + ], + 'reportingDimensionValuePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'reportingDimensionValuePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +172,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function reportingDimensionDelete($id, $business_id) + public function reportingDimensionDelete($id, $business_id, string $contentType = self::contentTypes['reportingDimensionDelete'][0]) { - $this->reportingDimensionDeleteWithHttpInfo($id, $business_id); + $this->reportingDimensionDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +190,15 @@ public function reportingDimensionDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionDeleteWithHttpInfo($id, $business_id) + public function reportingDimensionDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['reportingDimensionDelete'][0]) { - $returnType = ''; - $request = $this->reportingDimensionDeleteRequest($id, $business_id); + $request = $this->reportingDimensionDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +207,16 @@ public function reportingDimensionDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +227,11 @@ public function reportingDimensionDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +251,14 @@ public function reportingDimensionDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionDeleteAsync($id, $business_id) + public function reportingDimensionDeleteAsync($id, $business_id, string $contentType = self::contentTypes['reportingDimensionDelete'][0]) { - return $this->reportingDimensionDeleteAsyncWithHttpInfo($id, $business_id) + return $this->reportingDimensionDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +273,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionDeleteAsyncWithHttpInfo($id, $business_id) + public function reportingDimensionDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['reportingDimensionDelete'][0]) { $returnType = ''; - $request = $this->reportingDimensionDeleteRequest($id, $business_id); + $request = $this->reportingDimensionDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +300,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +311,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionDeleteRequest($id, $business_id) + public function reportingDimensionDeleteRequest($id, $business_id, string $contentType = self::contentTypes['reportingDimensionDelete'][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 reportingDimensionDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +333,7 @@ protected function reportingDimensionDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/dimension/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +342,7 @@ protected function reportingDimensionDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +360,35 @@ protected function reportingDimensionDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +409,11 @@ protected function reportingDimensionDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +426,15 @@ protected function reportingDimensionDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionApiModel + * @return \OpenAPI\Client\Model\ReportingDimensionApiModel */ - public function reportingDimensionGet($id, $business_id) + public function reportingDimensionGet($id, $business_id, string $contentType = self::contentTypes['reportingDimensionGet'][0]) { - list($response) = $this->reportingDimensionGetWithHttpInfo($id, $business_id); + list($response) = $this->reportingDimensionGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +445,15 @@ public function reportingDimensionGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionGetWithHttpInfo($id, $business_id) + public function reportingDimensionGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['reportingDimensionGet'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel'; - $request = $this->reportingDimensionGetRequest($id, $business_id); + $request = $this->reportingDimensionGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +462,16 @@ public function reportingDimensionGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +482,37 @@ public function reportingDimensionGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +529,7 @@ public function reportingDimensionGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionApiModel', + '\OpenAPI\Client\Model\ReportingDimensionApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +546,14 @@ public function reportingDimensionGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionGetAsync($id, $business_id) + public function reportingDimensionGetAsync($id, $business_id, string $contentType = self::contentTypes['reportingDimensionGet'][0]) { - return $this->reportingDimensionGetAsyncWithHttpInfo($id, $business_id) + return $this->reportingDimensionGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +568,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionGetAsyncWithHttpInfo($id, $business_id) + public function reportingDimensionGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['reportingDimensionGet'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel'; - $request = $this->reportingDimensionGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel'; + $request = $this->reportingDimensionGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +608,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +619,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionGetRequest($id, $business_id) + public function reportingDimensionGetRequest($id, $business_id, string $contentType = self::contentTypes['reportingDimensionGet'][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 reportingDimensionGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +641,7 @@ protected function reportingDimensionGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/dimension/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +650,7 @@ protected function reportingDimensionGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +668,35 @@ protected function reportingDimensionGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +717,11 @@ protected function reportingDimensionGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +733,20 @@ protected function reportingDimensionGetRequest($id, $business_id) * List Dimensions * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGetDimensions'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionApiModel[] + * @return \OpenAPI\Client\Model\ReportingDimensionApiModel[] */ - public function reportingDimensionGetDimensions($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionGetDimensions($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionGetDimensions'][0]) { - list($response) = $this->reportingDimensionGetDimensionsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->reportingDimensionGetDimensionsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +756,20 @@ public function reportingDimensionGetDimensions($business_id, $filter = null, $o * List Dimensions * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGetDimensions'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionGetDimensionsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionGetDimensionsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionGetDimensions'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel[]'; - $request = $this->reportingDimensionGetDimensionsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->reportingDimensionGetDimensionsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +778,16 @@ public function reportingDimensionGetDimensionsWithHttpInfo($business_id, $filte } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +798,37 @@ public function reportingDimensionGetDimensionsWithHttpInfo($business_id, $filte sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +845,7 @@ public function reportingDimensionGetDimensionsWithHttpInfo($business_id, $filte case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionApiModel[]', + '\OpenAPI\Client\Model\ReportingDimensionApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +861,19 @@ public function reportingDimensionGetDimensionsWithHttpInfo($business_id, $filte * List Dimensions * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGetDimensions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionGetDimensionsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionGetDimensionsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionGetDimensions'][0]) { - return $this->reportingDimensionGetDimensionsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->reportingDimensionGetDimensionsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +887,29 @@ function ($response) { * List Dimensions * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGetDimensions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionGetDimensionsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionGetDimensionsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionGetDimensions'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel[]'; - $request = $this->reportingDimensionGetDimensionsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel[]'; + $request = $this->reportingDimensionGetDimensionsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +932,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +942,19 @@ function ($exception) { * Create request for operation 'reportingDimensionGetDimensions' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionGetDimensions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionGetDimensionsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionGetDimensionsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionGetDimensions'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +962,12 @@ protected function reportingDimensionGetDimensionsRequest($business_id, $filter ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/dimension'; $formParams = []; $queryParams = []; @@ -845,20 +976,45 @@ protected function reportingDimensionGetDimensionsRequest($business_id, $filter $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1026,35 @@ protected function reportingDimensionGetDimensionsRequest($business_id, $filter ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1075,11 @@ protected function reportingDimensionGetDimensionsRequest($business_id, $filter $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1090,17 @@ protected function reportingDimensionGetDimensionsRequest($business_id, $filter * * Create Dimension * - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension dimension (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension dimension (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionApiModel + * @return \OpenAPI\Client\Model\ReportingDimensionApiModel */ - public function reportingDimensionPost($dimension, $business_id) + public function reportingDimensionPost($business_id, $dimension, string $contentType = self::contentTypes['reportingDimensionPost'][0]) { - list($response) = $this->reportingDimensionPostWithHttpInfo($dimension, $business_id); + list($response) = $this->reportingDimensionPostWithHttpInfo($business_id, $dimension, $contentType); return $response; } @@ -969,17 +1109,17 @@ public function reportingDimensionPost($dimension, $business_id) * * Create Dimension * - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionPostWithHttpInfo($dimension, $business_id) + public function reportingDimensionPostWithHttpInfo($business_id, $dimension, string $contentType = self::contentTypes['reportingDimensionPost'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel'; - $request = $this->reportingDimensionPostRequest($dimension, $business_id); + $request = $this->reportingDimensionPostRequest($business_id, $dimension, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1128,16 @@ public function reportingDimensionPostWithHttpInfo($dimension, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1148,37 @@ public function reportingDimensionPostWithHttpInfo($dimension, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1195,7 @@ public function reportingDimensionPostWithHttpInfo($dimension, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionApiModel', + '\OpenAPI\Client\Model\ReportingDimensionApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1210,16 @@ public function reportingDimensionPostWithHttpInfo($dimension, $business_id) * * Create Dimension * - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionPostAsync($dimension, $business_id) + public function reportingDimensionPostAsync($business_id, $dimension, string $contentType = self::contentTypes['reportingDimensionPost'][0]) { - return $this->reportingDimensionPostAsyncWithHttpInfo($dimension, $business_id) + return $this->reportingDimensionPostAsyncWithHttpInfo($business_id, $dimension, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1232,26 @@ function ($response) { * * Create Dimension * - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionPostAsyncWithHttpInfo($dimension, $business_id) + public function reportingDimensionPostAsyncWithHttpInfo($business_id, $dimension, string $contentType = self::contentTypes['reportingDimensionPost'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel'; - $request = $this->reportingDimensionPostRequest($dimension, $business_id); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel'; + $request = $this->reportingDimensionPostRequest($business_id, $dimension, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1274,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1283,16 @@ function ($exception) { /** * Create request for operation 'reportingDimensionPost' * - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionPostRequest($dimension, $business_id) + public function reportingDimensionPostRequest($business_id, $dimension, string $contentType = self::contentTypes['reportingDimensionPost'][0]) { - // verify the required parameter 'dimension' is set - if ($dimension === null || (is_array($dimension) && count($dimension) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dimension when calling reportingDimensionPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1300,14 @@ protected function reportingDimensionPostRequest($dimension, $business_id) ); } + // verify the required parameter 'dimension' is set + if ($dimension === null || (is_array($dimension) && count($dimension) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dimension when calling reportingDimensionPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/dimension'; $formParams = []; $queryParams = []; @@ -1146,6 +1316,7 @@ protected function reportingDimensionPostRequest($dimension, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1326,42 @@ protected function reportingDimensionPostRequest($dimension, $business_id) ); } - // body params - $_tempBody = null; - if (isset($dimension)) { - $_tempBody = $dimension; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($dimension)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($dimension)); + } else { + $httpBody = $dimension; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1382,11 @@ protected function reportingDimensionPostRequest($dimension, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1398,17 @@ protected function reportingDimensionPostRequest($dimension, $business_id) * Update Dimension * * @param int $id id (required) - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension_model dimension_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension_model dimension_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionApiModel + * @return \OpenAPI\Client\Model\ReportingDimensionApiModel */ - public function reportingDimensionPut($id, $dimension_model, $business_id) + public function reportingDimensionPut($id, $business_id, $dimension_model, string $contentType = self::contentTypes['reportingDimensionPut'][0]) { - list($response) = $this->reportingDimensionPutWithHttpInfo($id, $dimension_model, $business_id); + list($response) = $this->reportingDimensionPutWithHttpInfo($id, $business_id, $dimension_model, $contentType); return $response; } @@ -1259,17 +1418,17 @@ public function reportingDimensionPut($id, $dimension_model, $business_id) * Update Dimension * * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionPutWithHttpInfo($id, $dimension_model, $business_id) + public function reportingDimensionPutWithHttpInfo($id, $business_id, $dimension_model, string $contentType = self::contentTypes['reportingDimensionPut'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel'; - $request = $this->reportingDimensionPutRequest($id, $dimension_model, $business_id); + $request = $this->reportingDimensionPutRequest($id, $business_id, $dimension_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1437,16 @@ public function reportingDimensionPutWithHttpInfo($id, $dimension_model, $busine } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1457,37 @@ public function reportingDimensionPutWithHttpInfo($id, $dimension_model, $busine sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1504,7 @@ public function reportingDimensionPutWithHttpInfo($id, $dimension_model, $busine case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionApiModel', + '\OpenAPI\Client\Model\ReportingDimensionApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1520,16 @@ public function reportingDimensionPutWithHttpInfo($id, $dimension_model, $busine * Update Dimension * * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionPutAsync($id, $dimension_model, $business_id) + public function reportingDimensionPutAsync($id, $business_id, $dimension_model, string $contentType = self::contentTypes['reportingDimensionPut'][0]) { - return $this->reportingDimensionPutAsyncWithHttpInfo($id, $dimension_model, $business_id) + return $this->reportingDimensionPutAsyncWithHttpInfo($id, $business_id, $dimension_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1543,26 @@ function ($response) { * Update Dimension * * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionPutAsyncWithHttpInfo($id, $dimension_model, $business_id) + public function reportingDimensionPutAsyncWithHttpInfo($id, $business_id, $dimension_model, string $contentType = self::contentTypes['reportingDimensionPut'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionApiModel'; - $request = $this->reportingDimensionPutRequest($id, $dimension_model, $business_id); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionApiModel'; + $request = $this->reportingDimensionPutRequest($id, $business_id, $dimension_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1595,23 @@ function ($exception) { * Create request for operation 'reportingDimensionPut' * * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionApiModel $dimension_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionApiModel $dimension_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionPutRequest($id, $dimension_model, $business_id) + public function reportingDimensionPutRequest($id, $business_id, $dimension_model, string $contentType = self::contentTypes['reportingDimensionPut'][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 reportingDimensionPut' ); } - // verify the required parameter 'dimension_model' is set - if ($dimension_model === null || (is_array($dimension_model) && count($dimension_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dimension_model when calling reportingDimensionPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1619,14 @@ protected function reportingDimensionPutRequest($id, $dimension_model, $business ); } + // verify the required parameter 'dimension_model' is set + if ($dimension_model === null || (is_array($dimension_model) && count($dimension_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dimension_model when calling reportingDimensionPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/dimension/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1635,7 @@ protected function reportingDimensionPutRequest($id, $dimension_model, $business $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1653,42 @@ protected function reportingDimensionPutRequest($id, $dimension_model, $business ); } - // body params - $_tempBody = null; - if (isset($dimension_model)) { - $_tempBody = $dimension_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($dimension_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($dimension_model)); + } else { + $httpBody = $dimension_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1709,11 @@ protected function reportingDimensionPutRequest($id, $dimension_model, $business $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1549,14 +1727,15 @@ protected function reportingDimensionPutRequest($id, $dimension_model, $business * @param int $dimension_id dimension_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function reportingDimensionValueDelete($dimension_id, $id, $business_id) + public function reportingDimensionValueDelete($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueDelete'][0]) { - $this->reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $business_id); + $this->reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $business_id, $contentType); } /** @@ -1567,15 +1746,15 @@ public function reportingDimensionValueDelete($dimension_id, $id, $business_id) * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $business_id) + public function reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueDelete'][0]) { - $returnType = ''; - $request = $this->reportingDimensionValueDeleteRequest($dimension_id, $id, $business_id); + $request = $this->reportingDimensionValueDeleteRequest($dimension_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1584,9 +1763,16 @@ public function reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $b } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1597,11 +1783,11 @@ public function reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $b sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1622,13 +1808,14 @@ public function reportingDimensionValueDeleteWithHttpInfo($dimension_id, $id, $b * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValueDeleteAsync($dimension_id, $id, $business_id) + public function reportingDimensionValueDeleteAsync($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueDelete'][0]) { - return $this->reportingDimensionValueDeleteAsyncWithHttpInfo($dimension_id, $id, $business_id) + return $this->reportingDimensionValueDeleteAsyncWithHttpInfo($dimension_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1644,14 +1831,15 @@ function ($response) { * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValueDeleteAsyncWithHttpInfo($dimension_id, $id, $business_id) + public function reportingDimensionValueDeleteAsyncWithHttpInfo($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueDelete'][0]) { $returnType = ''; - $request = $this->reportingDimensionValueDeleteRequest($dimension_id, $id, $business_id); + $request = $this->reportingDimensionValueDeleteRequest($dimension_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1670,7 +1858,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1682,24 +1870,28 @@ function ($exception) { * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionValueDeleteRequest($dimension_id, $id, $business_id) + public function reportingDimensionValueDeleteRequest($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueDelete'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling reportingDimensionValueDelete' ); } + // 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 reportingDimensionValueDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1707,6 +1899,7 @@ protected function reportingDimensionValueDeleteRequest($dimension_id, $id, $bus ); } + $resourcePath = '/api/v2/business/{businessId}/dimension/{dimensionId}/value/{id}'; $formParams = []; $queryParams = []; @@ -1715,6 +1908,7 @@ protected function reportingDimensionValueDeleteRequest($dimension_id, $id, $bus $multipart = false; + // path params if ($dimension_id !== null) { $resourcePath = str_replace( @@ -1740,53 +1934,35 @@ protected function reportingDimensionValueDeleteRequest($dimension_id, $id, $bus ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1807,10 +1983,11 @@ protected function reportingDimensionValueDeleteRequest($dimension_id, $id, $bus $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1824,14 +2001,15 @@ protected function reportingDimensionValueDeleteRequest($dimension_id, $id, $bus * @param int $dimension_id dimension_id (required) * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionValueApiModel + * @return \OpenAPI\Client\Model\ReportingDimensionValueApiModel */ - public function reportingDimensionValueGet($dimension_id, $id, $business_id) + public function reportingDimensionValueGet($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueGet'][0]) { - list($response) = $this->reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $business_id); + list($response) = $this->reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $business_id, $contentType); return $response; } @@ -1843,15 +2021,15 @@ public function reportingDimensionValueGet($dimension_id, $id, $business_id) * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionValueApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionValueApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $business_id) + public function reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueGet'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel'; - $request = $this->reportingDimensionValueGetRequest($dimension_id, $id, $business_id); + $request = $this->reportingDimensionValueGetRequest($dimension_id, $id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1860,9 +2038,16 @@ public function reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1873,19 +2058,37 @@ public function reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionValueApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1902,7 +2105,7 @@ public function reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $busi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionValueApiModel', + '\OpenAPI\Client\Model\ReportingDimensionValueApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1920,13 +2123,14 @@ public function reportingDimensionValueGetWithHttpInfo($dimension_id, $id, $busi * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValueGetAsync($dimension_id, $id, $business_id) + public function reportingDimensionValueGetAsync($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueGet'][0]) { - return $this->reportingDimensionValueGetAsyncWithHttpInfo($dimension_id, $id, $business_id) + return $this->reportingDimensionValueGetAsyncWithHttpInfo($dimension_id, $id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1942,24 +2146,24 @@ function ($response) { * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValueGetAsyncWithHttpInfo($dimension_id, $id, $business_id) + public function reportingDimensionValueGetAsyncWithHttpInfo($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueGet'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel'; - $request = $this->reportingDimensionValueGetRequest($dimension_id, $id, $business_id); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel'; + $request = $this->reportingDimensionValueGetRequest($dimension_id, $id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1982,7 +2186,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1994,24 +2198,28 @@ function ($exception) { * @param int $dimension_id (required) * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionValueGetRequest($dimension_id, $id, $business_id) + public function reportingDimensionValueGetRequest($dimension_id, $id, $business_id, string $contentType = self::contentTypes['reportingDimensionValueGet'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling reportingDimensionValueGet' ); } + // 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 reportingDimensionValueGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2019,6 +2227,7 @@ protected function reportingDimensionValueGetRequest($dimension_id, $id, $busine ); } + $resourcePath = '/api/v2/business/{businessId}/dimension/{dimensionId}/value/{id}'; $formParams = []; $queryParams = []; @@ -2027,6 +2236,7 @@ protected function reportingDimensionValueGetRequest($dimension_id, $id, $busine $multipart = false; + // path params if ($dimension_id !== null) { $resourcePath = str_replace( @@ -2052,53 +2262,35 @@ protected function reportingDimensionValueGetRequest($dimension_id, $id, $busine ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2119,10 +2311,11 @@ protected function reportingDimensionValueGetRequest($dimension_id, $id, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2135,18 +2328,20 @@ protected function reportingDimensionValueGetRequest($dimension_id, $id, $busine * * @param int $dimension_id dimension_id (required) * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGetDimensionValues'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionValueApiModel[] + * @return \OpenAPI\Client\Model\ReportingDimensionValueApiModel[] */ - public function reportingDimensionValueGetDimensionValues($dimension_id, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionValueGetDimensionValues($dimension_id, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionValueGetDimensionValues'][0]) { - list($response) = $this->reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension_id, $business_id, $filter, $orderby, $top, $skip); + list($response) = $this->reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension_id, $business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -2157,19 +2352,20 @@ public function reportingDimensionValueGetDimensionValues($dimension_id, $busine * * @param int $dimension_id (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGetDimensionValues'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionValueApiModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionValueApiModel[], HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension_id, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension_id, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionValueGetDimensionValues'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel[]'; - $request = $this->reportingDimensionValueGetDimensionValuesRequest($dimension_id, $business_id, $filter, $orderby, $top, $skip); + $request = $this->reportingDimensionValueGetDimensionValuesRequest($dimension_id, $business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -2178,9 +2374,16 @@ public function reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2191,19 +2394,37 @@ public function reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionValueApiModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2220,7 +2441,7 @@ public function reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionValueApiModel[]', + '\OpenAPI\Client\Model\ReportingDimensionValueApiModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2237,17 +2458,19 @@ public function reportingDimensionValueGetDimensionValuesWithHttpInfo($dimension * * @param int $dimension_id (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGetDimensionValues'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValueGetDimensionValuesAsync($dimension_id, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionValueGetDimensionValuesAsync($dimension_id, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionValueGetDimensionValues'][0]) { - return $this->reportingDimensionValueGetDimensionValuesAsyncWithHttpInfo($dimension_id, $business_id, $filter, $orderby, $top, $skip) + return $this->reportingDimensionValueGetDimensionValuesAsyncWithHttpInfo($dimension_id, $business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -2262,28 +2485,29 @@ function ($response) { * * @param int $dimension_id (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGetDimensionValues'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValueGetDimensionValuesAsyncWithHttpInfo($dimension_id, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionValueGetDimensionValuesAsyncWithHttpInfo($dimension_id, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionValueGetDimensionValues'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel[]'; - $request = $this->reportingDimensionValueGetDimensionValuesRequest($dimension_id, $business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel[]'; + $request = $this->reportingDimensionValueGetDimensionValuesRequest($dimension_id, $business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2306,7 +2530,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2317,22 +2541,26 @@ function ($exception) { * * @param int $dimension_id (required) * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValueGetDimensionValues'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionValueGetDimensionValuesRequest($dimension_id, $business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function reportingDimensionValueGetDimensionValuesRequest($dimension_id, $business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['reportingDimensionValueGetDimensionValues'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling reportingDimensionValueGetDimensionValues' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2340,6 +2568,12 @@ protected function reportingDimensionValueGetDimensionValuesRequest($dimension_i ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/dimension/{dimensionId}/value'; $formParams = []; $queryParams = []; @@ -2348,20 +2582,45 @@ protected function reportingDimensionValueGetDimensionValuesRequest($dimension_i $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -2381,53 +2640,35 @@ protected function reportingDimensionValueGetDimensionValuesRequest($dimension_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2448,10 +2689,11 @@ protected function reportingDimensionValueGetDimensionValuesRequest($dimension_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2463,16 +2705,17 @@ protected function reportingDimensionValueGetDimensionValuesRequest($dimension_i * Create Dimension Value * * @param int $dimension_id dimension_id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value dimension_value (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value dimension_value (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionValueApiModel + * @return \OpenAPI\Client\Model\ReportingDimensionValueApiModel */ - public function reportingDimensionValuePost($dimension_id, $dimension_value, $business_id) + public function reportingDimensionValuePost($dimension_id, $business_id, $dimension_value, string $contentType = self::contentTypes['reportingDimensionValuePost'][0]) { - list($response) = $this->reportingDimensionValuePostWithHttpInfo($dimension_id, $dimension_value, $business_id); + list($response) = $this->reportingDimensionValuePostWithHttpInfo($dimension_id, $business_id, $dimension_value, $contentType); return $response; } @@ -2482,17 +2725,17 @@ public function reportingDimensionValuePost($dimension_id, $dimension_value, $bu * Create Dimension Value * * @param int $dimension_id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionValueApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionValueApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionValuePostWithHttpInfo($dimension_id, $dimension_value, $business_id) + public function reportingDimensionValuePostWithHttpInfo($dimension_id, $business_id, $dimension_value, string $contentType = self::contentTypes['reportingDimensionValuePost'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel'; - $request = $this->reportingDimensionValuePostRequest($dimension_id, $dimension_value, $business_id); + $request = $this->reportingDimensionValuePostRequest($dimension_id, $business_id, $dimension_value, $contentType); try { $options = $this->createHttpClientOption(); @@ -2501,9 +2744,16 @@ public function reportingDimensionValuePostWithHttpInfo($dimension_id, $dimensio } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2514,19 +2764,37 @@ public function reportingDimensionValuePostWithHttpInfo($dimension_id, $dimensio sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionValueApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2543,7 +2811,7 @@ public function reportingDimensionValuePostWithHttpInfo($dimension_id, $dimensio case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionValueApiModel', + '\OpenAPI\Client\Model\ReportingDimensionValueApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2559,15 +2827,16 @@ public function reportingDimensionValuePostWithHttpInfo($dimension_id, $dimensio * Create Dimension Value * * @param int $dimension_id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValuePostAsync($dimension_id, $dimension_value, $business_id) + public function reportingDimensionValuePostAsync($dimension_id, $business_id, $dimension_value, string $contentType = self::contentTypes['reportingDimensionValuePost'][0]) { - return $this->reportingDimensionValuePostAsyncWithHttpInfo($dimension_id, $dimension_value, $business_id) + return $this->reportingDimensionValuePostAsyncWithHttpInfo($dimension_id, $business_id, $dimension_value, $contentType) ->then( function ($response) { return $response[0]; @@ -2581,26 +2850,26 @@ function ($response) { * Create Dimension Value * * @param int $dimension_id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValuePostAsyncWithHttpInfo($dimension_id, $dimension_value, $business_id) + public function reportingDimensionValuePostAsyncWithHttpInfo($dimension_id, $business_id, $dimension_value, string $contentType = self::contentTypes['reportingDimensionValuePost'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel'; - $request = $this->reportingDimensionValuePostRequest($dimension_id, $dimension_value, $business_id); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel'; + $request = $this->reportingDimensionValuePostRequest($dimension_id, $business_id, $dimension_value, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2623,7 +2892,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2633,26 +2902,23 @@ function ($exception) { * Create request for operation 'reportingDimensionValuePost' * * @param int $dimension_id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionValuePostRequest($dimension_id, $dimension_value, $business_id) + public function reportingDimensionValuePostRequest($dimension_id, $business_id, $dimension_value, string $contentType = self::contentTypes['reportingDimensionValuePost'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling reportingDimensionValuePost' ); } - // verify the required parameter 'dimension_value' is set - if ($dimension_value === null || (is_array($dimension_value) && count($dimension_value) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dimension_value when calling reportingDimensionValuePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2660,6 +2926,14 @@ protected function reportingDimensionValuePostRequest($dimension_id, $dimension_ ); } + // verify the required parameter 'dimension_value' is set + if ($dimension_value === null || (is_array($dimension_value) && count($dimension_value) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dimension_value when calling reportingDimensionValuePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/dimension/{dimensionId}/value'; $formParams = []; $queryParams = []; @@ -2668,6 +2942,7 @@ protected function reportingDimensionValuePostRequest($dimension_id, $dimension_ $multipart = false; + // path params if ($dimension_id !== null) { $resourcePath = str_replace( @@ -2685,56 +2960,42 @@ protected function reportingDimensionValuePostRequest($dimension_id, $dimension_ ); } - // body params - $_tempBody = null; - if (isset($dimension_value)) { - $_tempBody = $dimension_value; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($dimension_value)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($dimension_value)); + } else { + $httpBody = $dimension_value; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2755,10 +3016,11 @@ protected function reportingDimensionValuePostRequest($dimension_id, $dimension_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2771,16 +3033,17 @@ protected function reportingDimensionValuePostRequest($dimension_id, $dimension_ * * @param int $dimension_id dimension_id (required) * @param int $id id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value_model dimension_value_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value_model dimension_value_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ReportingDimensionValueApiModel + * @return \OpenAPI\Client\Model\ReportingDimensionValueApiModel */ - public function reportingDimensionValuePut($dimension_id, $id, $dimension_value_model, $business_id) + public function reportingDimensionValuePut($dimension_id, $id, $business_id, $dimension_value_model, string $contentType = self::contentTypes['reportingDimensionValuePut'][0]) { - list($response) = $this->reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $dimension_value_model, $business_id); + list($response) = $this->reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $business_id, $dimension_value_model, $contentType); return $response; } @@ -2791,17 +3054,17 @@ public function reportingDimensionValuePut($dimension_id, $id, $dimension_value_ * * @param int $dimension_id (required) * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ReportingDimensionValueApiModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ReportingDimensionValueApiModel, HTTP status code, HTTP response headers (array of strings) */ - public function reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $dimension_value_model, $business_id) + public function reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $business_id, $dimension_value_model, string $contentType = self::contentTypes['reportingDimensionValuePut'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel'; - $request = $this->reportingDimensionValuePutRequest($dimension_id, $id, $dimension_value_model, $business_id); + $request = $this->reportingDimensionValuePutRequest($dimension_id, $id, $business_id, $dimension_value_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2810,9 +3073,16 @@ public function reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $dime } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2823,19 +3093,37 @@ public function reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $dime sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ReportingDimensionValueApiModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ReportingDimensionValueApiModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2852,7 +3140,7 @@ public function reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $dime case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ReportingDimensionValueApiModel', + '\OpenAPI\Client\Model\ReportingDimensionValueApiModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2869,15 +3157,16 @@ public function reportingDimensionValuePutWithHttpInfo($dimension_id, $id, $dime * * @param int $dimension_id (required) * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValuePutAsync($dimension_id, $id, $dimension_value_model, $business_id) + public function reportingDimensionValuePutAsync($dimension_id, $id, $business_id, $dimension_value_model, string $contentType = self::contentTypes['reportingDimensionValuePut'][0]) { - return $this->reportingDimensionValuePutAsyncWithHttpInfo($dimension_id, $id, $dimension_value_model, $business_id) + return $this->reportingDimensionValuePutAsyncWithHttpInfo($dimension_id, $id, $business_id, $dimension_value_model, $contentType) ->then( function ($response) { return $response[0]; @@ -2892,26 +3181,26 @@ function ($response) { * * @param int $dimension_id (required) * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function reportingDimensionValuePutAsyncWithHttpInfo($dimension_id, $id, $dimension_value_model, $business_id) + public function reportingDimensionValuePutAsyncWithHttpInfo($dimension_id, $id, $business_id, $dimension_value_model, string $contentType = self::contentTypes['reportingDimensionValuePut'][0]) { - $returnType = '\Swagger\Client\Model\ReportingDimensionValueApiModel'; - $request = $this->reportingDimensionValuePutRequest($dimension_id, $id, $dimension_value_model, $business_id); + $returnType = '\OpenAPI\Client\Model\ReportingDimensionValueApiModel'; + $request = $this->reportingDimensionValuePutRequest($dimension_id, $id, $business_id, $dimension_value_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -2934,7 +3223,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2945,32 +3234,30 @@ function ($exception) { * * @param int $dimension_id (required) * @param int $id (required) - * @param \Swagger\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ReportingDimensionValueApiModel $dimension_value_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportingDimensionValuePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function reportingDimensionValuePutRequest($dimension_id, $id, $dimension_value_model, $business_id) + public function reportingDimensionValuePutRequest($dimension_id, $id, $business_id, $dimension_value_model, string $contentType = self::contentTypes['reportingDimensionValuePut'][0]) { + // verify the required parameter 'dimension_id' is set if ($dimension_id === null || (is_array($dimension_id) && count($dimension_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $dimension_id when calling reportingDimensionValuePut' ); } + // 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 reportingDimensionValuePut' ); } - // verify the required parameter 'dimension_value_model' is set - if ($dimension_value_model === null || (is_array($dimension_value_model) && count($dimension_value_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $dimension_value_model when calling reportingDimensionValuePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2978,6 +3265,14 @@ protected function reportingDimensionValuePutRequest($dimension_id, $id, $dimens ); } + // verify the required parameter 'dimension_value_model' is set + if ($dimension_value_model === null || (is_array($dimension_value_model) && count($dimension_value_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dimension_value_model when calling reportingDimensionValuePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/dimension/{dimensionId}/value/{id}'; $formParams = []; $queryParams = []; @@ -2986,6 +3281,7 @@ protected function reportingDimensionValuePutRequest($dimension_id, $id, $dimens $multipart = false; + // path params if ($dimension_id !== null) { $resourcePath = str_replace( @@ -3011,56 +3307,42 @@ protected function reportingDimensionValuePutRequest($dimension_id, $id, $dimens ); } - // body params - $_tempBody = null; - if (isset($dimension_value_model)) { - $_tempBody = $dimension_value_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($dimension_value_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($dimension_value_model)); + } else { + $httpBody = $dimension_value_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3081,10 +3363,11 @@ protected function reportingDimensionValuePutRequest($dimension_id, $id, $dimens $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/ResellerApi.php b/src/lib/Api/ResellerApi.php index 535dbe0..53fa698 100644 --- a/src/lib/Api/ResellerApi.php +++ b/src/lib/Api/ResellerApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'resellerGetResellers' => [ + '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 + 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; } /** @@ -93,14 +131,15 @@ public function getConfig() * Get Reseller by ID * * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ResellerModel + * @return \OpenAPI\Client\Model\ResellerModel */ - public function resellerGet($id) + public function resellerGet($id, string $contentType = self::contentTypes['resellerGet'][0]) { - list($response) = $this->resellerGetWithHttpInfo($id); + list($response) = $this->resellerGetWithHttpInfo($id, $contentType); return $response; } @@ -110,15 +149,15 @@ public function resellerGet($id) * Get Reseller by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ResellerModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ResellerModel, HTTP status code, HTTP response headers (array of strings) */ - public function resellerGetWithHttpInfo($id) + public function resellerGetWithHttpInfo($id, string $contentType = self::contentTypes['resellerGet'][0]) { - $returnType = '\Swagger\Client\Model\ResellerModel'; - $request = $this->resellerGetRequest($id); + $request = $this->resellerGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -127,9 +166,16 @@ public function resellerGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -140,19 +186,37 @@ public function resellerGetWithHttpInfo($id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ResellerModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ResellerModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ResellerModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ResellerModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -169,7 +233,7 @@ public function resellerGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ResellerModel', + '\OpenAPI\Client\Model\ResellerModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -185,13 +249,14 @@ public function resellerGetWithHttpInfo($id) * Get Reseller by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function resellerGetAsync($id) + public function resellerGetAsync($id, string $contentType = self::contentTypes['resellerGet'][0]) { - return $this->resellerGetAsyncWithHttpInfo($id) + return $this->resellerGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -205,24 +270,24 @@ function ($response) { * Get Reseller by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function resellerGetAsyncWithHttpInfo($id) + public function resellerGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['resellerGet'][0]) { - $returnType = '\Swagger\Client\Model\ResellerModel'; - $request = $this->resellerGetRequest($id); + $returnType = '\OpenAPI\Client\Model\ResellerModel'; + $request = $this->resellerGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -245,7 +310,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -255,12 +320,14 @@ function ($exception) { * Create request for operation 'resellerGet' * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function resellerGetRequest($id) + public function resellerGetRequest($id, string $contentType = self::contentTypes['resellerGet'][0]) { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( @@ -268,6 +335,7 @@ protected function resellerGetRequest($id) ); } + $resourcePath = '/api/v2/reseller/{id}'; $formParams = []; $queryParams = []; @@ -276,6 +344,7 @@ protected function resellerGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -285,53 +354,35 @@ protected function resellerGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -352,10 +403,11 @@ protected function resellerGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -366,14 +418,15 @@ protected function resellerGetRequest($id) * * List Resellers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGetResellers'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\ResellerModel[] + * @return \OpenAPI\Client\Model\ResellerModel[] */ - public function resellerGetResellers() + public function resellerGetResellers(string $contentType = self::contentTypes['resellerGetResellers'][0]) { - list($response) = $this->resellerGetResellersWithHttpInfo(); + list($response) = $this->resellerGetResellersWithHttpInfo($contentType); return $response; } @@ -382,15 +435,15 @@ public function resellerGetResellers() * * List Resellers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGetResellers'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\ResellerModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ResellerModel[], HTTP status code, HTTP response headers (array of strings) */ - public function resellerGetResellersWithHttpInfo() + public function resellerGetResellersWithHttpInfo(string $contentType = self::contentTypes['resellerGetResellers'][0]) { - $returnType = '\Swagger\Client\Model\ResellerModel[]'; - $request = $this->resellerGetResellersRequest(); + $request = $this->resellerGetResellersRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -399,9 +452,16 @@ public function resellerGetResellersWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -412,19 +472,37 @@ public function resellerGetResellersWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ResellerModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ResellerModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ResellerModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ResellerModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -441,7 +519,7 @@ public function resellerGetResellersWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\ResellerModel[]', + '\OpenAPI\Client\Model\ResellerModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -456,13 +534,14 @@ public function resellerGetResellersWithHttpInfo() * * List Resellers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGetResellers'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function resellerGetResellersAsync() + public function resellerGetResellersAsync(string $contentType = self::contentTypes['resellerGetResellers'][0]) { - return $this->resellerGetResellersAsyncWithHttpInfo() + return $this->resellerGetResellersAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -475,24 +554,24 @@ function ($response) { * * List Resellers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGetResellers'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function resellerGetResellersAsyncWithHttpInfo() + public function resellerGetResellersAsyncWithHttpInfo(string $contentType = self::contentTypes['resellerGetResellers'][0]) { - $returnType = '\Swagger\Client\Model\ResellerModel[]'; - $request = $this->resellerGetResellersRequest(); + $returnType = '\OpenAPI\Client\Model\ResellerModel[]'; + $request = $this->resellerGetResellersRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -515,7 +594,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -524,13 +603,15 @@ function ($exception) { /** * Create request for operation 'resellerGetResellers' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resellerGetResellers'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function resellerGetResellersRequest() + public function resellerGetResellersRequest(string $contentType = self::contentTypes['resellerGetResellers'][0]) { + $resourcePath = '/api/v2/reseller'; $formParams = []; $queryParams = []; @@ -540,53 +621,36 @@ protected function resellerGetResellersRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -607,10 +671,11 @@ protected function resellerGetResellersRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/RosterShiftApi.php b/src/lib/Api/RosterShiftApi.php index a034d29..cf064cc 100644 --- a/src/lib/Api/RosterShiftApi.php +++ b/src/lib/Api/RosterShiftApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auRosterShiftMatchingClockOffRosterShift' => [ + 'application/json', + ], + 'auRosterShiftMatchingClockOnRosterShift' => [ + 'application/json', + ], + 'auRosterShiftNearbyRosterShifts' => [ + 'application/json', + ], + 'auRosterShiftPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auRosterShiftPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auRosterShiftStubShiftTimesheets' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -93,30 +158,31 @@ public function getConfig() * Get Roster Shifts * * @param string $business_id business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param string $filter_shift_status filter_shift_status (optional) + * @param string[] $filter_shift_statuses filter_shift_statuses (optional) + * @param string[] $filter_selected_locations filter_selected_locations (optional) + * @param string[] $filter_selected_employees filter_selected_employees (optional) + * @param string[] $filter_selected_roles filter_selected_roles (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param int $filter_location_id filter_location_id (optional) + * @param int $filter_employee_group_id filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size filter_page_size (optional) + * @param int $filter_current_page filter_current_page (optional) + * @param bool $filter_include_warnings filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[] + * @return \OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[] */ - public function auRosterShiftGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auRosterShiftGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auRosterShiftGet'][0]) { - list($response) = $this->auRosterShiftGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings); + list($response) = $this->auRosterShiftGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType); return $response; } @@ -126,31 +192,31 @@ public function auRosterShiftGet($business_id, $filter_from_date = null, $filter * Get Roster Shifts * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) - * - * @throws \Swagger\Client\ApiException on non-2xx response + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auRosterShiftGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auRosterShiftGet'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; - $request = $this->auRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings); + $request = $this->auRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType); try { $options = $this->createHttpClientOption(); @@ -159,9 +225,16 @@ public function auRosterShiftGetWithHttpInfo($business_id, $filter_from_date = n } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -172,19 +245,37 @@ public function auRosterShiftGetWithHttpInfo($business_id, $filter_from_date = n sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -201,7 +292,7 @@ public function auRosterShiftGetWithHttpInfo($business_id, $filter_from_date = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[]', + '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -217,29 +308,30 @@ public function auRosterShiftGetWithHttpInfo($business_id, $filter_from_date = n * Get Roster Shifts * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auRosterShiftGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auRosterShiftGet'][0]) { - return $this->auRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings) + return $this->auRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType) ->then( function ($response) { return $response[0]; @@ -253,40 +345,40 @@ function ($response) { * Get Roster Shifts * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auRosterShiftGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auRosterShiftGet'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; - $request = $this->auRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftGenerateTimesheetModel[]'; + $request = $this->auRosterShiftGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_shift_status, $filter_shift_statuses, $filter_selected_locations, $filter_selected_employees, $filter_selected_roles, $filter_employee_id, $filter_location_id, $filter_employee_group_id, $filter_unassigned_shifts_only, $filter_select_all_roles, $filter_exclude_shifts_overlapping_from_date, $filter_page_size, $filter_current_page, $filter_include_warnings, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -309,7 +401,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -319,28 +411,30 @@ function ($exception) { * Create request for operation 'auRosterShiftGet' * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param string $filter_shift_status (optional) - * @param string[] $filter_shift_statuses (optional) - * @param string[] $filter_selected_locations (optional) - * @param string[] $filter_selected_employees (optional) - * @param string[] $filter_selected_roles (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_location_id (optional) - * @param int $filter_employee_group_id (optional) - * @param bool $filter_unassigned_shifts_only (optional) - * @param bool $filter_select_all_roles (optional) - * @param bool $filter_exclude_shifts_overlapping_from_date (optional) - * @param int $filter_page_size (optional) - * @param int $filter_current_page (optional) - * @param bool $filter_include_warnings (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param string $filter_shift_status (optional) + * @param string[] $filter_shift_statuses (optional) + * @param string[] $filter_selected_locations (optional) + * @param string[] $filter_selected_employees (optional) + * @param string[] $filter_selected_roles (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_location_id (optional) + * @param int $filter_employee_group_id (optional) + * @param bool $filter_unassigned_shifts_only (optional) + * @param bool $filter_select_all_roles (optional) + * @param bool $filter_exclude_shifts_overlapping_from_date (optional) + * @param int $filter_page_size (optional) + * @param int $filter_current_page (optional) + * @param bool $filter_include_warnings (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null) + public function auRosterShiftGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_shift_status = null, $filter_shift_statuses = null, $filter_selected_locations = null, $filter_selected_employees = null, $filter_selected_roles = null, $filter_employee_id = null, $filter_location_id = null, $filter_employee_group_id = null, $filter_unassigned_shifts_only = null, $filter_select_all_roles = null, $filter_exclude_shifts_overlapping_from_date = null, $filter_page_size = null, $filter_current_page = null, $filter_include_warnings = null, string $contentType = self::contentTypes['auRosterShiftGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -348,6 +442,23 @@ protected function auRosterShiftGetRequest($business_id, $filter_from_date = nul ); } + + + + + + + + + + + + + + + + + $resourcePath = '/api/v2/business/{businessId}/rostershift'; $formParams = []; $queryParams = []; @@ -356,81 +467,150 @@ protected function auRosterShiftGetRequest($business_id, $filter_from_date = nul $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_shift_status !== null) { - $queryParams['filter.shiftStatus'] = ObjectSerializer::toQueryValue($filter_shift_status); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_shift_status, + 'filter.shiftStatus', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if (is_array($filter_shift_statuses)) { - $queryParams['filter.shiftStatuses'] = $filter_shift_statuses; - } else - if ($filter_shift_statuses !== null) { - $queryParams['filter.shiftStatuses'] = ObjectSerializer::toQueryValue($filter_shift_statuses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_shift_statuses, + 'filter.shiftStatuses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($filter_selected_locations)) { - $queryParams['filter.selectedLocations'] = $filter_selected_locations; - } else - if ($filter_selected_locations !== null) { - $queryParams['filter.selectedLocations'] = ObjectSerializer::toQueryValue($filter_selected_locations); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_selected_locations, + 'filter.selectedLocations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($filter_selected_employees)) { - $queryParams['filter.selectedEmployees'] = $filter_selected_employees; - } else - if ($filter_selected_employees !== null) { - $queryParams['filter.selectedEmployees'] = ObjectSerializer::toQueryValue($filter_selected_employees); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_selected_employees, + 'filter.selectedEmployees', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if (is_array($filter_selected_roles)) { - $queryParams['filter.selectedRoles'] = $filter_selected_roles; - } else - if ($filter_selected_roles !== null) { - $queryParams['filter.selectedRoles'] = ObjectSerializer::toQueryValue($filter_selected_roles); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_selected_roles, + 'filter.selectedRoles', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_location_id !== null) { - $queryParams['filter.locationId'] = ObjectSerializer::toQueryValue($filter_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_location_id, + 'filter.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_group_id !== null) { - $queryParams['filter.employeeGroupId'] = ObjectSerializer::toQueryValue($filter_employee_group_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_group_id, + 'filter.employeeGroupId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_unassigned_shifts_only !== null) { - $queryParams['filter.unassignedShiftsOnly'] = ObjectSerializer::toQueryValue($filter_unassigned_shifts_only); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_unassigned_shifts_only, + 'filter.unassignedShiftsOnly', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_select_all_roles !== null) { - $queryParams['filter.selectAllRoles'] = ObjectSerializer::toQueryValue($filter_select_all_roles); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_select_all_roles, + 'filter.selectAllRoles', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_exclude_shifts_overlapping_from_date !== null) { - $queryParams['filter.excludeShiftsOverlappingFromDate'] = ObjectSerializer::toQueryValue($filter_exclude_shifts_overlapping_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_exclude_shifts_overlapping_from_date, + 'filter.excludeShiftsOverlappingFromDate', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_page_size !== null) { - $queryParams['filter.pageSize'] = ObjectSerializer::toQueryValue($filter_page_size); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_page_size, + 'filter.pageSize', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_current_page !== null) { - $queryParams['filter.currentPage'] = ObjectSerializer::toQueryValue($filter_current_page); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_current_page, + 'filter.currentPage', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_include_warnings !== null) { - $queryParams['filter.includeWarnings'] = ObjectSerializer::toQueryValue($filter_include_warnings); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_include_warnings, + 'filter.includeWarnings', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -441,53 +621,35 @@ protected function auRosterShiftGetRequest($business_id, $filter_from_date = nul ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -508,10 +670,11 @@ protected function auRosterShiftGetRequest($business_id, $filter_from_date = nul $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -526,14 +689,15 @@ protected function auRosterShiftGetRequest($business_id, $filter_from_date = nul * @param int $kiosk_id kiosk_id (required) * @param \DateTime $date_utc date_utc (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftMatchingResultModel + * @return \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel */ - public function auRosterShiftMatchingClockOffRosterShift($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOffRosterShift($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOffRosterShift'][0]) { - list($response) = $this->auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id); + list($response) = $this->auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $response; } @@ -546,15 +710,15 @@ public function auRosterShiftMatchingClockOffRosterShift($employee_id, $kiosk_id * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOffRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $request = $this->auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -563,9 +727,16 @@ public function auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -576,19 +747,37 @@ public function auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -605,7 +794,7 @@ public function auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftMatchingResultModel', + '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -624,13 +813,14 @@ public function auRosterShiftMatchingClockOffRosterShiftWithHttpInfo($employee_i * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftMatchingClockOffRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOffRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOffRosterShift'][0]) { - return $this->auRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + return $this->auRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -647,24 +837,24 @@ function ($response) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOffRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOffRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; + $request = $this->auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -687,7 +877,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -700,30 +890,35 @@ function ($exception) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOffRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOffRosterShift'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auRosterShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling auRosterShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'date_utc' is set if ($date_utc === null || (is_array($date_utc) && count($date_utc) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $date_utc when calling auRosterShiftMatchingClockOffRosterShift' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -731,6 +926,7 @@ protected function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, ); } + $resourcePath = '/api/v2/business/{businessId}/rostershift/{employeeId}/matchingclockoff'; $formParams = []; $queryParams = []; @@ -739,13 +935,24 @@ protected function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $multipart = false; // query params - if ($kiosk_id !== null) { - $queryParams['kioskId'] = ObjectSerializer::toQueryValue($kiosk_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $kiosk_id, + 'kioskId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($date_utc !== null) { - $queryParams['dateUtc'] = ObjectSerializer::toQueryValue($date_utc); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $date_utc, + 'dateUtc', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -764,53 +971,35 @@ protected function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -831,10 +1020,11 @@ protected function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -849,14 +1039,15 @@ protected function auRosterShiftMatchingClockOffRosterShiftRequest($employee_id, * @param int $kiosk_id kiosk_id (required) * @param \DateTime $date_utc date_utc (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuRosterShiftMatchingResultModel + * @return \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel */ - public function auRosterShiftMatchingClockOnRosterShift($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOnRosterShift($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOnRosterShift'][0]) { - list($response) = $this->auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id); + list($response) = $this->auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $response; } @@ -869,15 +1060,15 @@ public function auRosterShiftMatchingClockOnRosterShift($employee_id, $kiosk_id, * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuRosterShiftMatchingResultModel, HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOnRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $request = $this->auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -886,9 +1077,16 @@ public function auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -899,19 +1097,37 @@ public function auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -928,7 +1144,7 @@ public function auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuRosterShiftMatchingResultModel', + '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -947,13 +1163,14 @@ public function auRosterShiftMatchingClockOnRosterShiftWithHttpInfo($employee_id * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftMatchingClockOnRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOnRosterShiftAsync($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOnRosterShift'][0]) { - return $this->auRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + return $this->auRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -970,24 +1187,24 @@ function ($response) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOnRosterShiftAsyncWithHttpInfo($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOnRosterShift'][0]) { - $returnType = '\Swagger\Client\Model\AuRosterShiftMatchingResultModel'; - $request = $this->auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id); + $returnType = '\OpenAPI\Client\Model\AuRosterShiftMatchingResultModel'; + $request = $this->auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1010,7 +1227,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1023,30 +1240,35 @@ function ($exception) { * @param int $kiosk_id (required) * @param \DateTime $date_utc (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftMatchingClockOnRosterShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id) + public function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $kiosk_id, $date_utc, $business_id, string $contentType = self::contentTypes['auRosterShiftMatchingClockOnRosterShift'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auRosterShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling auRosterShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'date_utc' is set if ($date_utc === null || (is_array($date_utc) && count($date_utc) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $date_utc when calling auRosterShiftMatchingClockOnRosterShift' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1054,6 +1276,7 @@ protected function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, ); } + $resourcePath = '/api/v2/business/{businessId}/rostershift/{employeeId}/matchingclockon'; $formParams = []; $queryParams = []; @@ -1062,13 +1285,24 @@ protected function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $multipart = false; // query params - if ($kiosk_id !== null) { - $queryParams['kioskId'] = ObjectSerializer::toQueryValue($kiosk_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $kiosk_id, + 'kioskId', // param base name + 'integer', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($date_utc !== null) { - $queryParams['dateUtc'] = ObjectSerializer::toQueryValue($date_utc); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $date_utc, + 'dateUtc', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -1087,53 +1321,35 @@ protected function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1154,10 +1370,11 @@ protected function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1171,14 +1388,15 @@ protected function auRosterShiftMatchingClockOnRosterShiftRequest($employee_id, * @param int $employee_id employee_id (required) * @param \DateTime $local_time local_time (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftNearbyRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[] */ - public function auRosterShiftNearbyRosterShifts($employee_id, $local_time, $business_id) + public function auRosterShiftNearbyRosterShifts($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auRosterShiftNearbyRosterShifts'][0]) { - list($response) = $this->auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id); + list($response) = $this->auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id, $contentType); return $response; } @@ -1190,15 +1408,15 @@ public function auRosterShiftNearbyRosterShifts($employee_id, $local_time, $busi * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftNearbyRosterShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuEssRosterShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id) + public function auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auRosterShiftNearbyRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id); + $request = $this->auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1207,9 +1425,16 @@ public function auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1220,19 +1445,37 @@ public function auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuEssRosterShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1249,7 +1492,7 @@ public function auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuEssRosterShiftModel[]', + '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1267,13 +1510,14 @@ public function auRosterShiftNearbyRosterShiftsWithHttpInfo($employee_id, $local * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftNearbyRosterShiftsAsync($employee_id, $local_time, $business_id) + public function auRosterShiftNearbyRosterShiftsAsync($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auRosterShiftNearbyRosterShifts'][0]) { - return $this->auRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id) + return $this->auRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1289,24 +1533,24 @@ function ($response) { * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id) + public function auRosterShiftNearbyRosterShiftsAsyncWithHttpInfo($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auRosterShiftNearbyRosterShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuEssRosterShiftModel[]'; - $request = $this->auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id); + $returnType = '\OpenAPI\Client\Model\AuEssRosterShiftModel[]'; + $request = $this->auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1329,7 +1573,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1341,24 +1585,28 @@ function ($exception) { * @param int $employee_id (required) * @param \DateTime $local_time (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftNearbyRosterShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id) + public function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_time, $business_id, string $contentType = self::contentTypes['auRosterShiftNearbyRosterShifts'][0]) { + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auRosterShiftNearbyRosterShifts' ); } + // verify the required parameter 'local_time' is set if ($local_time === null || (is_array($local_time) && count($local_time) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $local_time when calling auRosterShiftNearbyRosterShifts' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1366,6 +1614,7 @@ protected function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_t ); } + $resourcePath = '/api/v2/business/{businessId}/rostershift/{employeeId}/nearby'; $formParams = []; $queryParams = []; @@ -1374,9 +1623,15 @@ protected function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_t $multipart = false; // query params - if ($local_time !== null) { - $queryParams['localTime'] = ObjectSerializer::toQueryValue($local_time); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $local_time, + 'localTime', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($employee_id !== null) { @@ -1395,53 +1650,35 @@ protected function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_t ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1462,10 +1699,11 @@ protected function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_t $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1476,17 +1714,18 @@ protected function auRosterShiftNearbyRosterShiftsRequest($employee_id, $local_t * * Create roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model shift_model (required) * @param bool $publish publish (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auRosterShiftPost($shift_model, $publish, $business_id) + public function auRosterShiftPost($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPost'][0]) { - $this->auRosterShiftPostWithHttpInfo($shift_model, $publish, $business_id); + $this->auRosterShiftPostWithHttpInfo($publish, $business_id, $shift_model, $contentType); } /** @@ -1494,18 +1733,18 @@ public function auRosterShiftPost($shift_model, $publish, $business_id) * * Create roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftPostWithHttpInfo($shift_model, $publish, $business_id) + public function auRosterShiftPostWithHttpInfo($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPost'][0]) { - $returnType = ''; - $request = $this->auRosterShiftPostRequest($shift_model, $publish, $business_id); + $request = $this->auRosterShiftPostRequest($publish, $business_id, $shift_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1514,9 +1753,16 @@ public function auRosterShiftPostWithHttpInfo($shift_model, $publish, $business_ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1527,11 +1773,11 @@ public function auRosterShiftPostWithHttpInfo($shift_model, $publish, $business_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1549,16 +1795,17 @@ public function auRosterShiftPostWithHttpInfo($shift_model, $publish, $business_ * * Create roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftPostAsync($shift_model, $publish, $business_id) + public function auRosterShiftPostAsync($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPost'][0]) { - return $this->auRosterShiftPostAsyncWithHttpInfo($shift_model, $publish, $business_id) + return $this->auRosterShiftPostAsyncWithHttpInfo($publish, $business_id, $shift_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1571,17 +1818,18 @@ function ($response) { * * Create roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftPostAsyncWithHttpInfo($shift_model, $publish, $business_id) + public function auRosterShiftPostAsyncWithHttpInfo($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPost'][0]) { $returnType = ''; - $request = $this->auRosterShiftPostRequest($shift_model, $publish, $business_id); + $request = $this->auRosterShiftPostRequest($publish, $business_id, $shift_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1600,7 +1848,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1609,27 +1857,24 @@ function ($exception) { /** * Create request for operation 'auRosterShiftPost' * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftPostRequest($shift_model, $publish, $business_id) + public function auRosterShiftPostRequest($publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPost'][0]) { - // verify the required parameter 'shift_model' is set - if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $shift_model when calling auRosterShiftPost' - ); - } + // verify the required parameter 'publish' is set if ($publish === null || (is_array($publish) && count($publish) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $publish when calling auRosterShiftPost' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1637,6 +1882,14 @@ protected function auRosterShiftPostRequest($shift_model, $publish, $business_id ); } + // verify the required parameter 'shift_model' is set + if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $shift_model when calling auRosterShiftPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/rostershift'; $formParams = []; $queryParams = []; @@ -1645,9 +1898,15 @@ protected function auRosterShiftPostRequest($shift_model, $publish, $business_id $multipart = false; // query params - if ($publish !== null) { - $queryParams['publish'] = ObjectSerializer::toQueryValue($publish); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $publish, + 'publish', // param base name + 'boolean', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1658,56 +1917,42 @@ protected function auRosterShiftPostRequest($shift_model, $publish, $business_id ); } - // body params - $_tempBody = null; - if (isset($shift_model)) { - $_tempBody = $shift_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($shift_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shift_model)); + } else { + $httpBody = $shift_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1728,10 +1973,11 @@ protected function auRosterShiftPostRequest($shift_model, $publish, $business_id $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1742,18 +1988,19 @@ protected function auRosterShiftPostRequest($shift_model, $publish, $business_id * * Update roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model shift_model (required) * @param int $roster_shift_id roster_shift_id (required) * @param bool $publish publish (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auRosterShiftPut($shift_model, $roster_shift_id, $publish, $business_id) + public function auRosterShiftPut($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPut'][0]) { - $this->auRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id); + $this->auRosterShiftPutWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, $contentType); } /** @@ -1761,19 +2008,19 @@ public function auRosterShiftPut($shift_model, $roster_shift_id, $publish, $busi * * Update roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id) + public function auRosterShiftPutWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPut'][0]) { - $returnType = ''; - $request = $this->auRosterShiftPutRequest($shift_model, $roster_shift_id, $publish, $business_id); + $request = $this->auRosterShiftPutRequest($roster_shift_id, $publish, $business_id, $shift_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1782,9 +2029,16 @@ public function auRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $pu } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1795,11 +2049,11 @@ public function auRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $pu sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1817,17 +2071,18 @@ public function auRosterShiftPutWithHttpInfo($shift_model, $roster_shift_id, $pu * * Update roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftPutAsync($shift_model, $roster_shift_id, $publish, $business_id) + public function auRosterShiftPutAsync($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPut'][0]) { - return $this->auRosterShiftPutAsyncWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id) + return $this->auRosterShiftPutAsyncWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1840,18 +2095,19 @@ function ($response) { * * Update roster shift * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftPutAsyncWithHttpInfo($shift_model, $roster_shift_id, $publish, $business_id) + public function auRosterShiftPutAsyncWithHttpInfo($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPut'][0]) { $returnType = ''; - $request = $this->auRosterShiftPutRequest($shift_model, $roster_shift_id, $publish, $business_id); + $request = $this->auRosterShiftPutRequest($roster_shift_id, $publish, $business_id, $shift_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1870,7 +2126,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1879,34 +2135,32 @@ function ($exception) { /** * Create request for operation 'auRosterShiftPut' * - * @param \Swagger\Client\Model\AuRosterShiftEditModel $shift_model (required) * @param int $roster_shift_id (required) * @param bool $publish (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuRosterShiftEditModel $shift_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftPutRequest($shift_model, $roster_shift_id, $publish, $business_id) + public function auRosterShiftPutRequest($roster_shift_id, $publish, $business_id, $shift_model, string $contentType = self::contentTypes['auRosterShiftPut'][0]) { - // verify the required parameter 'shift_model' is set - if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $shift_model when calling auRosterShiftPut' - ); - } + // verify the required parameter 'roster_shift_id' is set if ($roster_shift_id === null || (is_array($roster_shift_id) && count($roster_shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $roster_shift_id when calling auRosterShiftPut' ); } + // verify the required parameter 'publish' is set if ($publish === null || (is_array($publish) && count($publish) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $publish when calling auRosterShiftPut' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1914,6 +2168,14 @@ protected function auRosterShiftPutRequest($shift_model, $roster_shift_id, $publ ); } + // verify the required parameter 'shift_model' is set + if ($shift_model === null || (is_array($shift_model) && count($shift_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $shift_model when calling auRosterShiftPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/rostershift/{rosterShiftId}'; $formParams = []; $queryParams = []; @@ -1922,9 +2184,15 @@ protected function auRosterShiftPutRequest($shift_model, $roster_shift_id, $publ $multipart = false; // query params - if ($publish !== null) { - $queryParams['publish'] = ObjectSerializer::toQueryValue($publish); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $publish, + 'publish', // param base name + 'boolean', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($roster_shift_id !== null) { @@ -1943,56 +2211,42 @@ protected function auRosterShiftPutRequest($shift_model, $roster_shift_id, $publ ); } - // body params - $_tempBody = null; - if (isset($shift_model)) { - $_tempBody = $shift_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($shift_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($shift_model)); + } else { + $httpBody = $shift_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2013,10 +2267,11 @@ protected function auRosterShiftPutRequest($shift_model, $roster_shift_id, $publ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2028,16 +2283,17 @@ protected function auRosterShiftPutRequest($shift_model, $roster_shift_id, $publ * Stub Shift Timesheets * * @param int $roster_shift_id roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftStubShiftTimesheets'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auRosterShiftStubShiftTimesheets($roster_shift_id, $model, $business_id) + public function auRosterShiftStubShiftTimesheets($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auRosterShiftStubShiftTimesheets'][0]) { - $this->auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $model, $business_id); + $this->auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $business_id, $model, $contentType); } /** @@ -2046,17 +2302,17 @@ public function auRosterShiftStubShiftTimesheets($roster_shift_id, $model, $busi * Stub Shift Timesheets * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftStubShiftTimesheets'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $model, $business_id) + public function auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auRosterShiftStubShiftTimesheets'][0]) { - $returnType = ''; - $request = $this->auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $model, $business_id); + $request = $this->auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2065,9 +2321,16 @@ public function auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2078,11 +2341,11 @@ public function auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2101,15 +2364,16 @@ public function auRosterShiftStubShiftTimesheetsWithHttpInfo($roster_shift_id, $ * Stub Shift Timesheets * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftStubShiftTimesheets'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftStubShiftTimesheetsAsync($roster_shift_id, $model, $business_id) + public function auRosterShiftStubShiftTimesheetsAsync($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auRosterShiftStubShiftTimesheets'][0]) { - return $this->auRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $model, $business_id) + return $this->auRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2123,16 +2387,17 @@ function ($response) { * Stub Shift Timesheets * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftStubShiftTimesheets'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $model, $business_id) + public function auRosterShiftStubShiftTimesheetsAsyncWithHttpInfo($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auRosterShiftStubShiftTimesheets'][0]) { $returnType = ''; - $request = $this->auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $model, $business_id); + $request = $this->auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2151,7 +2416,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2161,26 +2426,23 @@ function ($exception) { * Create request for operation 'auRosterShiftStubShiftTimesheets' * * @param int $roster_shift_id (required) - * @param \Swagger\Client\Model\StubRosterShiftViewModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StubRosterShiftViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auRosterShiftStubShiftTimesheets'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $model, $business_id) + public function auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $business_id, $model, string $contentType = self::contentTypes['auRosterShiftStubShiftTimesheets'][0]) { + // verify the required parameter 'roster_shift_id' is set if ($roster_shift_id === null || (is_array($roster_shift_id) && count($roster_shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $roster_shift_id when calling auRosterShiftStubShiftTimesheets' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auRosterShiftStubShiftTimesheets' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2188,6 +2450,14 @@ protected function auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $mo ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auRosterShiftStubShiftTimesheets' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/rostershift/{rosterShiftId}/stub'; $formParams = []; $queryParams = []; @@ -2196,6 +2466,7 @@ protected function auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $mo $multipart = false; + // path params if ($roster_shift_id !== null) { $resourcePath = str_replace( @@ -2213,56 +2484,42 @@ protected function auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $mo ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2283,10 +2540,11 @@ protected function auRosterShiftStubShiftTimesheetsRequest($roster_shift_id, $mo $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/SuperFundApi.php b/src/lib/Api/SuperFundApi.php index 24cfe27..d97460c 100644 --- a/src/lib/Api/SuperFundApi.php +++ b/src/lib/Api/SuperFundApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auSelfManagedSuperFundGetFunds' => [ + 'application/json', + ], + 'auSelfManagedSuperFundPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auSelfManagedSuperFundPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auSuperFundElectronicServiceAddressIndex' => [ + 'application/json', + ], + 'auSuperFundProductSearch' => [ + '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 + 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; } /** @@ -94,14 +152,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SelfManagedSuperFundModel + * @return \OpenAPI\Client\Model\SelfManagedSuperFundModel */ - public function auSelfManagedSuperFundGet($id, $business_id) + public function auSelfManagedSuperFundGet($id, $business_id, string $contentType = self::contentTypes['auSelfManagedSuperFundGet'][0]) { - list($response) = $this->auSelfManagedSuperFundGetWithHttpInfo($id, $business_id); + list($response) = $this->auSelfManagedSuperFundGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -112,15 +171,15 @@ public function auSelfManagedSuperFundGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SelfManagedSuperFundModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SelfManagedSuperFundModel, HTTP status code, HTTP response headers (array of strings) */ - public function auSelfManagedSuperFundGetWithHttpInfo($id, $business_id) + public function auSelfManagedSuperFundGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auSelfManagedSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel'; - $request = $this->auSelfManagedSuperFundGetRequest($id, $business_id); + $request = $this->auSelfManagedSuperFundGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,9 +188,16 @@ public function auSelfManagedSuperFundGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -142,19 +208,37 @@ public function auSelfManagedSuperFundGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SelfManagedSuperFundModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -171,7 +255,7 @@ public function auSelfManagedSuperFundGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SelfManagedSuperFundModel', + '\OpenAPI\Client\Model\SelfManagedSuperFundModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -188,13 +272,14 @@ public function auSelfManagedSuperFundGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundGetAsync($id, $business_id) + public function auSelfManagedSuperFundGetAsync($id, $business_id, string $contentType = self::contentTypes['auSelfManagedSuperFundGet'][0]) { - return $this->auSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id) + return $this->auSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -209,24 +294,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id) + public function auSelfManagedSuperFundGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auSelfManagedSuperFundGet'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel'; - $request = $this->auSelfManagedSuperFundGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel'; + $request = $this->auSelfManagedSuperFundGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -249,7 +334,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -260,18 +345,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSelfManagedSuperFundGetRequest($id, $business_id) + public function auSelfManagedSuperFundGetRequest($id, $business_id, string $contentType = self::contentTypes['auSelfManagedSuperFundGet'][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 auSelfManagedSuperFundGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -279,6 +367,7 @@ protected function auSelfManagedSuperFundGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/selfmanagedsuperfund/{id}'; $formParams = []; $queryParams = []; @@ -287,6 +376,7 @@ protected function auSelfManagedSuperFundGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -304,53 +394,35 @@ protected function auSelfManagedSuperFundGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -371,10 +443,11 @@ protected function auSelfManagedSuperFundGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -386,18 +459,20 @@ protected function auSelfManagedSuperFundGetRequest($id, $business_id) * List Self Managed Super Funds * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGetFunds'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SelfManagedSuperFundModel[] + * @return \OpenAPI\Client\Model\SelfManagedSuperFundModel[] */ - public function auSelfManagedSuperFundGetFunds($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auSelfManagedSuperFundGetFunds($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auSelfManagedSuperFundGetFunds'][0]) { - list($response) = $this->auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -407,19 +482,20 @@ public function auSelfManagedSuperFundGetFunds($business_id, $filter = null, $or * List Self Managed Super Funds * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGetFunds'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SelfManagedSuperFundModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SelfManagedSuperFundModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auSelfManagedSuperFundGetFunds'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel[]'; - $request = $this->auSelfManagedSuperFundGetFundsRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auSelfManagedSuperFundGetFundsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -428,9 +504,16 @@ public function auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $filter } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -441,19 +524,37 @@ public function auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $filter sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SelfManagedSuperFundModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -470,7 +571,7 @@ public function auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $filter case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SelfManagedSuperFundModel[]', + '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -486,17 +587,19 @@ public function auSelfManagedSuperFundGetFundsWithHttpInfo($business_id, $filter * List Self Managed Super Funds * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundGetFundsAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auSelfManagedSuperFundGetFundsAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auSelfManagedSuperFundGetFunds'][0]) { - return $this->auSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -510,28 +613,29 @@ function ($response) { * List Self Managed Super Funds * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auSelfManagedSuperFundGetFundsAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auSelfManagedSuperFundGetFunds'][0]) { - $returnType = '\Swagger\Client\Model\SelfManagedSuperFundModel[]'; - $request = $this->auSelfManagedSuperFundGetFundsRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\SelfManagedSuperFundModel[]'; + $request = $this->auSelfManagedSuperFundGetFundsRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -554,7 +658,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -564,16 +668,19 @@ function ($exception) { * Create request for operation 'auSelfManagedSuperFundGetFunds' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundGetFunds'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSelfManagedSuperFundGetFundsRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auSelfManagedSuperFundGetFundsRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auSelfManagedSuperFundGetFunds'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -581,6 +688,12 @@ protected function auSelfManagedSuperFundGetFundsRequest($business_id, $filter = ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/selfmanagedsuperfund'; $formParams = []; $queryParams = []; @@ -589,20 +702,45 @@ protected function auSelfManagedSuperFundGetFundsRequest($business_id, $filter = $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -614,53 +752,35 @@ protected function auSelfManagedSuperFundGetFundsRequest($business_id, $filter = ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -681,10 +801,11 @@ protected function auSelfManagedSuperFundGetFundsRequest($business_id, $filter = $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -695,16 +816,17 @@ protected function auSelfManagedSuperFundGetFundsRequest($business_id, $filter = * * Create Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund fund (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auSelfManagedSuperFundPost($fund, $business_id) + public function auSelfManagedSuperFundPost($business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPost'][0]) { - $this->auSelfManagedSuperFundPostWithHttpInfo($fund, $business_id); + $this->auSelfManagedSuperFundPostWithHttpInfo($business_id, $fund, $contentType); } /** @@ -712,17 +834,17 @@ public function auSelfManagedSuperFundPost($fund, $business_id) * * Create Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auSelfManagedSuperFundPostWithHttpInfo($fund, $business_id) + public function auSelfManagedSuperFundPostWithHttpInfo($business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPost'][0]) { - $returnType = ''; - $request = $this->auSelfManagedSuperFundPostRequest($fund, $business_id); + $request = $this->auSelfManagedSuperFundPostRequest($business_id, $fund, $contentType); try { $options = $this->createHttpClientOption(); @@ -731,9 +853,16 @@ public function auSelfManagedSuperFundPostWithHttpInfo($fund, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -744,11 +873,11 @@ public function auSelfManagedSuperFundPostWithHttpInfo($fund, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -766,15 +895,16 @@ public function auSelfManagedSuperFundPostWithHttpInfo($fund, $business_id) * * Create Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundPostAsync($fund, $business_id) + public function auSelfManagedSuperFundPostAsync($business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPost'][0]) { - return $this->auSelfManagedSuperFundPostAsyncWithHttpInfo($fund, $business_id) + return $this->auSelfManagedSuperFundPostAsyncWithHttpInfo($business_id, $fund, $contentType) ->then( function ($response) { return $response[0]; @@ -787,16 +917,17 @@ function ($response) { * * Create Self Managed Super Fund * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundPostAsyncWithHttpInfo($fund, $business_id) + public function auSelfManagedSuperFundPostAsyncWithHttpInfo($business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPost'][0]) { $returnType = ''; - $request = $this->auSelfManagedSuperFundPostRequest($fund, $business_id); + $request = $this->auSelfManagedSuperFundPostRequest($business_id, $fund, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -815,7 +946,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -824,20 +955,16 @@ function ($exception) { /** * Create request for operation 'auSelfManagedSuperFundPost' * - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSelfManagedSuperFundPostRequest($fund, $business_id) + public function auSelfManagedSuperFundPostRequest($business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPost'][0]) { - // verify the required parameter 'fund' is set - if ($fund === null || (is_array($fund) && count($fund) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $fund when calling auSelfManagedSuperFundPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -845,6 +972,14 @@ protected function auSelfManagedSuperFundPostRequest($fund, $business_id) ); } + // verify the required parameter 'fund' is set + if ($fund === null || (is_array($fund) && count($fund) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $fund when calling auSelfManagedSuperFundPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/selfmanagedsuperfund'; $formParams = []; $queryParams = []; @@ -853,6 +988,7 @@ protected function auSelfManagedSuperFundPostRequest($fund, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -862,56 +998,42 @@ protected function auSelfManagedSuperFundPostRequest($fund, $business_id) ); } - // body params - $_tempBody = null; - if (isset($fund)) { - $_tempBody = $fund; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($fund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fund)); + } else { + $httpBody = $fund; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -932,10 +1054,11 @@ protected function auSelfManagedSuperFundPostRequest($fund, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -947,16 +1070,17 @@ protected function auSelfManagedSuperFundPostRequest($fund, $business_id) * Update Self Managed Super Fund * * @param int $id id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund fund (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auSelfManagedSuperFundPut($id, $fund, $business_id) + public function auSelfManagedSuperFundPut($id, $business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPut'][0]) { - $this->auSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id); + $this->auSelfManagedSuperFundPutWithHttpInfo($id, $business_id, $fund, $contentType); } /** @@ -965,17 +1089,17 @@ public function auSelfManagedSuperFundPut($id, $fund, $business_id) * Update Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id) + public function auSelfManagedSuperFundPutWithHttpInfo($id, $business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPut'][0]) { - $returnType = ''; - $request = $this->auSelfManagedSuperFundPutRequest($id, $fund, $business_id); + $request = $this->auSelfManagedSuperFundPutRequest($id, $business_id, $fund, $contentType); try { $options = $this->createHttpClientOption(); @@ -984,9 +1108,16 @@ public function auSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -997,11 +1128,11 @@ public function auSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1020,15 +1151,16 @@ public function auSelfManagedSuperFundPutWithHttpInfo($id, $fund, $business_id) * Update Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundPutAsync($id, $fund, $business_id) + public function auSelfManagedSuperFundPutAsync($id, $business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPut'][0]) { - return $this->auSelfManagedSuperFundPutAsyncWithHttpInfo($id, $fund, $business_id) + return $this->auSelfManagedSuperFundPutAsyncWithHttpInfo($id, $business_id, $fund, $contentType) ->then( function ($response) { return $response[0]; @@ -1042,16 +1174,17 @@ function ($response) { * Update Self Managed Super Fund * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSelfManagedSuperFundPutAsyncWithHttpInfo($id, $fund, $business_id) + public function auSelfManagedSuperFundPutAsyncWithHttpInfo($id, $business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPut'][0]) { $returnType = ''; - $request = $this->auSelfManagedSuperFundPutRequest($id, $fund, $business_id); + $request = $this->auSelfManagedSuperFundPutRequest($id, $business_id, $fund, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1070,7 +1203,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1080,26 +1213,23 @@ function ($exception) { * Create request for operation 'auSelfManagedSuperFundPut' * * @param int $id (required) - * @param \Swagger\Client\Model\SelfManagedSuperFundModel $fund (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\SelfManagedSuperFundModel $fund (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSelfManagedSuperFundPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSelfManagedSuperFundPutRequest($id, $fund, $business_id) + public function auSelfManagedSuperFundPutRequest($id, $business_id, $fund, string $contentType = self::contentTypes['auSelfManagedSuperFundPut'][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 auSelfManagedSuperFundPut' ); } - // verify the required parameter 'fund' is set - if ($fund === null || (is_array($fund) && count($fund) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $fund when calling auSelfManagedSuperFundPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1107,6 +1237,14 @@ protected function auSelfManagedSuperFundPutRequest($id, $fund, $business_id) ); } + // verify the required parameter 'fund' is set + if ($fund === null || (is_array($fund) && count($fund) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $fund when calling auSelfManagedSuperFundPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/selfmanagedsuperfund/{id}'; $formParams = []; $queryParams = []; @@ -1115,6 +1253,7 @@ protected function auSelfManagedSuperFundPutRequest($id, $fund, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1132,56 +1271,42 @@ protected function auSelfManagedSuperFundPutRequest($id, $fund, $business_id) ); } - // body params - $_tempBody = null; - if (isset($fund)) { - $_tempBody = $fund; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($fund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fund)); + } else { + $httpBody = $fund; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1202,10 +1327,11 @@ protected function auSelfManagedSuperFundPutRequest($id, $fund, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1217,14 +1343,15 @@ protected function auSelfManagedSuperFundPutRequest($id, $fund, $business_id) * List Electronic Service Addresses * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundElectronicServiceAddressIndex'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSmsfElectronicServiceAddressModel[] + * @return \OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[] */ - public function auSuperFundElectronicServiceAddressIndex($business_id) + public function auSuperFundElectronicServiceAddressIndex($business_id, string $contentType = self::contentTypes['auSuperFundElectronicServiceAddressIndex'][0]) { - list($response) = $this->auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_id); + list($response) = $this->auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_id, $contentType); return $response; } @@ -1234,15 +1361,15 @@ public function auSuperFundElectronicServiceAddressIndex($business_id) * List Electronic Service Addresses * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundElectronicServiceAddressIndex'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSmsfElectronicServiceAddressModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_id) + public function auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_id, string $contentType = self::contentTypes['auSuperFundElectronicServiceAddressIndex'][0]) { - $returnType = '\Swagger\Client\Model\AuSmsfElectronicServiceAddressModel[]'; - $request = $this->auSuperFundElectronicServiceAddressIndexRequest($business_id); + $request = $this->auSuperFundElectronicServiceAddressIndexRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1251,9 +1378,16 @@ public function auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1264,19 +1398,37 @@ public function auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1293,7 +1445,7 @@ public function auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSmsfElectronicServiceAddressModel[]', + '\OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1309,13 +1461,14 @@ public function auSuperFundElectronicServiceAddressIndexWithHttpInfo($business_i * List Electronic Service Addresses * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundElectronicServiceAddressIndex'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSuperFundElectronicServiceAddressIndexAsync($business_id) + public function auSuperFundElectronicServiceAddressIndexAsync($business_id, string $contentType = self::contentTypes['auSuperFundElectronicServiceAddressIndex'][0]) { - return $this->auSuperFundElectronicServiceAddressIndexAsyncWithHttpInfo($business_id) + return $this->auSuperFundElectronicServiceAddressIndexAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1329,24 +1482,24 @@ function ($response) { * List Electronic Service Addresses * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundElectronicServiceAddressIndex'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSuperFundElectronicServiceAddressIndexAsyncWithHttpInfo($business_id) + public function auSuperFundElectronicServiceAddressIndexAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['auSuperFundElectronicServiceAddressIndex'][0]) { - $returnType = '\Swagger\Client\Model\AuSmsfElectronicServiceAddressModel[]'; - $request = $this->auSuperFundElectronicServiceAddressIndexRequest($business_id); + $returnType = '\OpenAPI\Client\Model\AuSmsfElectronicServiceAddressModel[]'; + $request = $this->auSuperFundElectronicServiceAddressIndexRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1369,7 +1522,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1379,12 +1532,14 @@ function ($exception) { * Create request for operation 'auSuperFundElectronicServiceAddressIndex' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundElectronicServiceAddressIndex'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSuperFundElectronicServiceAddressIndexRequest($business_id) + public function auSuperFundElectronicServiceAddressIndexRequest($business_id, string $contentType = self::contentTypes['auSuperFundElectronicServiceAddressIndex'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1392,6 +1547,7 @@ protected function auSuperFundElectronicServiceAddressIndexRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/superfund/electronicserviceaddress'; $formParams = []; $queryParams = []; @@ -1400,6 +1556,7 @@ protected function auSuperFundElectronicServiceAddressIndexRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1409,53 +1566,35 @@ protected function auSuperFundElectronicServiceAddressIndexRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1476,10 +1615,11 @@ protected function auSuperFundElectronicServiceAddressIndexRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1492,15 +1632,16 @@ protected function auSuperFundElectronicServiceAddressIndexRequest($business_id) * * @param string $term term (required) * @param string $business_id business_id (required) - * @param string $search_by search_by (optional, default to 0) + * @param string $search_by search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundProductSearch'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SuperProductEditModel[] + * @return \OpenAPI\Client\Model\SuperProductEditModel[] */ - public function auSuperFundProductSearch($term, $business_id, $search_by = '0') + public function auSuperFundProductSearch($term, $business_id, $search_by = '0', string $contentType = self::contentTypes['auSuperFundProductSearch'][0]) { - list($response) = $this->auSuperFundProductSearchWithHttpInfo($term, $business_id, $search_by); + list($response) = $this->auSuperFundProductSearchWithHttpInfo($term, $business_id, $search_by, $contentType); return $response; } @@ -1511,16 +1652,16 @@ public function auSuperFundProductSearch($term, $business_id, $search_by = '0') * * @param string $term (required) * @param string $business_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundProductSearch'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SuperProductEditModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SuperProductEditModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auSuperFundProductSearchWithHttpInfo($term, $business_id, $search_by = '0') + public function auSuperFundProductSearchWithHttpInfo($term, $business_id, $search_by = '0', string $contentType = self::contentTypes['auSuperFundProductSearch'][0]) { - $returnType = '\Swagger\Client\Model\SuperProductEditModel[]'; - $request = $this->auSuperFundProductSearchRequest($term, $business_id, $search_by); + $request = $this->auSuperFundProductSearchRequest($term, $business_id, $search_by, $contentType); try { $options = $this->createHttpClientOption(); @@ -1529,9 +1670,16 @@ public function auSuperFundProductSearchWithHttpInfo($term, $business_id, $searc } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1542,19 +1690,37 @@ public function auSuperFundProductSearchWithHttpInfo($term, $business_id, $searc sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SuperProductEditModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SuperProductEditModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SuperProductEditModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SuperProductEditModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1571,7 +1737,7 @@ public function auSuperFundProductSearchWithHttpInfo($term, $business_id, $searc case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SuperProductEditModel[]', + '\OpenAPI\Client\Model\SuperProductEditModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1588,14 +1754,15 @@ public function auSuperFundProductSearchWithHttpInfo($term, $business_id, $searc * * @param string $term (required) * @param string $business_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundProductSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSuperFundProductSearchAsync($term, $business_id, $search_by = '0') + public function auSuperFundProductSearchAsync($term, $business_id, $search_by = '0', string $contentType = self::contentTypes['auSuperFundProductSearch'][0]) { - return $this->auSuperFundProductSearchAsyncWithHttpInfo($term, $business_id, $search_by) + return $this->auSuperFundProductSearchAsyncWithHttpInfo($term, $business_id, $search_by, $contentType) ->then( function ($response) { return $response[0]; @@ -1610,25 +1777,25 @@ function ($response) { * * @param string $term (required) * @param string $business_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundProductSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auSuperFundProductSearchAsyncWithHttpInfo($term, $business_id, $search_by = '0') + public function auSuperFundProductSearchAsyncWithHttpInfo($term, $business_id, $search_by = '0', string $contentType = self::contentTypes['auSuperFundProductSearch'][0]) { - $returnType = '\Swagger\Client\Model\SuperProductEditModel[]'; - $request = $this->auSuperFundProductSearchRequest($term, $business_id, $search_by); + $returnType = '\OpenAPI\Client\Model\SuperProductEditModel[]'; + $request = $this->auSuperFundProductSearchRequest($term, $business_id, $search_by, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1651,7 +1818,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1662,19 +1829,22 @@ function ($exception) { * * @param string $term (required) * @param string $business_id (required) - * @param string $search_by (optional, default to 0) + * @param string $search_by (optional, default to '0') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auSuperFundProductSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auSuperFundProductSearchRequest($term, $business_id, $search_by = '0') + public function auSuperFundProductSearchRequest($term, $business_id, $search_by = '0', string $contentType = self::contentTypes['auSuperFundProductSearch'][0]) { + // verify the required parameter 'term' is set if ($term === null || (is_array($term) && count($term) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $term when calling auSuperFundProductSearch' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1682,6 +1852,8 @@ protected function auSuperFundProductSearchRequest($term, $business_id, $search_ ); } + + $resourcePath = '/api/v2/business/{businessId}/superfund/productsearch'; $formParams = []; $queryParams = []; @@ -1690,13 +1862,24 @@ protected function auSuperFundProductSearchRequest($term, $business_id, $search_ $multipart = false; // query params - if ($term !== null) { - $queryParams['term'] = ObjectSerializer::toQueryValue($term); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $term, + 'term', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); // query params - if ($search_by !== null) { - $queryParams['searchBy'] = ObjectSerializer::toQueryValue($search_by); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search_by, + 'searchBy', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -1707,53 +1890,35 @@ protected function auSuperFundProductSearchRequest($term, $business_id, $search_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1774,10 +1939,11 @@ protected function auSuperFundProductSearchRequest($term, $business_id, $search_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/TimeAndAttendanceApi.php b/src/lib/Api/TimeAndAttendanceApi.php index 1ed2ee5..861362f 100644 --- a/src/lib/Api/TimeAndAttendanceApi.php +++ b/src/lib/Api/TimeAndAttendanceApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auTimeAndAttendanceShifts' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceAddNote' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceAddShift' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceChangePin' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceCheckId' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceCheckPin' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceClockOff' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceClockOn' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceDeleteNote' => [ + 'application/json', + ], + 'genericTimeAndAttendanceDiscardShift' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceEmailReset' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceEndBreak' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceGetHasAccess' => [ + 'application/json', + ], + 'genericTimeAndAttendanceGetShiftNotes' => [ + 'application/json', + ], + 'genericTimeAndAttendanceGetStaff' => [ + 'application/json', + ], + 'genericTimeAndAttendanceMarkNotesRead' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendancePostStaff' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceSmsReset' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'genericTimeAndAttendanceStartBreak' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'kioskDelete' => [ + 'application/json', + ], + 'kioskGet' => [ + 'application/json', + ], + 'kioskGetAll' => [ + 'application/json', + ], + 'kioskPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'kioskPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -95,14 +270,15 @@ public function getConfig() * @param int $kiosk_id kiosk_id (required) * @param int $employee_id employee_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceGetLookupData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel */ - public function auTimeAndAttendanceGetLookupData($kiosk_id, $employee_id, $business_id) + public function auTimeAndAttendanceGetLookupData($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auTimeAndAttendanceGetLookupData'][0]) { - list($response) = $this->auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id); + list($response) = $this->auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id, $contentType); return $response; } @@ -114,15 +290,15 @@ public function auTimeAndAttendanceGetLookupData($kiosk_id, $employee_id, $busin * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceGetLookupData'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel, HTTP status code, HTTP response headers (array of strings) */ - public function auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id) + public function auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auTimeAndAttendanceGetLookupData'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel'; - $request = $this->auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id); + $request = $this->auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -131,9 +307,16 @@ public function auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employe } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -144,19 +327,37 @@ public function auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -173,7 +374,7 @@ public function auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel', + '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -191,13 +392,14 @@ public function auTimeAndAttendanceGetLookupDataWithHttpInfo($kiosk_id, $employe * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimeAndAttendanceGetLookupDataAsync($kiosk_id, $employee_id, $business_id) + public function auTimeAndAttendanceGetLookupDataAsync($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auTimeAndAttendanceGetLookupData'][0]) { - return $this->auTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id) + return $this->auTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -213,24 +415,24 @@ function ($response) { * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id) + public function auTimeAndAttendanceGetLookupDataAsyncWithHttpInfo($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auTimeAndAttendanceGetLookupData'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceLookupDataModel'; - $request = $this->auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceLookupDataModel'; + $request = $this->auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -253,7 +455,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -265,24 +467,28 @@ function ($exception) { * @param int $kiosk_id (required) * @param int $employee_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceGetLookupData'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id) + public function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_id, $business_id, string $contentType = self::contentTypes['auTimeAndAttendanceGetLookupData'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling auTimeAndAttendanceGetLookupData' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $employee_id when calling auTimeAndAttendanceGetLookupData' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -290,6 +496,7 @@ protected function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_ ); } + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/lookupdata/{employeeId}'; $formParams = []; $queryParams = []; @@ -298,6 +505,7 @@ protected function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_ $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -323,53 +531,35 @@ protected function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -390,10 +580,11 @@ protected function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -404,16 +595,17 @@ protected function auTimeAndAttendanceGetLookupDataRequest($kiosk_id, $employee_ * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimeAndAttendanceShiftModel[] + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[] */ - public function auTimeAndAttendanceShifts($model, $business_id) + public function auTimeAndAttendanceShifts($business_id, $model, string $contentType = self::contentTypes['auTimeAndAttendanceShifts'][0]) { - list($response) = $this->auTimeAndAttendanceShiftsWithHttpInfo($model, $business_id); + list($response) = $this->auTimeAndAttendanceShiftsWithHttpInfo($business_id, $model, $contentType); return $response; } @@ -422,17 +614,17 @@ public function auTimeAndAttendanceShifts($model, $business_id) * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceShifts'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimeAndAttendanceShiftModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auTimeAndAttendanceShiftsWithHttpInfo($model, $business_id) + public function auTimeAndAttendanceShiftsWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auTimeAndAttendanceShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]'; - $request = $this->auTimeAndAttendanceShiftsRequest($model, $business_id); + $request = $this->auTimeAndAttendanceShiftsRequest($business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -441,9 +633,16 @@ public function auTimeAndAttendanceShiftsWithHttpInfo($model, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -454,19 +653,37 @@ public function auTimeAndAttendanceShiftsWithHttpInfo($model, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -483,7 +700,7 @@ public function auTimeAndAttendanceShiftsWithHttpInfo($model, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]', + '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -498,15 +715,16 @@ public function auTimeAndAttendanceShiftsWithHttpInfo($model, $business_id) * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimeAndAttendanceShiftsAsync($model, $business_id) + public function auTimeAndAttendanceShiftsAsync($business_id, $model, string $contentType = self::contentTypes['auTimeAndAttendanceShifts'][0]) { - return $this->auTimeAndAttendanceShiftsAsyncWithHttpInfo($model, $business_id) + return $this->auTimeAndAttendanceShiftsAsyncWithHttpInfo($business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -519,26 +737,26 @@ function ($response) { * * Shifts * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimeAndAttendanceShiftsAsyncWithHttpInfo($model, $business_id) + public function auTimeAndAttendanceShiftsAsyncWithHttpInfo($business_id, $model, string $contentType = self::contentTypes['auTimeAndAttendanceShifts'][0]) { - $returnType = '\Swagger\Client\Model\AuTimeAndAttendanceShiftModel[]'; - $request = $this->auTimeAndAttendanceShiftsRequest($model, $business_id); + $returnType = '\OpenAPI\Client\Model\AuTimeAndAttendanceShiftModel[]'; + $request = $this->auTimeAndAttendanceShiftsRequest($business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -561,7 +779,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -570,20 +788,16 @@ function ($exception) { /** * Create request for operation 'auTimeAndAttendanceShifts' * - * @param \Swagger\Client\Model\GetShiftsModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\GetShiftsModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimeAndAttendanceShifts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimeAndAttendanceShiftsRequest($model, $business_id) + public function auTimeAndAttendanceShiftsRequest($business_id, $model, string $contentType = self::contentTypes['auTimeAndAttendanceShifts'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling auTimeAndAttendanceShifts' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -591,6 +805,14 @@ protected function auTimeAndAttendanceShiftsRequest($model, $business_id) ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling auTimeAndAttendanceShifts' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/shifts'; $formParams = []; $queryParams = []; @@ -599,6 +821,7 @@ protected function auTimeAndAttendanceShiftsRequest($model, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -608,56 +831,42 @@ protected function auTimeAndAttendanceShiftsRequest($model, $business_id) ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -678,10 +887,11 @@ protected function auTimeAndAttendanceShiftsRequest($model, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -694,16 +904,17 @@ protected function auTimeAndAttendanceShiftsRequest($model, $business_id) * * @param int $kiosk_id kiosk_id (required) * @param int $shift_id shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceAddNote($kiosk_id, $shift_id, $model, $business_id) + public function genericTimeAndAttendanceAddNote($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddNote'][0]) { - $this->genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $model, $business_id); + $this->genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, $contentType); } /** @@ -713,17 +924,17 @@ public function genericTimeAndAttendanceAddNote($kiosk_id, $shift_id, $model, $b * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $model, $business_id) + public function genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddNote'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -732,9 +943,16 @@ public function genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -745,11 +963,11 @@ public function genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -769,15 +987,16 @@ public function genericTimeAndAttendanceAddNoteWithHttpInfo($kiosk_id, $shift_id * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceAddNoteAsync($kiosk_id, $shift_id, $model, $business_id) + public function genericTimeAndAttendanceAddNoteAsync($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddNote'][0]) { - return $this->genericTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $model, $business_id) + return $this->genericTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -792,16 +1011,17 @@ function ($response) { * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $model, $business_id) + public function genericTimeAndAttendanceAddNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddNote'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -820,7 +1040,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -831,32 +1051,30 @@ function ($exception) { * * @param int $kiosk_id (required) * @param int $shift_id (required) - * @param \Swagger\Client\Model\AddNoteModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AddNoteModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $model, $business_id) + public function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddNote'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceAddNote' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling genericTimeAndAttendanceAddNote' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceAddNote' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -864,6 +1082,14 @@ protected function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceAddNote' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/shift/{shiftId}/notes'; $formParams = []; $queryParams = []; @@ -872,6 +1098,7 @@ protected function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -897,56 +1124,42 @@ protected function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -967,10 +1180,11 @@ protected function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -982,16 +1196,17 @@ protected function genericTimeAndAttendanceAddNoteRequest($kiosk_id, $shift_id, * Add Complete Shift for Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\AuAddShiftModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuAddShiftModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceAddShift($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceAddShift($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddShift'][0]) { - $this->genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $model, $business_id); + $this->genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $business_id, $model, $contentType); } /** @@ -1000,17 +1215,17 @@ public function genericTimeAndAttendanceAddShift($kiosk_id, $model, $business_id * Add Complete Shift for Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuAddShiftModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuAddShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddShift'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceAddShiftRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1019,9 +1234,16 @@ public function genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $model, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1032,11 +1254,11 @@ public function genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $model, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1055,15 +1277,16 @@ public function genericTimeAndAttendanceAddShiftWithHttpInfo($kiosk_id, $model, * Add Complete Shift for Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuAddShiftModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuAddShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceAddShiftAsync($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceAddShiftAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddShift'][0]) { - return $this->genericTimeAndAttendanceAddShiftAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericTimeAndAttendanceAddShiftAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1077,16 +1300,17 @@ function ($response) { * Add Complete Shift for Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuAddShiftModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuAddShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceAddShiftAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceAddShiftAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddShift'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceAddShiftRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1105,7 +1329,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1115,26 +1339,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceAddShift' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuAddShiftModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuAddShiftModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceAddShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceAddShift'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceAddShift' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceAddShift' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1142,6 +1363,14 @@ protected function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $b ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceAddShift' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/addshift'; $formParams = []; $queryParams = []; @@ -1150,6 +1379,7 @@ protected function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $b $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -1167,56 +1397,42 @@ protected function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $b ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1237,10 +1453,11 @@ protected function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $b $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1252,16 +1469,17 @@ protected function genericTimeAndAttendanceAddShiftRequest($kiosk_id, $model, $b * Change PIN * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceChangePin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceChangePin($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceChangePin($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceChangePin'][0]) { - $this->genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, $business_id); + $this->genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $business_id, $model, $contentType); } /** @@ -1270,17 +1488,17 @@ public function genericTimeAndAttendanceChangePin($kiosk_id, $model, $business_i * Change PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceChangePin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceChangePin'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceChangePinRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1289,9 +1507,16 @@ public function genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1302,11 +1527,11 @@ public function genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1325,15 +1550,16 @@ public function genericTimeAndAttendanceChangePinWithHttpInfo($kiosk_id, $model, * Change PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceChangePin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceChangePinAsync($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceChangePinAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceChangePin'][0]) { - return $this->genericTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1347,16 +1573,17 @@ function ($response) { * Change PIN * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceChangePin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceChangePinAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceChangePin'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceChangePinRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1375,7 +1602,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1385,26 +1612,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceChangePin' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ChangeKioskPinModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ChangeKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceChangePin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceChangePinRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceChangePin'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceChangePin' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceChangePin' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1412,6 +1636,14 @@ protected function genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceChangePin' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/changepin'; $formParams = []; $queryParams = []; @@ -1420,6 +1652,7 @@ protected function genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $ $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -1437,56 +1670,42 @@ protected function genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1507,10 +1726,11 @@ protected function genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1521,17 +1741,18 @@ protected function genericTimeAndAttendanceChangePinRequest($kiosk_id, $model, $ * * Check Employee * - * @param \Swagger\Client\Model\BasicKioskEmployeeModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) + * @param \OpenAPI\Client\Model\BasicKioskEmployeeModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceCheckId($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckId($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckId'][0]) { - $this->genericTimeAndAttendanceCheckIdWithHttpInfo($model, $business_id, $kiosk_id); + $this->genericTimeAndAttendanceCheckIdWithHttpInfo($business_id, $kiosk_id, $model, $contentType); } /** @@ -1539,18 +1760,18 @@ public function genericTimeAndAttendanceCheckId($model, $business_id, $kiosk_id) * * Check Employee * - * @param \Swagger\Client\Model\BasicKioskEmployeeModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\BasicKioskEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckId'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceCheckIdWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckIdWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckId'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceCheckIdRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceCheckIdRequest($business_id, $kiosk_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1559,9 +1780,16 @@ public function genericTimeAndAttendanceCheckIdWithHttpInfo($model, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1572,11 +1800,11 @@ public function genericTimeAndAttendanceCheckIdWithHttpInfo($model, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1594,16 +1822,17 @@ public function genericTimeAndAttendanceCheckIdWithHttpInfo($model, $business_id * * Check Employee * - * @param \Swagger\Client\Model\BasicKioskEmployeeModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\BasicKioskEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceCheckIdAsync($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckIdAsync($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckId'][0]) { - return $this->genericTimeAndAttendanceCheckIdAsyncWithHttpInfo($model, $business_id, $kiosk_id) + return $this->genericTimeAndAttendanceCheckIdAsyncWithHttpInfo($business_id, $kiosk_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1616,17 +1845,18 @@ function ($response) { * * Check Employee * - * @param \Swagger\Client\Model\BasicKioskEmployeeModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\BasicKioskEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceCheckIdAsyncWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckIdAsyncWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckId'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceCheckIdRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceCheckIdRequest($business_id, $kiosk_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1645,7 +1875,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1654,27 +1884,24 @@ function ($exception) { /** * Create request for operation 'genericTimeAndAttendanceCheckId' * - * @param \Swagger\Client\Model\BasicKioskEmployeeModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\BasicKioskEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceCheckIdRequest($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckIdRequest($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckId'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceCheckId' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericTimeAndAttendanceCheckId' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( @@ -1682,6 +1909,14 @@ protected function genericTimeAndAttendanceCheckIdRequest($model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceCheckId' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/checkid'; $formParams = []; $queryParams = []; @@ -1690,6 +1925,7 @@ protected function genericTimeAndAttendanceCheckIdRequest($model, $business_id, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1707,56 +1943,42 @@ protected function genericTimeAndAttendanceCheckIdRequest($model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1777,10 +1999,11 @@ protected function genericTimeAndAttendanceCheckIdRequest($model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1791,17 +2014,18 @@ protected function genericTimeAndAttendanceCheckIdRequest($model, $business_id, * * Verify Kiosk PIN * - * @param \Swagger\Client\Model\CheckKioskPinModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckPin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\KioskEmployeeModel + * @return \OpenAPI\Client\Model\KioskEmployeeModel */ - public function genericTimeAndAttendanceCheckPin($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckPin($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckPin'][0]) { - list($response) = $this->genericTimeAndAttendanceCheckPinWithHttpInfo($model, $business_id, $kiosk_id); + list($response) = $this->genericTimeAndAttendanceCheckPinWithHttpInfo($business_id, $kiosk_id, $model, $contentType); return $response; } @@ -1810,18 +2034,18 @@ public function genericTimeAndAttendanceCheckPin($model, $business_id, $kiosk_id * * Verify Kiosk PIN * - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckPin'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\KioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceCheckPinWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckPinWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckPin'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericTimeAndAttendanceCheckPinRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceCheckPinRequest($business_id, $kiosk_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1830,9 +2054,16 @@ public function genericTimeAndAttendanceCheckPinWithHttpInfo($model, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1843,19 +2074,37 @@ public function genericTimeAndAttendanceCheckPinWithHttpInfo($model, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\KioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\KioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\KioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1872,7 +2121,7 @@ public function genericTimeAndAttendanceCheckPinWithHttpInfo($model, $business_i case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\KioskEmployeeModel', + '\OpenAPI\Client\Model\KioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1887,16 +2136,17 @@ public function genericTimeAndAttendanceCheckPinWithHttpInfo($model, $business_i * * Verify Kiosk PIN * - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckPin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceCheckPinAsync($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckPinAsync($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckPin'][0]) { - return $this->genericTimeAndAttendanceCheckPinAsyncWithHttpInfo($model, $business_id, $kiosk_id) + return $this->genericTimeAndAttendanceCheckPinAsyncWithHttpInfo($business_id, $kiosk_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -1909,27 +2159,27 @@ function ($response) { * * Verify Kiosk PIN * - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckPin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceCheckPinAsyncWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckPinAsyncWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckPin'][0]) { - $returnType = '\Swagger\Client\Model\KioskEmployeeModel'; - $request = $this->genericTimeAndAttendanceCheckPinRequest($model, $business_id, $kiosk_id); + $returnType = '\OpenAPI\Client\Model\KioskEmployeeModel'; + $request = $this->genericTimeAndAttendanceCheckPinRequest($business_id, $kiosk_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1952,7 +2202,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1961,27 +2211,24 @@ function ($exception) { /** * Create request for operation 'genericTimeAndAttendanceCheckPin' * - * @param \Swagger\Client\Model\CheckKioskPinModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\CheckKioskPinModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceCheckPin'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceCheckPinRequest($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceCheckPinRequest($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceCheckPin'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceCheckPin' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericTimeAndAttendanceCheckPin' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( @@ -1989,6 +2236,14 @@ protected function genericTimeAndAttendanceCheckPinRequest($model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceCheckPin' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/checkpin'; $formParams = []; $queryParams = []; @@ -1997,6 +2252,7 @@ protected function genericTimeAndAttendanceCheckPinRequest($model, $business_id, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -2014,56 +2270,42 @@ protected function genericTimeAndAttendanceCheckPinRequest($model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2084,10 +2326,11 @@ protected function genericTimeAndAttendanceCheckPinRequest($model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2099,16 +2342,17 @@ protected function genericTimeAndAttendanceCheckPinRequest($model, $business_id, * Clock Out Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceClockOff($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceClockOff($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOff'][0]) { - $this->genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request, $business_id); + $this->genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $business_id, $request, $contentType); } /** @@ -2117,17 +2361,17 @@ public function genericTimeAndAttendanceClockOff($kiosk_id, $request, $business_ * Clock Out Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOff'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceClockOffRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2136,9 +2380,16 @@ public function genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2149,11 +2400,11 @@ public function genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2172,15 +2423,16 @@ public function genericTimeAndAttendanceClockOffWithHttpInfo($kiosk_id, $request * Clock Out Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceClockOffAsync($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceClockOffAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOff'][0]) { - return $this->genericTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -2194,16 +2446,17 @@ function ($response) { * Clock Out Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceClockOffAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOff'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceClockOffRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2222,7 +2475,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2232,26 +2485,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceClockOff' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceClockOffRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOff'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceClockOff' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericTimeAndAttendanceClockOff' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2259,6 +2509,14 @@ protected function genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericTimeAndAttendanceClockOff' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/clockoff'; $formParams = []; $queryParams = []; @@ -2267,6 +2525,7 @@ protected function genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -2284,56 +2543,42 @@ protected function genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2354,10 +2599,11 @@ protected function genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2369,16 +2615,17 @@ protected function genericTimeAndAttendanceClockOffRequest($kiosk_id, $request, * Clock In Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOn'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceClockOn($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceClockOn($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOn'][0]) { - $this->genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $model, $business_id); + $this->genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $business_id, $model, $contentType); } /** @@ -2387,17 +2634,17 @@ public function genericTimeAndAttendanceClockOn($kiosk_id, $model, $business_id) * Clock In Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOn'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOn'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceClockOnRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -2406,9 +2653,16 @@ public function genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $model, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2419,11 +2673,11 @@ public function genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $model, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2442,15 +2696,16 @@ public function genericTimeAndAttendanceClockOnWithHttpInfo($kiosk_id, $model, $ * Clock In Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceClockOnAsync($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceClockOnAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOn'][0]) { - return $this->genericTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -2464,16 +2719,17 @@ function ($response) { * Clock In Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceClockOnAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOn'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendanceClockOnRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2492,7 +2748,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2502,26 +2758,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceClockOn' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\AuClockOnModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuClockOnModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceClockOn'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $business_id) + public function genericTimeAndAttendanceClockOnRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceClockOn'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceClockOn' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceClockOn' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2529,6 +2782,14 @@ protected function genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $bu ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceClockOn' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/clockon'; $formParams = []; $queryParams = []; @@ -2537,6 +2798,7 @@ protected function genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $bu $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -2554,56 +2816,42 @@ protected function genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $bu ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2624,10 +2872,11 @@ protected function genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $bu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2642,14 +2891,15 @@ protected function genericTimeAndAttendanceClockOnRequest($kiosk_id, $model, $bu * @param int $shift_id shift_id (required) * @param int $note_id note_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDeleteNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceDeleteNote($kiosk_id, $shift_id, $note_id, $business_id) + public function genericTimeAndAttendanceDeleteNote($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericTimeAndAttendanceDeleteNote'][0]) { - $this->genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id); + $this->genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, $contentType); } /** @@ -2661,15 +2911,15 @@ public function genericTimeAndAttendanceDeleteNote($kiosk_id, $shift_id, $note_i * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDeleteNote'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id) + public function genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericTimeAndAttendanceDeleteNote'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id); + $request = $this->genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2678,9 +2928,16 @@ public function genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2691,11 +2948,11 @@ public function genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -2717,13 +2974,14 @@ public function genericTimeAndAttendanceDeleteNoteWithHttpInfo($kiosk_id, $shift * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDeleteNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceDeleteNoteAsync($kiosk_id, $shift_id, $note_id, $business_id) + public function genericTimeAndAttendanceDeleteNoteAsync($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericTimeAndAttendanceDeleteNote'][0]) { - return $this->genericTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id) + return $this->genericTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2740,14 +2998,15 @@ function ($response) { * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDeleteNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id) + public function genericTimeAndAttendanceDeleteNoteAsyncWithHttpInfo($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericTimeAndAttendanceDeleteNote'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id); + $request = $this->genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2766,7 +3025,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -2779,30 +3038,35 @@ function ($exception) { * @param int $shift_id (required) * @param int $note_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDeleteNote'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id) + public function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_id, $note_id, $business_id, string $contentType = self::contentTypes['genericTimeAndAttendanceDeleteNote'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceDeleteNote' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling genericTimeAndAttendanceDeleteNote' ); } + // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $note_id when calling genericTimeAndAttendanceDeleteNote' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2810,6 +3074,7 @@ protected function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_i ); } + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/shift/{shiftId}/notes/{noteId}'; $formParams = []; $queryParams = []; @@ -2818,6 +3083,7 @@ protected function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_i $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -2851,53 +3117,35 @@ protected function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_i ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2918,10 +3166,11 @@ protected function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2933,16 +3182,17 @@ protected function genericTimeAndAttendanceDeleteNoteRequest($kiosk_id, $shift_i * Discard current shift * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDiscardShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceDiscardShift($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceDiscardShift($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceDiscardShift'][0]) { - $this->genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $request, $business_id); + $this->genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $business_id, $request, $contentType); } /** @@ -2951,17 +3201,17 @@ public function genericTimeAndAttendanceDiscardShift($kiosk_id, $request, $busin * Discard current shift * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDiscardShift'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceDiscardShift'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2970,9 +3220,16 @@ public function genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $req } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -2983,11 +3240,11 @@ public function genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $req sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3006,15 +3263,16 @@ public function genericTimeAndAttendanceDiscardShiftWithHttpInfo($kiosk_id, $req * Discard current shift * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDiscardShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceDiscardShiftAsync($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceDiscardShiftAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceDiscardShift'][0]) { - return $this->genericTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -3028,16 +3286,17 @@ function ($response) { * Discard current shift * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDiscardShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceDiscardShiftAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceDiscardShift'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3056,7 +3315,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3066,26 +3325,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceDiscardShift' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\ClockOffModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\ClockOffModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceDiscardShift'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceDiscardShift'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceDiscardShift' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericTimeAndAttendanceDiscardShift' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3093,6 +3349,14 @@ protected function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $reque ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericTimeAndAttendanceDiscardShift' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/discard'; $formParams = []; $queryParams = []; @@ -3101,6 +3365,7 @@ protected function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $reque $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -3118,56 +3383,42 @@ protected function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $reque ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3188,10 +3439,11 @@ protected function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $reque $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3202,17 +3454,18 @@ protected function genericTimeAndAttendanceDiscardShiftRequest($kiosk_id, $reque * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEmailReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceEmailReset($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceEmailReset($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceEmailReset'][0]) { - $this->genericTimeAndAttendanceEmailResetWithHttpInfo($model, $business_id, $kiosk_id); + $this->genericTimeAndAttendanceEmailResetWithHttpInfo($business_id, $kiosk_id, $model, $contentType); } /** @@ -3220,18 +3473,18 @@ public function genericTimeAndAttendanceEmailReset($model, $business_id, $kiosk_ * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEmailReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceEmailResetWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceEmailResetWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceEmailReset'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceEmailResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceEmailResetRequest($business_id, $kiosk_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -3240,9 +3493,16 @@ public function genericTimeAndAttendanceEmailResetWithHttpInfo($model, $business } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3253,11 +3513,11 @@ public function genericTimeAndAttendanceEmailResetWithHttpInfo($model, $business sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3275,16 +3535,17 @@ public function genericTimeAndAttendanceEmailResetWithHttpInfo($model, $business * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEmailReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceEmailResetAsync($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceEmailResetAsync($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceEmailReset'][0]) { - return $this->genericTimeAndAttendanceEmailResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + return $this->genericTimeAndAttendanceEmailResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -3297,17 +3558,18 @@ function ($response) { * * Send PIN Reset Email * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEmailReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceEmailResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceEmailResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceEmailReset'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceEmailResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceEmailResetRequest($business_id, $kiosk_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3326,7 +3588,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3335,27 +3597,24 @@ function ($exception) { /** * Create request for operation 'genericTimeAndAttendanceEmailReset' * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEmailReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceEmailResetRequest($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceEmailResetRequest($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceEmailReset'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceEmailReset' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericTimeAndAttendanceEmailReset' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( @@ -3363,6 +3622,14 @@ protected function genericTimeAndAttendanceEmailResetRequest($model, $business_i ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceEmailReset' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/emailreset'; $formParams = []; $queryParams = []; @@ -3371,6 +3638,7 @@ protected function genericTimeAndAttendanceEmailResetRequest($model, $business_i $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3388,56 +3656,42 @@ protected function genericTimeAndAttendanceEmailResetRequest($model, $business_i ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3458,10 +3712,11 @@ protected function genericTimeAndAttendanceEmailResetRequest($model, $business_i $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3473,16 +3728,17 @@ protected function genericTimeAndAttendanceEmailResetRequest($model, $business_i * End Break * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEndBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceEndBreak($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceEndBreak($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceEndBreak'][0]) { - $this->genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request, $business_id); + $this->genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $business_id, $request, $contentType); } /** @@ -3491,17 +3747,17 @@ public function genericTimeAndAttendanceEndBreak($kiosk_id, $request, $business_ * End Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEndBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceEndBreak'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceEndBreakRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -3510,9 +3766,16 @@ public function genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3523,11 +3786,11 @@ public function genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3546,15 +3809,16 @@ public function genericTimeAndAttendanceEndBreakWithHttpInfo($kiosk_id, $request * End Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEndBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceEndBreakAsync($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceEndBreakAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceEndBreak'][0]) { - return $this->genericTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -3568,16 +3832,17 @@ function ($response) { * End Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEndBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceEndBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceEndBreak'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceEndBreakRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3596,7 +3861,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3606,26 +3871,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceEndBreak' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\EndBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\EndBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceEndBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceEndBreak'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceEndBreak' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericTimeAndAttendanceEndBreak' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -3633,6 +3895,14 @@ protected function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericTimeAndAttendanceEndBreak' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/endbreak'; $formParams = []; $queryParams = []; @@ -3641,6 +3911,7 @@ protected function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -3658,56 +3929,42 @@ protected function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3728,10 +3985,11 @@ protected function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3744,14 +4002,15 @@ protected function genericTimeAndAttendanceEndBreakRequest($kiosk_id, $request, * * @param string $business_id business_id (required) * @param string $employee_id employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetHasAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceGetHasAccess($business_id, $employee_id) + public function genericTimeAndAttendanceGetHasAccess($business_id, $employee_id, string $contentType = self::contentTypes['genericTimeAndAttendanceGetHasAccess'][0]) { - $this->genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $employee_id); + $this->genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $employee_id, $contentType); } /** @@ -3761,15 +4020,15 @@ public function genericTimeAndAttendanceGetHasAccess($business_id, $employee_id) * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetHasAccess'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $employee_id) + public function genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['genericTimeAndAttendanceGetHasAccess'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceGetHasAccessRequest($business_id, $employee_id); + $request = $this->genericTimeAndAttendanceGetHasAccessRequest($business_id, $employee_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -3778,9 +4037,16 @@ public function genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -3791,11 +4057,11 @@ public function genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -3815,13 +4081,14 @@ public function genericTimeAndAttendanceGetHasAccessWithHttpInfo($business_id, $ * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetHasAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceGetHasAccessAsync($business_id, $employee_id) + public function genericTimeAndAttendanceGetHasAccessAsync($business_id, $employee_id, string $contentType = self::contentTypes['genericTimeAndAttendanceGetHasAccess'][0]) { - return $this->genericTimeAndAttendanceGetHasAccessAsyncWithHttpInfo($business_id, $employee_id) + return $this->genericTimeAndAttendanceGetHasAccessAsyncWithHttpInfo($business_id, $employee_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3836,14 +4103,15 @@ function ($response) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetHasAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceGetHasAccessAsyncWithHttpInfo($business_id, $employee_id) + public function genericTimeAndAttendanceGetHasAccessAsyncWithHttpInfo($business_id, $employee_id, string $contentType = self::contentTypes['genericTimeAndAttendanceGetHasAccess'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceGetHasAccessRequest($business_id, $employee_id); + $request = $this->genericTimeAndAttendanceGetHasAccessRequest($business_id, $employee_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3862,7 +4130,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -3873,18 +4141,21 @@ function ($exception) { * * @param string $business_id (required) * @param string $employee_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetHasAccess'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceGetHasAccessRequest($business_id, $employee_id) + public function genericTimeAndAttendanceGetHasAccessRequest($business_id, $employee_id, string $contentType = self::contentTypes['genericTimeAndAttendanceGetHasAccess'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericTimeAndAttendanceGetHasAccess' ); } + // verify the required parameter 'employee_id' is set if ($employee_id === null || (is_array($employee_id) && count($employee_id) === 0)) { throw new \InvalidArgumentException( @@ -3892,6 +4163,7 @@ protected function genericTimeAndAttendanceGetHasAccessRequest($business_id, $em ); } + $resourcePath = '/api/v2/business/{businessId}/kiosk/hasaccess/{employeeId}'; $formParams = []; $queryParams = []; @@ -3900,6 +4172,7 @@ protected function genericTimeAndAttendanceGetHasAccessRequest($business_id, $em $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -3917,53 +4190,35 @@ protected function genericTimeAndAttendanceGetHasAccessRequest($business_id, $em ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3984,10 +4239,11 @@ protected function genericTimeAndAttendanceGetHasAccessRequest($business_id, $em $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4001,18 +4257,19 @@ protected function genericTimeAndAttendanceGetHasAccessRequest($business_id, $em * @param int $kiosk_id kiosk_id (required) * @param int $shift_id shift_id (required) * @param string $business_id business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id model_employee_id (optional) + * @param bool $model_is_admin_initiated model_is_admin_initiated (optional) + * @param string $model_type model_type (optional) + * @param string $model_visibility model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceGetShiftNotes($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericTimeAndAttendanceGetShiftNotes($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericTimeAndAttendanceGetShiftNotes'][0]) { - $this->genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $this->genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); } /** @@ -4023,19 +4280,19 @@ public function genericTimeAndAttendanceGetShiftNotes($kiosk_id, $shift_id, $bus * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericTimeAndAttendanceGetShiftNotes'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $request = $this->genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); try { $options = $this->createHttpClientOption(); @@ -4044,9 +4301,16 @@ public function genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $sh } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4057,11 +4321,11 @@ public function genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $sh sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -4082,17 +4346,18 @@ public function genericTimeAndAttendanceGetShiftNotesWithHttpInfo($kiosk_id, $sh * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceGetShiftNotesAsync($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericTimeAndAttendanceGetShiftNotesAsync($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericTimeAndAttendanceGetShiftNotes'][0]) { - return $this->genericTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility) + return $this->genericTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType) ->then( function ($response) { return $response[0]; @@ -4108,18 +4373,19 @@ function ($response) { * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericTimeAndAttendanceGetShiftNotesAsyncWithHttpInfo($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericTimeAndAttendanceGetShiftNotes'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility); + $request = $this->genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id, $model_is_admin_initiated, $model_type, $model_visibility, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4138,7 +4404,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4150,28 +4416,32 @@ function ($exception) { * @param int $kiosk_id (required) * @param int $shift_id (required) * @param string $business_id (required) - * @param int $model_employee_id (optional) - * @param bool $model_is_admin_initiated (optional) - * @param string $model_type (optional) - * @param string $model_visibility (optional) + * @param int $model_employee_id (optional) + * @param bool $model_is_admin_initiated (optional) + * @param string $model_type (optional) + * @param string $model_visibility (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetShiftNotes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null) + public function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shift_id, $business_id, $model_employee_id = null, $model_is_admin_initiated = null, $model_type = null, $model_visibility = null, string $contentType = self::contentTypes['genericTimeAndAttendanceGetShiftNotes'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceGetShiftNotes' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $shift_id when calling genericTimeAndAttendanceGetShiftNotes' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4179,6 +4449,11 @@ protected function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shif ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/shift/{shiftId}/notes'; $formParams = []; $queryParams = []; @@ -4187,21 +4462,42 @@ protected function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shif $multipart = false; // query params - if ($model_employee_id !== null) { - $queryParams['model.employeeId'] = ObjectSerializer::toQueryValue($model_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_employee_id, + 'model.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_is_admin_initiated !== null) { - $queryParams['model.isAdminInitiated'] = ObjectSerializer::toQueryValue($model_is_admin_initiated); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_is_admin_initiated, + 'model.isAdminInitiated', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_type !== null) { - $queryParams['model.type'] = ObjectSerializer::toQueryValue($model_type); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_type, + 'model.type', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($model_visibility !== null) { - $queryParams['model.visibility'] = ObjectSerializer::toQueryValue($model_visibility); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $model_visibility, + 'model.visibility', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($kiosk_id !== null) { @@ -4228,53 +4524,35 @@ protected function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shif ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4295,10 +4573,11 @@ protected function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shif $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4312,14 +4591,15 @@ protected function genericTimeAndAttendanceGetShiftNotesRequest($kiosk_id, $shif * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BasicKioskEmployeeModel[] + * @return \OpenAPI\Client\Model\BasicKioskEmployeeModel[] */ - public function genericTimeAndAttendanceGetStaff($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericTimeAndAttendanceGetStaff($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericTimeAndAttendanceGetStaff'][0]) { - list($response) = $this->genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location); + list($response) = $this->genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType); return $response; } @@ -4331,15 +4611,15 @@ public function genericTimeAndAttendanceGetStaff($kiosk_id, $business_id, $restr * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BasicKioskEmployeeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BasicKioskEmployeeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericTimeAndAttendanceGetStaff'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel[]'; - $request = $this->genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location); + $request = $this->genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType); try { $options = $this->createHttpClientOption(); @@ -4348,9 +4628,16 @@ public function genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $busines } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4361,19 +4648,37 @@ public function genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $busines sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4390,7 +4695,7 @@ public function genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $busines case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BasicKioskEmployeeModel[]', + '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4408,13 +4713,14 @@ public function genericTimeAndAttendanceGetStaffWithHttpInfo($kiosk_id, $busines * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceGetStaffAsync($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericTimeAndAttendanceGetStaffAsync($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericTimeAndAttendanceGetStaff'][0]) { - return $this->genericTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location) + return $this->genericTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType) ->then( function ($response) { return $response[0]; @@ -4430,24 +4736,24 @@ function ($response) { * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericTimeAndAttendanceGetStaffAsyncWithHttpInfo($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericTimeAndAttendanceGetStaff'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel[]'; - $request = $this->genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location); + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel[]'; + $request = $this->genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4470,7 +4776,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4482,18 +4788,21 @@ function ($exception) { * @param int $kiosk_id The ID of the kiosk (required) * @param string $business_id (required) * @param bool $restrict_current_shifts_to_current_kiosk_location The default value is set to false which will return current shifts for employees against this particular location. Setting the value to true will return employees shift details with access to this location. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceGetStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = 'false') + public function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_id, $restrict_current_shifts_to_current_kiosk_location = false, string $contentType = self::contentTypes['genericTimeAndAttendanceGetStaff'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceGetStaff' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -4501,6 +4810,8 @@ protected function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_ ); } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/staff'; $formParams = []; $queryParams = []; @@ -4509,9 +4820,15 @@ protected function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_ $multipart = false; // query params - if ($restrict_current_shifts_to_current_kiosk_location !== null) { - $queryParams['restrictCurrentShiftsToCurrentKioskLocation'] = ObjectSerializer::toQueryValue($restrict_current_shifts_to_current_kiosk_location); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $restrict_current_shifts_to_current_kiosk_location, + 'restrictCurrentShiftsToCurrentKioskLocation', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($kiosk_id !== null) { @@ -4530,53 +4847,35 @@ protected function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4597,10 +4896,11 @@ protected function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4611,18 +4911,19 @@ protected function genericTimeAndAttendanceGetStaffRequest($kiosk_id, $business_ * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) * @param string $shift_id shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceMarkNotesRead($model, $business_id, $kiosk_id, $shift_id) + public function genericTimeAndAttendanceMarkNotesRead($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceMarkNotesRead'][0]) { - $this->genericTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $business_id, $kiosk_id, $shift_id); + $this->genericTimeAndAttendanceMarkNotesReadWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, $contentType); } /** @@ -4630,19 +4931,19 @@ public function genericTimeAndAttendanceMarkNotesRead($model, $business_id, $kio * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $business_id, $kiosk_id, $shift_id) + public function genericTimeAndAttendanceMarkNotesReadWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceMarkNotesRead'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceMarkNotesReadRequest($model, $business_id, $kiosk_id, $shift_id); + $request = $this->genericTimeAndAttendanceMarkNotesReadRequest($business_id, $kiosk_id, $shift_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -4651,9 +4952,16 @@ public function genericTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $busin } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4664,11 +4972,11 @@ public function genericTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $busin sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -4686,17 +4994,18 @@ public function genericTimeAndAttendanceMarkNotesReadWithHttpInfo($model, $busin * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceMarkNotesReadAsync($model, $business_id, $kiosk_id, $shift_id) + public function genericTimeAndAttendanceMarkNotesReadAsync($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceMarkNotesRead'][0]) { - return $this->genericTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($model, $business_id, $kiosk_id, $shift_id) + return $this->genericTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -4709,18 +5018,19 @@ function ($response) { * * Mark Shift Notes Read * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($model, $business_id, $kiosk_id, $shift_id) + public function genericTimeAndAttendanceMarkNotesReadAsyncWithHttpInfo($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceMarkNotesRead'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceMarkNotesReadRequest($model, $business_id, $kiosk_id, $shift_id); + $request = $this->genericTimeAndAttendanceMarkNotesReadRequest($business_id, $kiosk_id, $shift_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4739,7 +5049,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -4748,34 +5058,32 @@ function ($exception) { /** * Create request for operation 'genericTimeAndAttendanceMarkNotesRead' * - * @param \Swagger\Client\Model\MarkNotesReadViewModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) * @param string $shift_id (required) + * @param \OpenAPI\Client\Model\MarkNotesReadViewModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceMarkNotesRead'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceMarkNotesReadRequest($model, $business_id, $kiosk_id, $shift_id) + public function genericTimeAndAttendanceMarkNotesReadRequest($business_id, $kiosk_id, $shift_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceMarkNotesRead'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceMarkNotesRead' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericTimeAndAttendanceMarkNotesRead' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceMarkNotesRead' ); } + // verify the required parameter 'shift_id' is set if ($shift_id === null || (is_array($shift_id) && count($shift_id) === 0)) { throw new \InvalidArgumentException( @@ -4783,6 +5091,14 @@ protected function genericTimeAndAttendanceMarkNotesReadRequest($model, $busines ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceMarkNotesRead' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/shift/{shiftId}/notes/read-state'; $formParams = []; $queryParams = []; @@ -4791,6 +5107,7 @@ protected function genericTimeAndAttendanceMarkNotesReadRequest($model, $busines $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -4816,56 +5133,42 @@ protected function genericTimeAndAttendanceMarkNotesReadRequest($model, $busines ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4886,10 +5189,11 @@ protected function genericTimeAndAttendanceMarkNotesReadRequest($model, $busines $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4901,16 +5205,17 @@ protected function genericTimeAndAttendanceMarkNotesReadRequest($model, $busines * Add an Employee * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendancePostStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\BasicKioskEmployeeModel + * @return \OpenAPI\Client\Model\BasicKioskEmployeeModel */ - public function genericTimeAndAttendancePostStaff($kiosk_id, $model, $business_id) + public function genericTimeAndAttendancePostStaff($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendancePostStaff'][0]) { - list($response) = $this->genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, $business_id); + list($response) = $this->genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $business_id, $model, $contentType); return $response; } @@ -4920,17 +5225,17 @@ public function genericTimeAndAttendancePostStaff($kiosk_id, $model, $business_i * Add an Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendancePostStaff'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\BasicKioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\BasicKioskEmployeeModel, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendancePostStaff'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel'; - $request = $this->genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $business_id); + $request = $this->genericTimeAndAttendancePostStaffRequest($kiosk_id, $business_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -4939,9 +5244,16 @@ public function genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -4952,19 +5264,37 @@ public function genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BasicKioskEmployeeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BasicKioskEmployeeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -4981,7 +5311,7 @@ public function genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\BasicKioskEmployeeModel', + '\OpenAPI\Client\Model\BasicKioskEmployeeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4997,15 +5327,16 @@ public function genericTimeAndAttendancePostStaffWithHttpInfo($kiosk_id, $model, * Add an Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendancePostStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendancePostStaffAsync($kiosk_id, $model, $business_id) + public function genericTimeAndAttendancePostStaffAsync($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendancePostStaff'][0]) { - return $this->genericTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $model, $business_id) + return $this->genericTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $business_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -5019,26 +5350,26 @@ function ($response) { * Add an Employee * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendancePostStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $model, $business_id) + public function genericTimeAndAttendancePostStaffAsyncWithHttpInfo($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendancePostStaff'][0]) { - $returnType = '\Swagger\Client\Model\BasicKioskEmployeeModel'; - $request = $this->genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $business_id); + $returnType = '\OpenAPI\Client\Model\BasicKioskEmployeeModel'; + $request = $this->genericTimeAndAttendancePostStaffRequest($kiosk_id, $business_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -5061,7 +5392,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5071,26 +5402,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendancePostStaff' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\KioskCreateEmployeeModel $model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\KioskCreateEmployeeModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendancePostStaff'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $business_id) + public function genericTimeAndAttendancePostStaffRequest($kiosk_id, $business_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendancePostStaff'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendancePostStaff' ); } - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendancePostStaff' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5098,6 +5426,14 @@ protected function genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $ ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendancePostStaff' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/staff'; $formParams = []; $queryParams = []; @@ -5106,6 +5442,7 @@ protected function genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $ $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -5123,56 +5460,42 @@ protected function genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $ ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5193,10 +5516,11 @@ protected function genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5207,17 +5531,18 @@ protected function genericTimeAndAttendancePostStaffRequest($kiosk_id, $model, $ * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model model (required) * @param string $business_id business_id (required) * @param string $kiosk_id kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceSmsReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceSmsReset($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceSmsReset($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceSmsReset'][0]) { - $this->genericTimeAndAttendanceSmsResetWithHttpInfo($model, $business_id, $kiosk_id); + $this->genericTimeAndAttendanceSmsResetWithHttpInfo($business_id, $kiosk_id, $model, $contentType); } /** @@ -5225,18 +5550,18 @@ public function genericTimeAndAttendanceSmsReset($model, $business_id, $kiosk_id * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceSmsReset'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceSmsResetWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceSmsResetWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceSmsReset'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceSmsResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceSmsResetRequest($business_id, $kiosk_id, $model, $contentType); try { $options = $this->createHttpClientOption(); @@ -5245,9 +5570,16 @@ public function genericTimeAndAttendanceSmsResetWithHttpInfo($model, $business_i } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5258,11 +5590,11 @@ public function genericTimeAndAttendanceSmsResetWithHttpInfo($model, $business_i sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5280,16 +5612,17 @@ public function genericTimeAndAttendanceSmsResetWithHttpInfo($model, $business_i * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceSmsReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceSmsResetAsync($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceSmsResetAsync($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceSmsReset'][0]) { - return $this->genericTimeAndAttendanceSmsResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + return $this->genericTimeAndAttendanceSmsResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, $contentType) ->then( function ($response) { return $response[0]; @@ -5302,17 +5635,18 @@ function ($response) { * * Send PIN Reset SMS * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceSmsReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceSmsResetAsyncWithHttpInfo($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceSmsResetAsyncWithHttpInfo($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceSmsReset'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceSmsResetRequest($model, $business_id, $kiosk_id); + $request = $this->genericTimeAndAttendanceSmsResetRequest($business_id, $kiosk_id, $model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5331,7 +5665,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5340,27 +5674,24 @@ function ($exception) { /** * Create request for operation 'genericTimeAndAttendanceSmsReset' * - * @param \Swagger\Client\Model\PinResetModel $model (required) * @param string $business_id (required) * @param string $kiosk_id (required) + * @param \OpenAPI\Client\Model\PinResetModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceSmsReset'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceSmsResetRequest($model, $business_id, $kiosk_id) + public function genericTimeAndAttendanceSmsResetRequest($business_id, $kiosk_id, $model, string $contentType = self::contentTypes['genericTimeAndAttendanceSmsReset'][0]) { - // verify the required parameter 'model' is set - if ($model === null || (is_array($model) && count($model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $model when calling genericTimeAndAttendanceSmsReset' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $business_id when calling genericTimeAndAttendanceSmsReset' ); } + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( @@ -5368,6 +5699,14 @@ protected function genericTimeAndAttendanceSmsResetRequest($model, $business_id, ); } + // verify the required parameter 'model' is set + if ($model === null || (is_array($model) && count($model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $model when calling genericTimeAndAttendanceSmsReset' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/smsreset'; $formParams = []; $queryParams = []; @@ -5376,6 +5715,7 @@ protected function genericTimeAndAttendanceSmsResetRequest($model, $business_id, $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -5393,56 +5733,42 @@ protected function genericTimeAndAttendanceSmsResetRequest($model, $business_id, ); } - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5463,10 +5789,11 @@ protected function genericTimeAndAttendanceSmsResetRequest($model, $business_id, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5478,16 +5805,17 @@ protected function genericTimeAndAttendanceSmsResetRequest($model, $business_id, * Start Break * * @param int $kiosk_id kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceStartBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function genericTimeAndAttendanceStartBreak($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceStartBreak($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceStartBreak'][0]) { - $this->genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $request, $business_id); + $this->genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $business_id, $request, $contentType); } /** @@ -5496,17 +5824,17 @@ public function genericTimeAndAttendanceStartBreak($kiosk_id, $request, $busines * Start Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceStartBreak'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceStartBreak'][0]) { - $returnType = ''; - $request = $this->genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceStartBreakRequest($kiosk_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -5515,9 +5843,16 @@ public function genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $reque } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5528,11 +5863,11 @@ public function genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $reque sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5551,15 +5886,16 @@ public function genericTimeAndAttendanceStartBreakWithHttpInfo($kiosk_id, $reque * Start Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceStartBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceStartBreakAsync($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceStartBreakAsync($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceStartBreak'][0]) { - return $this->genericTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + return $this->genericTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -5573,16 +5909,17 @@ function ($response) { * Start Break * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceStartBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function genericTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceStartBreakAsyncWithHttpInfo($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceStartBreak'][0]) { $returnType = ''; - $request = $this->genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request, $business_id); + $request = $this->genericTimeAndAttendanceStartBreakRequest($kiosk_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5601,7 +5938,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5611,26 +5948,23 @@ function ($exception) { * Create request for operation 'genericTimeAndAttendanceStartBreak' * * @param int $kiosk_id (required) - * @param \Swagger\Client\Model\StartBreakModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\StartBreakModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['genericTimeAndAttendanceStartBreak'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request, $business_id) + public function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $business_id, $request, string $contentType = self::contentTypes['genericTimeAndAttendanceStartBreak'][0]) { + // verify the required parameter 'kiosk_id' is set if ($kiosk_id === null || (is_array($kiosk_id) && count($kiosk_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $kiosk_id when calling genericTimeAndAttendanceStartBreak' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling genericTimeAndAttendanceStartBreak' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5638,6 +5972,14 @@ protected function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling genericTimeAndAttendanceStartBreak' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{kioskId}/startbreak'; $formParams = []; $queryParams = []; @@ -5646,6 +5988,7 @@ protected function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request $multipart = false; + // path params if ($kiosk_id !== null) { $resourcePath = str_replace( @@ -5663,56 +6006,42 @@ protected function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5733,10 +6062,11 @@ protected function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5749,14 +6079,15 @@ protected function genericTimeAndAttendanceStartBreakRequest($kiosk_id, $request * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function kioskDelete($id, $business_id) + public function kioskDelete($id, $business_id, string $contentType = self::contentTypes['kioskDelete'][0]) { - $this->kioskDeleteWithHttpInfo($id, $business_id); + $this->kioskDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -5766,15 +6097,15 @@ public function kioskDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function kioskDeleteWithHttpInfo($id, $business_id) + public function kioskDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['kioskDelete'][0]) { - $returnType = ''; - $request = $this->kioskDeleteRequest($id, $business_id); + $request = $this->kioskDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5783,9 +6114,16 @@ public function kioskDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -5796,11 +6134,11 @@ public function kioskDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -5820,13 +6158,14 @@ public function kioskDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskDeleteAsync($id, $business_id) + public function kioskDeleteAsync($id, $business_id, string $contentType = self::contentTypes['kioskDelete'][0]) { - return $this->kioskDeleteAsyncWithHttpInfo($id, $business_id) + return $this->kioskDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5841,14 +6180,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskDeleteAsyncWithHttpInfo($id, $business_id) + public function kioskDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['kioskDelete'][0]) { $returnType = ''; - $request = $this->kioskDeleteRequest($id, $business_id); + $request = $this->kioskDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5867,7 +6207,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -5878,18 +6218,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function kioskDeleteRequest($id, $business_id) + public function kioskDeleteRequest($id, $business_id, string $contentType = self::contentTypes['kioskDelete'][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 kioskDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -5897,6 +6240,7 @@ protected function kioskDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/kiosk/{id}'; $formParams = []; $queryParams = []; @@ -5905,6 +6249,7 @@ protected function kioskDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -5922,53 +6267,35 @@ protected function kioskDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5989,10 +6316,11 @@ protected function kioskDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6005,14 +6333,15 @@ protected function kioskDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimeAndAttendanceKioskModel + * @return \OpenAPI\Client\Model\TimeAndAttendanceKioskModel */ - public function kioskGet($id, $business_id) + public function kioskGet($id, $business_id, string $contentType = self::contentTypes['kioskGet'][0]) { - list($response) = $this->kioskGetWithHttpInfo($id, $business_id); + list($response) = $this->kioskGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -6023,15 +6352,15 @@ public function kioskGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) */ - public function kioskGetWithHttpInfo($id, $business_id) + public function kioskGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['kioskGet'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->kioskGetRequest($id, $business_id); + $request = $this->kioskGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6040,9 +6369,16 @@ public function kioskGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6053,19 +6389,37 @@ public function kioskGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6082,7 +6436,7 @@ public function kioskGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimeAndAttendanceKioskModel', + '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6099,13 +6453,14 @@ public function kioskGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskGetAsync($id, $business_id) + public function kioskGetAsync($id, $business_id, string $contentType = self::contentTypes['kioskGet'][0]) { - return $this->kioskGetAsyncWithHttpInfo($id, $business_id) + return $this->kioskGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6120,24 +6475,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskGetAsyncWithHttpInfo($id, $business_id) + public function kioskGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['kioskGet'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->kioskGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; + $request = $this->kioskGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6160,7 +6515,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6171,18 +6526,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function kioskGetRequest($id, $business_id) + public function kioskGetRequest($id, $business_id, string $contentType = self::contentTypes['kioskGet'][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 kioskGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6190,6 +6548,7 @@ protected function kioskGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/kiosk/{id}'; $formParams = []; $queryParams = []; @@ -6198,6 +6557,7 @@ protected function kioskGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -6215,53 +6575,35 @@ protected function kioskGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6282,10 +6624,11 @@ protected function kioskGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6301,14 +6644,15 @@ protected function kioskGetRequest($id, $business_id) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimeAndAttendanceKioskModel[] + * @return \OpenAPI\Client\Model\TimeAndAttendanceKioskModel[] */ - public function kioskGetAll($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function kioskGetAll($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['kioskGetAll'][0]) { - list($response) = $this->kioskGetAllWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->kioskGetAllWithHttpInfo($business_id, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -6322,15 +6666,15 @@ public function kioskGetAll($business_id, $filter = null, $orderby = null, $top * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGetAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimeAndAttendanceKioskModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimeAndAttendanceKioskModel[], HTTP status code, HTTP response headers (array of strings) */ - public function kioskGetAllWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function kioskGetAllWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['kioskGetAll'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel[]'; - $request = $this->kioskGetAllRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->kioskGetAllRequest($business_id, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -6339,9 +6683,16 @@ public function kioskGetAllWithHttpInfo($business_id, $filter = null, $orderby = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6352,19 +6703,37 @@ public function kioskGetAllWithHttpInfo($business_id, $filter = null, $orderby = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6381,7 +6750,7 @@ public function kioskGetAllWithHttpInfo($business_id, $filter = null, $orderby = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimeAndAttendanceKioskModel[]', + '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6401,13 +6770,14 @@ public function kioskGetAllWithHttpInfo($business_id, $filter = null, $orderby = * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskGetAllAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function kioskGetAllAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['kioskGetAll'][0]) { - return $this->kioskGetAllAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->kioskGetAllAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -6425,24 +6795,24 @@ function ($response) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskGetAllAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function kioskGetAllAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['kioskGetAll'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel[]'; - $request = $this->kioskGetAllRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel[]'; + $request = $this->kioskGetAllRequest($business_id, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6465,7 +6835,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6479,12 +6849,14 @@ function ($exception) { * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskGetAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function kioskGetAllRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function kioskGetAllRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['kioskGetAll'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6492,6 +6864,11 @@ protected function kioskGetAllRequest($business_id, $filter = null, $orderby = n ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/kiosk'; $formParams = []; $queryParams = []; @@ -6500,21 +6877,42 @@ protected function kioskGetAllRequest($business_id, $filter = null, $orderby = n $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -6525,53 +6923,35 @@ protected function kioskGetAllRequest($business_id, $filter = null, $orderby = n ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6592,10 +6972,11 @@ protected function kioskGetAllRequest($business_id, $filter = null, $orderby = n $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6606,16 +6987,17 @@ protected function kioskGetAllRequest($business_id, $filter = null, $orderby = n * * Create Kiosk * - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk kiosk (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimeAndAttendanceKioskModel + * @return \OpenAPI\Client\Model\TimeAndAttendanceKioskModel */ - public function kioskPost($kiosk, $business_id) + public function kioskPost($business_id, $kiosk, string $contentType = self::contentTypes['kioskPost'][0]) { - list($response) = $this->kioskPostWithHttpInfo($kiosk, $business_id); + list($response) = $this->kioskPostWithHttpInfo($business_id, $kiosk, $contentType); return $response; } @@ -6624,17 +7006,17 @@ public function kioskPost($kiosk, $business_id) * * Create Kiosk * - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) */ - public function kioskPostWithHttpInfo($kiosk, $business_id) + public function kioskPostWithHttpInfo($business_id, $kiosk, string $contentType = self::contentTypes['kioskPost'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->kioskPostRequest($kiosk, $business_id); + $request = $this->kioskPostRequest($business_id, $kiosk, $contentType); try { $options = $this->createHttpClientOption(); @@ -6643,9 +7025,16 @@ public function kioskPostWithHttpInfo($kiosk, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6656,19 +7045,37 @@ public function kioskPostWithHttpInfo($kiosk, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6685,7 +7092,7 @@ public function kioskPostWithHttpInfo($kiosk, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimeAndAttendanceKioskModel', + '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6700,15 +7107,16 @@ public function kioskPostWithHttpInfo($kiosk, $business_id) * * Create Kiosk * - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskPostAsync($kiosk, $business_id) + public function kioskPostAsync($business_id, $kiosk, string $contentType = self::contentTypes['kioskPost'][0]) { - return $this->kioskPostAsyncWithHttpInfo($kiosk, $business_id) + return $this->kioskPostAsyncWithHttpInfo($business_id, $kiosk, $contentType) ->then( function ($response) { return $response[0]; @@ -6721,26 +7129,26 @@ function ($response) { * * Create Kiosk * - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskPostAsyncWithHttpInfo($kiosk, $business_id) + public function kioskPostAsyncWithHttpInfo($business_id, $kiosk, string $contentType = self::contentTypes['kioskPost'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->kioskPostRequest($kiosk, $business_id); + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; + $request = $this->kioskPostRequest($business_id, $kiosk, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6763,7 +7171,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -6772,20 +7180,16 @@ function ($exception) { /** * Create request for operation 'kioskPost' * - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function kioskPostRequest($kiosk, $business_id) + public function kioskPostRequest($business_id, $kiosk, string $contentType = self::contentTypes['kioskPost'][0]) { - // verify the required parameter 'kiosk' is set - if ($kiosk === null || (is_array($kiosk) && count($kiosk) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $kiosk when calling kioskPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -6793,6 +7197,14 @@ protected function kioskPostRequest($kiosk, $business_id) ); } + // verify the required parameter 'kiosk' is set + if ($kiosk === null || (is_array($kiosk) && count($kiosk) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $kiosk when calling kioskPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk'; $formParams = []; $queryParams = []; @@ -6801,6 +7213,7 @@ protected function kioskPostRequest($kiosk, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -6810,56 +7223,42 @@ protected function kioskPostRequest($kiosk, $business_id) ); } - // body params - $_tempBody = null; - if (isset($kiosk)) { - $_tempBody = $kiosk; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($kiosk)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($kiosk)); + } else { + $httpBody = $kiosk; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -6880,10 +7279,11 @@ protected function kioskPostRequest($kiosk, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -6895,16 +7295,17 @@ protected function kioskPostRequest($kiosk, $business_id) * Update Kiosk * * @param int $id id (required) - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk kiosk (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\TimeAndAttendanceKioskModel + * @return \OpenAPI\Client\Model\TimeAndAttendanceKioskModel */ - public function kioskPut($id, $kiosk, $business_id) + public function kioskPut($id, $business_id, $kiosk, string $contentType = self::contentTypes['kioskPut'][0]) { - list($response) = $this->kioskPutWithHttpInfo($id, $kiosk, $business_id); + list($response) = $this->kioskPutWithHttpInfo($id, $business_id, $kiosk, $contentType); return $response; } @@ -6914,17 +7315,17 @@ public function kioskPut($id, $kiosk, $business_id) * Update Kiosk * * @param int $id (required) - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\TimeAndAttendanceKioskModel, HTTP status code, HTTP response headers (array of strings) */ - public function kioskPutWithHttpInfo($id, $kiosk, $business_id) + public function kioskPutWithHttpInfo($id, $business_id, $kiosk, string $contentType = self::contentTypes['kioskPut'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->kioskPutRequest($id, $kiosk, $business_id); + $request = $this->kioskPutRequest($id, $business_id, $kiosk, $contentType); try { $options = $this->createHttpClientOption(); @@ -6933,9 +7334,16 @@ public function kioskPutWithHttpInfo($id, $kiosk, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -6946,19 +7354,37 @@ public function kioskPutWithHttpInfo($id, $kiosk, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeAndAttendanceKioskModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -6975,7 +7401,7 @@ public function kioskPutWithHttpInfo($id, $kiosk, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\TimeAndAttendanceKioskModel', + '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6991,15 +7417,16 @@ public function kioskPutWithHttpInfo($id, $kiosk, $business_id) * Update Kiosk * * @param int $id (required) - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskPutAsync($id, $kiosk, $business_id) + public function kioskPutAsync($id, $business_id, $kiosk, string $contentType = self::contentTypes['kioskPut'][0]) { - return $this->kioskPutAsyncWithHttpInfo($id, $kiosk, $business_id) + return $this->kioskPutAsyncWithHttpInfo($id, $business_id, $kiosk, $contentType) ->then( function ($response) { return $response[0]; @@ -7013,26 +7440,26 @@ function ($response) { * Update Kiosk * * @param int $id (required) - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function kioskPutAsyncWithHttpInfo($id, $kiosk, $business_id) + public function kioskPutAsyncWithHttpInfo($id, $business_id, $kiosk, string $contentType = self::contentTypes['kioskPut'][0]) { - $returnType = '\Swagger\Client\Model\TimeAndAttendanceKioskModel'; - $request = $this->kioskPutRequest($id, $kiosk, $business_id); + $returnType = '\OpenAPI\Client\Model\TimeAndAttendanceKioskModel'; + $request = $this->kioskPutRequest($id, $business_id, $kiosk, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -7055,7 +7482,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -7065,26 +7492,23 @@ function ($exception) { * Create request for operation 'kioskPut' * * @param int $id (required) - * @param \Swagger\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\TimeAndAttendanceKioskModel $kiosk (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['kioskPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function kioskPutRequest($id, $kiosk, $business_id) + public function kioskPutRequest($id, $business_id, $kiosk, string $contentType = self::contentTypes['kioskPut'][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 kioskPut' ); } - // verify the required parameter 'kiosk' is set - if ($kiosk === null || (is_array($kiosk) && count($kiosk) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $kiosk when calling kioskPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -7092,6 +7516,14 @@ protected function kioskPutRequest($id, $kiosk, $business_id) ); } + // verify the required parameter 'kiosk' is set + if ($kiosk === null || (is_array($kiosk) && count($kiosk) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $kiosk when calling kioskPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/kiosk/{id}'; $formParams = []; $queryParams = []; @@ -7100,6 +7532,7 @@ protected function kioskPutRequest($id, $kiosk, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -7117,56 +7550,42 @@ protected function kioskPutRequest($id, $kiosk, $business_id) ); } - // body params - $_tempBody = null; - if (isset($kiosk)) { - $_tempBody = $kiosk; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($kiosk)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($kiosk)); + } else { + $httpBody = $kiosk; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -7187,10 +7606,11 @@ protected function kioskPutRequest($id, $kiosk, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/TimesheetsApi.php b/src/lib/Api/TimesheetsApi.php index 60631eb..9457881 100644 --- a/src/lib/Api/TimesheetsApi.php +++ b/src/lib/Api/TimesheetsApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auTimesheetGet' => [ + 'application/json', + ], + 'auTimesheetPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auTimesheetPostIndividual' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auTimesheetPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auTimesheetPutIndividual' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +160,15 @@ public function getConfig() * * @param int $timesheet_line_id timesheet_line_id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetDeleteIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auTimesheetDeleteIndividual($timesheet_line_id, $business_id) + public function auTimesheetDeleteIndividual($timesheet_line_id, $business_id, string $contentType = self::contentTypes['auTimesheetDeleteIndividual'][0]) { - $this->auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $business_id); + $this->auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $business_id, $contentType); } /** @@ -111,15 +178,15 @@ public function auTimesheetDeleteIndividual($timesheet_line_id, $business_id) * * @param int $timesheet_line_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetDeleteIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $business_id) + public function auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $business_id, string $contentType = self::contentTypes['auTimesheetDeleteIndividual'][0]) { - $returnType = ''; - $request = $this->auTimesheetDeleteIndividualRequest($timesheet_line_id, $business_id); + $request = $this->auTimesheetDeleteIndividualRequest($timesheet_line_id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +195,16 @@ public function auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $bus } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +215,11 @@ public function auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $bus sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +239,14 @@ public function auTimesheetDeleteIndividualWithHttpInfo($timesheet_line_id, $bus * * @param int $timesheet_line_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetDeleteIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetDeleteIndividualAsync($timesheet_line_id, $business_id) + public function auTimesheetDeleteIndividualAsync($timesheet_line_id, $business_id, string $contentType = self::contentTypes['auTimesheetDeleteIndividual'][0]) { - return $this->auTimesheetDeleteIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id) + return $this->auTimesheetDeleteIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +261,15 @@ function ($response) { * * @param int $timesheet_line_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetDeleteIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetDeleteIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id) + public function auTimesheetDeleteIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, string $contentType = self::contentTypes['auTimesheetDeleteIndividual'][0]) { $returnType = ''; - $request = $this->auTimesheetDeleteIndividualRequest($timesheet_line_id, $business_id); + $request = $this->auTimesheetDeleteIndividualRequest($timesheet_line_id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +288,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +299,21 @@ function ($exception) { * * @param int $timesheet_line_id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetDeleteIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimesheetDeleteIndividualRequest($timesheet_line_id, $business_id) + public function auTimesheetDeleteIndividualRequest($timesheet_line_id, $business_id, string $contentType = self::contentTypes['auTimesheetDeleteIndividual'][0]) { + // verify the required parameter 'timesheet_line_id' is set if ($timesheet_line_id === null || (is_array($timesheet_line_id) && count($timesheet_line_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_line_id when calling auTimesheetDeleteIndividual' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +321,7 @@ protected function auTimesheetDeleteIndividualRequest($timesheet_line_id, $busin ); } + $resourcePath = '/api/v2/business/{businessId}/timesheet/{timesheetLineId}'; $formParams = []; $queryParams = []; @@ -250,6 +330,7 @@ protected function auTimesheetDeleteIndividualRequest($timesheet_line_id, $busin $multipart = false; + // path params if ($timesheet_line_id !== null) { $resourcePath = str_replace( @@ -267,53 +348,35 @@ protected function auTimesheetDeleteIndividualRequest($timesheet_line_id, $busin ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +397,11 @@ protected function auTimesheetDeleteIndividualRequest($timesheet_line_id, $busin $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -349,18 +413,20 @@ protected function auTimesheetDeleteIndividualRequest($timesheet_line_id, $busin * Get Business Timesheets * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuTimesheetLineModel[] + * @return \OpenAPI\Client\Model\AuTimesheetLineModel[] */ - public function auTimesheetGet($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auTimesheetGet($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auTimesheetGet'][0]) { - list($response) = $this->auTimesheetGetWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auTimesheetGetWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -370,19 +436,20 @@ public function auTimesheetGet($business_id, $filter = null, $orderby = null, $t * Get Business Timesheets * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuTimesheetLineModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuTimesheetLineModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auTimesheetGetWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auTimesheetGetWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuTimesheetLineModel[]'; - $request = $this->auTimesheetGetRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auTimesheetGetRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -391,9 +458,16 @@ public function auTimesheetGetWithHttpInfo($business_id, $filter = null, $orderb } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -404,19 +478,37 @@ public function auTimesheetGetWithHttpInfo($business_id, $filter = null, $orderb sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuTimesheetLineModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuTimesheetLineModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuTimesheetLineModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuTimesheetLineModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -433,7 +525,7 @@ public function auTimesheetGetWithHttpInfo($business_id, $filter = null, $orderb case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuTimesheetLineModel[]', + '\OpenAPI\Client\Model\AuTimesheetLineModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -449,17 +541,19 @@ public function auTimesheetGetWithHttpInfo($business_id, $filter = null, $orderb * Get Business Timesheets * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetGetAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auTimesheetGetAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auTimesheetGet'][0]) { - return $this->auTimesheetGetAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auTimesheetGetAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -473,28 +567,29 @@ function ($response) { * Get Business Timesheets * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetGetAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auTimesheetGetAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auTimesheetGet'][0]) { - $returnType = '\Swagger\Client\Model\AuTimesheetLineModel[]'; - $request = $this->auTimesheetGetRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuTimesheetLineModel[]'; + $request = $this->auTimesheetGetRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -517,7 +612,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -527,16 +622,19 @@ function ($exception) { * Create request for operation 'auTimesheetGet' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimesheetGetRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auTimesheetGetRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auTimesheetGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -544,6 +642,12 @@ protected function auTimesheetGetRequest($business_id, $filter = null, $orderby ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/timesheet'; $formParams = []; $queryParams = []; @@ -552,20 +656,45 @@ protected function auTimesheetGetRequest($business_id, $filter = null, $orderby $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -577,53 +706,35 @@ protected function auTimesheetGetRequest($business_id, $filter = null, $orderby ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -644,10 +755,11 @@ protected function auTimesheetGetRequest($business_id, $filter = null, $orderby $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -658,16 +770,17 @@ protected function auTimesheetGetRequest($business_id, $filter = null, $orderby * * Bulk Insert Timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSubmitTimesheetsResponse + * @return \OpenAPI\Client\Model\AuSubmitTimesheetsResponse */ - public function auTimesheetPost($request, $business_id) + public function auTimesheetPost($business_id, $request, string $contentType = self::contentTypes['auTimesheetPost'][0]) { - list($response) = $this->auTimesheetPostWithHttpInfo($request, $business_id); + list($response) = $this->auTimesheetPostWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -676,17 +789,17 @@ public function auTimesheetPost($request, $business_id) * * Bulk Insert Timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSubmitTimesheetsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSubmitTimesheetsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auTimesheetPostWithHttpInfo($request, $business_id) + public function auTimesheetPostWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auTimesheetPost'][0]) { - $returnType = '\Swagger\Client\Model\AuSubmitTimesheetsResponse'; - $request = $this->auTimesheetPostRequest($request, $business_id); + $request = $this->auTimesheetPostRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -695,9 +808,16 @@ public function auTimesheetPostWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -708,19 +828,37 @@ public function auTimesheetPostWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSubmitTimesheetsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSubmitTimesheetsResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -737,7 +875,7 @@ public function auTimesheetPostWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSubmitTimesheetsResponse', + '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -752,15 +890,16 @@ public function auTimesheetPostWithHttpInfo($request, $business_id) * * Bulk Insert Timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPostAsync($request, $business_id) + public function auTimesheetPostAsync($business_id, $request, string $contentType = self::contentTypes['auTimesheetPost'][0]) { - return $this->auTimesheetPostAsyncWithHttpInfo($request, $business_id) + return $this->auTimesheetPostAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -773,26 +912,26 @@ function ($response) { * * Bulk Insert Timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPostAsyncWithHttpInfo($request, $business_id) + public function auTimesheetPostAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auTimesheetPost'][0]) { - $returnType = '\Swagger\Client\Model\AuSubmitTimesheetsResponse'; - $request = $this->auTimesheetPostRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse'; + $request = $this->auTimesheetPostRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -815,7 +954,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -824,20 +963,16 @@ function ($exception) { /** * Create request for operation 'auTimesheetPost' * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimesheetPostRequest($request, $business_id) + public function auTimesheetPostRequest($business_id, $request, string $contentType = self::contentTypes['auTimesheetPost'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auTimesheetPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -845,6 +980,14 @@ protected function auTimesheetPostRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auTimesheetPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/timesheet/bulk'; $formParams = []; $queryParams = []; @@ -853,6 +996,7 @@ protected function auTimesheetPostRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -862,56 +1006,42 @@ protected function auTimesheetPostRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -932,10 +1062,11 @@ protected function auTimesheetPostRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -946,16 +1077,17 @@ protected function auTimesheetPostRequest($request, $business_id) * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPostIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auTimesheetPostIndividual($request, $business_id) + public function auTimesheetPostIndividual($business_id, $request, string $contentType = self::contentTypes['auTimesheetPostIndividual'][0]) { - list($response) = $this->auTimesheetPostIndividualWithHttpInfo($request, $business_id); + list($response) = $this->auTimesheetPostIndividualWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -964,17 +1096,17 @@ public function auTimesheetPostIndividual($request, $business_id) * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPostIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auTimesheetPostIndividualWithHttpInfo($request, $business_id) + public function auTimesheetPostIndividualWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auTimesheetPostIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auTimesheetPostIndividualRequest($request, $business_id); + $request = $this->auTimesheetPostIndividualRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -983,9 +1115,16 @@ public function auTimesheetPostIndividualWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -996,19 +1135,37 @@ public function auTimesheetPostIndividualWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1025,7 +1182,7 @@ public function auTimesheetPostIndividualWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1040,15 +1197,16 @@ public function auTimesheetPostIndividualWithHttpInfo($request, $business_id) * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPostIndividualAsync($request, $business_id) + public function auTimesheetPostIndividualAsync($business_id, $request, string $contentType = self::contentTypes['auTimesheetPostIndividual'][0]) { - return $this->auTimesheetPostIndividualAsyncWithHttpInfo($request, $business_id) + return $this->auTimesheetPostIndividualAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -1061,26 +1219,26 @@ function ($response) { * * Create timesheet line * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPostIndividualAsyncWithHttpInfo($request, $business_id) + public function auTimesheetPostIndividualAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auTimesheetPostIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auTimesheetPostIndividualRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auTimesheetPostIndividualRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1103,7 +1261,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1112,20 +1270,16 @@ function ($exception) { /** * Create request for operation 'auTimesheetPostIndividual' * - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPostIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimesheetPostIndividualRequest($request, $business_id) + public function auTimesheetPostIndividualRequest($business_id, $request, string $contentType = self::contentTypes['auTimesheetPostIndividual'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auTimesheetPostIndividual' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1133,6 +1287,14 @@ protected function auTimesheetPostIndividualRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auTimesheetPostIndividual' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/timesheet'; $formParams = []; $queryParams = []; @@ -1141,6 +1303,7 @@ protected function auTimesheetPostIndividualRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1150,56 +1313,42 @@ protected function auTimesheetPostIndividualRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1220,10 +1369,11 @@ protected function auTimesheetPostIndividualRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1234,16 +1384,17 @@ protected function auTimesheetPostIndividualRequest($request, $business_id) * * Update/Replace timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuSubmitTimesheetsResponse + * @return \OpenAPI\Client\Model\AuSubmitTimesheetsResponse */ - public function auTimesheetPut($request, $business_id) + public function auTimesheetPut($business_id, $request, string $contentType = self::contentTypes['auTimesheetPut'][0]) { - list($response) = $this->auTimesheetPutWithHttpInfo($request, $business_id); + list($response) = $this->auTimesheetPutWithHttpInfo($business_id, $request, $contentType); return $response; } @@ -1252,17 +1403,17 @@ public function auTimesheetPut($request, $business_id) * * Update/Replace timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuSubmitTimesheetsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuSubmitTimesheetsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function auTimesheetPutWithHttpInfo($request, $business_id) + public function auTimesheetPutWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auTimesheetPut'][0]) { - $returnType = '\Swagger\Client\Model\AuSubmitTimesheetsResponse'; - $request = $this->auTimesheetPutRequest($request, $business_id); + $request = $this->auTimesheetPutRequest($business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -1271,9 +1422,16 @@ public function auTimesheetPutWithHttpInfo($request, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1284,19 +1442,37 @@ public function auTimesheetPutWithHttpInfo($request, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuSubmitTimesheetsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuSubmitTimesheetsResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1313,7 +1489,7 @@ public function auTimesheetPutWithHttpInfo($request, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuSubmitTimesheetsResponse', + '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1328,15 +1504,16 @@ public function auTimesheetPutWithHttpInfo($request, $business_id) * * Update/Replace timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPutAsync($request, $business_id) + public function auTimesheetPutAsync($business_id, $request, string $contentType = self::contentTypes['auTimesheetPut'][0]) { - return $this->auTimesheetPutAsyncWithHttpInfo($request, $business_id) + return $this->auTimesheetPutAsyncWithHttpInfo($business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -1349,26 +1526,26 @@ function ($response) { * * Update/Replace timesheets * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPutAsyncWithHttpInfo($request, $business_id) + public function auTimesheetPutAsyncWithHttpInfo($business_id, $request, string $contentType = self::contentTypes['auTimesheetPut'][0]) { - $returnType = '\Swagger\Client\Model\AuSubmitTimesheetsResponse'; - $request = $this->auTimesheetPutRequest($request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuSubmitTimesheetsResponse'; + $request = $this->auTimesheetPutRequest($business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1391,7 +1568,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1400,20 +1577,16 @@ function ($exception) { /** * Create request for operation 'auTimesheetPut' * - * @param \Swagger\Client\Model\AuSubmitTimesheetsRequest $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuSubmitTimesheetsRequest $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimesheetPutRequest($request, $business_id) + public function auTimesheetPutRequest($business_id, $request, string $contentType = self::contentTypes['auTimesheetPut'][0]) { - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auTimesheetPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1421,6 +1594,14 @@ protected function auTimesheetPutRequest($request, $business_id) ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auTimesheetPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/timesheet/bulk'; $formParams = []; $queryParams = []; @@ -1429,6 +1610,7 @@ protected function auTimesheetPutRequest($request, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1438,56 +1620,42 @@ protected function auTimesheetPutRequest($request, $business_id) ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1508,10 +1676,11 @@ protected function auTimesheetPutRequest($request, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1523,16 +1692,17 @@ protected function auTimesheetPutRequest($request, $business_id) * Update timesheet line * * @param int $timesheet_line_id timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request request (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPutIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuIndividualTimesheetLineModel + * @return \OpenAPI\Client\Model\AuIndividualTimesheetLineModel */ - public function auTimesheetPutIndividual($timesheet_line_id, $request, $business_id) + public function auTimesheetPutIndividual($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auTimesheetPutIndividual'][0]) { - list($response) = $this->auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $request, $business_id); + list($response) = $this->auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $business_id, $request, $contentType); return $response; } @@ -1542,17 +1712,17 @@ public function auTimesheetPutIndividual($timesheet_line_id, $request, $business * Update timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPutIndividual'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuIndividualTimesheetLineModel, HTTP status code, HTTP response headers (array of strings) */ - public function auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $request, $business_id) + public function auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auTimesheetPutIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auTimesheetPutIndividualRequest($timesheet_line_id, $request, $business_id); + $request = $this->auTimesheetPutIndividualRequest($timesheet_line_id, $business_id, $request, $contentType); try { $options = $this->createHttpClientOption(); @@ -1561,9 +1731,16 @@ public function auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $reques } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1574,19 +1751,37 @@ public function auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $reques sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuIndividualTimesheetLineModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1603,7 +1798,7 @@ public function auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $reques case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuIndividualTimesheetLineModel', + '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1619,15 +1814,16 @@ public function auTimesheetPutIndividualWithHttpInfo($timesheet_line_id, $reques * Update timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPutIndividualAsync($timesheet_line_id, $request, $business_id) + public function auTimesheetPutIndividualAsync($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auTimesheetPutIndividual'][0]) { - return $this->auTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $request, $business_id) + return $this->auTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $request, $contentType) ->then( function ($response) { return $response[0]; @@ -1641,26 +1837,26 @@ function ($response) { * Update timesheet line * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $request, $business_id) + public function auTimesheetPutIndividualAsyncWithHttpInfo($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auTimesheetPutIndividual'][0]) { - $returnType = '\Swagger\Client\Model\AuIndividualTimesheetLineModel'; - $request = $this->auTimesheetPutIndividualRequest($timesheet_line_id, $request, $business_id); + $returnType = '\OpenAPI\Client\Model\AuIndividualTimesheetLineModel'; + $request = $this->auTimesheetPutIndividualRequest($timesheet_line_id, $business_id, $request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1683,7 +1879,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1693,26 +1889,23 @@ function ($exception) { * Create request for operation 'auTimesheetPutIndividual' * * @param int $timesheet_line_id (required) - * @param \Swagger\Client\Model\AuIndividualTimesheetLineModel $request (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuIndividualTimesheetLineModel $request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auTimesheetPutIndividual'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auTimesheetPutIndividualRequest($timesheet_line_id, $request, $business_id) + public function auTimesheetPutIndividualRequest($timesheet_line_id, $business_id, $request, string $contentType = self::contentTypes['auTimesheetPutIndividual'][0]) { + // verify the required parameter 'timesheet_line_id' is set if ($timesheet_line_id === null || (is_array($timesheet_line_id) && count($timesheet_line_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $timesheet_line_id when calling auTimesheetPutIndividual' ); } - // verify the required parameter 'request' is set - if ($request === null || (is_array($request) && count($request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $request when calling auTimesheetPutIndividual' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1720,6 +1913,14 @@ protected function auTimesheetPutIndividualRequest($timesheet_line_id, $request, ); } + // verify the required parameter 'request' is set + if ($request === null || (is_array($request) && count($request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling auTimesheetPutIndividual' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/timesheet/{timesheetLineId}'; $formParams = []; $queryParams = []; @@ -1728,6 +1929,7 @@ protected function auTimesheetPutIndividualRequest($timesheet_line_id, $request, $multipart = false; + // path params if ($timesheet_line_id !== null) { $resourcePath = str_replace( @@ -1745,56 +1947,42 @@ protected function auTimesheetPutIndividualRequest($timesheet_line_id, $request, ); } - // body params - $_tempBody = null; - if (isset($request)) { - $_tempBody = $request; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request)); + } else { + $httpBody = $request; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1815,10 +2003,11 @@ protected function auTimesheetPutIndividualRequest($timesheet_line_id, $request, $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/UnavailabilityApi.php b/src/lib/Api/UnavailabilityApi.php index 548508a..604fb85 100644 --- a/src/lib/Api/UnavailabilityApi.php +++ b/src/lib/Api/UnavailabilityApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'unavailabilityGet' => [ + 'application/json', + ], + 'unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById' => [ + 'application/json', + ], + 'unavailabilityPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'unavailabilityPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function unavailabilityDelete($id, $business_id) + public function unavailabilityDelete($id, $business_id, string $contentType = self::contentTypes['unavailabilityDelete'][0]) { - $this->unavailabilityDeleteWithHttpInfo($id, $business_id); + $this->unavailabilityDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function unavailabilityDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function unavailabilityDeleteWithHttpInfo($id, $business_id) + public function unavailabilityDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['unavailabilityDelete'][0]) { - $returnType = ''; - $request = $this->unavailabilityDeleteRequest($id, $business_id); + $request = $this->unavailabilityDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function unavailabilityDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function unavailabilityDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function unavailabilityDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityDeleteAsync($id, $business_id) + public function unavailabilityDeleteAsync($id, $business_id, string $contentType = self::contentTypes['unavailabilityDelete'][0]) { - return $this->unavailabilityDeleteAsyncWithHttpInfo($id, $business_id) + return $this->unavailabilityDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityDeleteAsyncWithHttpInfo($id, $business_id) + public function unavailabilityDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['unavailabilityDelete'][0]) { $returnType = ''; - $request = $this->unavailabilityDeleteRequest($id, $business_id); + $request = $this->unavailabilityDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function unavailabilityDeleteRequest($id, $business_id) + public function unavailabilityDeleteRequest($id, $business_id, string $contentType = self::contentTypes['unavailabilityDelete'][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 unavailabilityDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function unavailabilityDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/unavailability/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function unavailabilityDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function unavailabilityDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function unavailabilityDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -349,18 +402,19 @@ protected function unavailabilityDeleteRequest($id, $business_id) * List Unavailabilities * * @param string $business_id business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_default_location_id (optional) + * @param \DateTime $filter_from_date filter_from_date (optional) + * @param \DateTime $filter_to_date filter_to_date (optional) + * @param int $filter_employee_id filter_employee_id (optional) + * @param int $filter_default_location_id filter_default_location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\UnavailabilityModel[] + * @return \OpenAPI\Client\Model\UnavailabilityModel[] */ - public function unavailabilityGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null) + public function unavailabilityGet($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null, string $contentType = self::contentTypes['unavailabilityGet'][0]) { - list($response) = $this->unavailabilityGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id); + list($response) = $this->unavailabilityGetWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id, $contentType); return $response; } @@ -370,19 +424,19 @@ public function unavailabilityGet($business_id, $filter_from_date = null, $filte * List Unavailabilities * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_default_location_id (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_default_location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\UnavailabilityModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\UnavailabilityModel[], HTTP status code, HTTP response headers (array of strings) */ - public function unavailabilityGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null) + public function unavailabilityGetWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null, string $contentType = self::contentTypes['unavailabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\UnavailabilityModel[]'; - $request = $this->unavailabilityGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id); + $request = $this->unavailabilityGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -391,9 +445,16 @@ public function unavailabilityGetWithHttpInfo($business_id, $filter_from_date = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -404,19 +465,37 @@ public function unavailabilityGetWithHttpInfo($business_id, $filter_from_date = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\UnavailabilityModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\UnavailabilityModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UnavailabilityModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\UnavailabilityModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -433,7 +512,7 @@ public function unavailabilityGetWithHttpInfo($business_id, $filter_from_date = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\UnavailabilityModel[]', + '\OpenAPI\Client\Model\UnavailabilityModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -449,17 +528,18 @@ public function unavailabilityGetWithHttpInfo($business_id, $filter_from_date = * List Unavailabilities * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_default_location_id (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_default_location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null) + public function unavailabilityGetAsync($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null, string $contentType = self::contentTypes['unavailabilityGet'][0]) { - return $this->unavailabilityGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id) + return $this->unavailabilityGetAsyncWithHttpInfo($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id, $contentType) ->then( function ($response) { return $response[0]; @@ -473,28 +553,28 @@ function ($response) { * List Unavailabilities * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_default_location_id (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_default_location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null) + public function unavailabilityGetAsyncWithHttpInfo($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null, string $contentType = self::contentTypes['unavailabilityGet'][0]) { - $returnType = '\Swagger\Client\Model\UnavailabilityModel[]'; - $request = $this->unavailabilityGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id); + $returnType = '\OpenAPI\Client\Model\UnavailabilityModel[]'; + $request = $this->unavailabilityGetRequest($business_id, $filter_from_date, $filter_to_date, $filter_employee_id, $filter_default_location_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -517,7 +597,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -527,16 +607,18 @@ function ($exception) { * Create request for operation 'unavailabilityGet' * * @param string $business_id (required) - * @param \DateTime $filter_from_date (optional) - * @param \DateTime $filter_to_date (optional) - * @param int $filter_employee_id (optional) - * @param int $filter_default_location_id (optional) + * @param \DateTime $filter_from_date (optional) + * @param \DateTime $filter_to_date (optional) + * @param int $filter_employee_id (optional) + * @param int $filter_default_location_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function unavailabilityGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null) + public function unavailabilityGetRequest($business_id, $filter_from_date = null, $filter_to_date = null, $filter_employee_id = null, $filter_default_location_id = null, string $contentType = self::contentTypes['unavailabilityGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -544,6 +626,11 @@ protected function unavailabilityGetRequest($business_id, $filter_from_date = nu ); } + + + + + $resourcePath = '/api/v2/business/{businessId}/unavailability'; $formParams = []; $queryParams = []; @@ -552,21 +639,42 @@ protected function unavailabilityGetRequest($business_id, $filter_from_date = nu $multipart = false; // query params - if ($filter_from_date !== null) { - $queryParams['filter.fromDate'] = ObjectSerializer::toQueryValue($filter_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_from_date, + 'filter.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_to_date !== null) { - $queryParams['filter.toDate'] = ObjectSerializer::toQueryValue($filter_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_to_date, + 'filter.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_employee_id !== null) { - $queryParams['filter.employeeId'] = ObjectSerializer::toQueryValue($filter_employee_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_employee_id, + 'filter.employeeId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($filter_default_location_id !== null) { - $queryParams['filter.defaultLocationId'] = ObjectSerializer::toQueryValue($filter_default_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter_default_location_id, + 'filter.defaultLocationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($business_id !== null) { @@ -577,53 +685,35 @@ protected function unavailabilityGetRequest($business_id, $filter_from_date = nu ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -644,10 +734,11 @@ protected function unavailabilityGetRequest($business_id, $filter_from_date = nu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -660,14 +751,15 @@ protected function unavailabilityGetRequest($business_id, $filter_from_date = nu * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\UnavailabilityModel + * @return \OpenAPI\Client\Model\UnavailabilityModel */ - public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById($id, $business_id) + public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById($id, $business_id, string $contentType = self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'][0]) { - list($response) = $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWithHttpInfo($id, $business_id); + list($response) = $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -678,15 +770,15 @@ public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById($id * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\UnavailabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\UnavailabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWithHttpInfo($id, $business_id) + public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'][0]) { - $returnType = '\Swagger\Client\Model\UnavailabilityModel'; - $request = $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdRequest($id, $business_id); + $request = $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -695,9 +787,16 @@ public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWith } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -708,19 +807,37 @@ public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWith sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\UnavailabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\UnavailabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UnavailabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\UnavailabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -737,7 +854,7 @@ public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWith case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\UnavailabilityModel', + '\OpenAPI\Client\Model\UnavailabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -754,13 +871,14 @@ public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdWith * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdAsync($id, $business_id) + public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdAsync($id, $business_id, string $contentType = self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'][0]) { - return $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdAsyncWithHttpInfo($id, $business_id) + return $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -775,24 +893,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdAsyncWithHttpInfo($id, $business_id) + public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'][0]) { - $returnType = '\Swagger\Client\Model\UnavailabilityModel'; - $request = $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\UnavailabilityModel'; + $request = $this->unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -815,7 +933,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -826,18 +944,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdRequest($id, $business_id) + public function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdRequest($id, $business_id, string $contentType = self::contentTypes['unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById'][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 unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityById' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -845,6 +966,7 @@ protected function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdR ); } + $resourcePath = '/api/v2/business/{businessId}/unavailability/{id}'; $formParams = []; $queryParams = []; @@ -853,6 +975,7 @@ protected function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdR $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -870,53 +993,35 @@ protected function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdR ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1042,11 @@ protected function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdR $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1057,17 @@ protected function unavailabilityGetApiV2BusinessByBusinessIdUnavailabilityByIdR * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model unavailability_save_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\UnavailabilityModel + * @return \OpenAPI\Client\Model\UnavailabilityModel */ - public function unavailabilityPost($unavailability_save_model, $business_id) + public function unavailabilityPost($business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPost'][0]) { - list($response) = $this->unavailabilityPostWithHttpInfo($unavailability_save_model, $business_id); + list($response) = $this->unavailabilityPostWithHttpInfo($business_id, $unavailability_save_model, $contentType); return $response; } @@ -969,17 +1076,17 @@ public function unavailabilityPost($unavailability_save_model, $business_id) * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\UnavailabilityModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\UnavailabilityModel, HTTP status code, HTTP response headers (array of strings) */ - public function unavailabilityPostWithHttpInfo($unavailability_save_model, $business_id) + public function unavailabilityPostWithHttpInfo($business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPost'][0]) { - $returnType = '\Swagger\Client\Model\UnavailabilityModel'; - $request = $this->unavailabilityPostRequest($unavailability_save_model, $business_id); + $request = $this->unavailabilityPostRequest($business_id, $unavailability_save_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1095,16 @@ public function unavailabilityPostWithHttpInfo($unavailability_save_model, $busi } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1115,37 @@ public function unavailabilityPostWithHttpInfo($unavailability_save_model, $busi sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\UnavailabilityModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\UnavailabilityModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UnavailabilityModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\UnavailabilityModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1162,7 @@ public function unavailabilityPostWithHttpInfo($unavailability_save_model, $busi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\UnavailabilityModel', + '\OpenAPI\Client\Model\UnavailabilityModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1177,16 @@ public function unavailabilityPostWithHttpInfo($unavailability_save_model, $busi * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityPostAsync($unavailability_save_model, $business_id) + public function unavailabilityPostAsync($business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPost'][0]) { - return $this->unavailabilityPostAsyncWithHttpInfo($unavailability_save_model, $business_id) + return $this->unavailabilityPostAsyncWithHttpInfo($business_id, $unavailability_save_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1199,26 @@ function ($response) { * * Create Unavailability * - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityPostAsyncWithHttpInfo($unavailability_save_model, $business_id) + public function unavailabilityPostAsyncWithHttpInfo($business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPost'][0]) { - $returnType = '\Swagger\Client\Model\UnavailabilityModel'; - $request = $this->unavailabilityPostRequest($unavailability_save_model, $business_id); + $returnType = '\OpenAPI\Client\Model\UnavailabilityModel'; + $request = $this->unavailabilityPostRequest($business_id, $unavailability_save_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1241,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1250,16 @@ function ($exception) { /** * Create request for operation 'unavailabilityPost' * - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function unavailabilityPostRequest($unavailability_save_model, $business_id) + public function unavailabilityPostRequest($business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPost'][0]) { - // verify the required parameter 'unavailability_save_model' is set - if ($unavailability_save_model === null || (is_array($unavailability_save_model) && count($unavailability_save_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $unavailability_save_model when calling unavailabilityPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1267,14 @@ protected function unavailabilityPostRequest($unavailability_save_model, $busine ); } + // verify the required parameter 'unavailability_save_model' is set + if ($unavailability_save_model === null || (is_array($unavailability_save_model) && count($unavailability_save_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $unavailability_save_model when calling unavailabilityPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/unavailability'; $formParams = []; $queryParams = []; @@ -1146,6 +1283,7 @@ protected function unavailabilityPostRequest($unavailability_save_model, $busine $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1293,42 @@ protected function unavailabilityPostRequest($unavailability_save_model, $busine ); } - // body params - $_tempBody = null; - if (isset($unavailability_save_model)) { - $_tempBody = $unavailability_save_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($unavailability_save_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unavailability_save_model)); + } else { + $httpBody = $unavailability_save_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1349,11 @@ protected function unavailabilityPostRequest($unavailability_save_model, $busine $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1365,17 @@ protected function unavailabilityPostRequest($unavailability_save_model, $busine * Update Unavailability * * @param int $id id (required) - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model unavailability_save_model (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function unavailabilityPut($id, $unavailability_save_model, $business_id) + public function unavailabilityPut($id, $business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPut'][0]) { - $this->unavailabilityPutWithHttpInfo($id, $unavailability_save_model, $business_id); + $this->unavailabilityPutWithHttpInfo($id, $business_id, $unavailability_save_model, $contentType); } /** @@ -1258,17 +1384,17 @@ public function unavailabilityPut($id, $unavailability_save_model, $business_id) * Update Unavailability * * @param int $id (required) - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function unavailabilityPutWithHttpInfo($id, $unavailability_save_model, $business_id) + public function unavailabilityPutWithHttpInfo($id, $business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPut'][0]) { - $returnType = ''; - $request = $this->unavailabilityPutRequest($id, $unavailability_save_model, $business_id); + $request = $this->unavailabilityPutRequest($id, $business_id, $unavailability_save_model, $contentType); try { $options = $this->createHttpClientOption(); @@ -1277,9 +1403,16 @@ public function unavailabilityPutWithHttpInfo($id, $unavailability_save_model, $ } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1290,11 +1423,11 @@ public function unavailabilityPutWithHttpInfo($id, $unavailability_save_model, $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -1313,15 +1446,16 @@ public function unavailabilityPutWithHttpInfo($id, $unavailability_save_model, $ * Update Unavailability * * @param int $id (required) - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityPutAsync($id, $unavailability_save_model, $business_id) + public function unavailabilityPutAsync($id, $business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPut'][0]) { - return $this->unavailabilityPutAsyncWithHttpInfo($id, $unavailability_save_model, $business_id) + return $this->unavailabilityPutAsyncWithHttpInfo($id, $business_id, $unavailability_save_model, $contentType) ->then( function ($response) { return $response[0]; @@ -1335,16 +1469,17 @@ function ($response) { * Update Unavailability * * @param int $id (required) - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unavailabilityPutAsyncWithHttpInfo($id, $unavailability_save_model, $business_id) + public function unavailabilityPutAsyncWithHttpInfo($id, $business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPut'][0]) { $returnType = ''; - $request = $this->unavailabilityPutRequest($id, $unavailability_save_model, $business_id); + $request = $this->unavailabilityPutRequest($id, $business_id, $unavailability_save_model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1363,7 +1498,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1373,26 +1508,23 @@ function ($exception) { * Create request for operation 'unavailabilityPut' * * @param int $id (required) - * @param \Swagger\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\UnavailabilitySaveModel $unavailability_save_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unavailabilityPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function unavailabilityPutRequest($id, $unavailability_save_model, $business_id) + public function unavailabilityPutRequest($id, $business_id, $unavailability_save_model, string $contentType = self::contentTypes['unavailabilityPut'][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 unavailabilityPut' ); } - // verify the required parameter 'unavailability_save_model' is set - if ($unavailability_save_model === null || (is_array($unavailability_save_model) && count($unavailability_save_model) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $unavailability_save_model when calling unavailabilityPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1400,6 +1532,14 @@ protected function unavailabilityPutRequest($id, $unavailability_save_model, $bu ); } + // verify the required parameter 'unavailability_save_model' is set + if ($unavailability_save_model === null || (is_array($unavailability_save_model) && count($unavailability_save_model) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $unavailability_save_model when calling unavailabilityPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/unavailability/{id}'; $formParams = []; $queryParams = []; @@ -1408,6 +1548,7 @@ protected function unavailabilityPutRequest($id, $unavailability_save_model, $bu $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1425,56 +1566,42 @@ protected function unavailabilityPutRequest($id, $unavailability_save_model, $bu ); } - // body params - $_tempBody = null; - if (isset($unavailability_save_model)) { - $_tempBody = $unavailability_save_model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($unavailability_save_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unavailability_save_model)); + } else { + $httpBody = $unavailability_save_model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1495,10 +1622,11 @@ protected function unavailabilityPutRequest($id, $unavailability_save_model, $bu $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/UserApi.php b/src/lib/Api/UserApi.php index ebee40e..36e84ad 100644 --- a/src/lib/Api/UserApi.php +++ b/src/lib/Api/UserApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'userPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'userPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -92,14 +141,15 @@ public function getConfig() * * Get User Details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\UserModel + * @return \OpenAPI\Client\Model\UserModel */ - public function userGet() + public function userGet(string $contentType = self::contentTypes['userGet'][0]) { - list($response) = $this->userGetWithHttpInfo(); + list($response) = $this->userGetWithHttpInfo($contentType); return $response; } @@ -108,15 +158,15 @@ public function userGet() * * Get User Details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\UserModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\UserModel, HTTP status code, HTTP response headers (array of strings) */ - public function userGetWithHttpInfo() + public function userGetWithHttpInfo(string $contentType = self::contentTypes['userGet'][0]) { - $returnType = '\Swagger\Client\Model\UserModel'; - $request = $this->userGetRequest(); + $request = $this->userGetRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -125,9 +175,16 @@ public function userGetWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -138,19 +195,37 @@ public function userGetWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\UserModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\UserModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UserModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\UserModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -167,7 +242,7 @@ public function userGetWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\UserModel', + '\OpenAPI\Client\Model\UserModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -182,13 +257,14 @@ public function userGetWithHttpInfo() * * Get User Details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userGetAsync() + public function userGetAsync(string $contentType = self::contentTypes['userGet'][0]) { - return $this->userGetAsyncWithHttpInfo() + return $this->userGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -201,24 +277,24 @@ function ($response) { * * Get User Details * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userGetAsyncWithHttpInfo() + public function userGetAsyncWithHttpInfo(string $contentType = self::contentTypes['userGet'][0]) { - $returnType = '\Swagger\Client\Model\UserModel'; - $request = $this->userGetRequest(); + $returnType = '\OpenAPI\Client\Model\UserModel'; + $request = $this->userGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -241,7 +317,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -250,13 +326,15 @@ function ($exception) { /** * Create request for operation 'userGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function userGetRequest() + public function userGetRequest(string $contentType = self::contentTypes['userGet'][0]) { + $resourcePath = '/api/v2/user'; $formParams = []; $queryParams = []; @@ -266,53 +344,36 @@ protected function userGetRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -333,10 +394,11 @@ protected function userGetRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -347,15 +409,16 @@ protected function userGetRequest() * * Create New User * - * @param \Swagger\Client\Model\NewUserModel $model model (required) + * @param \OpenAPI\Client\Model\NewUserModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\NewUserCreatedModel + * @return \OpenAPI\Client\Model\NewUserCreatedModel */ - public function userPost($model) + public function userPost($model, string $contentType = self::contentTypes['userPost'][0]) { - list($response) = $this->userPostWithHttpInfo($model); + list($response) = $this->userPostWithHttpInfo($model, $contentType); return $response; } @@ -364,16 +427,16 @@ public function userPost($model) * * Create New User * - * @param \Swagger\Client\Model\NewUserModel $model (required) + * @param \OpenAPI\Client\Model\NewUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\NewUserCreatedModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\NewUserCreatedModel, HTTP status code, HTTP response headers (array of strings) */ - public function userPostWithHttpInfo($model) + public function userPostWithHttpInfo($model, string $contentType = self::contentTypes['userPost'][0]) { - $returnType = '\Swagger\Client\Model\NewUserCreatedModel'; - $request = $this->userPostRequest($model); + $request = $this->userPostRequest($model, $contentType); try { $options = $this->createHttpClientOption(); @@ -382,9 +445,16 @@ public function userPostWithHttpInfo($model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -395,19 +465,37 @@ public function userPostWithHttpInfo($model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\NewUserCreatedModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\NewUserCreatedModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\NewUserCreatedModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\NewUserCreatedModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -424,7 +512,7 @@ public function userPostWithHttpInfo($model) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\NewUserCreatedModel', + '\OpenAPI\Client\Model\NewUserCreatedModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -439,14 +527,15 @@ public function userPostWithHttpInfo($model) * * Create New User * - * @param \Swagger\Client\Model\NewUserModel $model (required) + * @param \OpenAPI\Client\Model\NewUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userPostAsync($model) + public function userPostAsync($model, string $contentType = self::contentTypes['userPost'][0]) { - return $this->userPostAsyncWithHttpInfo($model) + return $this->userPostAsyncWithHttpInfo($model, $contentType) ->then( function ($response) { return $response[0]; @@ -459,25 +548,25 @@ function ($response) { * * Create New User * - * @param \Swagger\Client\Model\NewUserModel $model (required) + * @param \OpenAPI\Client\Model\NewUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userPostAsyncWithHttpInfo($model) + public function userPostAsyncWithHttpInfo($model, string $contentType = self::contentTypes['userPost'][0]) { - $returnType = '\Swagger\Client\Model\NewUserCreatedModel'; - $request = $this->userPostRequest($model); + $returnType = '\OpenAPI\Client\Model\NewUserCreatedModel'; + $request = $this->userPostRequest($model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -500,7 +589,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -509,13 +598,15 @@ function ($exception) { /** * Create request for operation 'userPost' * - * @param \Swagger\Client\Model\NewUserModel $model (required) + * @param \OpenAPI\Client\Model\NewUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function userPostRequest($model) + public function userPostRequest($model, string $contentType = self::contentTypes['userPost'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -523,6 +614,7 @@ protected function userPostRequest($model) ); } + $resourcePath = '/api/v2/user'; $formParams = []; $queryParams = []; @@ -532,56 +624,43 @@ protected function userPostRequest($model) - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -602,10 +681,11 @@ protected function userPostRequest($model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -616,15 +696,16 @@ protected function userPostRequest($model) * * Update User * - * @param \Swagger\Client\Model\UpdateUserModel $model model (required) + * @param \OpenAPI\Client\Model\UpdateUserModel $model model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\UserUpdatedModel + * @return \OpenAPI\Client\Model\UserUpdatedModel */ - public function userPut($model) + public function userPut($model, string $contentType = self::contentTypes['userPut'][0]) { - list($response) = $this->userPutWithHttpInfo($model); + list($response) = $this->userPutWithHttpInfo($model, $contentType); return $response; } @@ -633,16 +714,16 @@ public function userPut($model) * * Update User * - * @param \Swagger\Client\Model\UpdateUserModel $model (required) + * @param \OpenAPI\Client\Model\UpdateUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\UserUpdatedModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\UserUpdatedModel, HTTP status code, HTTP response headers (array of strings) */ - public function userPutWithHttpInfo($model) + public function userPutWithHttpInfo($model, string $contentType = self::contentTypes['userPut'][0]) { - $returnType = '\Swagger\Client\Model\UserUpdatedModel'; - $request = $this->userPutRequest($model); + $request = $this->userPutRequest($model, $contentType); try { $options = $this->createHttpClientOption(); @@ -651,9 +732,16 @@ public function userPutWithHttpInfo($model) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -664,19 +752,37 @@ public function userPutWithHttpInfo($model) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\UserUpdatedModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\UserUpdatedModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UserUpdatedModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\UserUpdatedModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -693,7 +799,7 @@ public function userPutWithHttpInfo($model) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\UserUpdatedModel', + '\OpenAPI\Client\Model\UserUpdatedModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -708,14 +814,15 @@ public function userPutWithHttpInfo($model) * * Update User * - * @param \Swagger\Client\Model\UpdateUserModel $model (required) + * @param \OpenAPI\Client\Model\UpdateUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userPutAsync($model) + public function userPutAsync($model, string $contentType = self::contentTypes['userPut'][0]) { - return $this->userPutAsyncWithHttpInfo($model) + return $this->userPutAsyncWithHttpInfo($model, $contentType) ->then( function ($response) { return $response[0]; @@ -728,25 +835,25 @@ function ($response) { * * Update User * - * @param \Swagger\Client\Model\UpdateUserModel $model (required) + * @param \OpenAPI\Client\Model\UpdateUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function userPutAsyncWithHttpInfo($model) + public function userPutAsyncWithHttpInfo($model, string $contentType = self::contentTypes['userPut'][0]) { - $returnType = '\Swagger\Client\Model\UserUpdatedModel'; - $request = $this->userPutRequest($model); + $returnType = '\OpenAPI\Client\Model\UserUpdatedModel'; + $request = $this->userPutRequest($model, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -769,7 +876,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -778,13 +885,15 @@ function ($exception) { /** * Create request for operation 'userPut' * - * @param \Swagger\Client\Model\UpdateUserModel $model (required) + * @param \OpenAPI\Client\Model\UpdateUserModel $model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function userPutRequest($model) + public function userPutRequest($model, string $contentType = self::contentTypes['userPut'][0]) { + // verify the required parameter 'model' is set if ($model === null || (is_array($model) && count($model) === 0)) { throw new \InvalidArgumentException( @@ -792,6 +901,7 @@ protected function userPutRequest($model) ); } + $resourcePath = '/api/v2/user'; $formParams = []; $queryParams = []; @@ -801,56 +911,43 @@ protected function userPutRequest($model) - // body params - $_tempBody = null; - if (isset($model)) { - $_tempBody = $model; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($model)); + } else { + $httpBody = $model; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -871,10 +968,11 @@ protected function userPutRequest($model) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/WebhookApi.php b/src/lib/Api/WebhookApi.php index 39dea79..a947b8d 100644 --- a/src/lib/Api/WebhookApi.php +++ b/src/lib/Api/WebhookApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'webHookRegistrationsDeleteAll' => [ + 'application/json', + ], + 'webHookRegistrationsGet' => [ + 'application/json', + ], + 'webHookRegistrationsLookup' => [ + 'application/json', + ], + 'webHookRegistrationsPost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'webHookRegistrationsPut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'webHookRegistrationsTest' => [ + '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 + 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; } /** @@ -94,14 +155,15 @@ public function getConfig() * * @param string $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function webHookRegistrationsDelete($id, $business_id) + public function webHookRegistrationsDelete($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsDelete'][0]) { - list($response) = $this->webHookRegistrationsDeleteWithHttpInfo($id, $business_id); + list($response) = $this->webHookRegistrationsDeleteWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -112,15 +174,15 @@ public function webHookRegistrationsDelete($id, $business_id) * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsDeleteWithHttpInfo($id, $business_id) + public function webHookRegistrationsDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsDelete'][0]) { - $returnType = 'object'; - $request = $this->webHookRegistrationsDeleteRequest($id, $business_id); + $request = $this->webHookRegistrationsDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -129,9 +191,16 @@ public function webHookRegistrationsDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -142,19 +211,37 @@ public function webHookRegistrationsDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -188,13 +275,14 @@ public function webHookRegistrationsDeleteWithHttpInfo($id, $business_id) * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsDeleteAsync($id, $business_id) + public function webHookRegistrationsDeleteAsync($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsDelete'][0]) { - return $this->webHookRegistrationsDeleteAsyncWithHttpInfo($id, $business_id) + return $this->webHookRegistrationsDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -209,24 +297,24 @@ function ($response) { * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsDeleteAsyncWithHttpInfo($id, $business_id) + public function webHookRegistrationsDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsDelete'][0]) { $returnType = 'object'; - $request = $this->webHookRegistrationsDeleteRequest($id, $business_id); + $request = $this->webHookRegistrationsDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -249,7 +337,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -260,18 +348,21 @@ function ($exception) { * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsDeleteRequest($id, $business_id) + public function webHookRegistrationsDeleteRequest($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsDelete'][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 webHookRegistrationsDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -279,6 +370,7 @@ protected function webHookRegistrationsDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations/{id}'; $formParams = []; $queryParams = []; @@ -287,6 +379,7 @@ protected function webHookRegistrationsDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -304,53 +397,35 @@ protected function webHookRegistrationsDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -371,10 +446,11 @@ protected function webHookRegistrationsDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -386,14 +462,15 @@ protected function webHookRegistrationsDeleteRequest($id, $business_id) * Delete all Web Hook Registrations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDeleteAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function webHookRegistrationsDeleteAll($business_id) + public function webHookRegistrationsDeleteAll($business_id, string $contentType = self::contentTypes['webHookRegistrationsDeleteAll'][0]) { - list($response) = $this->webHookRegistrationsDeleteAllWithHttpInfo($business_id); + list($response) = $this->webHookRegistrationsDeleteAllWithHttpInfo($business_id, $contentType); return $response; } @@ -403,15 +480,15 @@ public function webHookRegistrationsDeleteAll($business_id) * Delete all Web Hook Registrations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDeleteAll'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsDeleteAllWithHttpInfo($business_id) + public function webHookRegistrationsDeleteAllWithHttpInfo($business_id, string $contentType = self::contentTypes['webHookRegistrationsDeleteAll'][0]) { - $returnType = 'object'; - $request = $this->webHookRegistrationsDeleteAllRequest($business_id); + $request = $this->webHookRegistrationsDeleteAllRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -420,9 +497,16 @@ public function webHookRegistrationsDeleteAllWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -433,19 +517,37 @@ public function webHookRegistrationsDeleteAllWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -478,13 +580,14 @@ public function webHookRegistrationsDeleteAllWithHttpInfo($business_id) * Delete all Web Hook Registrations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDeleteAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsDeleteAllAsync($business_id) + public function webHookRegistrationsDeleteAllAsync($business_id, string $contentType = self::contentTypes['webHookRegistrationsDeleteAll'][0]) { - return $this->webHookRegistrationsDeleteAllAsyncWithHttpInfo($business_id) + return $this->webHookRegistrationsDeleteAllAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -498,24 +601,24 @@ function ($response) { * Delete all Web Hook Registrations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDeleteAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsDeleteAllAsyncWithHttpInfo($business_id) + public function webHookRegistrationsDeleteAllAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['webHookRegistrationsDeleteAll'][0]) { $returnType = 'object'; - $request = $this->webHookRegistrationsDeleteAllRequest($business_id); + $request = $this->webHookRegistrationsDeleteAllRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -538,7 +641,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -548,12 +651,14 @@ function ($exception) { * Create request for operation 'webHookRegistrationsDeleteAll' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsDeleteAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsDeleteAllRequest($business_id) + public function webHookRegistrationsDeleteAllRequest($business_id, string $contentType = self::contentTypes['webHookRegistrationsDeleteAll'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -561,6 +666,7 @@ protected function webHookRegistrationsDeleteAllRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations'; $formParams = []; $queryParams = []; @@ -569,6 +675,7 @@ protected function webHookRegistrationsDeleteAllRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -578,53 +685,35 @@ protected function webHookRegistrationsDeleteAllRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -645,10 +734,11 @@ protected function webHookRegistrationsDeleteAllRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -660,14 +750,15 @@ protected function webHookRegistrationsDeleteAllRequest($business_id) * List Web Hook Registrations * * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\WebHook[] + * @return \OpenAPI\Client\Model\WebHook[] */ - public function webHookRegistrationsGet($business_id) + public function webHookRegistrationsGet($business_id, string $contentType = self::contentTypes['webHookRegistrationsGet'][0]) { - list($response) = $this->webHookRegistrationsGetWithHttpInfo($business_id); + list($response) = $this->webHookRegistrationsGetWithHttpInfo($business_id, $contentType); return $response; } @@ -677,15 +768,15 @@ public function webHookRegistrationsGet($business_id) * List Web Hook Registrations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\WebHook[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\WebHook[], HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsGetWithHttpInfo($business_id) + public function webHookRegistrationsGetWithHttpInfo($business_id, string $contentType = self::contentTypes['webHookRegistrationsGet'][0]) { - $returnType = '\Swagger\Client\Model\WebHook[]'; - $request = $this->webHookRegistrationsGetRequest($business_id); + $request = $this->webHookRegistrationsGetRequest($business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -694,9 +785,16 @@ public function webHookRegistrationsGetWithHttpInfo($business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -707,19 +805,37 @@ public function webHookRegistrationsGetWithHttpInfo($business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\WebHook[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\WebHook[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\WebHook[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\WebHook[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -736,7 +852,7 @@ public function webHookRegistrationsGetWithHttpInfo($business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\WebHook[]', + '\OpenAPI\Client\Model\WebHook[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -752,13 +868,14 @@ public function webHookRegistrationsGetWithHttpInfo($business_id) * List Web Hook Registrations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsGetAsync($business_id) + public function webHookRegistrationsGetAsync($business_id, string $contentType = self::contentTypes['webHookRegistrationsGet'][0]) { - return $this->webHookRegistrationsGetAsyncWithHttpInfo($business_id) + return $this->webHookRegistrationsGetAsyncWithHttpInfo($business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -772,24 +889,24 @@ function ($response) { * List Web Hook Registrations * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsGetAsyncWithHttpInfo($business_id) + public function webHookRegistrationsGetAsyncWithHttpInfo($business_id, string $contentType = self::contentTypes['webHookRegistrationsGet'][0]) { - $returnType = '\Swagger\Client\Model\WebHook[]'; - $request = $this->webHookRegistrationsGetRequest($business_id); + $returnType = '\OpenAPI\Client\Model\WebHook[]'; + $request = $this->webHookRegistrationsGetRequest($business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -812,7 +929,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -822,12 +939,14 @@ function ($exception) { * Create request for operation 'webHookRegistrationsGet' * * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsGetRequest($business_id) + public function webHookRegistrationsGetRequest($business_id, string $contentType = self::contentTypes['webHookRegistrationsGet'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -835,6 +954,7 @@ protected function webHookRegistrationsGetRequest($business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations'; $formParams = []; $queryParams = []; @@ -843,6 +963,7 @@ protected function webHookRegistrationsGetRequest($business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -852,53 +973,35 @@ protected function webHookRegistrationsGetRequest($business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -919,10 +1022,11 @@ protected function webHookRegistrationsGetRequest($business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -935,14 +1039,15 @@ protected function webHookRegistrationsGetRequest($business_id) * * @param string $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsLookup'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\WebHook + * @return \OpenAPI\Client\Model\WebHook */ - public function webHookRegistrationsLookup($id, $business_id) + public function webHookRegistrationsLookup($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsLookup'][0]) { - list($response) = $this->webHookRegistrationsLookupWithHttpInfo($id, $business_id); + list($response) = $this->webHookRegistrationsLookupWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -953,15 +1058,15 @@ public function webHookRegistrationsLookup($id, $business_id) * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsLookup'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\WebHook, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\WebHook, HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsLookupWithHttpInfo($id, $business_id) + public function webHookRegistrationsLookupWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsLookup'][0]) { - $returnType = '\Swagger\Client\Model\WebHook'; - $request = $this->webHookRegistrationsLookupRequest($id, $business_id); + $request = $this->webHookRegistrationsLookupRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -970,9 +1075,16 @@ public function webHookRegistrationsLookupWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -983,19 +1095,37 @@ public function webHookRegistrationsLookupWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\WebHook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\WebHook' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\WebHook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\WebHook'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1012,7 +1142,7 @@ public function webHookRegistrationsLookupWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\WebHook', + '\OpenAPI\Client\Model\WebHook', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1029,13 +1159,14 @@ public function webHookRegistrationsLookupWithHttpInfo($id, $business_id) * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsLookup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsLookupAsync($id, $business_id) + public function webHookRegistrationsLookupAsync($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsLookup'][0]) { - return $this->webHookRegistrationsLookupAsyncWithHttpInfo($id, $business_id) + return $this->webHookRegistrationsLookupAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1050,24 +1181,24 @@ function ($response) { * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsLookup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsLookupAsyncWithHttpInfo($id, $business_id) + public function webHookRegistrationsLookupAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsLookup'][0]) { - $returnType = '\Swagger\Client\Model\WebHook'; - $request = $this->webHookRegistrationsLookupRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\WebHook'; + $request = $this->webHookRegistrationsLookupRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1090,7 +1221,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1101,18 +1232,21 @@ function ($exception) { * * @param string $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsLookup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsLookupRequest($id, $business_id) + public function webHookRegistrationsLookupRequest($id, $business_id, string $contentType = self::contentTypes['webHookRegistrationsLookup'][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 webHookRegistrationsLookup' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1120,6 +1254,7 @@ protected function webHookRegistrationsLookupRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations/{id}'; $formParams = []; $queryParams = []; @@ -1128,6 +1263,7 @@ protected function webHookRegistrationsLookupRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1145,53 +1281,35 @@ protected function webHookRegistrationsLookupRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1212,10 +1330,11 @@ protected function webHookRegistrationsLookupRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1226,16 +1345,17 @@ protected function webHookRegistrationsLookupRequest($id, $business_id) * * Register Web Hook * - * @param \Swagger\Client\Model\WebHook $web_hook web_hook (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\WebHook + * @return \OpenAPI\Client\Model\WebHook */ - public function webHookRegistrationsPost($web_hook, $business_id) + public function webHookRegistrationsPost($business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPost'][0]) { - list($response) = $this->webHookRegistrationsPostWithHttpInfo($web_hook, $business_id); + list($response) = $this->webHookRegistrationsPostWithHttpInfo($business_id, $web_hook, $contentType); return $response; } @@ -1244,17 +1364,17 @@ public function webHookRegistrationsPost($web_hook, $business_id) * * Register Web Hook * - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\WebHook, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\WebHook, HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsPostWithHttpInfo($web_hook, $business_id) + public function webHookRegistrationsPostWithHttpInfo($business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPost'][0]) { - $returnType = '\Swagger\Client\Model\WebHook'; - $request = $this->webHookRegistrationsPostRequest($web_hook, $business_id); + $request = $this->webHookRegistrationsPostRequest($business_id, $web_hook, $contentType); try { $options = $this->createHttpClientOption(); @@ -1263,9 +1383,16 @@ public function webHookRegistrationsPostWithHttpInfo($web_hook, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1276,19 +1403,37 @@ public function webHookRegistrationsPostWithHttpInfo($web_hook, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\WebHook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\WebHook' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\WebHook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\WebHook'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1305,7 +1450,7 @@ public function webHookRegistrationsPostWithHttpInfo($web_hook, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\WebHook', + '\OpenAPI\Client\Model\WebHook', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1320,15 +1465,16 @@ public function webHookRegistrationsPostWithHttpInfo($web_hook, $business_id) * * Register Web Hook * - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsPostAsync($web_hook, $business_id) + public function webHookRegistrationsPostAsync($business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPost'][0]) { - return $this->webHookRegistrationsPostAsyncWithHttpInfo($web_hook, $business_id) + return $this->webHookRegistrationsPostAsyncWithHttpInfo($business_id, $web_hook, $contentType) ->then( function ($response) { return $response[0]; @@ -1341,26 +1487,26 @@ function ($response) { * * Register Web Hook * - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsPostAsyncWithHttpInfo($web_hook, $business_id) + public function webHookRegistrationsPostAsyncWithHttpInfo($business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPost'][0]) { - $returnType = '\Swagger\Client\Model\WebHook'; - $request = $this->webHookRegistrationsPostRequest($web_hook, $business_id); + $returnType = '\OpenAPI\Client\Model\WebHook'; + $request = $this->webHookRegistrationsPostRequest($business_id, $web_hook, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1383,7 +1529,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1392,20 +1538,16 @@ function ($exception) { /** * Create request for operation 'webHookRegistrationsPost' * - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsPostRequest($web_hook, $business_id) + public function webHookRegistrationsPostRequest($business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPost'][0]) { - // verify the required parameter 'web_hook' is set - if ($web_hook === null || (is_array($web_hook) && count($web_hook) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $web_hook when calling webHookRegistrationsPost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1413,6 +1555,14 @@ protected function webHookRegistrationsPostRequest($web_hook, $business_id) ); } + // verify the required parameter 'web_hook' is set + if ($web_hook === null || (is_array($web_hook) && count($web_hook) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $web_hook when calling webHookRegistrationsPost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations'; $formParams = []; $queryParams = []; @@ -1421,6 +1571,7 @@ protected function webHookRegistrationsPostRequest($web_hook, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1430,56 +1581,42 @@ protected function webHookRegistrationsPostRequest($web_hook, $business_id) ); } - // body params - $_tempBody = null; - if (isset($web_hook)) { - $_tempBody = $web_hook; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($web_hook)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_hook)); + } else { + $httpBody = $web_hook; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1500,10 +1637,11 @@ protected function webHookRegistrationsPostRequest($web_hook, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1515,16 +1653,17 @@ protected function webHookRegistrationsPostRequest($web_hook, $business_id) * Update Web Hook Registration * * @param string $id id (required) - * @param \Swagger\Client\Model\WebHook $web_hook web_hook (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function webHookRegistrationsPut($id, $web_hook, $business_id) + public function webHookRegistrationsPut($id, $business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPut'][0]) { - list($response) = $this->webHookRegistrationsPutWithHttpInfo($id, $web_hook, $business_id); + list($response) = $this->webHookRegistrationsPutWithHttpInfo($id, $business_id, $web_hook, $contentType); return $response; } @@ -1534,17 +1673,17 @@ public function webHookRegistrationsPut($id, $web_hook, $business_id) * Update Web Hook Registration * * @param string $id (required) - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsPutWithHttpInfo($id, $web_hook, $business_id) + public function webHookRegistrationsPutWithHttpInfo($id, $business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPut'][0]) { - $returnType = 'object'; - $request = $this->webHookRegistrationsPutRequest($id, $web_hook, $business_id); + $request = $this->webHookRegistrationsPutRequest($id, $business_id, $web_hook, $contentType); try { $options = $this->createHttpClientOption(); @@ -1553,9 +1692,16 @@ public function webHookRegistrationsPutWithHttpInfo($id, $web_hook, $business_id } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1566,19 +1712,37 @@ public function webHookRegistrationsPutWithHttpInfo($id, $web_hook, $business_id sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1611,15 +1775,16 @@ public function webHookRegistrationsPutWithHttpInfo($id, $web_hook, $business_id * Update Web Hook Registration * * @param string $id (required) - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsPutAsync($id, $web_hook, $business_id) + public function webHookRegistrationsPutAsync($id, $business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPut'][0]) { - return $this->webHookRegistrationsPutAsyncWithHttpInfo($id, $web_hook, $business_id) + return $this->webHookRegistrationsPutAsyncWithHttpInfo($id, $business_id, $web_hook, $contentType) ->then( function ($response) { return $response[0]; @@ -1633,26 +1798,26 @@ function ($response) { * Update Web Hook Registration * * @param string $id (required) - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsPutAsyncWithHttpInfo($id, $web_hook, $business_id) + public function webHookRegistrationsPutAsyncWithHttpInfo($id, $business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPut'][0]) { $returnType = 'object'; - $request = $this->webHookRegistrationsPutRequest($id, $web_hook, $business_id); + $request = $this->webHookRegistrationsPutRequest($id, $business_id, $web_hook, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1675,7 +1840,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1685,26 +1850,23 @@ function ($exception) { * Create request for operation 'webHookRegistrationsPut' * * @param string $id (required) - * @param \Swagger\Client\Model\WebHook $web_hook (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\WebHook $web_hook (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsPut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsPutRequest($id, $web_hook, $business_id) + public function webHookRegistrationsPutRequest($id, $business_id, $web_hook, string $contentType = self::contentTypes['webHookRegistrationsPut'][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 webHookRegistrationsPut' ); } - // verify the required parameter 'web_hook' is set - if ($web_hook === null || (is_array($web_hook) && count($web_hook) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $web_hook when calling webHookRegistrationsPut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1712,6 +1874,14 @@ protected function webHookRegistrationsPutRequest($id, $web_hook, $business_id) ); } + // verify the required parameter 'web_hook' is set + if ($web_hook === null || (is_array($web_hook) && count($web_hook) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $web_hook when calling webHookRegistrationsPut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations/{id}'; $formParams = []; $queryParams = []; @@ -1720,6 +1890,7 @@ protected function webHookRegistrationsPutRequest($id, $web_hook, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1737,56 +1908,42 @@ protected function webHookRegistrationsPutRequest($id, $web_hook, $business_id) ); } - // body params - $_tempBody = null; - if (isset($web_hook)) { - $_tempBody = $web_hook; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($web_hook)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($web_hook)); + } else { + $httpBody = $web_hook; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1807,10 +1964,11 @@ protected function webHookRegistrationsPutRequest($id, $web_hook, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1824,14 +1982,15 @@ protected function webHookRegistrationsPutRequest($id, $web_hook, $business_id) * @param string $id id (required) * @param string $filter filter (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsTest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object */ - public function webHookRegistrationsTest($id, $filter, $business_id) + public function webHookRegistrationsTest($id, $filter, $business_id, string $contentType = self::contentTypes['webHookRegistrationsTest'][0]) { - list($response) = $this->webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id); + list($response) = $this->webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id, $contentType); return $response; } @@ -1843,15 +2002,15 @@ public function webHookRegistrationsTest($id, $filter, $business_id) * @param string $id (required) * @param string $filter (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsTest'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object, HTTP status code, HTTP response headers (array of strings) */ - public function webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id) + public function webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id, string $contentType = self::contentTypes['webHookRegistrationsTest'][0]) { - $returnType = 'object'; - $request = $this->webHookRegistrationsTestRequest($id, $filter, $business_id); + $request = $this->webHookRegistrationsTestRequest($id, $filter, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1860,9 +2019,16 @@ public function webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1873,19 +2039,37 @@ public function webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1920,13 +2104,14 @@ public function webHookRegistrationsTestWithHttpInfo($id, $filter, $business_id) * @param string $id (required) * @param string $filter (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsTest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsTestAsync($id, $filter, $business_id) + public function webHookRegistrationsTestAsync($id, $filter, $business_id, string $contentType = self::contentTypes['webHookRegistrationsTest'][0]) { - return $this->webHookRegistrationsTestAsyncWithHttpInfo($id, $filter, $business_id) + return $this->webHookRegistrationsTestAsyncWithHttpInfo($id, $filter, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1942,24 +2127,24 @@ function ($response) { * @param string $id (required) * @param string $filter (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsTest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function webHookRegistrationsTestAsyncWithHttpInfo($id, $filter, $business_id) + public function webHookRegistrationsTestAsyncWithHttpInfo($id, $filter, $business_id, string $contentType = self::contentTypes['webHookRegistrationsTest'][0]) { $returnType = 'object'; - $request = $this->webHookRegistrationsTestRequest($id, $filter, $business_id); + $request = $this->webHookRegistrationsTestRequest($id, $filter, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1982,7 +2167,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1994,24 +2179,28 @@ function ($exception) { * @param string $id (required) * @param string $filter (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['webHookRegistrationsTest'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function webHookRegistrationsTestRequest($id, $filter, $business_id) + public function webHookRegistrationsTestRequest($id, $filter, $business_id, string $contentType = self::contentTypes['webHookRegistrationsTest'][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 webHookRegistrationsTest' ); } + // verify the required parameter 'filter' is set if ($filter === null || (is_array($filter) && count($filter) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $filter when calling webHookRegistrationsTest' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -2019,6 +2208,7 @@ protected function webHookRegistrationsTestRequest($id, $filter, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/webhookregistrations/{id}/test'; $formParams = []; $queryParams = []; @@ -2027,9 +2217,15 @@ protected function webHookRegistrationsTestRequest($id, $filter, $business_id) $multipart = false; // query params - if ($filter !== null) { - $queryParams['filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + 'filter', // param base name + 'string', // openApiType + '', // style + false, // explode + true // required + ) ?? []); + // path params if ($id !== null) { @@ -2048,53 +2244,35 @@ protected function webHookRegistrationsTestRequest($id, $filter, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2115,10 +2293,11 @@ protected function webHookRegistrationsTestRequest($id, $filter, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/WhiteLabelApi.php b/src/lib/Api/WhiteLabelApi.php index e21e39b..6425d08 100644 --- a/src/lib/Api/WhiteLabelApi.php +++ b/src/lib/Api/WhiteLabelApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'whiteLabelGet' => [ + 'application/json', + ], + 'whiteLabelGetWhiteLabels' => [ + 'application/json', + ], + 'whiteLabelReportGet' => [ + '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 + 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; } /** @@ -93,20 +137,21 @@ public function getConfig() * Active Employees Report * * @param int $white_label_id white_label_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses request_email_addresses (optional) + * @param bool $request_include_inactive_businesses request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWhiteLabelActiveEmployeeReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuActiveEmployeesModel[] + * @return \OpenAPI\Client\Model\AuActiveEmployeesModel[] */ - public function auWhiteLabelActiveEmployeeReportGet($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auWhiteLabelActiveEmployeeReportGet($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auWhiteLabelActiveEmployeeReportGet'][0]) { - list($response) = $this->auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -116,21 +161,21 @@ public function auWhiteLabelActiveEmployeeReportGet($white_label_id, $request_em * Active Employees Report * * @param int $white_label_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWhiteLabelActiveEmployeeReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuActiveEmployeesModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuActiveEmployeesModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auWhiteLabelActiveEmployeeReportGet'][0]) { - $returnType = '\Swagger\Client\Model\AuActiveEmployeesModel[]'; - $request = $this->auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -139,9 +184,16 @@ public function auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -152,19 +204,37 @@ public function auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuActiveEmployeesModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuActiveEmployeesModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuActiveEmployeesModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuActiveEmployeesModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -181,7 +251,7 @@ public function auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuActiveEmployeesModel[]', + '\OpenAPI\Client\Model\AuActiveEmployeesModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -197,19 +267,20 @@ public function auWhiteLabelActiveEmployeeReportGetWithHttpInfo($white_label_id, * Active Employees Report * * @param int $white_label_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWhiteLabelActiveEmployeeReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWhiteLabelActiveEmployeeReportGetAsync($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auWhiteLabelActiveEmployeeReportGetAsync($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auWhiteLabelActiveEmployeeReportGet'][0]) { - return $this->auWhiteLabelActiveEmployeeReportGetAsyncWithHttpInfo($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->auWhiteLabelActiveEmployeeReportGetAsyncWithHttpInfo($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -223,30 +294,30 @@ function ($response) { * Active Employees Report * * @param int $white_label_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWhiteLabelActiveEmployeeReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWhiteLabelActiveEmployeeReportGetAsyncWithHttpInfo($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auWhiteLabelActiveEmployeeReportGetAsyncWithHttpInfo($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auWhiteLabelActiveEmployeeReportGet'][0]) { - $returnType = '\Swagger\Client\Model\AuActiveEmployeesModel[]'; - $request = $this->auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\AuActiveEmployeesModel[]'; + $request = $this->auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $request_email_addresses, $request_include_inactive_businesses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -269,7 +340,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -279,18 +350,20 @@ function ($exception) { * Create request for operation 'auWhiteLabelActiveEmployeeReportGet' * * @param int $white_label_id (required) - * @param string $request_email_addresses (optional) - * @param bool $request_include_inactive_businesses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param bool $request_include_inactive_businesses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWhiteLabelActiveEmployeeReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $request_email_addresses = null, $request_include_inactive_businesses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['auWhiteLabelActiveEmployeeReportGet'][0]) { + // verify the required parameter 'white_label_id' is set if ($white_label_id === null || (is_array($white_label_id) && count($white_label_id) === 0)) { throw new \InvalidArgumentException( @@ -298,6 +371,13 @@ protected function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $ ); } + + + + + + + $resourcePath = '/api/v2/whitelabel/{whiteLabelId}/reports/activeemployees'; $formParams = []; $queryParams = []; @@ -306,29 +386,60 @@ protected function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $ $multipart = false; // query params - if ($request_email_addresses !== null) { - $queryParams['request.emailAddresses'] = ObjectSerializer::toQueryValue($request_email_addresses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_email_addresses, + 'request.emailAddresses', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_include_inactive_businesses !== null) { - $queryParams['request.includeInactiveBusinesses'] = ObjectSerializer::toQueryValue($request_include_inactive_businesses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_include_inactive_businesses, + 'request.includeInactiveBusinesses', // param base name + 'boolean', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($white_label_id !== null) { @@ -339,53 +450,35 @@ protected function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -406,10 +499,11 @@ protected function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -421,14 +515,15 @@ protected function auWhiteLabelActiveEmployeeReportGetRequest($white_label_id, $ * Get White Label by ID * * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\WhiteLabelModel + * @return \OpenAPI\Client\Model\WhiteLabelModel */ - public function whiteLabelGet($id) + public function whiteLabelGet($id, string $contentType = self::contentTypes['whiteLabelGet'][0]) { - list($response) = $this->whiteLabelGetWithHttpInfo($id); + list($response) = $this->whiteLabelGetWithHttpInfo($id, $contentType); return $response; } @@ -438,15 +533,15 @@ public function whiteLabelGet($id) * Get White Label by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\WhiteLabelModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\WhiteLabelModel, HTTP status code, HTTP response headers (array of strings) */ - public function whiteLabelGetWithHttpInfo($id) + public function whiteLabelGetWithHttpInfo($id, string $contentType = self::contentTypes['whiteLabelGet'][0]) { - $returnType = '\Swagger\Client\Model\WhiteLabelModel'; - $request = $this->whiteLabelGetRequest($id); + $request = $this->whiteLabelGetRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -455,9 +550,16 @@ public function whiteLabelGetWithHttpInfo($id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -468,19 +570,37 @@ public function whiteLabelGetWithHttpInfo($id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\WhiteLabelModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\WhiteLabelModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\WhiteLabelModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\WhiteLabelModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -497,7 +617,7 @@ public function whiteLabelGetWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\WhiteLabelModel', + '\OpenAPI\Client\Model\WhiteLabelModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -513,13 +633,14 @@ public function whiteLabelGetWithHttpInfo($id) * Get White Label by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function whiteLabelGetAsync($id) + public function whiteLabelGetAsync($id, string $contentType = self::contentTypes['whiteLabelGet'][0]) { - return $this->whiteLabelGetAsyncWithHttpInfo($id) + return $this->whiteLabelGetAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -533,24 +654,24 @@ function ($response) { * Get White Label by ID * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function whiteLabelGetAsyncWithHttpInfo($id) + public function whiteLabelGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['whiteLabelGet'][0]) { - $returnType = '\Swagger\Client\Model\WhiteLabelModel'; - $request = $this->whiteLabelGetRequest($id); + $returnType = '\OpenAPI\Client\Model\WhiteLabelModel'; + $request = $this->whiteLabelGetRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -573,7 +694,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -583,12 +704,14 @@ function ($exception) { * Create request for operation 'whiteLabelGet' * * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function whiteLabelGetRequest($id) + public function whiteLabelGetRequest($id, string $contentType = self::contentTypes['whiteLabelGet'][0]) { + // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( @@ -596,6 +719,7 @@ protected function whiteLabelGetRequest($id) ); } + $resourcePath = '/api/v2/whitelabel/{id}'; $formParams = []; $queryParams = []; @@ -604,6 +728,7 @@ protected function whiteLabelGetRequest($id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -613,53 +738,35 @@ protected function whiteLabelGetRequest($id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -680,10 +787,11 @@ protected function whiteLabelGetRequest($id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -694,14 +802,15 @@ protected function whiteLabelGetRequest($id) * * List White Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGetWhiteLabels'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\WhiteLabelModel[] + * @return \OpenAPI\Client\Model\WhiteLabelModel[] */ - public function whiteLabelGetWhiteLabels() + public function whiteLabelGetWhiteLabels(string $contentType = self::contentTypes['whiteLabelGetWhiteLabels'][0]) { - list($response) = $this->whiteLabelGetWhiteLabelsWithHttpInfo(); + list($response) = $this->whiteLabelGetWhiteLabelsWithHttpInfo($contentType); return $response; } @@ -710,15 +819,15 @@ public function whiteLabelGetWhiteLabels() * * List White Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGetWhiteLabels'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\WhiteLabelModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\WhiteLabelModel[], HTTP status code, HTTP response headers (array of strings) */ - public function whiteLabelGetWhiteLabelsWithHttpInfo() + public function whiteLabelGetWhiteLabelsWithHttpInfo(string $contentType = self::contentTypes['whiteLabelGetWhiteLabels'][0]) { - $returnType = '\Swagger\Client\Model\WhiteLabelModel[]'; - $request = $this->whiteLabelGetWhiteLabelsRequest(); + $request = $this->whiteLabelGetWhiteLabelsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -727,9 +836,16 @@ public function whiteLabelGetWhiteLabelsWithHttpInfo() } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -740,19 +856,37 @@ public function whiteLabelGetWhiteLabelsWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\WhiteLabelModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\WhiteLabelModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\WhiteLabelModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\WhiteLabelModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -769,7 +903,7 @@ public function whiteLabelGetWhiteLabelsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\WhiteLabelModel[]', + '\OpenAPI\Client\Model\WhiteLabelModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -784,13 +918,14 @@ public function whiteLabelGetWhiteLabelsWithHttpInfo() * * List White Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGetWhiteLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function whiteLabelGetWhiteLabelsAsync() + public function whiteLabelGetWhiteLabelsAsync(string $contentType = self::contentTypes['whiteLabelGetWhiteLabels'][0]) { - return $this->whiteLabelGetWhiteLabelsAsyncWithHttpInfo() + return $this->whiteLabelGetWhiteLabelsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -803,24 +938,24 @@ function ($response) { * * List White Labels * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGetWhiteLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function whiteLabelGetWhiteLabelsAsyncWithHttpInfo() + public function whiteLabelGetWhiteLabelsAsyncWithHttpInfo(string $contentType = self::contentTypes['whiteLabelGetWhiteLabels'][0]) { - $returnType = '\Swagger\Client\Model\WhiteLabelModel[]'; - $request = $this->whiteLabelGetWhiteLabelsRequest(); + $returnType = '\OpenAPI\Client\Model\WhiteLabelModel[]'; + $request = $this->whiteLabelGetWhiteLabelsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -843,7 +978,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -852,13 +987,15 @@ function ($exception) { /** * Create request for operation 'whiteLabelGetWhiteLabels' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelGetWhiteLabels'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function whiteLabelGetWhiteLabelsRequest() + public function whiteLabelGetWhiteLabelsRequest(string $contentType = self::contentTypes['whiteLabelGetWhiteLabels'][0]) { + $resourcePath = '/api/v2/whitelabel'; $formParams = []; $queryParams = []; @@ -868,53 +1005,36 @@ protected function whiteLabelGetWhiteLabelsRequest() - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -935,10 +1055,11 @@ protected function whiteLabelGetWhiteLabelsRequest() $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -950,19 +1071,20 @@ protected function whiteLabelGetWhiteLabelsRequest() * Signup Report * * @param int $whitelabel_id whitelabel_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses request_email_addresses (optional) + * @param \DateTime $request_from_date request_from_date (optional) + * @param \DateTime $request_to_date request_to_date (optional) + * @param int $request_location_id request_location_id (optional) + * @param int $request_employing_entity_id request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\SignupModel[] + * @return \OpenAPI\Client\Model\SignupModel[] */ - public function whiteLabelReportGet($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function whiteLabelReportGet($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['whiteLabelReportGet'][0]) { - list($response) = $this->whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + list($response) = $this->whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $response; } @@ -972,20 +1094,20 @@ public function whiteLabelReportGet($whitelabel_id, $request_email_addresses = n * Signup Report * * @param int $whitelabel_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelReportGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\SignupModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SignupModel[], HTTP status code, HTTP response headers (array of strings) */ - public function whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['whiteLabelReportGet'][0]) { - $returnType = '\Swagger\Client\Model\SignupModel[]'; - $request = $this->whiteLabelReportGetRequest($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $request = $this->whiteLabelReportGetRequest($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -994,9 +1116,16 @@ public function whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_a } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1007,19 +1136,37 @@ public function whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_a sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\SignupModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SignupModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SignupModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SignupModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1036,7 +1183,7 @@ public function whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_a case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\SignupModel[]', + '\OpenAPI\Client\Model\SignupModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1052,18 +1199,19 @@ public function whiteLabelReportGetWithHttpInfo($whitelabel_id, $request_email_a * Signup Report * * @param int $whitelabel_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function whiteLabelReportGetAsync($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function whiteLabelReportGetAsync($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['whiteLabelReportGet'][0]) { - return $this->whiteLabelReportGetAsyncWithHttpInfo($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id) + return $this->whiteLabelReportGetAsyncWithHttpInfo($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1077,29 +1225,29 @@ function ($response) { * Signup Report * * @param int $whitelabel_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function whiteLabelReportGetAsyncWithHttpInfo($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function whiteLabelReportGetAsyncWithHttpInfo($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['whiteLabelReportGet'][0]) { - $returnType = '\Swagger\Client\Model\SignupModel[]'; - $request = $this->whiteLabelReportGetRequest($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id); + $returnType = '\OpenAPI\Client\Model\SignupModel[]'; + $request = $this->whiteLabelReportGetRequest($whitelabel_id, $request_email_addresses, $request_from_date, $request_to_date, $request_location_id, $request_employing_entity_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1122,7 +1270,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1132,17 +1280,19 @@ function ($exception) { * Create request for operation 'whiteLabelReportGet' * * @param int $whitelabel_id (required) - * @param string $request_email_addresses (optional) - * @param \DateTime $request_from_date (optional) - * @param \DateTime $request_to_date (optional) - * @param int $request_location_id (optional) - * @param int $request_employing_entity_id (optional) + * @param string $request_email_addresses (optional) + * @param \DateTime $request_from_date (optional) + * @param \DateTime $request_to_date (optional) + * @param int $request_location_id (optional) + * @param int $request_employing_entity_id (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['whiteLabelReportGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function whiteLabelReportGetRequest($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null) + public function whiteLabelReportGetRequest($whitelabel_id, $request_email_addresses = null, $request_from_date = null, $request_to_date = null, $request_location_id = null, $request_employing_entity_id = null, string $contentType = self::contentTypes['whiteLabelReportGet'][0]) { + // verify the required parameter 'whitelabel_id' is set if ($whitelabel_id === null || (is_array($whitelabel_id) && count($whitelabel_id) === 0)) { throw new \InvalidArgumentException( @@ -1150,6 +1300,12 @@ protected function whiteLabelReportGetRequest($whitelabel_id, $request_email_add ); } + + + + + + $resourcePath = '/api/v2/whitelabel/{whitelabelId}/reports/signups'; $formParams = []; $queryParams = []; @@ -1158,25 +1314,51 @@ protected function whiteLabelReportGetRequest($whitelabel_id, $request_email_add $multipart = false; // query params - if ($request_email_addresses !== null) { - $queryParams['request.emailAddresses'] = ObjectSerializer::toQueryValue($request_email_addresses); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_email_addresses, + 'request.emailAddresses', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_from_date !== null) { - $queryParams['request.fromDate'] = ObjectSerializer::toQueryValue($request_from_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_from_date, + 'request.fromDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_to_date !== null) { - $queryParams['request.toDate'] = ObjectSerializer::toQueryValue($request_to_date); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_to_date, + 'request.toDate', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_location_id !== null) { - $queryParams['request.locationId'] = ObjectSerializer::toQueryValue($request_location_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_location_id, + 'request.locationId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($request_employing_entity_id !== null) { - $queryParams['request.employingEntityId'] = ObjectSerializer::toQueryValue($request_employing_entity_id); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $request_employing_entity_id, + 'request.employingEntityId', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + // path params if ($whitelabel_id !== null) { @@ -1187,53 +1369,35 @@ protected function whiteLabelReportGetRequest($whitelabel_id, $request_email_add ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1254,10 +1418,11 @@ protected function whiteLabelReportGetRequest($whitelabel_id, $request_email_add $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/Api/WorkTypeApi.php b/src/lib/Api/WorkTypeApi.php index 4565396..40315a3 100644 --- a/src/lib/Api/WorkTypeApi.php +++ b/src/lib/Api/WorkTypeApi.php @@ -1,51 +1,51 @@ [ + 'application/json', + ], + 'auWorkTypeGet' => [ + 'application/json', + ], + 'auWorkTypeGetWorkTypes' => [ + 'application/json', + ], + 'auWorkTypePost' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + 'auWorkTypePut' => [ + 'application/json', + 'text/json', + 'application/xml', + 'text/xml', + 'application/x-www-form-urlencoded', + ], + ]; + +/** * @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 + 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; } /** @@ -94,14 +149,15 @@ public function getConfig() * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function auWorkTypeDelete($id, $business_id) + public function auWorkTypeDelete($id, $business_id, string $contentType = self::contentTypes['auWorkTypeDelete'][0]) { - $this->auWorkTypeDeleteWithHttpInfo($id, $business_id); + $this->auWorkTypeDeleteWithHttpInfo($id, $business_id, $contentType); } /** @@ -111,15 +167,15 @@ public function auWorkTypeDelete($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeDelete'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function auWorkTypeDeleteWithHttpInfo($id, $business_id) + public function auWorkTypeDeleteWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auWorkTypeDelete'][0]) { - $returnType = ''; - $request = $this->auWorkTypeDeleteRequest($id, $business_id); + $request = $this->auWorkTypeDeleteRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -128,9 +184,16 @@ public function auWorkTypeDeleteWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -141,11 +204,11 @@ public function auWorkTypeDeleteWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } @@ -165,13 +228,14 @@ public function auWorkTypeDeleteWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypeDeleteAsync($id, $business_id) + public function auWorkTypeDeleteAsync($id, $business_id, string $contentType = self::contentTypes['auWorkTypeDelete'][0]) { - return $this->auWorkTypeDeleteAsyncWithHttpInfo($id, $business_id) + return $this->auWorkTypeDeleteAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -186,14 +250,15 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypeDeleteAsyncWithHttpInfo($id, $business_id) + public function auWorkTypeDeleteAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auWorkTypeDelete'][0]) { $returnType = ''; - $request = $this->auWorkTypeDeleteRequest($id, $business_id); + $request = $this->auWorkTypeDeleteRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -212,7 +277,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -223,18 +288,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeDelete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auWorkTypeDeleteRequest($id, $business_id) + public function auWorkTypeDeleteRequest($id, $business_id, string $contentType = self::contentTypes['auWorkTypeDelete'][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 auWorkTypeDelete' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -242,6 +310,7 @@ protected function auWorkTypeDeleteRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/worktype/{id}'; $formParams = []; $queryParams = []; @@ -250,6 +319,7 @@ protected function auWorkTypeDeleteRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -267,53 +337,35 @@ protected function auWorkTypeDeleteRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -334,10 +386,11 @@ protected function auWorkTypeDeleteRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -350,14 +403,15 @@ protected function auWorkTypeDeleteRequest($id, $business_id) * * @param int $id id (required) * @param string $business_id business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel + * @return \OpenAPI\Client\Model\AuWorkTypeModel */ - public function auWorkTypeGet($id, $business_id) + public function auWorkTypeGet($id, $business_id, string $contentType = self::contentTypes['auWorkTypeGet'][0]) { - list($response) = $this->auWorkTypeGetWithHttpInfo($id, $business_id); + list($response) = $this->auWorkTypeGetWithHttpInfo($id, $business_id, $contentType); return $response; } @@ -368,15 +422,15 @@ public function auWorkTypeGet($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGet'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auWorkTypeGetWithHttpInfo($id, $business_id) + public function auWorkTypeGetWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auWorkTypeGet'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel'; - $request = $this->auWorkTypeGetRequest($id, $business_id); + $request = $this->auWorkTypeGetRequest($id, $business_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -385,9 +439,16 @@ public function auWorkTypeGetWithHttpInfo($id, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -398,19 +459,37 @@ public function auWorkTypeGetWithHttpInfo($id, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -427,7 +506,7 @@ public function auWorkTypeGetWithHttpInfo($id, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel', + '\OpenAPI\Client\Model\AuWorkTypeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -444,13 +523,14 @@ public function auWorkTypeGetWithHttpInfo($id, $business_id) * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypeGetAsync($id, $business_id) + public function auWorkTypeGetAsync($id, $business_id, string $contentType = self::contentTypes['auWorkTypeGet'][0]) { - return $this->auWorkTypeGetAsyncWithHttpInfo($id, $business_id) + return $this->auWorkTypeGetAsyncWithHttpInfo($id, $business_id, $contentType) ->then( function ($response) { return $response[0]; @@ -465,24 +545,24 @@ function ($response) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypeGetAsyncWithHttpInfo($id, $business_id) + public function auWorkTypeGetAsyncWithHttpInfo($id, $business_id, string $contentType = self::contentTypes['auWorkTypeGet'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel'; - $request = $this->auWorkTypeGetRequest($id, $business_id); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel'; + $request = $this->auWorkTypeGetRequest($id, $business_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -505,7 +585,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -516,18 +596,21 @@ function ($exception) { * * @param int $id (required) * @param string $business_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGet'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auWorkTypeGetRequest($id, $business_id) + public function auWorkTypeGetRequest($id, $business_id, string $contentType = self::contentTypes['auWorkTypeGet'][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 auWorkTypeGet' ); } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -535,6 +618,7 @@ protected function auWorkTypeGetRequest($id, $business_id) ); } + $resourcePath = '/api/v2/business/{businessId}/worktype/{id}'; $formParams = []; $queryParams = []; @@ -543,6 +627,7 @@ protected function auWorkTypeGetRequest($id, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -560,53 +645,35 @@ protected function auWorkTypeGetRequest($id, $business_id) ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -627,10 +694,11 @@ protected function auWorkTypeGetRequest($id, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -642,18 +710,20 @@ protected function auWorkTypeGetRequest($id, $business_id) * List Work Types * * @param string $business_id business_id (required) + * @param mixed $query query (optional) * @param string $filter filter (optional) * @param string $orderby orderby (optional) * @param int $top top (optional) * @param int $skip skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGetWorkTypes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuWorkTypeModel[] */ - public function auWorkTypeGetWorkTypes($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auWorkTypeGetWorkTypes($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auWorkTypeGetWorkTypes'][0]) { - list($response) = $this->auWorkTypeGetWorkTypesWithHttpInfo($business_id, $filter, $orderby, $top, $skip); + list($response) = $this->auWorkTypeGetWorkTypesWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $response; } @@ -663,19 +733,20 @@ public function auWorkTypeGetWorkTypes($business_id, $filter = null, $orderby = * List Work Types * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGetWorkTypes'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel[], HTTP status code, HTTP response headers (array of strings) */ - public function auWorkTypeGetWorkTypesWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auWorkTypeGetWorkTypesWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auWorkTypeGetWorkTypes'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auWorkTypeGetWorkTypesRequest($business_id, $filter, $orderby, $top, $skip); + $request = $this->auWorkTypeGetWorkTypesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); try { $options = $this->createHttpClientOption(); @@ -684,9 +755,16 @@ public function auWorkTypeGetWorkTypesWithHttpInfo($business_id, $filter = null, } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -697,19 +775,37 @@ public function auWorkTypeGetWorkTypesWithHttpInfo($business_id, $filter = null, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -726,7 +822,7 @@ public function auWorkTypeGetWorkTypesWithHttpInfo($business_id, $filter = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel[]', + '\OpenAPI\Client\Model\AuWorkTypeModel[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -742,17 +838,19 @@ public function auWorkTypeGetWorkTypesWithHttpInfo($business_id, $filter = null, * List Work Types * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGetWorkTypes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypeGetWorkTypesAsync($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auWorkTypeGetWorkTypesAsync($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auWorkTypeGetWorkTypes'][0]) { - return $this->auWorkTypeGetWorkTypesAsyncWithHttpInfo($business_id, $filter, $orderby, $top, $skip) + return $this->auWorkTypeGetWorkTypesAsyncWithHttpInfo($business_id, $query, $filter, $orderby, $top, $skip, $contentType) ->then( function ($response) { return $response[0]; @@ -766,28 +864,29 @@ function ($response) { * List Work Types * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGetWorkTypes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypeGetWorkTypesAsyncWithHttpInfo($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auWorkTypeGetWorkTypesAsyncWithHttpInfo($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auWorkTypeGetWorkTypes'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel[]'; - $request = $this->auWorkTypeGetWorkTypesRequest($business_id, $filter, $orderby, $top, $skip); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel[]'; + $request = $this->auWorkTypeGetWorkTypesRequest($business_id, $query, $filter, $orderby, $top, $skip, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -810,7 +909,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -820,16 +919,19 @@ function ($exception) { * Create request for operation 'auWorkTypeGetWorkTypes' * * @param string $business_id (required) + * @param mixed $query (optional) * @param string $filter (optional) * @param string $orderby (optional) * @param int $top (optional) * @param int $skip (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypeGetWorkTypes'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auWorkTypeGetWorkTypesRequest($business_id, $filter = null, $orderby = null, $top = null, $skip = null) + public function auWorkTypeGetWorkTypesRequest($business_id, $query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auWorkTypeGetWorkTypes'][0]) { + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -837,6 +939,12 @@ protected function auWorkTypeGetWorkTypesRequest($business_id, $filter = null, $ ); } + + + + + + $resourcePath = '/api/v2/business/{businessId}/worktype'; $formParams = []; $queryParams = []; @@ -845,20 +953,45 @@ protected function auWorkTypeGetWorkTypesRequest($business_id, $filter = null, $ $multipart = false; // query params - if ($filter !== null) { - $queryParams['$filter'] = ObjectSerializer::toQueryValue($filter); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filter, + '$filter', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($orderby !== null) { - $queryParams['$orderby'] = ObjectSerializer::toQueryValue($orderby); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $orderby, + '$orderby', // param base name + 'string', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($top !== null) { - $queryParams['$top'] = ObjectSerializer::toQueryValue($top); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $top, + '$top', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); // query params - if ($skip !== null) { - $queryParams['$skip'] = ObjectSerializer::toQueryValue($skip); + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $skip, + '$skip', // param base name + 'integer', // openApiType + '', // style + false, // explode + false // required + ) ?? []); + + // header params + if ($query !== null) { + $headerParams['query'] = ObjectSerializer::toHeaderValue($query); } // path params @@ -870,53 +1003,35 @@ protected function auWorkTypeGetWorkTypesRequest($business_id, $filter = null, $ ); } - // body params - $_tempBody = null; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -937,10 +1052,11 @@ protected function auWorkTypeGetWorkTypesRequest($business_id, $filter = null, $ $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -951,16 +1067,17 @@ protected function auWorkTypeGetWorkTypesRequest($business_id, $filter = null, $ * * Create Work Type * - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type work_type (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel + * @return \OpenAPI\Client\Model\AuWorkTypeModel */ - public function auWorkTypePost($work_type, $business_id) + public function auWorkTypePost($business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePost'][0]) { - list($response) = $this->auWorkTypePostWithHttpInfo($work_type, $business_id); + list($response) = $this->auWorkTypePostWithHttpInfo($business_id, $work_type, $contentType); return $response; } @@ -969,17 +1086,17 @@ public function auWorkTypePost($work_type, $business_id) * * Create Work Type * - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePost'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auWorkTypePostWithHttpInfo($work_type, $business_id) + public function auWorkTypePostWithHttpInfo($business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePost'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel'; - $request = $this->auWorkTypePostRequest($work_type, $business_id); + $request = $this->auWorkTypePostRequest($business_id, $work_type, $contentType); try { $options = $this->createHttpClientOption(); @@ -988,9 +1105,16 @@ public function auWorkTypePostWithHttpInfo($work_type, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1001,19 +1125,37 @@ public function auWorkTypePostWithHttpInfo($work_type, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1030,7 +1172,7 @@ public function auWorkTypePostWithHttpInfo($work_type, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel', + '\OpenAPI\Client\Model\AuWorkTypeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1045,15 +1187,16 @@ public function auWorkTypePostWithHttpInfo($work_type, $business_id) * * Create Work Type * - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypePostAsync($work_type, $business_id) + public function auWorkTypePostAsync($business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePost'][0]) { - return $this->auWorkTypePostAsyncWithHttpInfo($work_type, $business_id) + return $this->auWorkTypePostAsyncWithHttpInfo($business_id, $work_type, $contentType) ->then( function ($response) { return $response[0]; @@ -1066,26 +1209,26 @@ function ($response) { * * Create Work Type * - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypePostAsyncWithHttpInfo($work_type, $business_id) + public function auWorkTypePostAsyncWithHttpInfo($business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePost'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel'; - $request = $this->auWorkTypePostRequest($work_type, $business_id); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel'; + $request = $this->auWorkTypePostRequest($business_id, $work_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1108,7 +1251,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1117,20 +1260,16 @@ function ($exception) { /** * Create request for operation 'auWorkTypePost' * - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePost'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auWorkTypePostRequest($work_type, $business_id) + public function auWorkTypePostRequest($business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePost'][0]) { - // verify the required parameter 'work_type' is set - if ($work_type === null || (is_array($work_type) && count($work_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $work_type when calling auWorkTypePost' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1138,6 +1277,14 @@ protected function auWorkTypePostRequest($work_type, $business_id) ); } + // verify the required parameter 'work_type' is set + if ($work_type === null || (is_array($work_type) && count($work_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $work_type when calling auWorkTypePost' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/worktype'; $formParams = []; $queryParams = []; @@ -1146,6 +1293,7 @@ protected function auWorkTypePostRequest($work_type, $business_id) $multipart = false; + // path params if ($business_id !== null) { $resourcePath = str_replace( @@ -1155,56 +1303,42 @@ protected function auWorkTypePostRequest($work_type, $business_id) ); } - // body params - $_tempBody = null; - if (isset($work_type)) { - $_tempBody = $work_type; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($work_type)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($work_type)); + } else { + $httpBody = $work_type; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1225,10 +1359,11 @@ protected function auWorkTypePostRequest($work_type, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1240,16 +1375,17 @@ protected function auWorkTypePostRequest($work_type, $business_id) * Update Work Type * * @param int $id id (required) - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type work_type (required) * @param string $business_id business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \Swagger\Client\Model\AuWorkTypeModel + * @return \OpenAPI\Client\Model\AuWorkTypeModel */ - public function auWorkTypePut($id, $work_type, $business_id) + public function auWorkTypePut($id, $business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePut'][0]) { - list($response) = $this->auWorkTypePutWithHttpInfo($id, $work_type, $business_id); + list($response) = $this->auWorkTypePutWithHttpInfo($id, $business_id, $work_type, $contentType); return $response; } @@ -1259,17 +1395,17 @@ public function auWorkTypePut($id, $work_type, $business_id) * Update Work Type * * @param int $id (required) - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePut'] to see the possible values for this operation * - * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \Swagger\Client\Model\AuWorkTypeModel, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\AuWorkTypeModel, HTTP status code, HTTP response headers (array of strings) */ - public function auWorkTypePutWithHttpInfo($id, $work_type, $business_id) + public function auWorkTypePutWithHttpInfo($id, $business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePut'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel'; - $request = $this->auWorkTypePutRequest($id, $work_type, $business_id); + $request = $this->auWorkTypePutRequest($id, $business_id, $work_type, $contentType); try { $options = $this->createHttpClientOption(); @@ -1278,9 +1414,16 @@ public function auWorkTypePutWithHttpInfo($id, $work_type, $business_id) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), + (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } @@ -1291,19 +1434,37 @@ public function auWorkTypePutWithHttpInfo($id, $work_type, $business_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - $request->getUri() + (string) $request->getUri() ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } - $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\AuWorkTypeModel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AuWorkTypeModel' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AuWorkTypeModel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel'; if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1320,7 +1481,7 @@ public function auWorkTypePutWithHttpInfo($id, $work_type, $business_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Swagger\Client\Model\AuWorkTypeModel', + '\OpenAPI\Client\Model\AuWorkTypeModel', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1336,15 +1497,16 @@ public function auWorkTypePutWithHttpInfo($id, $work_type, $business_id) * Update Work Type * * @param int $id (required) - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypePutAsync($id, $work_type, $business_id) + public function auWorkTypePutAsync($id, $business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePut'][0]) { - return $this->auWorkTypePutAsyncWithHttpInfo($id, $work_type, $business_id) + return $this->auWorkTypePutAsyncWithHttpInfo($id, $business_id, $work_type, $contentType) ->then( function ($response) { return $response[0]; @@ -1358,26 +1520,26 @@ function ($response) { * Update Work Type * * @param int $id (required) - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function auWorkTypePutAsyncWithHttpInfo($id, $work_type, $business_id) + public function auWorkTypePutAsyncWithHttpInfo($id, $business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePut'][0]) { - $returnType = '\Swagger\Client\Model\AuWorkTypeModel'; - $request = $this->auWorkTypePutRequest($id, $work_type, $business_id); + $returnType = '\OpenAPI\Client\Model\AuWorkTypeModel'; + $request = $this->auWorkTypePutRequest($id, $business_id, $work_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer + $content = $response->getBody(); //stream goes to serializer } else { - $content = $responseBody->getContents(); + $content = (string) $response->getBody(); if ($returnType !== 'string') { $content = json_decode($content); } @@ -1400,7 +1562,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - $response->getBody() + (string) $response->getBody() ); } ); @@ -1410,26 +1572,23 @@ function ($exception) { * Create request for operation 'auWorkTypePut' * * @param int $id (required) - * @param \Swagger\Client\Model\AuWorkTypeModel $work_type (required) * @param string $business_id (required) + * @param \OpenAPI\Client\Model\AuWorkTypeModel $work_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['auWorkTypePut'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function auWorkTypePutRequest($id, $work_type, $business_id) + public function auWorkTypePutRequest($id, $business_id, $work_type, string $contentType = self::contentTypes['auWorkTypePut'][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 auWorkTypePut' ); } - // verify the required parameter 'work_type' is set - if ($work_type === null || (is_array($work_type) && count($work_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $work_type when calling auWorkTypePut' - ); - } + // verify the required parameter 'business_id' is set if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) { throw new \InvalidArgumentException( @@ -1437,6 +1596,14 @@ protected function auWorkTypePutRequest($id, $work_type, $business_id) ); } + // verify the required parameter 'work_type' is set + if ($work_type === null || (is_array($work_type) && count($work_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $work_type when calling auWorkTypePut' + ); + } + + $resourcePath = '/api/v2/business/{businessId}/worktype/{id}'; $formParams = []; $queryParams = []; @@ -1445,6 +1612,7 @@ protected function auWorkTypePutRequest($id, $work_type, $business_id) $multipart = false; + // path params if ($id !== null) { $resourcePath = str_replace( @@ -1462,56 +1630,42 @@ protected function auWorkTypePutRequest($id, $work_type, $business_id) ); } - // body params - $_tempBody = null; - if (isset($work_type)) { - $_tempBody = $work_type; - } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', 'text/json', 'application/xml', 'text/xml'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', 'text/json', 'application/xml', 'text/xml'], - ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml', ], + $contentType, + $multipart + ); // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - - if($headers['Content-Type'] === 'application/json') { - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass) { - $httpBody = \GuzzleHttp\json_encode($httpBody); - } - // array has no __toString(), so we should encode it manually - if(is_array($httpBody)) { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); - } + if (isset($work_type)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($work_type)); + } else { + $httpBody = $work_type; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $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 ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1532,10 +1686,11 @@ protected function auWorkTypePutRequest($id, $work_type, $business_id) $headers ); - $query = \GuzzleHttp\Psr7\build_query($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/src/lib/ApiException.php b/src/lib/ApiException.php index c2d408c..46db37a 100644 --- a/src/lib/ApiException.php +++ b/src/lib/ApiException.php @@ -1,32 +1,31 @@ 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 * @@ -375,7 +411,7 @@ public static function getDefaultConfiguration() } /** - * Sets the detault configuration instance + * Sets the default configuration instance * * @param Configuration $config An instance of the Configuration Object * @@ -393,10 +429,10 @@ public static function setDefaultConfiguration(Configuration $config) */ public static function toDebugReport() { - $report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL; + $report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' OpenAPI Spec Version: AU' . PHP_EOL; + $report .= ' The version of the OpenAPI document: AU' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; @@ -407,7 +443,7 @@ public static function toDebugReport() * * @param string $apiKeyIdentifier name of apikey * - * @return string API key with the prefix + * @return null|string API key with the prefix */ public function getApiKeyWithPrefix($apiKeyIdentifier) { @@ -426,4 +462,70 @@ public function getApiKeyWithPrefix($apiKeyIdentifier) return $keyWithPrefix; } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.yourpayroll.com.au", + "description" => "No description provided", + ] + ]; + } + + /** + * 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/src/lib/HeaderSelector.php b/src/lib/HeaderSelector.php index 1d07ff6..4bb5712 100644 --- a/src/lib/HeaderSelector.php +++ b/src/lib/HeaderSelector.php @@ -1,52 +1,49 @@ selectContentTypeHeader($contentTypes); + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + return $headers; } /** - * @param string[] $accept - * @return array + * 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) */ - public function selectHeadersForMultipart($accept) + private function selectAcceptHeader(array $accept): ?string { - $headers = $this->selectHeaders($accept, []); + # filter out empty entries + $accept = array_filter($accept); - unset($headers['Content-Type']); - return $headers; + 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); } /** - * Return the header 'Accept' based on an array of Accept provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $accept Array of header + * @param string $header "Accept" Header * - * @return string Accept (e.g. application/json) + * @return array with the header and its weight */ - private function selectAcceptHeader($accept) + private function getHeaderAndWeight(string $header): array { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { - return null; - } elseif (preg_grep("/application\/json/i", $accept)) { - return 'application/json'; + # 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 { - return implode(',', $accept); + $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; } /** - * Return the content type based on an array of content-type provided + * @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))) * - * @param string[] $contentType Array fo content-type + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) * - * @return string Content-Type (e.g. application/json) + * 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 */ - private function selectContentTypeHeader($contentType) + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; - } else { - return implode(',', $contentType); + if ($currentWeight <= 1) { + return 1; } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/src/lib/Model/AccessModel.php b/src/lib/Model/AccessModel.php index 541288c..85b0fb0 100644 --- a/src/lib/Model/AccessModel.php +++ b/src/lib/Model/AccessModel.php @@ -2,61 +2,61 @@ /** * AccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AccessModel implements ModelInterface, ArrayAccess +class AccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AccessModel'; + protected static $openAPIModelName = 'AccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', 'email' => 'string' ]; @@ -65,20 +65,39 @@ class AccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'email' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -223,12 +309,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -247,12 +336,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -264,7 +356,7 @@ public function setEmail($email) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ActivityReportExportModel.php b/src/lib/Model/ActivityReportExportModel.php index 4d4efe7..8dc1237 100644 --- a/src/lib/Model/ActivityReportExportModel.php +++ b/src/lib/Model/ActivityReportExportModel.php @@ -2,81 +2,83 @@ /** * ActivityReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ActivityReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ActivityReportExportModel implements ModelInterface, ArrayAccess +class ActivityReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ActivityReportExportModel'; + protected static $openAPIModelName = 'ActivityReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'location_id' => 'int', 'location' => 'string', 'first_name' => 'string', 'surname' => 'string', - 'total_hours' => 'double', - 'gross_earnings' => 'double', - 'taxable_earnings' => 'double', - 'payg_withholding' => 'double', - 'super_contributions' => 'double', - 'employer_contributions' => 'double', - 'net_earnings' => 'double' + 'total_hours' => 'float', + 'gross_earnings' => 'float', + 'taxable_earnings' => 'float', + 'payg_withholding' => 'float', + 'super_contributions' => 'float', + 'employer_contributions' => 'float', + 'net_earnings' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'location_id' => 'int32', 'location' => null, @@ -91,14 +93,41 @@ class ActivityReportExportModel implements ModelInterface, ArrayAccess 'net_earnings' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'location_id' => false, + 'location' => false, + 'first_name' => false, + 'surname' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'taxable_earnings' => false, + 'payg_withholding' => false, + 'super_contributions' => false, + 'employer_contributions' => false, + 'net_earnings' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['payg_withholding'] = isset($data['payg_withholding']) ? $data['payg_withholding'] : null; - $this->container['super_contributions'] = isset($data['super_contributions']) ? $data['super_contributions'] : null; - $this->container['employer_contributions'] = isset($data['employer_contributions']) ? $data['employer_contributions'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('payg_withholding', $data ?? [], null); + $this->setIfExists('super_contributions', $data ?? [], null); + $this->setIfExists('employer_contributions', $data ?? [], null); + $this->setIfExists('net_earnings', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -283,12 +379,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -297,7 +396,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -307,12 +406,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -321,7 +423,7 @@ public function setLocationId($location_id) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -331,12 +433,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -345,7 +450,7 @@ public function setLocation($location) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -355,12 +460,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -369,7 +477,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -379,12 +487,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -393,7 +504,7 @@ public function setSurname($surname) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -403,12 +514,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -417,7 +531,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -427,12 +541,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -441,7 +558,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -451,12 +568,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -465,7 +585,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets payg_withholding * - * @return double + * @return float|null */ public function getPaygWithholding() { @@ -475,12 +595,15 @@ public function getPaygWithholding() /** * Sets payg_withholding * - * @param double $payg_withholding + * @param float|null $payg_withholding * - * @return $this + * @return self */ public function setPaygWithholding($payg_withholding) { + if (is_null($payg_withholding)) { + throw new \InvalidArgumentException('non-nullable payg_withholding cannot be null'); + } $this->container['payg_withholding'] = $payg_withholding; return $this; @@ -489,7 +612,7 @@ public function setPaygWithholding($payg_withholding) /** * Gets super_contributions * - * @return double + * @return float|null */ public function getSuperContributions() { @@ -499,12 +622,15 @@ public function getSuperContributions() /** * Sets super_contributions * - * @param double $super_contributions + * @param float|null $super_contributions * - * @return $this + * @return self */ public function setSuperContributions($super_contributions) { + if (is_null($super_contributions)) { + throw new \InvalidArgumentException('non-nullable super_contributions cannot be null'); + } $this->container['super_contributions'] = $super_contributions; return $this; @@ -513,7 +639,7 @@ public function setSuperContributions($super_contributions) /** * Gets employer_contributions * - * @return double + * @return float|null */ public function getEmployerContributions() { @@ -523,12 +649,15 @@ public function getEmployerContributions() /** * Sets employer_contributions * - * @param double $employer_contributions + * @param float|null $employer_contributions * - * @return $this + * @return self */ public function setEmployerContributions($employer_contributions) { + if (is_null($employer_contributions)) { + throw new \InvalidArgumentException('non-nullable employer_contributions cannot be null'); + } $this->container['employer_contributions'] = $employer_contributions; return $this; @@ -537,7 +666,7 @@ public function setEmployerContributions($employer_contributions) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -547,12 +676,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -564,7 +696,7 @@ public function setNetEarnings($net_earnings) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AddNoteModel.php b/src/lib/Model/AddNoteModel.php index b6f801a..51ba73c 100644 --- a/src/lib/Model/AddNoteModel.php +++ b/src/lib/Model/AddNoteModel.php @@ -2,61 +2,61 @@ /** * AddNoteModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AddNoteModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AddNoteModel implements ModelInterface, ArrayAccess +class AddNoteModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AddNoteModel'; + protected static $openAPIModelName = 'AddNoteModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'type' => 'string', 'visibility' => 'string', @@ -68,8 +68,10 @@ class AddNoteModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'type' => null, 'visibility' => null, @@ -77,14 +79,34 @@ class AddNoteModel implements ModelInterface, ArrayAccess 'is_admin_initiated' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'type' => false, + 'visibility' => false, + 'note' => false, + 'is_admin_initiated' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -175,17 +249,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TYPE_SHIFT = 'Shift'; - const TYPE_CLOCK_ON = 'ClockOn'; - const TYPE_CLOCK_OFF = 'ClockOff'; - const VISIBILITY_HIDDEN = 'Hidden'; - const VISIBILITY_VISIBLE = 'Visible'; - + public const TYPE_SHIFT = 'Shift'; + public const TYPE_CLOCK_ON = 'ClockOn'; + public const TYPE_CLOCK_OFF = 'ClockOff'; + public const VISIBILITY_HIDDEN = 'Hidden'; + public const VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -199,7 +271,7 @@ public function getTypeAllowableValues() self::TYPE_CLOCK_OFF, ]; } - + /** * Gets allowable values of the enum * @@ -212,7 +284,6 @@ public function getVisibilityAllowableValues() self::VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -229,11 +300,29 @@ public function getVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['visibility'] = isset($data['visibility']) ? $data['visibility'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('visibility', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $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; } /** @@ -248,7 +337,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -256,7 +346,8 @@ public function listInvalidProperties() $allowedValues = $this->getVisibilityAllowableValues(); if (!is_null($this->container['visibility']) && !in_array($this->container['visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'visibility', must be one of '%s'", + "invalid value '%s' for 'visibility', must be one of '%s'", + $this->container['visibility'], implode("', '", $allowedValues) ); } @@ -279,7 +370,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -289,12 +380,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -303,7 +397,7 @@ public function setEmployeeId($employee_id) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -313,17 +407,21 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { + if (!in_array($type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -336,7 +434,7 @@ public function setType($type) /** * Gets visibility * - * @return string + * @return string|null */ public function getVisibility() { @@ -346,17 +444,21 @@ public function getVisibility() /** * Sets visibility * - * @param string $visibility + * @param string|null $visibility * - * @return $this + * @return self */ public function setVisibility($visibility) { + if (is_null($visibility)) { + throw new \InvalidArgumentException('non-nullable visibility cannot be null'); + } $allowedValues = $this->getVisibilityAllowableValues(); - if (!is_null($visibility) && !in_array($visibility, $allowedValues, true)) { + if (!in_array($visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'visibility', must be one of '%s'", + "Invalid value '%s' for 'visibility', must be one of '%s'", + $visibility, implode("', '", $allowedValues) ) ); @@ -369,7 +471,7 @@ public function setVisibility($visibility) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -379,12 +481,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -393,7 +498,7 @@ public function setNote($note) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -403,12 +508,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -420,7 +528,7 @@ public function setIsAdminInitiated($is_admin_initiated) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -430,22 +538,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -461,11 +570,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -473,13 +595,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AdditionalEarningsInputModel.php b/src/lib/Model/AdditionalEarningsInputModel.php index bf70dad..38bbd68 100644 --- a/src/lib/Model/AdditionalEarningsInputModel.php +++ b/src/lib/Model/AdditionalEarningsInputModel.php @@ -2,71 +2,71 @@ /** * AdditionalEarningsInputModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AdditionalEarningsInputModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AdditionalEarningsInputModel implements ModelInterface, ArrayAccess +class AdditionalEarningsInputModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AdditionalEarningsInputModel'; + protected static $openAPIModelName = 'AdditionalEarningsInputModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'pay_category_id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'expiry_date' => '\DateTime', - 'maximum_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', 'notes' => 'string', - 'units' => 'double', + 'units' => 'float', 'location_id' => 'int', - 'super_rate' => 'double', + 'super_rate' => 'float', 'override_super_rate' => 'bool' ]; @@ -74,8 +74,10 @@ class AdditionalEarningsInputModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int64', 'pay_category_id' => 'int32', 'employee_id' => 'int32', @@ -89,14 +91,40 @@ class AdditionalEarningsInputModel implements ModelInterface, ArrayAccess 'override_super_rate' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'pay_category_id' => false, + 'employee_id' => false, + 'amount' => false, + 'expiry_date' => false, + 'maximum_amount_paid' => false, + 'notes' => false, + 'units' => false, + 'location_id' => false, + 'super_rate' => false, + 'override_super_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['super_rate'] = isset($data['super_rate']) ? $data['super_rate'] : null; - $this->container['override_super_rate'] = isset($data['override_super_rate']) ? $data['override_super_rate'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('super_rate', $data ?? [], null); + $this->setIfExists('override_super_rate', $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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -277,12 +372,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -291,7 +389,7 @@ public function setId($id) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -301,12 +399,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -315,7 +416,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -325,12 +426,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -339,7 +443,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -349,12 +453,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -363,7 +470,7 @@ public function setAmount($amount) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -373,12 +480,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -387,7 +497,7 @@ public function setExpiryDate($expiry_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -397,12 +507,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -411,7 +524,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -421,12 +534,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -435,7 +551,7 @@ public function setNotes($notes) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -445,12 +561,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -459,7 +578,7 @@ public function setUnits($units) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -469,12 +588,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -483,7 +605,7 @@ public function setLocationId($location_id) /** * Gets super_rate * - * @return double + * @return float|null */ public function getSuperRate() { @@ -493,12 +615,15 @@ public function getSuperRate() /** * Sets super_rate * - * @param double $super_rate + * @param float|null $super_rate * - * @return $this + * @return self */ public function setSuperRate($super_rate) { + if (is_null($super_rate)) { + throw new \InvalidArgumentException('non-nullable super_rate cannot be null'); + } $this->container['super_rate'] = $super_rate; return $this; @@ -507,7 +632,7 @@ public function setSuperRate($super_rate) /** * Gets override_super_rate * - * @return bool + * @return bool|null */ public function getOverrideSuperRate() { @@ -517,12 +642,15 @@ public function getOverrideSuperRate() /** * Sets override_super_rate * - * @param bool $override_super_rate + * @param bool|null $override_super_rate * - * @return $this + * @return self */ public function setOverrideSuperRate($override_super_rate) { + if (is_null($override_super_rate)) { + throw new \InvalidArgumentException('non-nullable override_super_rate cannot be null'); + } $this->container['override_super_rate'] = $override_super_rate; return $this; @@ -534,7 +662,7 @@ public function setOverrideSuperRate($override_super_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AdditionalEarningsModel.php b/src/lib/Model/AdditionalEarningsModel.php index 50510bc..75d567a 100644 --- a/src/lib/Model/AdditionalEarningsModel.php +++ b/src/lib/Model/AdditionalEarningsModel.php @@ -2,77 +2,77 @@ /** * AdditionalEarningsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AdditionalEarningsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AdditionalEarningsModel implements ModelInterface, ArrayAccess +class AdditionalEarningsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AdditionalEarningsModel'; + protected static $openAPIModelName = 'AdditionalEarningsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'pay_category_id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'start_date' => '\DateTime', 'expiry_date' => '\DateTime', - 'maximum_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', 'is_active' => 'bool', 'notes' => 'string', 'expiration_type' => 'string', - 'total_amount_paid' => 'double', - 'units' => 'double', + 'total_amount_paid' => 'float', + 'units' => 'float', 'location_id' => 'int', 'location_name' => 'string', - 'super_rate' => 'double', + 'super_rate' => 'float', 'override_super_rate' => 'bool' ]; @@ -80,8 +80,10 @@ class AdditionalEarningsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'pay_category_id' => 'int32', @@ -101,14 +103,46 @@ class AdditionalEarningsModel implements ModelInterface, ArrayAccess 'override_super_rate' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'pay_category_id' => false, + 'employee_id' => false, + 'amount' => false, + 'start_date' => false, + 'expiry_date' => false, + 'maximum_amount_paid' => false, + 'is_active' => false, + 'notes' => false, + 'expiration_type' => false, + 'total_amount_paid' => false, + 'units' => false, + 'location_id' => false, + 'location_name' => false, + 'super_rate' => false, + 'override_super_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -235,15 +321,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EXPIRATION_TYPE_NONE = 'None'; - const EXPIRATION_TYPE_DATE_EXPIRY = 'DateExpiry'; - const EXPIRATION_TYPE_AMOUNT_EXPIRY = 'AmountExpiry'; - + public const EXPIRATION_TYPE_NONE = 'None'; + public const EXPIRATION_TYPE_DATE_EXPIRY = 'DateExpiry'; + public const EXPIRATION_TYPE_AMOUNT_EXPIRY = 'AmountExpiry'; - /** * Gets allowable values of the enum * @@ -257,7 +341,6 @@ public function getExpirationTypeAllowableValues() self::EXPIRATION_TYPE_AMOUNT_EXPIRY, ]; } - /** * Associative array for storing property values @@ -274,23 +357,41 @@ public function getExpirationTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['is_active'] = isset($data['is_active']) ? $data['is_active'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['expiration_type'] = isset($data['expiration_type']) ? $data['expiration_type'] : null; - $this->container['total_amount_paid'] = isset($data['total_amount_paid']) ? $data['total_amount_paid'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['super_rate'] = isset($data['super_rate']) ? $data['super_rate'] : null; - $this->container['override_super_rate'] = isset($data['override_super_rate']) ? $data['override_super_rate'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('is_active', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('expiration_type', $data ?? [], null); + $this->setIfExists('total_amount_paid', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('super_rate', $data ?? [], null); + $this->setIfExists('override_super_rate', $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; } /** @@ -305,7 +406,8 @@ public function listInvalidProperties() $allowedValues = $this->getExpirationTypeAllowableValues(); if (!is_null($this->container['expiration_type']) && !in_array($this->container['expiration_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'expiration_type', must be one of '%s'", + "invalid value '%s' for 'expiration_type', must be one of '%s'", + $this->container['expiration_type'], implode("', '", $allowedValues) ); } @@ -328,7 +430,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -338,12 +440,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -352,7 +457,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -362,12 +467,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -376,7 +484,7 @@ public function setName($name) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -386,12 +494,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -400,7 +511,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -410,12 +521,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -424,7 +538,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -434,12 +548,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -448,7 +565,7 @@ public function setAmount($amount) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -458,12 +575,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -472,7 +592,7 @@ public function setStartDate($start_date) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -482,12 +602,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -496,7 +619,7 @@ public function setExpiryDate($expiry_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -506,12 +629,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -520,7 +646,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets is_active * - * @return bool + * @return bool|null */ public function getIsActive() { @@ -530,12 +656,15 @@ public function getIsActive() /** * Sets is_active * - * @param bool $is_active + * @param bool|null $is_active * - * @return $this + * @return self */ public function setIsActive($is_active) { + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + } $this->container['is_active'] = $is_active; return $this; @@ -544,7 +673,7 @@ public function setIsActive($is_active) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -554,12 +683,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -568,7 +700,7 @@ public function setNotes($notes) /** * Gets expiration_type * - * @return string + * @return string|null */ public function getExpirationType() { @@ -578,17 +710,21 @@ public function getExpirationType() /** * Sets expiration_type * - * @param string $expiration_type + * @param string|null $expiration_type * - * @return $this + * @return self */ public function setExpirationType($expiration_type) { + if (is_null($expiration_type)) { + throw new \InvalidArgumentException('non-nullable expiration_type cannot be null'); + } $allowedValues = $this->getExpirationTypeAllowableValues(); - if (!is_null($expiration_type) && !in_array($expiration_type, $allowedValues, true)) { + if (!in_array($expiration_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'expiration_type', must be one of '%s'", + "Invalid value '%s' for 'expiration_type', must be one of '%s'", + $expiration_type, implode("', '", $allowedValues) ) ); @@ -601,7 +737,7 @@ public function setExpirationType($expiration_type) /** * Gets total_amount_paid * - * @return double + * @return float|null */ public function getTotalAmountPaid() { @@ -611,12 +747,15 @@ public function getTotalAmountPaid() /** * Sets total_amount_paid * - * @param double $total_amount_paid + * @param float|null $total_amount_paid * - * @return $this + * @return self */ public function setTotalAmountPaid($total_amount_paid) { + if (is_null($total_amount_paid)) { + throw new \InvalidArgumentException('non-nullable total_amount_paid cannot be null'); + } $this->container['total_amount_paid'] = $total_amount_paid; return $this; @@ -625,7 +764,7 @@ public function setTotalAmountPaid($total_amount_paid) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -635,12 +774,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -649,7 +791,7 @@ public function setUnits($units) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -659,12 +801,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -673,7 +818,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -683,12 +828,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -697,7 +845,7 @@ public function setLocationName($location_name) /** * Gets super_rate * - * @return double + * @return float|null */ public function getSuperRate() { @@ -707,12 +855,15 @@ public function getSuperRate() /** * Sets super_rate * - * @param double $super_rate + * @param float|null $super_rate * - * @return $this + * @return self */ public function setSuperRate($super_rate) { + if (is_null($super_rate)) { + throw new \InvalidArgumentException('non-nullable super_rate cannot be null'); + } $this->container['super_rate'] = $super_rate; return $this; @@ -721,7 +872,7 @@ public function setSuperRate($super_rate) /** * Gets override_super_rate * - * @return bool + * @return bool|null */ public function getOverrideSuperRate() { @@ -731,12 +882,15 @@ public function getOverrideSuperRate() /** * Sets override_super_rate * - * @param bool $override_super_rate + * @param bool|null $override_super_rate * - * @return $this + * @return self */ public function setOverrideSuperRate($override_super_rate) { + if (is_null($override_super_rate)) { + throw new \InvalidArgumentException('non-nullable override_super_rate cannot be null'); + } $this->container['override_super_rate'] = $override_super_rate; return $this; @@ -748,7 +902,7 @@ public function setOverrideSuperRate($override_super_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -758,22 +912,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -789,11 +944,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -801,13 +969,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiEmployeeExpenseGridModel.php b/src/lib/Model/ApiEmployeeExpenseGridModel.php index 3e54ba5..8e81b71 100644 --- a/src/lib/Model/ApiEmployeeExpenseGridModel.php +++ b/src/lib/Model/ApiEmployeeExpenseGridModel.php @@ -2,63 +2,63 @@ /** * ApiEmployeeExpenseGridModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiEmployeeExpenseGridModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiEmployeeExpenseGridModel implements ModelInterface, ArrayAccess +class ApiEmployeeExpenseGridModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiEmployeeExpenseGridModel'; + protected static $openAPIModelName = 'ApiEmployeeExpenseGridModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'location_name' => 'string', 'employee_expense_category_name' => 'string' ]; @@ -67,22 +67,43 @@ class ApiEmployeeExpenseGridModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notes' => null, 'amount' => 'double', 'location_name' => null, 'employee_expense_category_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notes' => false, + 'amount' => false, + 'location_name' => false, + 'employee_expense_category_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_expense_category_name'] = isset($data['employee_expense_category_name']) ? $data['employee_expense_category_name'] : null; + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_expense_category_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -235,12 +323,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -249,7 +340,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -259,12 +350,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -273,7 +367,7 @@ public function setAmount($amount) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -283,12 +377,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -297,7 +394,7 @@ public function setLocationName($location_name) /** * Gets employee_expense_category_name * - * @return string + * @return string|null */ public function getEmployeeExpenseCategoryName() { @@ -307,12 +404,15 @@ public function getEmployeeExpenseCategoryName() /** * Sets employee_expense_category_name * - * @param string $employee_expense_category_name + * @param string|null $employee_expense_category_name * - * @return $this + * @return self */ public function setEmployeeExpenseCategoryName($employee_expense_category_name) { + if (is_null($employee_expense_category_name)) { + throw new \InvalidArgumentException('non-nullable employee_expense_category_name cannot be null'); + } $this->container['employee_expense_category_name'] = $employee_expense_category_name; return $this; @@ -324,7 +424,7 @@ public function setEmployeeExpenseCategoryName($employee_expense_category_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiPaySlipDeductionModel.php b/src/lib/Model/ApiPaySlipDeductionModel.php index d0c3bc8..8e4b20d 100644 --- a/src/lib/Model/ApiPaySlipDeductionModel.php +++ b/src/lib/Model/ApiPaySlipDeductionModel.php @@ -2,63 +2,63 @@ /** * ApiPaySlipDeductionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiPaySlipDeductionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiPaySlipDeductionModel implements ModelInterface, ArrayAccess +class ApiPaySlipDeductionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiPaySlipDeductionModel'; + protected static $openAPIModelName = 'ApiPaySlipDeductionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'tax_status' => 'string', 'name' => 'string' ]; @@ -67,22 +67,43 @@ class ApiPaySlipDeductionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notes' => null, 'amount' => 'double', 'tax_status' => null, 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notes' => false, + 'amount' => false, + 'tax_status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['tax_status'] = isset($data['tax_status']) ? $data['tax_status'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('tax_status', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -235,12 +323,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -249,7 +340,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -259,12 +350,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -273,7 +367,7 @@ public function setAmount($amount) /** * Gets tax_status * - * @return string + * @return string|null */ public function getTaxStatus() { @@ -283,12 +377,15 @@ public function getTaxStatus() /** * Sets tax_status * - * @param string $tax_status + * @param string|null $tax_status * - * @return $this + * @return self */ public function setTaxStatus($tax_status) { + if (is_null($tax_status)) { + throw new \InvalidArgumentException('non-nullable tax_status cannot be null'); + } $this->container['tax_status'] = $tax_status; return $this; @@ -297,7 +394,7 @@ public function setTaxStatus($tax_status) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -307,12 +404,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -324,7 +424,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiPaySlipLeaveModel.php b/src/lib/Model/ApiPaySlipLeaveModel.php index a11d96b..e6fc776 100644 --- a/src/lib/Model/ApiPaySlipLeaveModel.php +++ b/src/lib/Model/ApiPaySlipLeaveModel.php @@ -2,63 +2,63 @@ /** * ApiPaySlipLeaveModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiPaySlipLeaveModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiPaySlipLeaveModel implements ModelInterface, ArrayAccess +class ApiPaySlipLeaveModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiPaySlipLeaveModel'; + protected static $openAPIModelName = 'ApiPaySlipLeaveModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_category' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'notes' => 'string' ]; @@ -66,21 +66,41 @@ class ApiPaySlipLeaveModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_category' => null, 'amount' => 'double', 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_category' => false, + 'amount' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['leave_category'] = isset($data['leave_category']) ? $data['leave_category'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('leave_category', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets leave_category * - * @return string + * @return string|null */ public function getLeaveCategory() { @@ -229,12 +316,15 @@ public function getLeaveCategory() /** * Sets leave_category * - * @param string $leave_category + * @param string|null $leave_category * - * @return $this + * @return self */ public function setLeaveCategory($leave_category) { + if (is_null($leave_category)) { + throw new \InvalidArgumentException('non-nullable leave_category cannot be null'); + } $this->container['leave_category'] = $leave_category; return $this; @@ -243,7 +333,7 @@ public function setLeaveCategory($leave_category) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -253,12 +343,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -267,7 +360,7 @@ public function setAmount($amount) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -277,12 +370,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -294,7 +390,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiPaySlipPaygAdjustmentModel.php b/src/lib/Model/ApiPaySlipPaygAdjustmentModel.php index 31612ca..b905738 100644 --- a/src/lib/Model/ApiPaySlipPaygAdjustmentModel.php +++ b/src/lib/Model/ApiPaySlipPaygAdjustmentModel.php @@ -2,83 +2,102 @@ /** * ApiPaySlipPaygAdjustmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiPaySlipPaygAdjustmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiPaySlipPaygAdjustmentModel implements ModelInterface, ArrayAccess +class ApiPaySlipPaygAdjustmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiPaySlipPaygAdjustmentModel'; + protected static $openAPIModelName = 'ApiPaySlipPaygAdjustmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notes' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notes' => null, 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notes' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -223,12 +309,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -237,7 +326,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -247,12 +336,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -264,7 +356,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiPaySlipSuperAdjustmentModel.php b/src/lib/Model/ApiPaySlipSuperAdjustmentModel.php index 0b6c5b6..2c9434e 100644 --- a/src/lib/Model/ApiPaySlipSuperAdjustmentModel.php +++ b/src/lib/Model/ApiPaySlipSuperAdjustmentModel.php @@ -2,83 +2,102 @@ /** * ApiPaySlipSuperAdjustmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiPaySlipSuperAdjustmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiPaySlipSuperAdjustmentModel implements ModelInterface, ArrayAccess +class ApiPaySlipSuperAdjustmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiPaySlipSuperAdjustmentModel'; + protected static $openAPIModelName = 'ApiPaySlipSuperAdjustmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notes' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notes' => null, 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notes' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -223,12 +309,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -237,7 +326,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -247,12 +336,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -264,7 +356,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiPaySlipSuperPaymentModel.php b/src/lib/Model/ApiPaySlipSuperPaymentModel.php index 3cda7ae..34487e5 100644 --- a/src/lib/Model/ApiPaySlipSuperPaymentModel.php +++ b/src/lib/Model/ApiPaySlipSuperPaymentModel.php @@ -2,85 +2,105 @@ /** * ApiPaySlipSuperPaymentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiPaySlipSuperPaymentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiPaySlipSuperPaymentModel implements ModelInterface, ArrayAccess +class ApiPaySlipSuperPaymentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiPaySlipSuperPaymentModel'; + protected static $openAPIModelName = 'ApiPaySlipSuperPaymentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'fund_name' => 'string', 'member_number' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'fund_name' => null, 'member_number' => null, 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fund_name' => false, + 'member_number' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['fund_name'] = isset($data['fund_name']) ? $data['fund_name'] : null; - $this->container['member_number'] = isset($data['member_number']) ? $data['member_number'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('fund_name', $data ?? [], null); + $this->setIfExists('member_number', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets fund_name * - * @return string + * @return string|null */ public function getFundName() { @@ -229,12 +316,15 @@ public function getFundName() /** * Sets fund_name * - * @param string $fund_name + * @param string|null $fund_name * - * @return $this + * @return self */ public function setFundName($fund_name) { + if (is_null($fund_name)) { + throw new \InvalidArgumentException('non-nullable fund_name cannot be null'); + } $this->container['fund_name'] = $fund_name; return $this; @@ -243,7 +333,7 @@ public function setFundName($fund_name) /** * Gets member_number * - * @return string + * @return string|null */ public function getMemberNumber() { @@ -253,12 +343,15 @@ public function getMemberNumber() /** * Sets member_number * - * @param string $member_number + * @param string|null $member_number * - * @return $this + * @return self */ public function setMemberNumber($member_number) { + if (is_null($member_number)) { + throw new \InvalidArgumentException('non-nullable member_number cannot be null'); + } $this->container['member_number'] = $member_number; return $this; @@ -267,7 +360,7 @@ public function setMemberNumber($member_number) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -277,12 +370,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -294,7 +390,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApiYearToDateEarningsBreakdownModel.php b/src/lib/Model/ApiYearToDateEarningsBreakdownModel.php index 339fd28..c5021ff 100644 --- a/src/lib/Model/ApiYearToDateEarningsBreakdownModel.php +++ b/src/lib/Model/ApiYearToDateEarningsBreakdownModel.php @@ -2,83 +2,102 @@ /** * ApiYearToDateEarningsBreakdownModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApiYearToDateEarningsBreakdownModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApiYearToDateEarningsBreakdownModel implements ModelInterface, ArrayAccess +class ApiYearToDateEarningsBreakdownModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApiYearToDateEarningsBreakdownModel'; + protected static $openAPIModelName = 'ApiYearToDateEarningsBreakdownModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_category_name' => 'string', - 'gross_earnings' => 'double' + 'gross_earnings' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_category_name' => null, 'gross_earnings' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_category_name' => false, + 'gross_earnings' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_category_name'] = isset($data['pay_category_name']) ? $data['pay_category_name'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; + $this->setIfExists('pay_category_name', $data ?? [], null); + $this->setIfExists('gross_earnings', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets pay_category_name * - * @return string + * @return string|null */ public function getPayCategoryName() { @@ -223,12 +309,15 @@ public function getPayCategoryName() /** * Sets pay_category_name * - * @param string $pay_category_name + * @param string|null $pay_category_name * - * @return $this + * @return self */ public function setPayCategoryName($pay_category_name) { + if (is_null($pay_category_name)) { + throw new \InvalidArgumentException('non-nullable pay_category_name cannot be null'); + } $this->container['pay_category_name'] = $pay_category_name; return $this; @@ -237,7 +326,7 @@ public function setPayCategoryName($pay_category_name) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -247,12 +336,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -264,7 +356,7 @@ public function setGrossEarnings($gross_earnings) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApplyLeaveRequestModel.php b/src/lib/Model/ApplyLeaveRequestModel.php index 0ae832c..82d06ea 100644 --- a/src/lib/Model/ApplyLeaveRequestModel.php +++ b/src/lib/Model/ApplyLeaveRequestModel.php @@ -2,64 +2,64 @@ /** * ApplyLeaveRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApplyLeaveRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApplyLeaveRequestModel implements ModelInterface, ArrayAccess +class ApplyLeaveRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApplyLeaveRequestModel'; + protected static $openAPIModelName = 'ApplyLeaveRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_total_id' => 'int', 'leave_request_id' => 'int', - 'units' => 'double', + 'units' => 'float', 'error_message' => 'string', 'from_date' => '\DateTime', 'to_date' => '\DateTime' @@ -69,8 +69,10 @@ class ApplyLeaveRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_total_id' => 'int32', 'leave_request_id' => 'int32', 'units' => 'double', @@ -79,14 +81,35 @@ class ApplyLeaveRequestModel implements ModelInterface, ArrayAccess 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_total_id' => false, + 'leave_request_id' => false, + 'units' => false, + 'error_message' => false, + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_total_id'] = isset($data['pay_run_total_id']) ? $data['pay_run_total_id'] : null; - $this->container['leave_request_id'] = isset($data['leave_request_id']) ? $data['leave_request_id'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['error_message'] = isset($data['error_message']) ? $data['error_message'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('pay_run_total_id', $data ?? [], null); + $this->setIfExists('leave_request_id', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets pay_run_total_id * - * @return int + * @return int|null */ public function getPayRunTotalId() { @@ -247,12 +337,15 @@ public function getPayRunTotalId() /** * Sets pay_run_total_id * - * @param int $pay_run_total_id + * @param int|null $pay_run_total_id * - * @return $this + * @return self */ public function setPayRunTotalId($pay_run_total_id) { + if (is_null($pay_run_total_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_total_id cannot be null'); + } $this->container['pay_run_total_id'] = $pay_run_total_id; return $this; @@ -261,7 +354,7 @@ public function setPayRunTotalId($pay_run_total_id) /** * Gets leave_request_id * - * @return int + * @return int|null */ public function getLeaveRequestId() { @@ -271,12 +364,15 @@ public function getLeaveRequestId() /** * Sets leave_request_id * - * @param int $leave_request_id + * @param int|null $leave_request_id * - * @return $this + * @return self */ public function setLeaveRequestId($leave_request_id) { + if (is_null($leave_request_id)) { + throw new \InvalidArgumentException('non-nullable leave_request_id cannot be null'); + } $this->container['leave_request_id'] = $leave_request_id; return $this; @@ -285,7 +381,7 @@ public function setLeaveRequestId($leave_request_id) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -295,12 +391,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -309,7 +408,7 @@ public function setUnits($units) /** * Gets error_message * - * @return string + * @return string|null */ public function getErrorMessage() { @@ -319,12 +418,15 @@ public function getErrorMessage() /** * Sets error_message * - * @param string $error_message + * @param string|null $error_message * - * @return $this + * @return self */ public function setErrorMessage($error_message) { + if (is_null($error_message)) { + throw new \InvalidArgumentException('non-nullable error_message cannot be null'); + } $this->container['error_message'] = $error_message; return $this; @@ -333,7 +435,7 @@ public function setErrorMessage($error_message) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -343,12 +445,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -357,7 +462,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -367,12 +472,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -384,7 +492,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ApplyLeaveRequestResult.php b/src/lib/Model/ApplyLeaveRequestResult.php index 91aeac5..dd23f64 100644 --- a/src/lib/Model/ApplyLeaveRequestResult.php +++ b/src/lib/Model/ApplyLeaveRequestResult.php @@ -2,83 +2,102 @@ /** * ApplyLeaveRequestResult * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ApplyLeaveRequestResult Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ApplyLeaveRequestResult implements ModelInterface, ArrayAccess +class ApplyLeaveRequestResult implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ApplyLeaveRequestResult'; + protected static $openAPIModelName = 'ApplyLeaveRequestResult'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'updated_pay_run_totals' => 'int[]', - 'failed_leave_requests' => '\Swagger\Client\Model\ApplyLeaveRequestModel[]' + 'failed_leave_requests' => '\OpenAPI\Client\Model\ApplyLeaveRequestModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'updated_pay_run_totals' => 'int32', 'failed_leave_requests' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'updated_pay_run_totals' => false, + 'failed_leave_requests' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['updated_pay_run_totals'] = isset($data['updated_pay_run_totals']) ? $data['updated_pay_run_totals'] : null; - $this->container['failed_leave_requests'] = isset($data['failed_leave_requests']) ? $data['failed_leave_requests'] : null; + $this->setIfExists('updated_pay_run_totals', $data ?? [], null); + $this->setIfExists('failed_leave_requests', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets updated_pay_run_totals * - * @return int[] + * @return int[]|null */ public function getUpdatedPayRunTotals() { @@ -223,12 +309,15 @@ public function getUpdatedPayRunTotals() /** * Sets updated_pay_run_totals * - * @param int[] $updated_pay_run_totals + * @param int[]|null $updated_pay_run_totals * - * @return $this + * @return self */ public function setUpdatedPayRunTotals($updated_pay_run_totals) { + if (is_null($updated_pay_run_totals)) { + throw new \InvalidArgumentException('non-nullable updated_pay_run_totals cannot be null'); + } $this->container['updated_pay_run_totals'] = $updated_pay_run_totals; return $this; @@ -237,7 +326,7 @@ public function setUpdatedPayRunTotals($updated_pay_run_totals) /** * Gets failed_leave_requests * - * @return \Swagger\Client\Model\ApplyLeaveRequestModel[] + * @return \OpenAPI\Client\Model\ApplyLeaveRequestModel[]|null */ public function getFailedLeaveRequests() { @@ -247,12 +336,15 @@ public function getFailedLeaveRequests() /** * Sets failed_leave_requests * - * @param \Swagger\Client\Model\ApplyLeaveRequestModel[] $failed_leave_requests + * @param \OpenAPI\Client\Model\ApplyLeaveRequestModel[]|null $failed_leave_requests * - * @return $this + * @return self */ public function setFailedLeaveRequests($failed_leave_requests) { + if (is_null($failed_leave_requests)) { + throw new \InvalidArgumentException('non-nullable failed_leave_requests cannot be null'); + } $this->container['failed_leave_requests'] = $failed_leave_requests; return $this; @@ -264,7 +356,7 @@ public function setFailedLeaveRequests($failed_leave_requests) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/Attachment.php b/src/lib/Model/Attachment.php index 71bb8dc..8fabb00 100644 --- a/src/lib/Model/Attachment.php +++ b/src/lib/Model/Attachment.php @@ -2,61 +2,61 @@ /** * Attachment * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * Attachment Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class Attachment implements ModelInterface, ArrayAccess +class Attachment implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'Attachment'; + protected static $openAPIModelName = 'Attachment'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'data' => 'string', 'is_deleted' => 'bool', 'id' => 'int', @@ -71,8 +71,10 @@ class Attachment implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'data' => 'byte', 'is_deleted' => null, 'id' => 'int32', @@ -83,14 +85,37 @@ class Attachment implements ModelInterface, ArrayAccess 'is_infected' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'is_deleted' => false, + 'id' => false, + 'friendly_name' => false, + 'date_created' => false, + 'url' => false, + 'date_scanned' => false, + 'is_infected' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['data'] = isset($data['data']) ? $data['data'] : null; - $this->container['is_deleted'] = isset($data['is_deleted']) ? $data['is_deleted'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['friendly_name'] = isset($data['friendly_name']) ? $data['friendly_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['date_scanned'] = isset($data['date_scanned']) ? $data['date_scanned'] : null; - $this->container['is_infected'] = isset($data['is_infected']) ? $data['is_infected'] : null; + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('is_deleted', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('friendly_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('date_scanned', $data ?? [], null); + $this->setIfExists('is_infected', $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; } /** @@ -253,7 +345,7 @@ public function valid() /** * Gets data * - * @return string + * @return string|null */ public function getData() { @@ -263,15 +355,18 @@ public function getData() /** * Sets data * - * @param string $data + * @param string|null $data * - * @return $this + * @return self */ public function setData($data) { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } - if (!is_null($data) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $data))) { - throw new \InvalidArgumentException("invalid value for $data when calling Attachment., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $data))) { + throw new \InvalidArgumentException("invalid value for \$data when calling Attachment., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['data'] = $data; @@ -282,7 +377,7 @@ public function setData($data) /** * Gets is_deleted * - * @return bool + * @return bool|null */ public function getIsDeleted() { @@ -292,12 +387,15 @@ public function getIsDeleted() /** * Sets is_deleted * - * @param bool $is_deleted + * @param bool|null $is_deleted * - * @return $this + * @return self */ public function setIsDeleted($is_deleted) { + if (is_null($is_deleted)) { + throw new \InvalidArgumentException('non-nullable is_deleted cannot be null'); + } $this->container['is_deleted'] = $is_deleted; return $this; @@ -306,7 +404,7 @@ public function setIsDeleted($is_deleted) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -316,12 +414,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -330,7 +431,7 @@ public function setId($id) /** * Gets friendly_name * - * @return string + * @return string|null */ public function getFriendlyName() { @@ -340,12 +441,15 @@ public function getFriendlyName() /** * Sets friendly_name * - * @param string $friendly_name + * @param string|null $friendly_name * - * @return $this + * @return self */ public function setFriendlyName($friendly_name) { + if (is_null($friendly_name)) { + throw new \InvalidArgumentException('non-nullable friendly_name cannot be null'); + } $this->container['friendly_name'] = $friendly_name; return $this; @@ -354,7 +458,7 @@ public function setFriendlyName($friendly_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -364,12 +468,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -378,7 +485,7 @@ public function setDateCreated($date_created) /** * Gets url * - * @return string + * @return string|null */ public function getUrl() { @@ -388,12 +495,15 @@ public function getUrl() /** * Sets url * - * @param string $url + * @param string|null $url * - * @return $this + * @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; @@ -402,7 +512,7 @@ public function setUrl($url) /** * Gets date_scanned * - * @return \DateTime + * @return \DateTime|null */ public function getDateScanned() { @@ -412,12 +522,15 @@ public function getDateScanned() /** * Sets date_scanned * - * @param \DateTime $date_scanned + * @param \DateTime|null $date_scanned * - * @return $this + * @return self */ public function setDateScanned($date_scanned) { + if (is_null($date_scanned)) { + throw new \InvalidArgumentException('non-nullable date_scanned cannot be null'); + } $this->container['date_scanned'] = $date_scanned; return $this; @@ -426,7 +539,7 @@ public function setDateScanned($date_scanned) /** * Gets is_infected * - * @return bool + * @return bool|null */ public function getIsInfected() { @@ -436,12 +549,15 @@ public function getIsInfected() /** * Sets is_infected * - * @param bool $is_infected + * @param bool|null $is_infected * - * @return $this + * @return self */ public function setIsInfected($is_infected) { + if (is_null($is_infected)) { + throw new \InvalidArgumentException('non-nullable is_infected cannot be null'); + } $this->container['is_infected'] = $is_infected; return $this; @@ -453,7 +569,7 @@ public function setIsInfected($is_infected) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -463,22 +579,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -494,11 +611,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -506,13 +636,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AttachmentModel.php b/src/lib/Model/AttachmentModel.php index 4fff93c..05b72d9 100644 --- a/src/lib/Model/AttachmentModel.php +++ b/src/lib/Model/AttachmentModel.php @@ -2,61 +2,61 @@ /** * AttachmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AttachmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AttachmentModel implements ModelInterface, ArrayAccess +class AttachmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AttachmentModel'; + protected static $openAPIModelName = 'AttachmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'friendly_name' => 'string', 'date_created' => '\DateTime', @@ -69,8 +69,10 @@ class AttachmentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'friendly_name' => null, 'date_created' => 'date-time', @@ -79,14 +81,35 @@ class AttachmentModel implements ModelInterface, ArrayAccess 'is_infected' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'friendly_name' => false, + 'date_created' => false, + 'url' => false, + 'date_scanned' => false, + 'is_infected' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['friendly_name'] = isset($data['friendly_name']) ? $data['friendly_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['date_scanned'] = isset($data['date_scanned']) ? $data['date_scanned'] : null; - $this->container['is_infected'] = isset($data['is_infected']) ? $data['is_infected'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('friendly_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('date_scanned', $data ?? [], null); + $this->setIfExists('is_infected', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -247,12 +337,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setId($id) /** * Gets friendly_name * - * @return string + * @return string|null */ public function getFriendlyName() { @@ -271,12 +364,15 @@ public function getFriendlyName() /** * Sets friendly_name * - * @param string $friendly_name + * @param string|null $friendly_name * - * @return $this + * @return self */ public function setFriendlyName($friendly_name) { + if (is_null($friendly_name)) { + throw new \InvalidArgumentException('non-nullable friendly_name cannot be null'); + } $this->container['friendly_name'] = $friendly_name; return $this; @@ -285,7 +381,7 @@ public function setFriendlyName($friendly_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -295,12 +391,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -309,7 +408,7 @@ public function setDateCreated($date_created) /** * Gets url * - * @return string + * @return string|null */ public function getUrl() { @@ -319,12 +418,15 @@ public function getUrl() /** * Sets url * - * @param string $url + * @param string|null $url * - * @return $this + * @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; @@ -333,7 +435,7 @@ public function setUrl($url) /** * Gets date_scanned * - * @return \DateTime + * @return \DateTime|null */ public function getDateScanned() { @@ -343,12 +445,15 @@ public function getDateScanned() /** * Sets date_scanned * - * @param \DateTime $date_scanned + * @param \DateTime|null $date_scanned * - * @return $this + * @return self */ public function setDateScanned($date_scanned) { + if (is_null($date_scanned)) { + throw new \InvalidArgumentException('non-nullable date_scanned cannot be null'); + } $this->container['date_scanned'] = $date_scanned; return $this; @@ -357,7 +462,7 @@ public function setDateScanned($date_scanned) /** * Gets is_infected * - * @return bool + * @return bool|null */ public function getIsInfected() { @@ -367,12 +472,15 @@ public function getIsInfected() /** * Sets is_infected * - * @param bool $is_infected + * @param bool|null $is_infected * - * @return $this + * @return self */ public function setIsInfected($is_infected) { + if (is_null($is_infected)) { + throw new \InvalidArgumentException('non-nullable is_infected cannot be null'); + } $this->container['is_infected'] = $is_infected; return $this; @@ -384,7 +492,7 @@ public function setIsInfected($is_infected) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuAcceptRosterShiftResponseModel.php b/src/lib/Model/AuAcceptRosterShiftResponseModel.php index 4e5c8b2..2f0f15c 100644 --- a/src/lib/Model/AuAcceptRosterShiftResponseModel.php +++ b/src/lib/Model/AuAcceptRosterShiftResponseModel.php @@ -2,62 +2,62 @@ /** * AuAcceptRosterShiftResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuAcceptRosterShiftResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuAcceptRosterShiftResponseModel implements ModelInterface, ArrayAccess +class AuAcceptRosterShiftResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuAcceptRosterShiftResponseModel'; + protected static $openAPIModelName = 'AuAcceptRosterShiftResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'shift' => '\Swagger\Client\Model\AuEssRosterShiftModel', + protected static $openAPITypes = [ + 'shift' => '\OpenAPI\Client\Model\AuEssRosterShiftModel', 'proposed_swap_count' => 'int', 'pending_shift_count' => 'int', 'biddable_shift_count' => 'int', @@ -68,8 +68,10 @@ class AuAcceptRosterShiftResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shift' => null, 'proposed_swap_count' => 'int32', 'pending_shift_count' => 'int32', @@ -77,14 +79,34 @@ class AuAcceptRosterShiftResponseModel implements ModelInterface, ArrayAccess 'not_accepted_shifts_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shift' => false, + 'proposed_swap_count' => false, + 'pending_shift_count' => false, + 'biddable_shift_count' => false, + 'not_accepted_shifts_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shift'] = isset($data['shift']) ? $data['shift'] : null; - $this->container['proposed_swap_count'] = isset($data['proposed_swap_count']) ? $data['proposed_swap_count'] : null; - $this->container['pending_shift_count'] = isset($data['pending_shift_count']) ? $data['pending_shift_count'] : null; - $this->container['biddable_shift_count'] = isset($data['biddable_shift_count']) ? $data['biddable_shift_count'] : null; - $this->container['not_accepted_shifts_count'] = isset($data['not_accepted_shifts_count']) ? $data['not_accepted_shifts_count'] : null; + $this->setIfExists('shift', $data ?? [], null); + $this->setIfExists('proposed_swap_count', $data ?? [], null); + $this->setIfExists('pending_shift_count', $data ?? [], null); + $this->setIfExists('biddable_shift_count', $data ?? [], null); + $this->setIfExists('not_accepted_shifts_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets shift * - * @return \Swagger\Client\Model\AuEssRosterShiftModel + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel|null */ public function getShift() { @@ -241,12 +330,15 @@ public function getShift() /** * Sets shift * - * @param \Swagger\Client\Model\AuEssRosterShiftModel $shift + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel|null $shift shift * - * @return $this + * @return self */ public function setShift($shift) { + if (is_null($shift)) { + throw new \InvalidArgumentException('non-nullable shift cannot be null'); + } $this->container['shift'] = $shift; return $this; @@ -255,7 +347,7 @@ public function setShift($shift) /** * Gets proposed_swap_count * - * @return int + * @return int|null */ public function getProposedSwapCount() { @@ -265,12 +357,15 @@ public function getProposedSwapCount() /** * Sets proposed_swap_count * - * @param int $proposed_swap_count + * @param int|null $proposed_swap_count * - * @return $this + * @return self */ public function setProposedSwapCount($proposed_swap_count) { + if (is_null($proposed_swap_count)) { + throw new \InvalidArgumentException('non-nullable proposed_swap_count cannot be null'); + } $this->container['proposed_swap_count'] = $proposed_swap_count; return $this; @@ -279,7 +374,7 @@ public function setProposedSwapCount($proposed_swap_count) /** * Gets pending_shift_count * - * @return int + * @return int|null */ public function getPendingShiftCount() { @@ -289,12 +384,15 @@ public function getPendingShiftCount() /** * Sets pending_shift_count * - * @param int $pending_shift_count + * @param int|null $pending_shift_count * - * @return $this + * @return self */ public function setPendingShiftCount($pending_shift_count) { + if (is_null($pending_shift_count)) { + throw new \InvalidArgumentException('non-nullable pending_shift_count cannot be null'); + } $this->container['pending_shift_count'] = $pending_shift_count; return $this; @@ -303,7 +401,7 @@ public function setPendingShiftCount($pending_shift_count) /** * Gets biddable_shift_count * - * @return int + * @return int|null */ public function getBiddableShiftCount() { @@ -313,12 +411,15 @@ public function getBiddableShiftCount() /** * Sets biddable_shift_count * - * @param int $biddable_shift_count + * @param int|null $biddable_shift_count * - * @return $this + * @return self */ public function setBiddableShiftCount($biddable_shift_count) { + if (is_null($biddable_shift_count)) { + throw new \InvalidArgumentException('non-nullable biddable_shift_count cannot be null'); + } $this->container['biddable_shift_count'] = $biddable_shift_count; return $this; @@ -327,7 +428,7 @@ public function setBiddableShiftCount($biddable_shift_count) /** * Gets not_accepted_shifts_count * - * @return int + * @return int|null */ public function getNotAcceptedShiftsCount() { @@ -337,12 +438,15 @@ public function getNotAcceptedShiftsCount() /** * Sets not_accepted_shifts_count * - * @param int $not_accepted_shifts_count + * @param int|null $not_accepted_shifts_count * - * @return $this + * @return self */ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) { + if (is_null($not_accepted_shifts_count)) { + throw new \InvalidArgumentException('non-nullable not_accepted_shifts_count cannot be null'); + } $this->container['not_accepted_shifts_count'] = $not_accepted_shifts_count; return $this; @@ -354,7 +458,7 @@ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuAcceptRosterShiftsResponseModel.php b/src/lib/Model/AuAcceptRosterShiftsResponseModel.php index 4bd0567..5b13501 100644 --- a/src/lib/Model/AuAcceptRosterShiftsResponseModel.php +++ b/src/lib/Model/AuAcceptRosterShiftsResponseModel.php @@ -2,62 +2,62 @@ /** * AuAcceptRosterShiftsResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuAcceptRosterShiftsResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuAcceptRosterShiftsResponseModel implements ModelInterface, ArrayAccess +class AuAcceptRosterShiftsResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuAcceptRosterShiftsResponseModel'; + protected static $openAPIModelName = 'AuAcceptRosterShiftsResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'shifts' => '\Swagger\Client\Model\AuEssRosterShiftModel[]', + protected static $openAPITypes = [ + 'shifts' => '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', 'proposed_swap_count' => 'int', 'pending_shift_count' => 'int', 'biddable_shift_count' => 'int', @@ -68,8 +68,10 @@ class AuAcceptRosterShiftsResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shifts' => null, 'proposed_swap_count' => 'int32', 'pending_shift_count' => 'int32', @@ -77,14 +79,34 @@ class AuAcceptRosterShiftsResponseModel implements ModelInterface, ArrayAccess 'not_accepted_shifts_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shifts' => false, + 'proposed_swap_count' => false, + 'pending_shift_count' => false, + 'biddable_shift_count' => false, + 'not_accepted_shifts_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; - $this->container['proposed_swap_count'] = isset($data['proposed_swap_count']) ? $data['proposed_swap_count'] : null; - $this->container['pending_shift_count'] = isset($data['pending_shift_count']) ? $data['pending_shift_count'] : null; - $this->container['biddable_shift_count'] = isset($data['biddable_shift_count']) ? $data['biddable_shift_count'] : null; - $this->container['not_accepted_shifts_count'] = isset($data['not_accepted_shifts_count']) ? $data['not_accepted_shifts_count'] : null; + $this->setIfExists('shifts', $data ?? [], null); + $this->setIfExists('proposed_swap_count', $data ?? [], null); + $this->setIfExists('pending_shift_count', $data ?? [], null); + $this->setIfExists('biddable_shift_count', $data ?? [], null); + $this->setIfExists('not_accepted_shifts_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets shifts * - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[]|null */ public function getShifts() { @@ -241,12 +330,15 @@ public function getShifts() /** * Sets shifts * - * @param \Swagger\Client\Model\AuEssRosterShiftModel[] $shifts + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -255,7 +347,7 @@ public function setShifts($shifts) /** * Gets proposed_swap_count * - * @return int + * @return int|null */ public function getProposedSwapCount() { @@ -265,12 +357,15 @@ public function getProposedSwapCount() /** * Sets proposed_swap_count * - * @param int $proposed_swap_count + * @param int|null $proposed_swap_count * - * @return $this + * @return self */ public function setProposedSwapCount($proposed_swap_count) { + if (is_null($proposed_swap_count)) { + throw new \InvalidArgumentException('non-nullable proposed_swap_count cannot be null'); + } $this->container['proposed_swap_count'] = $proposed_swap_count; return $this; @@ -279,7 +374,7 @@ public function setProposedSwapCount($proposed_swap_count) /** * Gets pending_shift_count * - * @return int + * @return int|null */ public function getPendingShiftCount() { @@ -289,12 +384,15 @@ public function getPendingShiftCount() /** * Sets pending_shift_count * - * @param int $pending_shift_count + * @param int|null $pending_shift_count * - * @return $this + * @return self */ public function setPendingShiftCount($pending_shift_count) { + if (is_null($pending_shift_count)) { + throw new \InvalidArgumentException('non-nullable pending_shift_count cannot be null'); + } $this->container['pending_shift_count'] = $pending_shift_count; return $this; @@ -303,7 +401,7 @@ public function setPendingShiftCount($pending_shift_count) /** * Gets biddable_shift_count * - * @return int + * @return int|null */ public function getBiddableShiftCount() { @@ -313,12 +411,15 @@ public function getBiddableShiftCount() /** * Sets biddable_shift_count * - * @param int $biddable_shift_count + * @param int|null $biddable_shift_count * - * @return $this + * @return self */ public function setBiddableShiftCount($biddable_shift_count) { + if (is_null($biddable_shift_count)) { + throw new \InvalidArgumentException('non-nullable biddable_shift_count cannot be null'); + } $this->container['biddable_shift_count'] = $biddable_shift_count; return $this; @@ -327,7 +428,7 @@ public function setBiddableShiftCount($biddable_shift_count) /** * Gets not_accepted_shifts_count * - * @return int + * @return int|null */ public function getNotAcceptedShiftsCount() { @@ -337,12 +438,15 @@ public function getNotAcceptedShiftsCount() /** * Sets not_accepted_shifts_count * - * @param int $not_accepted_shifts_count + * @param int|null $not_accepted_shifts_count * - * @return $this + * @return self */ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) { + if (is_null($not_accepted_shifts_count)) { + throw new \InvalidArgumentException('non-nullable not_accepted_shifts_count cannot be null'); + } $this->container['not_accepted_shifts_count'] = $not_accepted_shifts_count; return $this; @@ -354,7 +458,7 @@ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuActiveEmployeesModel.php b/src/lib/Model/AuActiveEmployeesModel.php index a537e04..a00a129 100644 --- a/src/lib/Model/AuActiveEmployeesModel.php +++ b/src/lib/Model/AuActiveEmployeesModel.php @@ -2,61 +2,61 @@ /** * AuActiveEmployeesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuActiveEmployeesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuActiveEmployeesModel implements ModelInterface, ArrayAccess +class AuActiveEmployeesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuActiveEmployeesModel'; + protected static $openAPIModelName = 'AuActiveEmployeesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'abn' => 'string', 'is_stp_enabled' => 'bool', 'business_id' => 'int', @@ -80,8 +80,10 @@ class AuActiveEmployeesModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'abn' => null, 'is_stp_enabled' => null, 'business_id' => 'int32', @@ -101,14 +103,46 @@ class AuActiveEmployeesModel implements ModelInterface, ArrayAccess 'active_emps' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'abn' => false, + 'is_stp_enabled' => false, + 'business_id' => false, + 'business_name' => false, + 'date_created' => false, + 'billing_plan' => false, + 'realm_id' => false, + 'external_id' => false, + 'email_addresses' => false, + 'user_ids' => false, + 'number_of_incomplete_employees' => false, + 'number_of_complete_employees' => false, + 'number_of_employees_paid' => false, + 'number_of_pay_runs' => false, + 'date_last_pay_run_finalised' => false, + 'date_last_billable_activity' => false, + 'active_emps' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -235,12 +321,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -257,23 +340,41 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['is_stp_enabled'] = isset($data['is_stp_enabled']) ? $data['is_stp_enabled'] : null; - $this->container['business_id'] = isset($data['business_id']) ? $data['business_id'] : null; - $this->container['business_name'] = isset($data['business_name']) ? $data['business_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['billing_plan'] = isset($data['billing_plan']) ? $data['billing_plan'] : null; - $this->container['realm_id'] = isset($data['realm_id']) ? $data['realm_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['email_addresses'] = isset($data['email_addresses']) ? $data['email_addresses'] : null; - $this->container['user_ids'] = isset($data['user_ids']) ? $data['user_ids'] : null; - $this->container['number_of_incomplete_employees'] = isset($data['number_of_incomplete_employees']) ? $data['number_of_incomplete_employees'] : null; - $this->container['number_of_complete_employees'] = isset($data['number_of_complete_employees']) ? $data['number_of_complete_employees'] : null; - $this->container['number_of_employees_paid'] = isset($data['number_of_employees_paid']) ? $data['number_of_employees_paid'] : null; - $this->container['number_of_pay_runs'] = isset($data['number_of_pay_runs']) ? $data['number_of_pay_runs'] : null; - $this->container['date_last_pay_run_finalised'] = isset($data['date_last_pay_run_finalised']) ? $data['date_last_pay_run_finalised'] : null; - $this->container['date_last_billable_activity'] = isset($data['date_last_billable_activity']) ? $data['date_last_billable_activity'] : null; - $this->container['active_emps'] = isset($data['active_emps']) ? $data['active_emps'] : null; + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('is_stp_enabled', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('business_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('billing_plan', $data ?? [], null); + $this->setIfExists('realm_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('user_ids', $data ?? [], null); + $this->setIfExists('number_of_incomplete_employees', $data ?? [], null); + $this->setIfExists('number_of_complete_employees', $data ?? [], null); + $this->setIfExists('number_of_employees_paid', $data ?? [], null); + $this->setIfExists('number_of_pay_runs', $data ?? [], null); + $this->setIfExists('date_last_pay_run_finalised', $data ?? [], null); + $this->setIfExists('date_last_billable_activity', $data ?? [], null); + $this->setIfExists('active_emps', $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; } /** @@ -303,7 +404,7 @@ public function valid() /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -313,12 +414,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -327,7 +431,7 @@ public function setAbn($abn) /** * Gets is_stp_enabled * - * @return bool + * @return bool|null */ public function getIsStpEnabled() { @@ -337,12 +441,15 @@ public function getIsStpEnabled() /** * Sets is_stp_enabled * - * @param bool $is_stp_enabled + * @param bool|null $is_stp_enabled * - * @return $this + * @return self */ public function setIsStpEnabled($is_stp_enabled) { + if (is_null($is_stp_enabled)) { + throw new \InvalidArgumentException('non-nullable is_stp_enabled cannot be null'); + } $this->container['is_stp_enabled'] = $is_stp_enabled; return $this; @@ -351,7 +458,7 @@ public function setIsStpEnabled($is_stp_enabled) /** * Gets business_id * - * @return int + * @return int|null */ public function getBusinessId() { @@ -361,12 +468,15 @@ public function getBusinessId() /** * Sets business_id * - * @param int $business_id + * @param int|null $business_id * - * @return $this + * @return self */ public function setBusinessId($business_id) { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } $this->container['business_id'] = $business_id; return $this; @@ -375,7 +485,7 @@ public function setBusinessId($business_id) /** * Gets business_name * - * @return string + * @return string|null */ public function getBusinessName() { @@ -385,12 +495,15 @@ public function getBusinessName() /** * Sets business_name * - * @param string $business_name + * @param string|null $business_name * - * @return $this + * @return self */ public function setBusinessName($business_name) { + if (is_null($business_name)) { + throw new \InvalidArgumentException('non-nullable business_name cannot be null'); + } $this->container['business_name'] = $business_name; return $this; @@ -399,7 +512,7 @@ public function setBusinessName($business_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -409,12 +522,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -423,7 +539,7 @@ public function setDateCreated($date_created) /** * Gets billing_plan * - * @return string + * @return string|null */ public function getBillingPlan() { @@ -433,12 +549,15 @@ public function getBillingPlan() /** * Sets billing_plan * - * @param string $billing_plan + * @param string|null $billing_plan * - * @return $this + * @return self */ public function setBillingPlan($billing_plan) { + if (is_null($billing_plan)) { + throw new \InvalidArgumentException('non-nullable billing_plan cannot be null'); + } $this->container['billing_plan'] = $billing_plan; return $this; @@ -447,7 +566,7 @@ public function setBillingPlan($billing_plan) /** * Gets realm_id * - * @return string + * @return string|null */ public function getRealmId() { @@ -457,12 +576,15 @@ public function getRealmId() /** * Sets realm_id * - * @param string $realm_id + * @param string|null $realm_id * - * @return $this + * @return self */ public function setRealmId($realm_id) { + if (is_null($realm_id)) { + throw new \InvalidArgumentException('non-nullable realm_id cannot be null'); + } $this->container['realm_id'] = $realm_id; return $this; @@ -471,7 +593,7 @@ public function setRealmId($realm_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -481,12 +603,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -495,7 +620,7 @@ public function setExternalId($external_id) /** * Gets email_addresses * - * @return string + * @return string|null */ public function getEmailAddresses() { @@ -505,12 +630,15 @@ public function getEmailAddresses() /** * Sets email_addresses * - * @param string $email_addresses + * @param string|null $email_addresses * - * @return $this + * @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; @@ -519,7 +647,7 @@ public function setEmailAddresses($email_addresses) /** * Gets user_ids * - * @return string + * @return string|null */ public function getUserIds() { @@ -529,12 +657,15 @@ public function getUserIds() /** * Sets user_ids * - * @param string $user_ids + * @param string|null $user_ids * - * @return $this + * @return self */ public function setUserIds($user_ids) { + if (is_null($user_ids)) { + throw new \InvalidArgumentException('non-nullable user_ids cannot be null'); + } $this->container['user_ids'] = $user_ids; return $this; @@ -543,7 +674,7 @@ public function setUserIds($user_ids) /** * Gets number_of_incomplete_employees * - * @return int + * @return int|null */ public function getNumberOfIncompleteEmployees() { @@ -553,12 +684,15 @@ public function getNumberOfIncompleteEmployees() /** * Sets number_of_incomplete_employees * - * @param int $number_of_incomplete_employees + * @param int|null $number_of_incomplete_employees * - * @return $this + * @return self */ public function setNumberOfIncompleteEmployees($number_of_incomplete_employees) { + if (is_null($number_of_incomplete_employees)) { + throw new \InvalidArgumentException('non-nullable number_of_incomplete_employees cannot be null'); + } $this->container['number_of_incomplete_employees'] = $number_of_incomplete_employees; return $this; @@ -567,7 +701,7 @@ public function setNumberOfIncompleteEmployees($number_of_incomplete_employees) /** * Gets number_of_complete_employees * - * @return int + * @return int|null */ public function getNumberOfCompleteEmployees() { @@ -577,12 +711,15 @@ public function getNumberOfCompleteEmployees() /** * Sets number_of_complete_employees * - * @param int $number_of_complete_employees + * @param int|null $number_of_complete_employees * - * @return $this + * @return self */ public function setNumberOfCompleteEmployees($number_of_complete_employees) { + if (is_null($number_of_complete_employees)) { + throw new \InvalidArgumentException('non-nullable number_of_complete_employees cannot be null'); + } $this->container['number_of_complete_employees'] = $number_of_complete_employees; return $this; @@ -591,7 +728,7 @@ public function setNumberOfCompleteEmployees($number_of_complete_employees) /** * Gets number_of_employees_paid * - * @return int + * @return int|null */ public function getNumberOfEmployeesPaid() { @@ -601,12 +738,15 @@ public function getNumberOfEmployeesPaid() /** * Sets number_of_employees_paid * - * @param int $number_of_employees_paid + * @param int|null $number_of_employees_paid * - * @return $this + * @return self */ public function setNumberOfEmployeesPaid($number_of_employees_paid) { + if (is_null($number_of_employees_paid)) { + throw new \InvalidArgumentException('non-nullable number_of_employees_paid cannot be null'); + } $this->container['number_of_employees_paid'] = $number_of_employees_paid; return $this; @@ -615,7 +755,7 @@ public function setNumberOfEmployeesPaid($number_of_employees_paid) /** * Gets number_of_pay_runs * - * @return int + * @return int|null */ public function getNumberOfPayRuns() { @@ -625,12 +765,15 @@ public function getNumberOfPayRuns() /** * Sets number_of_pay_runs * - * @param int $number_of_pay_runs + * @param int|null $number_of_pay_runs * - * @return $this + * @return self */ public function setNumberOfPayRuns($number_of_pay_runs) { + if (is_null($number_of_pay_runs)) { + throw new \InvalidArgumentException('non-nullable number_of_pay_runs cannot be null'); + } $this->container['number_of_pay_runs'] = $number_of_pay_runs; return $this; @@ -639,7 +782,7 @@ public function setNumberOfPayRuns($number_of_pay_runs) /** * Gets date_last_pay_run_finalised * - * @return \DateTime + * @return \DateTime|null */ public function getDateLastPayRunFinalised() { @@ -649,12 +792,15 @@ public function getDateLastPayRunFinalised() /** * Sets date_last_pay_run_finalised * - * @param \DateTime $date_last_pay_run_finalised + * @param \DateTime|null $date_last_pay_run_finalised * - * @return $this + * @return self */ public function setDateLastPayRunFinalised($date_last_pay_run_finalised) { + if (is_null($date_last_pay_run_finalised)) { + throw new \InvalidArgumentException('non-nullable date_last_pay_run_finalised cannot be null'); + } $this->container['date_last_pay_run_finalised'] = $date_last_pay_run_finalised; return $this; @@ -663,7 +809,7 @@ public function setDateLastPayRunFinalised($date_last_pay_run_finalised) /** * Gets date_last_billable_activity * - * @return \DateTime + * @return \DateTime|null */ public function getDateLastBillableActivity() { @@ -673,12 +819,15 @@ public function getDateLastBillableActivity() /** * Sets date_last_billable_activity * - * @param \DateTime $date_last_billable_activity + * @param \DateTime|null $date_last_billable_activity * - * @return $this + * @return self */ public function setDateLastBillableActivity($date_last_billable_activity) { + if (is_null($date_last_billable_activity)) { + throw new \InvalidArgumentException('non-nullable date_last_billable_activity cannot be null'); + } $this->container['date_last_billable_activity'] = $date_last_billable_activity; return $this; @@ -687,7 +836,7 @@ public function setDateLastBillableActivity($date_last_billable_activity) /** * Gets active_emps * - * @return int + * @return int|null */ public function getActiveEmps() { @@ -697,12 +846,15 @@ public function getActiveEmps() /** * Sets active_emps * - * @param int $active_emps + * @param int|null $active_emps * - * @return $this + * @return self */ public function setActiveEmps($active_emps) { + if (is_null($active_emps)) { + throw new \InvalidArgumentException('non-nullable active_emps cannot be null'); + } $this->container['active_emps'] = $active_emps; return $this; @@ -714,7 +866,7 @@ public function setActiveEmps($active_emps) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -724,22 +876,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -755,11 +908,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -767,13 +933,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuAddShiftModel.php b/src/lib/Model/AuAddShiftModel.php index 75d640b..75d4aa5 100644 --- a/src/lib/Model/AuAddShiftModel.php +++ b/src/lib/Model/AuAddShiftModel.php @@ -2,61 +2,61 @@ /** * AuAddShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuAddShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuAddShiftModel implements ModelInterface, ArrayAccess +class AuAddShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuAddShiftModel'; + protected static $openAPIModelName = 'AuAddShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'classification_id' => 'int', 'work_type_id' => 'int', @@ -64,10 +64,10 @@ class AuAddShiftModel implements ModelInterface, ArrayAccess 'note' => 'string', 'recorded_start_time_utc' => '\DateTime', 'recorded_end_time_utc' => '\DateTime', - 'breaks' => '\Swagger\Client\Model\ShiftBreakModel[]', + 'breaks' => '\OpenAPI\Client\Model\ShiftBreakModel[]', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -81,8 +81,10 @@ class AuAddShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'classification_id' => 'int32', 'work_type_id' => 'int32', @@ -103,14 +105,47 @@ class AuAddShiftModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'classification_id' => false, + 'work_type_id' => false, + 'shift_condition_ids' => false, + 'note' => false, + 'recorded_start_time_utc' => false, + 'recorded_end_time_utc' => false, + 'breaks' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -118,9 +153,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -240,14 +327,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -260,7 +345,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -277,24 +361,42 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['recorded_start_time_utc'] = isset($data['recorded_start_time_utc']) ? $data['recorded_start_time_utc'] : null; - $this->container['recorded_end_time_utc'] = isset($data['recorded_end_time_utc']) ? $data['recorded_end_time_utc'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('recorded_start_time_utc', $data ?? [], null); + $this->setIfExists('recorded_end_time_utc', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -313,7 +415,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -336,7 +439,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -346,12 +449,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -360,7 +466,7 @@ public function setLocationId($location_id) /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -370,12 +476,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -384,7 +493,7 @@ public function setClassificationId($classification_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -394,12 +503,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -408,7 +520,7 @@ public function setWorkTypeId($work_type_id) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -418,12 +530,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -432,7 +547,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -442,12 +557,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -456,7 +574,7 @@ public function setNote($note) /** * Gets recorded_start_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedStartTimeUtc() { @@ -466,12 +584,15 @@ public function getRecordedStartTimeUtc() /** * Sets recorded_start_time_utc * - * @param \DateTime $recorded_start_time_utc + * @param \DateTime|null $recorded_start_time_utc * - * @return $this + * @return self */ public function setRecordedStartTimeUtc($recorded_start_time_utc) { + if (is_null($recorded_start_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_start_time_utc cannot be null'); + } $this->container['recorded_start_time_utc'] = $recorded_start_time_utc; return $this; @@ -480,7 +601,7 @@ public function setRecordedStartTimeUtc($recorded_start_time_utc) /** * Gets recorded_end_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedEndTimeUtc() { @@ -490,12 +611,15 @@ public function getRecordedEndTimeUtc() /** * Sets recorded_end_time_utc * - * @param \DateTime $recorded_end_time_utc + * @param \DateTime|null $recorded_end_time_utc * - * @return $this + * @return self */ public function setRecordedEndTimeUtc($recorded_end_time_utc) { + if (is_null($recorded_end_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_end_time_utc cannot be null'); + } $this->container['recorded_end_time_utc'] = $recorded_end_time_utc; return $this; @@ -504,7 +628,7 @@ public function setRecordedEndTimeUtc($recorded_end_time_utc) /** * Gets breaks * - * @return \Swagger\Client\Model\ShiftBreakModel[] + * @return \OpenAPI\Client\Model\ShiftBreakModel[]|null */ public function getBreaks() { @@ -514,12 +638,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\ShiftBreakModel[] $breaks + * @param \OpenAPI\Client\Model\ShiftBreakModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -528,7 +655,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -538,12 +665,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -552,7 +682,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -562,12 +692,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -576,7 +709,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -586,12 +719,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -600,7 +736,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -610,12 +746,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -624,7 +763,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -634,12 +773,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -648,7 +790,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -658,15 +800,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling AuAddShiftModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling AuAddShiftModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -677,7 +822,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -687,12 +832,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -701,7 +849,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -711,12 +859,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -725,7 +876,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -735,12 +886,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -749,7 +903,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -759,17 +913,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -785,7 +943,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -795,22 +953,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -826,11 +985,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -838,13 +1010,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuAddressModel.php b/src/lib/Model/AuAddressModel.php index d78dcd0..c345c03 100644 --- a/src/lib/Model/AuAddressModel.php +++ b/src/lib/Model/AuAddressModel.php @@ -2,61 +2,61 @@ /** * AuAddressModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuAddressModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuAddressModel implements ModelInterface, ArrayAccess +class AuAddressModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuAddressModel'; + protected static $openAPIModelName = 'AuAddressModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'street_address' => 'string', 'address_line2' => 'string', 'postcode' => 'string', @@ -73,8 +73,10 @@ class AuAddressModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'street_address' => null, 'address_line2' => null, 'postcode' => null, @@ -87,14 +89,39 @@ class AuAddressModel implements ModelInterface, ArrayAccess 'is_out_of_region' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'street_address' => false, + 'address_line2' => false, + 'postcode' => false, + 'country' => false, + 'country_id' => false, + 'suburb_id' => false, + 'suburb' => false, + 'state' => false, + 'is_manual_address' => false, + 'is_out_of_region' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['street_address'] = isset($data['street_address']) ? $data['street_address'] : null; - $this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null; - $this->container['postcode'] = isset($data['postcode']) ? $data['postcode'] : null; - $this->container['country'] = isset($data['country']) ? $data['country'] : null; - $this->container['country_id'] = isset($data['country_id']) ? $data['country_id'] : null; - $this->container['suburb_id'] = isset($data['suburb_id']) ? $data['suburb_id'] : null; - $this->container['suburb'] = isset($data['suburb']) ? $data['suburb'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['is_manual_address'] = isset($data['is_manual_address']) ? $data['is_manual_address'] : null; - $this->container['is_out_of_region'] = isset($data['is_out_of_region']) ? $data['is_out_of_region'] : null; + $this->setIfExists('street_address', $data ?? [], null); + $this->setIfExists('address_line2', $data ?? [], null); + $this->setIfExists('postcode', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('country_id', $data ?? [], null); + $this->setIfExists('suburb_id', $data ?? [], null); + $this->setIfExists('suburb', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('is_manual_address', $data ?? [], null); + $this->setIfExists('is_out_of_region', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets street_address * - * @return string + * @return string|null */ public function getStreetAddress() { @@ -271,12 +365,15 @@ public function getStreetAddress() /** * Sets street_address * - * @param string $street_address + * @param string|null $street_address * - * @return $this + * @return self */ public function setStreetAddress($street_address) { + if (is_null($street_address)) { + throw new \InvalidArgumentException('non-nullable street_address cannot be null'); + } $this->container['street_address'] = $street_address; return $this; @@ -285,7 +382,7 @@ public function setStreetAddress($street_address) /** * Gets address_line2 * - * @return string + * @return string|null */ public function getAddressLine2() { @@ -295,12 +392,15 @@ public function getAddressLine2() /** * Sets address_line2 * - * @param string $address_line2 + * @param string|null $address_line2 * - * @return $this + * @return self */ public function setAddressLine2($address_line2) { + if (is_null($address_line2)) { + throw new \InvalidArgumentException('non-nullable address_line2 cannot be null'); + } $this->container['address_line2'] = $address_line2; return $this; @@ -309,7 +409,7 @@ public function setAddressLine2($address_line2) /** * Gets postcode * - * @return string + * @return string|null */ public function getPostcode() { @@ -319,12 +419,15 @@ public function getPostcode() /** * Sets postcode * - * @param string $postcode + * @param string|null $postcode * - * @return $this + * @return self */ public function setPostcode($postcode) { + if (is_null($postcode)) { + throw new \InvalidArgumentException('non-nullable postcode cannot be null'); + } $this->container['postcode'] = $postcode; return $this; @@ -333,7 +436,7 @@ public function setPostcode($postcode) /** * Gets country * - * @return string + * @return string|null */ public function getCountry() { @@ -343,12 +446,15 @@ public function getCountry() /** * Sets country * - * @param string $country + * @param string|null $country * - * @return $this + * @return self */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -357,7 +463,7 @@ public function setCountry($country) /** * Gets country_id * - * @return string + * @return string|null */ public function getCountryId() { @@ -367,12 +473,15 @@ public function getCountryId() /** * Sets country_id * - * @param string $country_id + * @param string|null $country_id * - * @return $this + * @return self */ public function setCountryId($country_id) { + if (is_null($country_id)) { + throw new \InvalidArgumentException('non-nullable country_id cannot be null'); + } $this->container['country_id'] = $country_id; return $this; @@ -381,7 +490,7 @@ public function setCountryId($country_id) /** * Gets suburb_id * - * @return int + * @return int|null */ public function getSuburbId() { @@ -391,12 +500,15 @@ public function getSuburbId() /** * Sets suburb_id * - * @param int $suburb_id + * @param int|null $suburb_id * - * @return $this + * @return self */ public function setSuburbId($suburb_id) { + if (is_null($suburb_id)) { + throw new \InvalidArgumentException('non-nullable suburb_id cannot be null'); + } $this->container['suburb_id'] = $suburb_id; return $this; @@ -405,7 +517,7 @@ public function setSuburbId($suburb_id) /** * Gets suburb * - * @return string + * @return string|null */ public function getSuburb() { @@ -415,12 +527,15 @@ public function getSuburb() /** * Sets suburb * - * @param string $suburb + * @param string|null $suburb * - * @return $this + * @return self */ public function setSuburb($suburb) { + if (is_null($suburb)) { + throw new \InvalidArgumentException('non-nullable suburb cannot be null'); + } $this->container['suburb'] = $suburb; return $this; @@ -429,7 +544,7 @@ public function setSuburb($suburb) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -439,12 +554,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -453,7 +571,7 @@ public function setState($state) /** * Gets is_manual_address * - * @return bool + * @return bool|null */ public function getIsManualAddress() { @@ -463,12 +581,15 @@ public function getIsManualAddress() /** * Sets is_manual_address * - * @param bool $is_manual_address + * @param bool|null $is_manual_address * - * @return $this + * @return self */ public function setIsManualAddress($is_manual_address) { + if (is_null($is_manual_address)) { + throw new \InvalidArgumentException('non-nullable is_manual_address cannot be null'); + } $this->container['is_manual_address'] = $is_manual_address; return $this; @@ -477,7 +598,7 @@ public function setIsManualAddress($is_manual_address) /** * Gets is_out_of_region * - * @return bool + * @return bool|null */ public function getIsOutOfRegion() { @@ -487,12 +608,15 @@ public function getIsOutOfRegion() /** * Sets is_out_of_region * - * @param bool $is_out_of_region + * @param bool|null $is_out_of_region * - * @return $this + * @return self */ public function setIsOutOfRegion($is_out_of_region) { + if (is_null($is_out_of_region)) { + throw new \InvalidArgumentException('non-nullable is_out_of_region cannot be null'); + } $this->container['is_out_of_region'] = $is_out_of_region; return $this; @@ -504,7 +628,7 @@ public function setIsOutOfRegion($is_out_of_region) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuApiPaySlipBankPaymentModel.php b/src/lib/Model/AuApiPaySlipBankPaymentModel.php index a4fc2a4..d7258fa 100644 --- a/src/lib/Model/AuApiPaySlipBankPaymentModel.php +++ b/src/lib/Model/AuApiPaySlipBankPaymentModel.php @@ -2,74 +2,76 @@ /** * AuApiPaySlipBankPaymentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuApiPaySlipBankPaymentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuApiPaySlipBankPaymentModel implements ModelInterface, ArrayAccess +class AuApiPaySlipBankPaymentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuApiPaySlipBankPaymentModel'; + protected static $openAPIModelName = 'AuApiPaySlipBankPaymentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'bsb' => 'string', 'account_name' => 'string', 'account_number' => 'string', 'lodgement_reference' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'bsb' => null, 'account_name' => null, 'account_number' => null, @@ -77,14 +79,34 @@ class AuApiPaySlipBankPaymentModel implements ModelInterface, ArrayAccess 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bsb' => false, + 'account_name' => false, + 'account_number' => false, + 'lodgement_reference' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['lodgement_reference'] = isset($data['lodgement_reference']) ? $data['lodgement_reference'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('lodgement_reference', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -241,12 +330,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -255,7 +347,7 @@ public function setBsb($bsb) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -265,12 +357,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -279,7 +374,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -289,12 +384,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -303,7 +401,7 @@ public function setAccountNumber($account_number) /** * Gets lodgement_reference * - * @return string + * @return string|null */ public function getLodgementReference() { @@ -313,12 +411,15 @@ public function getLodgementReference() /** * Sets lodgement_reference * - * @param string $lodgement_reference + * @param string|null $lodgement_reference * - * @return $this + * @return self */ public function setLodgementReference($lodgement_reference) { + if (is_null($lodgement_reference)) { + throw new \InvalidArgumentException('non-nullable lodgement_reference cannot be null'); + } $this->container['lodgement_reference'] = $lodgement_reference; return $this; @@ -327,7 +428,7 @@ public function setLodgementReference($lodgement_reference) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -337,12 +438,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -354,7 +458,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuApiPaySlipEarningsLineModel.php b/src/lib/Model/AuApiPaySlipEarningsLineModel.php index 1362a66..a864d6b 100644 --- a/src/lib/Model/AuApiPaySlipEarningsLineModel.php +++ b/src/lib/Model/AuApiPaySlipEarningsLineModel.php @@ -2,70 +2,70 @@ /** * AuApiPaySlipEarningsLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuApiPaySlipEarningsLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuApiPaySlipEarningsLineModel implements ModelInterface, ArrayAccess +class AuApiPaySlipEarningsLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuApiPaySlipEarningsLineModel'; + protected static $openAPIModelName = 'AuApiPaySlipEarningsLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super_contribution' => 'double', + protected static $openAPITypes = [ + 'super_contribution' => 'float', 'pay_category_name' => 'string', - 'units' => 'double', + 'units' => 'float', 'is_fixed' => 'bool', 'is_tax_exempt' => 'bool', - 'rate' => 'double', + 'rate' => 'float', 'notes' => 'string', - 'gross_earnings' => 'double', - 'taxable_earnings' => 'double', + 'gross_earnings' => 'float', + 'taxable_earnings' => 'float', 'location_name' => 'string' ]; @@ -73,8 +73,10 @@ class AuApiPaySlipEarningsLineModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_contribution' => 'double', 'pay_category_name' => null, 'units' => 'double', @@ -87,14 +89,39 @@ class AuApiPaySlipEarningsLineModel implements ModelInterface, ArrayAccess 'location_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_contribution' => false, + 'pay_category_name' => false, + 'units' => false, + 'is_fixed' => false, + 'is_tax_exempt' => false, + 'rate' => false, + 'notes' => false, + 'gross_earnings' => false, + 'taxable_earnings' => false, + 'location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['pay_category_name'] = isset($data['pay_category_name']) ? $data['pay_category_name'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['is_fixed'] = isset($data['is_fixed']) ? $data['is_fixed'] : null; - $this->container['is_tax_exempt'] = isset($data['is_tax_exempt']) ? $data['is_tax_exempt'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('pay_category_name', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('is_fixed', $data ?? [], null); + $this->setIfExists('is_tax_exempt', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('location_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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -271,12 +365,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -285,7 +382,7 @@ public function setSuperContribution($super_contribution) /** * Gets pay_category_name * - * @return string + * @return string|null */ public function getPayCategoryName() { @@ -295,12 +392,15 @@ public function getPayCategoryName() /** * Sets pay_category_name * - * @param string $pay_category_name + * @param string|null $pay_category_name * - * @return $this + * @return self */ public function setPayCategoryName($pay_category_name) { + if (is_null($pay_category_name)) { + throw new \InvalidArgumentException('non-nullable pay_category_name cannot be null'); + } $this->container['pay_category_name'] = $pay_category_name; return $this; @@ -309,7 +409,7 @@ public function setPayCategoryName($pay_category_name) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -319,12 +419,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -333,7 +436,7 @@ public function setUnits($units) /** * Gets is_fixed * - * @return bool + * @return bool|null */ public function getIsFixed() { @@ -343,12 +446,15 @@ public function getIsFixed() /** * Sets is_fixed * - * @param bool $is_fixed + * @param bool|null $is_fixed * - * @return $this + * @return self */ public function setIsFixed($is_fixed) { + if (is_null($is_fixed)) { + throw new \InvalidArgumentException('non-nullable is_fixed cannot be null'); + } $this->container['is_fixed'] = $is_fixed; return $this; @@ -357,7 +463,7 @@ public function setIsFixed($is_fixed) /** * Gets is_tax_exempt * - * @return bool + * @return bool|null */ public function getIsTaxExempt() { @@ -367,12 +473,15 @@ public function getIsTaxExempt() /** * Sets is_tax_exempt * - * @param bool $is_tax_exempt + * @param bool|null $is_tax_exempt * - * @return $this + * @return self */ public function setIsTaxExempt($is_tax_exempt) { + if (is_null($is_tax_exempt)) { + throw new \InvalidArgumentException('non-nullable is_tax_exempt cannot be null'); + } $this->container['is_tax_exempt'] = $is_tax_exempt; return $this; @@ -381,7 +490,7 @@ public function setIsTaxExempt($is_tax_exempt) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -391,12 +500,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -405,7 +517,7 @@ public function setRate($rate) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -415,12 +527,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -429,7 +544,7 @@ public function setNotes($notes) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -439,12 +554,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -453,7 +571,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -463,12 +581,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -477,7 +598,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -487,12 +608,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -504,7 +628,7 @@ public function setLocationName($location_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuApiPaySlipModel.php b/src/lib/Model/AuApiPaySlipModel.php index 6dd8443..2d2d568 100644 --- a/src/lib/Model/AuApiPaySlipModel.php +++ b/src/lib/Model/AuApiPaySlipModel.php @@ -2,90 +2,90 @@ /** * AuApiPaySlipModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuApiPaySlipModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuApiPaySlipModel implements ModelInterface, ArrayAccess +class AuApiPaySlipModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuApiPaySlipModel'; + protected static $openAPIModelName = 'AuApiPaySlipModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg_adjustments' => '\Swagger\Client\Model\ApiPaySlipPaygAdjustmentModel[]', - 'super_adjustments' => '\Swagger\Client\Model\ApiPaySlipSuperAdjustmentModel[]', - 'super_payments' => '\Swagger\Client\Model\ApiPaySlipSuperPaymentModel[]', - 'bank_payments' => '\Swagger\Client\Model\AuApiPaySlipBankPaymentModel[]', - 'earnings_lines' => '\Swagger\Client\Model\AuApiPaySlipEarningsLineModel[]', - 'payg_withholding_amount' => 'double', - 'sfss_amount' => 'double', - 'help_amount' => 'double', - 'super_contribution' => 'double', + protected static $openAPITypes = [ + 'payg_adjustments' => '\OpenAPI\Client\Model\ApiPaySlipPaygAdjustmentModel[]', + 'super_adjustments' => '\OpenAPI\Client\Model\ApiPaySlipSuperAdjustmentModel[]', + 'super_payments' => '\OpenAPI\Client\Model\ApiPaySlipSuperPaymentModel[]', + 'bank_payments' => '\OpenAPI\Client\Model\AuApiPaySlipBankPaymentModel[]', + 'earnings_lines' => '\OpenAPI\Client\Model\AuApiPaySlipEarningsLineModel[]', + 'payg_withholding_amount' => 'float', + 'sfss_amount' => 'float', + 'help_amount' => 'float', + 'super_contribution' => 'float', 'employee_postal_suburb_name' => 'string', 'employee_postal_suburb_postcode' => 'string', 'employee_postal_suburb_state' => 'string', - 'super_ytd' => 'double', - 'sfss_ytd' => 'double', - 'help_ytd' => 'double', - 'payg_ytd' => 'double', + 'super_ytd' => 'float', + 'sfss_ytd' => 'float', + 'help_ytd' => 'float', + 'payg_ytd' => 'float', 'abn' => 'string', - 'total_accrued_leave' => '\Swagger\Client\Model\ApiPaySlipLeaveModel[]', - 'accrued_leave' => '\Swagger\Client\Model\ApiPaySlipLeaveModel[]', - 'leave_taken' => '\Swagger\Client\Model\ApiPaySlipLeaveModel[]', - 'deductions' => '\Swagger\Client\Model\ApiPaySlipDeductionModel[]', - 'gross_ytd_details' => '\Swagger\Client\Model\ApiYearToDateEarningsBreakdownModel[]', - 'employee_expenses' => '\Swagger\Client\Model\ApiEmployeeExpenseGridModel[]', - 'total_hours' => 'double', - 'gross_earnings' => 'double', - 'net_earnings' => 'double', - 'taxable_earnings' => 'double', - 'post_tax_deduction_amount' => 'double', - 'pre_tax_deduction_amount' => 'double', + 'total_accrued_leave' => '\OpenAPI\Client\Model\ApiPaySlipLeaveModel[]', + 'accrued_leave' => '\OpenAPI\Client\Model\ApiPaySlipLeaveModel[]', + 'leave_taken' => '\OpenAPI\Client\Model\ApiPaySlipLeaveModel[]', + 'deductions' => '\OpenAPI\Client\Model\ApiPaySlipDeductionModel[]', + 'gross_ytd_details' => '\OpenAPI\Client\Model\ApiYearToDateEarningsBreakdownModel[]', + 'employee_expenses' => '\OpenAPI\Client\Model\ApiEmployeeExpenseGridModel[]', + 'total_hours' => 'float', + 'gross_earnings' => 'float', + 'net_earnings' => 'float', + 'taxable_earnings' => 'float', + 'post_tax_deduction_amount' => 'float', + 'pre_tax_deduction_amount' => 'float', 'id' => 'int', 'business_name' => 'string', 'business_address' => 'string', @@ -103,15 +103,15 @@ class AuApiPaySlipModel implements ModelInterface, ArrayAccess 'employee_postal_address_country' => 'string', 'notation' => 'string', 'is_published' => 'bool', - 'gross_ytd' => 'double', - 'net_ytd' => 'double', - 'withholding_ytd' => 'double', + 'gross_ytd' => 'float', + 'net_ytd' => 'float', + 'withholding_ytd' => 'float', 'base_pay_rate' => 'string', 'base_rate' => 'string', - 'hourly_rate' => 'double', - 'pre_tax_deductions_ytd' => 'double', - 'post_tax_deductions_ytd' => 'double', - 'employee_base_rate' => 'double', + 'hourly_rate' => 'float', + 'pre_tax_deductions_ytd' => 'float', + 'post_tax_deductions_ytd' => 'float', + 'employee_base_rate' => 'float', 'employee_base_rate_unit' => 'string' ]; @@ -119,8 +119,10 @@ class AuApiPaySlipModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg_adjustments' => null, 'super_adjustments' => null, 'super_payments' => null, @@ -179,14 +181,85 @@ class AuApiPaySlipModel implements ModelInterface, ArrayAccess 'employee_base_rate_unit' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg_adjustments' => false, + 'super_adjustments' => false, + 'super_payments' => false, + 'bank_payments' => false, + 'earnings_lines' => false, + 'payg_withholding_amount' => false, + 'sfss_amount' => false, + 'help_amount' => false, + 'super_contribution' => false, + 'employee_postal_suburb_name' => false, + 'employee_postal_suburb_postcode' => false, + 'employee_postal_suburb_state' => false, + 'super_ytd' => false, + 'sfss_ytd' => false, + 'help_ytd' => false, + 'payg_ytd' => false, + 'abn' => false, + 'total_accrued_leave' => false, + 'accrued_leave' => false, + 'leave_taken' => false, + 'deductions' => false, + 'gross_ytd_details' => false, + 'employee_expenses' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'net_earnings' => false, + 'taxable_earnings' => false, + 'post_tax_deduction_amount' => false, + 'pre_tax_deduction_amount' => false, + 'id' => false, + 'business_name' => false, + 'business_address' => false, + 'contact_name' => false, + 'pay_period_starting' => false, + 'pay_period_ending' => false, + 'message' => false, + 'employee_id' => false, + 'employee_external_id' => false, + 'employee_name' => false, + 'employee_first_name' => false, + 'employee_surname' => false, + 'employee_postal_street_address' => false, + 'employee_postal_address_line2' => false, + 'employee_postal_address_country' => false, + 'notation' => false, + 'is_published' => false, + 'gross_ytd' => false, + 'net_ytd' => false, + 'withholding_ytd' => false, + 'base_pay_rate' => false, + 'base_rate' => false, + 'hourly_rate' => false, + 'pre_tax_deductions_ytd' => false, + 'post_tax_deductions_ytd' => false, + 'employee_base_rate' => false, + 'employee_base_rate_unit' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -194,9 +267,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -430,17 +555,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYEE_BASE_RATE_UNIT_HOURLY = 'Hourly'; - const EMPLOYEE_BASE_RATE_UNIT_ANNUALLY = 'Annually'; - const EMPLOYEE_BASE_RATE_UNIT_FIXED = 'Fixed'; - const EMPLOYEE_BASE_RATE_UNIT_DAILY = 'Daily'; - const EMPLOYEE_BASE_RATE_UNIT_MONTHLY = 'Monthly'; - + public const EMPLOYEE_BASE_RATE_UNIT_HOURLY = 'Hourly'; + public const EMPLOYEE_BASE_RATE_UNIT_ANNUALLY = 'Annually'; + public const EMPLOYEE_BASE_RATE_UNIT_FIXED = 'Fixed'; + public const EMPLOYEE_BASE_RATE_UNIT_DAILY = 'Daily'; + public const EMPLOYEE_BASE_RATE_UNIT_MONTHLY = 'Monthly'; - /** * Gets allowable values of the enum * @@ -456,7 +579,6 @@ public function getEmployeeBaseRateUnitAllowableValues() self::EMPLOYEE_BASE_RATE_UNIT_MONTHLY, ]; } - /** * Associative array for storing property values @@ -473,62 +595,80 @@ public function getEmployeeBaseRateUnitAllowableValues() */ public function __construct(array $data = null) { - $this->container['payg_adjustments'] = isset($data['payg_adjustments']) ? $data['payg_adjustments'] : null; - $this->container['super_adjustments'] = isset($data['super_adjustments']) ? $data['super_adjustments'] : null; - $this->container['super_payments'] = isset($data['super_payments']) ? $data['super_payments'] : null; - $this->container['bank_payments'] = isset($data['bank_payments']) ? $data['bank_payments'] : null; - $this->container['earnings_lines'] = isset($data['earnings_lines']) ? $data['earnings_lines'] : null; - $this->container['payg_withholding_amount'] = isset($data['payg_withholding_amount']) ? $data['payg_withholding_amount'] : null; - $this->container['sfss_amount'] = isset($data['sfss_amount']) ? $data['sfss_amount'] : null; - $this->container['help_amount'] = isset($data['help_amount']) ? $data['help_amount'] : null; - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['employee_postal_suburb_name'] = isset($data['employee_postal_suburb_name']) ? $data['employee_postal_suburb_name'] : null; - $this->container['employee_postal_suburb_postcode'] = isset($data['employee_postal_suburb_postcode']) ? $data['employee_postal_suburb_postcode'] : null; - $this->container['employee_postal_suburb_state'] = isset($data['employee_postal_suburb_state']) ? $data['employee_postal_suburb_state'] : null; - $this->container['super_ytd'] = isset($data['super_ytd']) ? $data['super_ytd'] : null; - $this->container['sfss_ytd'] = isset($data['sfss_ytd']) ? $data['sfss_ytd'] : null; - $this->container['help_ytd'] = isset($data['help_ytd']) ? $data['help_ytd'] : null; - $this->container['payg_ytd'] = isset($data['payg_ytd']) ? $data['payg_ytd'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['total_accrued_leave'] = isset($data['total_accrued_leave']) ? $data['total_accrued_leave'] : null; - $this->container['accrued_leave'] = isset($data['accrued_leave']) ? $data['accrued_leave'] : null; - $this->container['leave_taken'] = isset($data['leave_taken']) ? $data['leave_taken'] : null; - $this->container['deductions'] = isset($data['deductions']) ? $data['deductions'] : null; - $this->container['gross_ytd_details'] = isset($data['gross_ytd_details']) ? $data['gross_ytd_details'] : null; - $this->container['employee_expenses'] = isset($data['employee_expenses']) ? $data['employee_expenses'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['post_tax_deduction_amount'] = isset($data['post_tax_deduction_amount']) ? $data['post_tax_deduction_amount'] : null; - $this->container['pre_tax_deduction_amount'] = isset($data['pre_tax_deduction_amount']) ? $data['pre_tax_deduction_amount'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['business_name'] = isset($data['business_name']) ? $data['business_name'] : null; - $this->container['business_address'] = isset($data['business_address']) ? $data['business_address'] : null; - $this->container['contact_name'] = isset($data['contact_name']) ? $data['contact_name'] : null; - $this->container['pay_period_starting'] = isset($data['pay_period_starting']) ? $data['pay_period_starting'] : null; - $this->container['pay_period_ending'] = isset($data['pay_period_ending']) ? $data['pay_period_ending'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_first_name'] = isset($data['employee_first_name']) ? $data['employee_first_name'] : null; - $this->container['employee_surname'] = isset($data['employee_surname']) ? $data['employee_surname'] : null; - $this->container['employee_postal_street_address'] = isset($data['employee_postal_street_address']) ? $data['employee_postal_street_address'] : null; - $this->container['employee_postal_address_line2'] = isset($data['employee_postal_address_line2']) ? $data['employee_postal_address_line2'] : null; - $this->container['employee_postal_address_country'] = isset($data['employee_postal_address_country']) ? $data['employee_postal_address_country'] : null; - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; - $this->container['is_published'] = isset($data['is_published']) ? $data['is_published'] : null; - $this->container['gross_ytd'] = isset($data['gross_ytd']) ? $data['gross_ytd'] : null; - $this->container['net_ytd'] = isset($data['net_ytd']) ? $data['net_ytd'] : null; - $this->container['withholding_ytd'] = isset($data['withholding_ytd']) ? $data['withholding_ytd'] : null; - $this->container['base_pay_rate'] = isset($data['base_pay_rate']) ? $data['base_pay_rate'] : null; - $this->container['base_rate'] = isset($data['base_rate']) ? $data['base_rate'] : null; - $this->container['hourly_rate'] = isset($data['hourly_rate']) ? $data['hourly_rate'] : null; - $this->container['pre_tax_deductions_ytd'] = isset($data['pre_tax_deductions_ytd']) ? $data['pre_tax_deductions_ytd'] : null; - $this->container['post_tax_deductions_ytd'] = isset($data['post_tax_deductions_ytd']) ? $data['post_tax_deductions_ytd'] : null; - $this->container['employee_base_rate'] = isset($data['employee_base_rate']) ? $data['employee_base_rate'] : null; - $this->container['employee_base_rate_unit'] = isset($data['employee_base_rate_unit']) ? $data['employee_base_rate_unit'] : null; + $this->setIfExists('payg_adjustments', $data ?? [], null); + $this->setIfExists('super_adjustments', $data ?? [], null); + $this->setIfExists('super_payments', $data ?? [], null); + $this->setIfExists('bank_payments', $data ?? [], null); + $this->setIfExists('earnings_lines', $data ?? [], null); + $this->setIfExists('payg_withholding_amount', $data ?? [], null); + $this->setIfExists('sfss_amount', $data ?? [], null); + $this->setIfExists('help_amount', $data ?? [], null); + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('employee_postal_suburb_name', $data ?? [], null); + $this->setIfExists('employee_postal_suburb_postcode', $data ?? [], null); + $this->setIfExists('employee_postal_suburb_state', $data ?? [], null); + $this->setIfExists('super_ytd', $data ?? [], null); + $this->setIfExists('sfss_ytd', $data ?? [], null); + $this->setIfExists('help_ytd', $data ?? [], null); + $this->setIfExists('payg_ytd', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('total_accrued_leave', $data ?? [], null); + $this->setIfExists('accrued_leave', $data ?? [], null); + $this->setIfExists('leave_taken', $data ?? [], null); + $this->setIfExists('deductions', $data ?? [], null); + $this->setIfExists('gross_ytd_details', $data ?? [], null); + $this->setIfExists('employee_expenses', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('post_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('pre_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('business_name', $data ?? [], null); + $this->setIfExists('business_address', $data ?? [], null); + $this->setIfExists('contact_name', $data ?? [], null); + $this->setIfExists('pay_period_starting', $data ?? [], null); + $this->setIfExists('pay_period_ending', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_first_name', $data ?? [], null); + $this->setIfExists('employee_surname', $data ?? [], null); + $this->setIfExists('employee_postal_street_address', $data ?? [], null); + $this->setIfExists('employee_postal_address_line2', $data ?? [], null); + $this->setIfExists('employee_postal_address_country', $data ?? [], null); + $this->setIfExists('notation', $data ?? [], null); + $this->setIfExists('is_published', $data ?? [], null); + $this->setIfExists('gross_ytd', $data ?? [], null); + $this->setIfExists('net_ytd', $data ?? [], null); + $this->setIfExists('withholding_ytd', $data ?? [], null); + $this->setIfExists('base_pay_rate', $data ?? [], null); + $this->setIfExists('base_rate', $data ?? [], null); + $this->setIfExists('hourly_rate', $data ?? [], null); + $this->setIfExists('pre_tax_deductions_ytd', $data ?? [], null); + $this->setIfExists('post_tax_deductions_ytd', $data ?? [], null); + $this->setIfExists('employee_base_rate', $data ?? [], null); + $this->setIfExists('employee_base_rate_unit', $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; } /** @@ -543,7 +683,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeBaseRateUnitAllowableValues(); if (!is_null($this->container['employee_base_rate_unit']) && !in_array($this->container['employee_base_rate_unit'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_base_rate_unit', must be one of '%s'", + "invalid value '%s' for 'employee_base_rate_unit', must be one of '%s'", + $this->container['employee_base_rate_unit'], implode("', '", $allowedValues) ); } @@ -566,7 +707,7 @@ public function valid() /** * Gets payg_adjustments * - * @return \Swagger\Client\Model\ApiPaySlipPaygAdjustmentModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipPaygAdjustmentModel[]|null */ public function getPaygAdjustments() { @@ -576,12 +717,15 @@ public function getPaygAdjustments() /** * Sets payg_adjustments * - * @param \Swagger\Client\Model\ApiPaySlipPaygAdjustmentModel[] $payg_adjustments + * @param \OpenAPI\Client\Model\ApiPaySlipPaygAdjustmentModel[]|null $payg_adjustments * - * @return $this + * @return self */ public function setPaygAdjustments($payg_adjustments) { + if (is_null($payg_adjustments)) { + throw new \InvalidArgumentException('non-nullable payg_adjustments cannot be null'); + } $this->container['payg_adjustments'] = $payg_adjustments; return $this; @@ -590,7 +734,7 @@ public function setPaygAdjustments($payg_adjustments) /** * Gets super_adjustments * - * @return \Swagger\Client\Model\ApiPaySlipSuperAdjustmentModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipSuperAdjustmentModel[]|null */ public function getSuperAdjustments() { @@ -600,12 +744,15 @@ public function getSuperAdjustments() /** * Sets super_adjustments * - * @param \Swagger\Client\Model\ApiPaySlipSuperAdjustmentModel[] $super_adjustments + * @param \OpenAPI\Client\Model\ApiPaySlipSuperAdjustmentModel[]|null $super_adjustments * - * @return $this + * @return self */ public function setSuperAdjustments($super_adjustments) { + if (is_null($super_adjustments)) { + throw new \InvalidArgumentException('non-nullable super_adjustments cannot be null'); + } $this->container['super_adjustments'] = $super_adjustments; return $this; @@ -614,7 +761,7 @@ public function setSuperAdjustments($super_adjustments) /** * Gets super_payments * - * @return \Swagger\Client\Model\ApiPaySlipSuperPaymentModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipSuperPaymentModel[]|null */ public function getSuperPayments() { @@ -624,12 +771,15 @@ public function getSuperPayments() /** * Sets super_payments * - * @param \Swagger\Client\Model\ApiPaySlipSuperPaymentModel[] $super_payments + * @param \OpenAPI\Client\Model\ApiPaySlipSuperPaymentModel[]|null $super_payments * - * @return $this + * @return self */ public function setSuperPayments($super_payments) { + if (is_null($super_payments)) { + throw new \InvalidArgumentException('non-nullable super_payments cannot be null'); + } $this->container['super_payments'] = $super_payments; return $this; @@ -638,7 +788,7 @@ public function setSuperPayments($super_payments) /** * Gets bank_payments * - * @return \Swagger\Client\Model\AuApiPaySlipBankPaymentModel[] + * @return \OpenAPI\Client\Model\AuApiPaySlipBankPaymentModel[]|null */ public function getBankPayments() { @@ -648,12 +798,15 @@ public function getBankPayments() /** * Sets bank_payments * - * @param \Swagger\Client\Model\AuApiPaySlipBankPaymentModel[] $bank_payments + * @param \OpenAPI\Client\Model\AuApiPaySlipBankPaymentModel[]|null $bank_payments * - * @return $this + * @return self */ public function setBankPayments($bank_payments) { + if (is_null($bank_payments)) { + throw new \InvalidArgumentException('non-nullable bank_payments cannot be null'); + } $this->container['bank_payments'] = $bank_payments; return $this; @@ -662,7 +815,7 @@ public function setBankPayments($bank_payments) /** * Gets earnings_lines * - * @return \Swagger\Client\Model\AuApiPaySlipEarningsLineModel[] + * @return \OpenAPI\Client\Model\AuApiPaySlipEarningsLineModel[]|null */ public function getEarningsLines() { @@ -672,12 +825,15 @@ public function getEarningsLines() /** * Sets earnings_lines * - * @param \Swagger\Client\Model\AuApiPaySlipEarningsLineModel[] $earnings_lines + * @param \OpenAPI\Client\Model\AuApiPaySlipEarningsLineModel[]|null $earnings_lines * - * @return $this + * @return self */ public function setEarningsLines($earnings_lines) { + if (is_null($earnings_lines)) { + throw new \InvalidArgumentException('non-nullable earnings_lines cannot be null'); + } $this->container['earnings_lines'] = $earnings_lines; return $this; @@ -686,7 +842,7 @@ public function setEarningsLines($earnings_lines) /** * Gets payg_withholding_amount * - * @return double + * @return float|null */ public function getPaygWithholdingAmount() { @@ -696,12 +852,15 @@ public function getPaygWithholdingAmount() /** * Sets payg_withholding_amount * - * @param double $payg_withholding_amount + * @param float|null $payg_withholding_amount * - * @return $this + * @return self */ public function setPaygWithholdingAmount($payg_withholding_amount) { + if (is_null($payg_withholding_amount)) { + throw new \InvalidArgumentException('non-nullable payg_withholding_amount cannot be null'); + } $this->container['payg_withholding_amount'] = $payg_withholding_amount; return $this; @@ -710,7 +869,7 @@ public function setPaygWithholdingAmount($payg_withholding_amount) /** * Gets sfss_amount * - * @return double + * @return float|null */ public function getSfssAmount() { @@ -720,12 +879,15 @@ public function getSfssAmount() /** * Sets sfss_amount * - * @param double $sfss_amount + * @param float|null $sfss_amount * - * @return $this + * @return self */ public function setSfssAmount($sfss_amount) { + if (is_null($sfss_amount)) { + throw new \InvalidArgumentException('non-nullable sfss_amount cannot be null'); + } $this->container['sfss_amount'] = $sfss_amount; return $this; @@ -734,7 +896,7 @@ public function setSfssAmount($sfss_amount) /** * Gets help_amount * - * @return double + * @return float|null */ public function getHelpAmount() { @@ -744,12 +906,15 @@ public function getHelpAmount() /** * Sets help_amount * - * @param double $help_amount + * @param float|null $help_amount * - * @return $this + * @return self */ public function setHelpAmount($help_amount) { + if (is_null($help_amount)) { + throw new \InvalidArgumentException('non-nullable help_amount cannot be null'); + } $this->container['help_amount'] = $help_amount; return $this; @@ -758,7 +923,7 @@ public function setHelpAmount($help_amount) /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -768,12 +933,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -782,7 +950,7 @@ public function setSuperContribution($super_contribution) /** * Gets employee_postal_suburb_name * - * @return string + * @return string|null */ public function getEmployeePostalSuburbName() { @@ -792,12 +960,15 @@ public function getEmployeePostalSuburbName() /** * Sets employee_postal_suburb_name * - * @param string $employee_postal_suburb_name + * @param string|null $employee_postal_suburb_name * - * @return $this + * @return self */ public function setEmployeePostalSuburbName($employee_postal_suburb_name) { + if (is_null($employee_postal_suburb_name)) { + throw new \InvalidArgumentException('non-nullable employee_postal_suburb_name cannot be null'); + } $this->container['employee_postal_suburb_name'] = $employee_postal_suburb_name; return $this; @@ -806,7 +977,7 @@ public function setEmployeePostalSuburbName($employee_postal_suburb_name) /** * Gets employee_postal_suburb_postcode * - * @return string + * @return string|null */ public function getEmployeePostalSuburbPostcode() { @@ -816,12 +987,15 @@ public function getEmployeePostalSuburbPostcode() /** * Sets employee_postal_suburb_postcode * - * @param string $employee_postal_suburb_postcode + * @param string|null $employee_postal_suburb_postcode * - * @return $this + * @return self */ public function setEmployeePostalSuburbPostcode($employee_postal_suburb_postcode) { + if (is_null($employee_postal_suburb_postcode)) { + throw new \InvalidArgumentException('non-nullable employee_postal_suburb_postcode cannot be null'); + } $this->container['employee_postal_suburb_postcode'] = $employee_postal_suburb_postcode; return $this; @@ -830,7 +1004,7 @@ public function setEmployeePostalSuburbPostcode($employee_postal_suburb_postcode /** * Gets employee_postal_suburb_state * - * @return string + * @return string|null */ public function getEmployeePostalSuburbState() { @@ -840,12 +1014,15 @@ public function getEmployeePostalSuburbState() /** * Sets employee_postal_suburb_state * - * @param string $employee_postal_suburb_state + * @param string|null $employee_postal_suburb_state * - * @return $this + * @return self */ public function setEmployeePostalSuburbState($employee_postal_suburb_state) { + if (is_null($employee_postal_suburb_state)) { + throw new \InvalidArgumentException('non-nullable employee_postal_suburb_state cannot be null'); + } $this->container['employee_postal_suburb_state'] = $employee_postal_suburb_state; return $this; @@ -854,7 +1031,7 @@ public function setEmployeePostalSuburbState($employee_postal_suburb_state) /** * Gets super_ytd * - * @return double + * @return float|null */ public function getSuperYtd() { @@ -864,12 +1041,15 @@ public function getSuperYtd() /** * Sets super_ytd * - * @param double $super_ytd + * @param float|null $super_ytd * - * @return $this + * @return self */ public function setSuperYtd($super_ytd) { + if (is_null($super_ytd)) { + throw new \InvalidArgumentException('non-nullable super_ytd cannot be null'); + } $this->container['super_ytd'] = $super_ytd; return $this; @@ -878,7 +1058,7 @@ public function setSuperYtd($super_ytd) /** * Gets sfss_ytd * - * @return double + * @return float|null */ public function getSfssYtd() { @@ -888,12 +1068,15 @@ public function getSfssYtd() /** * Sets sfss_ytd * - * @param double $sfss_ytd + * @param float|null $sfss_ytd * - * @return $this + * @return self */ public function setSfssYtd($sfss_ytd) { + if (is_null($sfss_ytd)) { + throw new \InvalidArgumentException('non-nullable sfss_ytd cannot be null'); + } $this->container['sfss_ytd'] = $sfss_ytd; return $this; @@ -902,7 +1085,7 @@ public function setSfssYtd($sfss_ytd) /** * Gets help_ytd * - * @return double + * @return float|null */ public function getHelpYtd() { @@ -912,12 +1095,15 @@ public function getHelpYtd() /** * Sets help_ytd * - * @param double $help_ytd + * @param float|null $help_ytd * - * @return $this + * @return self */ public function setHelpYtd($help_ytd) { + if (is_null($help_ytd)) { + throw new \InvalidArgumentException('non-nullable help_ytd cannot be null'); + } $this->container['help_ytd'] = $help_ytd; return $this; @@ -926,7 +1112,7 @@ public function setHelpYtd($help_ytd) /** * Gets payg_ytd * - * @return double + * @return float|null */ public function getPaygYtd() { @@ -936,12 +1122,15 @@ public function getPaygYtd() /** * Sets payg_ytd * - * @param double $payg_ytd + * @param float|null $payg_ytd * - * @return $this + * @return self */ public function setPaygYtd($payg_ytd) { + if (is_null($payg_ytd)) { + throw new \InvalidArgumentException('non-nullable payg_ytd cannot be null'); + } $this->container['payg_ytd'] = $payg_ytd; return $this; @@ -950,7 +1139,7 @@ public function setPaygYtd($payg_ytd) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -960,12 +1149,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -974,7 +1166,7 @@ public function setAbn($abn) /** * Gets total_accrued_leave * - * @return \Swagger\Client\Model\ApiPaySlipLeaveModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipLeaveModel[]|null */ public function getTotalAccruedLeave() { @@ -984,12 +1176,15 @@ public function getTotalAccruedLeave() /** * Sets total_accrued_leave * - * @param \Swagger\Client\Model\ApiPaySlipLeaveModel[] $total_accrued_leave + * @param \OpenAPI\Client\Model\ApiPaySlipLeaveModel[]|null $total_accrued_leave * - * @return $this + * @return self */ public function setTotalAccruedLeave($total_accrued_leave) { + if (is_null($total_accrued_leave)) { + throw new \InvalidArgumentException('non-nullable total_accrued_leave cannot be null'); + } $this->container['total_accrued_leave'] = $total_accrued_leave; return $this; @@ -998,7 +1193,7 @@ public function setTotalAccruedLeave($total_accrued_leave) /** * Gets accrued_leave * - * @return \Swagger\Client\Model\ApiPaySlipLeaveModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipLeaveModel[]|null */ public function getAccruedLeave() { @@ -1008,12 +1203,15 @@ public function getAccruedLeave() /** * Sets accrued_leave * - * @param \Swagger\Client\Model\ApiPaySlipLeaveModel[] $accrued_leave + * @param \OpenAPI\Client\Model\ApiPaySlipLeaveModel[]|null $accrued_leave * - * @return $this + * @return self */ public function setAccruedLeave($accrued_leave) { + if (is_null($accrued_leave)) { + throw new \InvalidArgumentException('non-nullable accrued_leave cannot be null'); + } $this->container['accrued_leave'] = $accrued_leave; return $this; @@ -1022,7 +1220,7 @@ public function setAccruedLeave($accrued_leave) /** * Gets leave_taken * - * @return \Swagger\Client\Model\ApiPaySlipLeaveModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipLeaveModel[]|null */ public function getLeaveTaken() { @@ -1032,12 +1230,15 @@ public function getLeaveTaken() /** * Sets leave_taken * - * @param \Swagger\Client\Model\ApiPaySlipLeaveModel[] $leave_taken + * @param \OpenAPI\Client\Model\ApiPaySlipLeaveModel[]|null $leave_taken * - * @return $this + * @return self */ public function setLeaveTaken($leave_taken) { + if (is_null($leave_taken)) { + throw new \InvalidArgumentException('non-nullable leave_taken cannot be null'); + } $this->container['leave_taken'] = $leave_taken; return $this; @@ -1046,7 +1247,7 @@ public function setLeaveTaken($leave_taken) /** * Gets deductions * - * @return \Swagger\Client\Model\ApiPaySlipDeductionModel[] + * @return \OpenAPI\Client\Model\ApiPaySlipDeductionModel[]|null */ public function getDeductions() { @@ -1056,12 +1257,15 @@ public function getDeductions() /** * Sets deductions * - * @param \Swagger\Client\Model\ApiPaySlipDeductionModel[] $deductions + * @param \OpenAPI\Client\Model\ApiPaySlipDeductionModel[]|null $deductions * - * @return $this + * @return self */ public function setDeductions($deductions) { + if (is_null($deductions)) { + throw new \InvalidArgumentException('non-nullable deductions cannot be null'); + } $this->container['deductions'] = $deductions; return $this; @@ -1070,7 +1274,7 @@ public function setDeductions($deductions) /** * Gets gross_ytd_details * - * @return \Swagger\Client\Model\ApiYearToDateEarningsBreakdownModel[] + * @return \OpenAPI\Client\Model\ApiYearToDateEarningsBreakdownModel[]|null */ public function getGrossYtdDetails() { @@ -1080,12 +1284,15 @@ public function getGrossYtdDetails() /** * Sets gross_ytd_details * - * @param \Swagger\Client\Model\ApiYearToDateEarningsBreakdownModel[] $gross_ytd_details + * @param \OpenAPI\Client\Model\ApiYearToDateEarningsBreakdownModel[]|null $gross_ytd_details * - * @return $this + * @return self */ public function setGrossYtdDetails($gross_ytd_details) { + if (is_null($gross_ytd_details)) { + throw new \InvalidArgumentException('non-nullable gross_ytd_details cannot be null'); + } $this->container['gross_ytd_details'] = $gross_ytd_details; return $this; @@ -1094,7 +1301,7 @@ public function setGrossYtdDetails($gross_ytd_details) /** * Gets employee_expenses * - * @return \Swagger\Client\Model\ApiEmployeeExpenseGridModel[] + * @return \OpenAPI\Client\Model\ApiEmployeeExpenseGridModel[]|null */ public function getEmployeeExpenses() { @@ -1104,12 +1311,15 @@ public function getEmployeeExpenses() /** * Sets employee_expenses * - * @param \Swagger\Client\Model\ApiEmployeeExpenseGridModel[] $employee_expenses + * @param \OpenAPI\Client\Model\ApiEmployeeExpenseGridModel[]|null $employee_expenses * - * @return $this + * @return self */ public function setEmployeeExpenses($employee_expenses) { + if (is_null($employee_expenses)) { + throw new \InvalidArgumentException('non-nullable employee_expenses cannot be null'); + } $this->container['employee_expenses'] = $employee_expenses; return $this; @@ -1118,7 +1328,7 @@ public function setEmployeeExpenses($employee_expenses) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -1128,12 +1338,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -1142,7 +1355,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -1152,12 +1365,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -1166,7 +1382,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -1176,12 +1392,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -1190,7 +1409,7 @@ public function setNetEarnings($net_earnings) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -1200,12 +1419,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -1214,7 +1436,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets post_tax_deduction_amount * - * @return double + * @return float|null */ public function getPostTaxDeductionAmount() { @@ -1224,12 +1446,15 @@ public function getPostTaxDeductionAmount() /** * Sets post_tax_deduction_amount * - * @param double $post_tax_deduction_amount + * @param float|null $post_tax_deduction_amount * - * @return $this + * @return self */ public function setPostTaxDeductionAmount($post_tax_deduction_amount) { + if (is_null($post_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable post_tax_deduction_amount cannot be null'); + } $this->container['post_tax_deduction_amount'] = $post_tax_deduction_amount; return $this; @@ -1238,7 +1463,7 @@ public function setPostTaxDeductionAmount($post_tax_deduction_amount) /** * Gets pre_tax_deduction_amount * - * @return double + * @return float|null */ public function getPreTaxDeductionAmount() { @@ -1248,12 +1473,15 @@ public function getPreTaxDeductionAmount() /** * Sets pre_tax_deduction_amount * - * @param double $pre_tax_deduction_amount + * @param float|null $pre_tax_deduction_amount * - * @return $this + * @return self */ public function setPreTaxDeductionAmount($pre_tax_deduction_amount) { + if (is_null($pre_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deduction_amount cannot be null'); + } $this->container['pre_tax_deduction_amount'] = $pre_tax_deduction_amount; return $this; @@ -1262,7 +1490,7 @@ public function setPreTaxDeductionAmount($pre_tax_deduction_amount) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -1272,12 +1500,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -1286,7 +1517,7 @@ public function setId($id) /** * Gets business_name * - * @return string + * @return string|null */ public function getBusinessName() { @@ -1296,12 +1527,15 @@ public function getBusinessName() /** * Sets business_name * - * @param string $business_name + * @param string|null $business_name * - * @return $this + * @return self */ public function setBusinessName($business_name) { + if (is_null($business_name)) { + throw new \InvalidArgumentException('non-nullable business_name cannot be null'); + } $this->container['business_name'] = $business_name; return $this; @@ -1310,7 +1544,7 @@ public function setBusinessName($business_name) /** * Gets business_address * - * @return string + * @return string|null */ public function getBusinessAddress() { @@ -1320,12 +1554,15 @@ public function getBusinessAddress() /** * Sets business_address * - * @param string $business_address + * @param string|null $business_address * - * @return $this + * @return self */ public function setBusinessAddress($business_address) { + if (is_null($business_address)) { + throw new \InvalidArgumentException('non-nullable business_address cannot be null'); + } $this->container['business_address'] = $business_address; return $this; @@ -1334,7 +1571,7 @@ public function setBusinessAddress($business_address) /** * Gets contact_name * - * @return string + * @return string|null */ public function getContactName() { @@ -1344,12 +1581,15 @@ public function getContactName() /** * Sets contact_name * - * @param string $contact_name + * @param string|null $contact_name * - * @return $this + * @return self */ public function setContactName($contact_name) { + if (is_null($contact_name)) { + throw new \InvalidArgumentException('non-nullable contact_name cannot be null'); + } $this->container['contact_name'] = $contact_name; return $this; @@ -1358,7 +1598,7 @@ public function setContactName($contact_name) /** * Gets pay_period_starting * - * @return string + * @return string|null */ public function getPayPeriodStarting() { @@ -1368,12 +1608,15 @@ public function getPayPeriodStarting() /** * Sets pay_period_starting * - * @param string $pay_period_starting + * @param string|null $pay_period_starting * - * @return $this + * @return self */ public function setPayPeriodStarting($pay_period_starting) { + if (is_null($pay_period_starting)) { + throw new \InvalidArgumentException('non-nullable pay_period_starting cannot be null'); + } $this->container['pay_period_starting'] = $pay_period_starting; return $this; @@ -1382,7 +1625,7 @@ public function setPayPeriodStarting($pay_period_starting) /** * Gets pay_period_ending * - * @return string + * @return string|null */ public function getPayPeriodEnding() { @@ -1392,12 +1635,15 @@ public function getPayPeriodEnding() /** * Sets pay_period_ending * - * @param string $pay_period_ending + * @param string|null $pay_period_ending * - * @return $this + * @return self */ public function setPayPeriodEnding($pay_period_ending) { + if (is_null($pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable pay_period_ending cannot be null'); + } $this->container['pay_period_ending'] = $pay_period_ending; return $this; @@ -1406,7 +1652,7 @@ public function setPayPeriodEnding($pay_period_ending) /** * Gets message * - * @return string + * @return string|null */ public function getMessage() { @@ -1416,12 +1662,15 @@ public function getMessage() /** * Sets message * - * @param string $message + * @param string|null $message * - * @return $this + * @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; @@ -1430,7 +1679,7 @@ public function setMessage($message) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -1440,12 +1689,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -1454,7 +1706,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -1464,12 +1716,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -1478,7 +1733,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -1488,12 +1743,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -1502,7 +1760,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_first_name * - * @return string + * @return string|null */ public function getEmployeeFirstName() { @@ -1512,12 +1770,15 @@ public function getEmployeeFirstName() /** * Sets employee_first_name * - * @param string $employee_first_name + * @param string|null $employee_first_name * - * @return $this + * @return self */ public function setEmployeeFirstName($employee_first_name) { + if (is_null($employee_first_name)) { + throw new \InvalidArgumentException('non-nullable employee_first_name cannot be null'); + } $this->container['employee_first_name'] = $employee_first_name; return $this; @@ -1526,7 +1787,7 @@ public function setEmployeeFirstName($employee_first_name) /** * Gets employee_surname * - * @return string + * @return string|null */ public function getEmployeeSurname() { @@ -1536,12 +1797,15 @@ public function getEmployeeSurname() /** * Sets employee_surname * - * @param string $employee_surname + * @param string|null $employee_surname * - * @return $this + * @return self */ public function setEmployeeSurname($employee_surname) { + if (is_null($employee_surname)) { + throw new \InvalidArgumentException('non-nullable employee_surname cannot be null'); + } $this->container['employee_surname'] = $employee_surname; return $this; @@ -1550,7 +1814,7 @@ public function setEmployeeSurname($employee_surname) /** * Gets employee_postal_street_address * - * @return string + * @return string|null */ public function getEmployeePostalStreetAddress() { @@ -1560,12 +1824,15 @@ public function getEmployeePostalStreetAddress() /** * Sets employee_postal_street_address * - * @param string $employee_postal_street_address + * @param string|null $employee_postal_street_address * - * @return $this + * @return self */ public function setEmployeePostalStreetAddress($employee_postal_street_address) { + if (is_null($employee_postal_street_address)) { + throw new \InvalidArgumentException('non-nullable employee_postal_street_address cannot be null'); + } $this->container['employee_postal_street_address'] = $employee_postal_street_address; return $this; @@ -1574,7 +1841,7 @@ public function setEmployeePostalStreetAddress($employee_postal_street_address) /** * Gets employee_postal_address_line2 * - * @return string + * @return string|null */ public function getEmployeePostalAddressLine2() { @@ -1584,12 +1851,15 @@ public function getEmployeePostalAddressLine2() /** * Sets employee_postal_address_line2 * - * @param string $employee_postal_address_line2 + * @param string|null $employee_postal_address_line2 * - * @return $this + * @return self */ public function setEmployeePostalAddressLine2($employee_postal_address_line2) { + if (is_null($employee_postal_address_line2)) { + throw new \InvalidArgumentException('non-nullable employee_postal_address_line2 cannot be null'); + } $this->container['employee_postal_address_line2'] = $employee_postal_address_line2; return $this; @@ -1598,7 +1868,7 @@ public function setEmployeePostalAddressLine2($employee_postal_address_line2) /** * Gets employee_postal_address_country * - * @return string + * @return string|null */ public function getEmployeePostalAddressCountry() { @@ -1608,12 +1878,15 @@ public function getEmployeePostalAddressCountry() /** * Sets employee_postal_address_country * - * @param string $employee_postal_address_country + * @param string|null $employee_postal_address_country * - * @return $this + * @return self */ public function setEmployeePostalAddressCountry($employee_postal_address_country) { + if (is_null($employee_postal_address_country)) { + throw new \InvalidArgumentException('non-nullable employee_postal_address_country cannot be null'); + } $this->container['employee_postal_address_country'] = $employee_postal_address_country; return $this; @@ -1622,7 +1895,7 @@ public function setEmployeePostalAddressCountry($employee_postal_address_country /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -1632,12 +1905,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -1646,7 +1922,7 @@ public function setNotation($notation) /** * Gets is_published * - * @return bool + * @return bool|null */ public function getIsPublished() { @@ -1656,12 +1932,15 @@ public function getIsPublished() /** * Sets is_published * - * @param bool $is_published + * @param bool|null $is_published * - * @return $this + * @return self */ public function setIsPublished($is_published) { + if (is_null($is_published)) { + throw new \InvalidArgumentException('non-nullable is_published cannot be null'); + } $this->container['is_published'] = $is_published; return $this; @@ -1670,7 +1949,7 @@ public function setIsPublished($is_published) /** * Gets gross_ytd * - * @return double + * @return float|null */ public function getGrossYtd() { @@ -1680,12 +1959,15 @@ public function getGrossYtd() /** * Sets gross_ytd * - * @param double $gross_ytd + * @param float|null $gross_ytd * - * @return $this + * @return self */ public function setGrossYtd($gross_ytd) { + if (is_null($gross_ytd)) { + throw new \InvalidArgumentException('non-nullable gross_ytd cannot be null'); + } $this->container['gross_ytd'] = $gross_ytd; return $this; @@ -1694,7 +1976,7 @@ public function setGrossYtd($gross_ytd) /** * Gets net_ytd * - * @return double + * @return float|null */ public function getNetYtd() { @@ -1704,12 +1986,15 @@ public function getNetYtd() /** * Sets net_ytd * - * @param double $net_ytd + * @param float|null $net_ytd * - * @return $this + * @return self */ public function setNetYtd($net_ytd) { + if (is_null($net_ytd)) { + throw new \InvalidArgumentException('non-nullable net_ytd cannot be null'); + } $this->container['net_ytd'] = $net_ytd; return $this; @@ -1718,7 +2003,7 @@ public function setNetYtd($net_ytd) /** * Gets withholding_ytd * - * @return double + * @return float|null */ public function getWithholdingYtd() { @@ -1728,12 +2013,15 @@ public function getWithholdingYtd() /** * Sets withholding_ytd * - * @param double $withholding_ytd + * @param float|null $withholding_ytd * - * @return $this + * @return self */ public function setWithholdingYtd($withholding_ytd) { + if (is_null($withholding_ytd)) { + throw new \InvalidArgumentException('non-nullable withholding_ytd cannot be null'); + } $this->container['withholding_ytd'] = $withholding_ytd; return $this; @@ -1742,7 +2030,7 @@ public function setWithholdingYtd($withholding_ytd) /** * Gets base_pay_rate * - * @return string + * @return string|null */ public function getBasePayRate() { @@ -1752,12 +2040,15 @@ public function getBasePayRate() /** * Sets base_pay_rate * - * @param string $base_pay_rate + * @param string|null $base_pay_rate * - * @return $this + * @return self */ public function setBasePayRate($base_pay_rate) { + if (is_null($base_pay_rate)) { + throw new \InvalidArgumentException('non-nullable base_pay_rate cannot be null'); + } $this->container['base_pay_rate'] = $base_pay_rate; return $this; @@ -1766,7 +2057,7 @@ public function setBasePayRate($base_pay_rate) /** * Gets base_rate * - * @return string + * @return string|null */ public function getBaseRate() { @@ -1776,12 +2067,15 @@ public function getBaseRate() /** * Sets base_rate * - * @param string $base_rate + * @param string|null $base_rate * - * @return $this + * @return self */ public function setBaseRate($base_rate) { + if (is_null($base_rate)) { + throw new \InvalidArgumentException('non-nullable base_rate cannot be null'); + } $this->container['base_rate'] = $base_rate; return $this; @@ -1790,7 +2084,7 @@ public function setBaseRate($base_rate) /** * Gets hourly_rate * - * @return double + * @return float|null */ public function getHourlyRate() { @@ -1800,12 +2094,15 @@ public function getHourlyRate() /** * Sets hourly_rate * - * @param double $hourly_rate + * @param float|null $hourly_rate * - * @return $this + * @return self */ public function setHourlyRate($hourly_rate) { + if (is_null($hourly_rate)) { + throw new \InvalidArgumentException('non-nullable hourly_rate cannot be null'); + } $this->container['hourly_rate'] = $hourly_rate; return $this; @@ -1814,7 +2111,7 @@ public function setHourlyRate($hourly_rate) /** * Gets pre_tax_deductions_ytd * - * @return double + * @return float|null */ public function getPreTaxDeductionsYtd() { @@ -1824,12 +2121,15 @@ public function getPreTaxDeductionsYtd() /** * Sets pre_tax_deductions_ytd * - * @param double $pre_tax_deductions_ytd + * @param float|null $pre_tax_deductions_ytd * - * @return $this + * @return self */ public function setPreTaxDeductionsYtd($pre_tax_deductions_ytd) { + if (is_null($pre_tax_deductions_ytd)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deductions_ytd cannot be null'); + } $this->container['pre_tax_deductions_ytd'] = $pre_tax_deductions_ytd; return $this; @@ -1838,7 +2138,7 @@ public function setPreTaxDeductionsYtd($pre_tax_deductions_ytd) /** * Gets post_tax_deductions_ytd * - * @return double + * @return float|null */ public function getPostTaxDeductionsYtd() { @@ -1848,12 +2148,15 @@ public function getPostTaxDeductionsYtd() /** * Sets post_tax_deductions_ytd * - * @param double $post_tax_deductions_ytd + * @param float|null $post_tax_deductions_ytd * - * @return $this + * @return self */ public function setPostTaxDeductionsYtd($post_tax_deductions_ytd) { + if (is_null($post_tax_deductions_ytd)) { + throw new \InvalidArgumentException('non-nullable post_tax_deductions_ytd cannot be null'); + } $this->container['post_tax_deductions_ytd'] = $post_tax_deductions_ytd; return $this; @@ -1862,7 +2165,7 @@ public function setPostTaxDeductionsYtd($post_tax_deductions_ytd) /** * Gets employee_base_rate * - * @return double + * @return float|null */ public function getEmployeeBaseRate() { @@ -1872,12 +2175,15 @@ public function getEmployeeBaseRate() /** * Sets employee_base_rate * - * @param double $employee_base_rate + * @param float|null $employee_base_rate * - * @return $this + * @return self */ public function setEmployeeBaseRate($employee_base_rate) { + if (is_null($employee_base_rate)) { + throw new \InvalidArgumentException('non-nullable employee_base_rate cannot be null'); + } $this->container['employee_base_rate'] = $employee_base_rate; return $this; @@ -1886,7 +2192,7 @@ public function setEmployeeBaseRate($employee_base_rate) /** * Gets employee_base_rate_unit * - * @return string + * @return string|null */ public function getEmployeeBaseRateUnit() { @@ -1896,17 +2202,21 @@ public function getEmployeeBaseRateUnit() /** * Sets employee_base_rate_unit * - * @param string $employee_base_rate_unit + * @param string|null $employee_base_rate_unit * - * @return $this + * @return self */ public function setEmployeeBaseRateUnit($employee_base_rate_unit) { + if (is_null($employee_base_rate_unit)) { + throw new \InvalidArgumentException('non-nullable employee_base_rate_unit cannot be null'); + } $allowedValues = $this->getEmployeeBaseRateUnitAllowableValues(); - if (!is_null($employee_base_rate_unit) && !in_array($employee_base_rate_unit, $allowedValues, true)) { + if (!in_array($employee_base_rate_unit, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_base_rate_unit', must be one of '%s'", + "Invalid value '%s' for 'employee_base_rate_unit', must be one of '%s'", + $employee_base_rate_unit, implode("', '", $allowedValues) ) ); @@ -1922,7 +2232,7 @@ public function setEmployeeBaseRateUnit($employee_base_rate_unit) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1932,22 +2242,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1963,11 +2274,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1975,13 +2299,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuAutoPayConfigurationModel.php b/src/lib/Model/AuAutoPayConfigurationModel.php index 5b9e5bf..d2a3bd7 100644 --- a/src/lib/Model/AuAutoPayConfigurationModel.php +++ b/src/lib/Model/AuAutoPayConfigurationModel.php @@ -2,61 +2,61 @@ /** * AuAutoPayConfigurationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuAutoPayConfigurationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuAutoPayConfigurationModel implements ModelInterface, ArrayAccess +class AuAutoPayConfigurationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuAutoPayConfigurationModel'; + protected static $openAPIModelName = 'AuAutoPayConfigurationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'enabled' => 'bool', 'paused' => 'bool', 'initial_pay_period_ending' => '\DateTime', @@ -85,8 +85,10 @@ class AuAutoPayConfigurationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'enabled' => null, 'paused' => null, 'initial_pay_period_ending' => 'date-time', @@ -111,14 +113,51 @@ class AuAutoPayConfigurationModel implements ModelInterface, ArrayAccess 'report_packs_to_run' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'enabled' => false, + 'paused' => false, + 'initial_pay_period_ending' => false, + 'initial_date_paid' => false, + 'initial_pay_run_creation_date_time' => false, + 'scheduled_end_date' => false, + 'next_scheduled_creation_date_time_utc' => false, + 'finalise' => false, + 'timesheet_import_option' => false, + 'export_journals' => false, + 'lodge_pay_run' => false, + 'publish_pay_slips' => false, + 'publish_pay_slips_hour' => false, + 'suppress_notifications' => false, + 'users_to_notify' => false, + 'run_on_specific_day_of_month' => false, + 'adjust_run_date_to_work_day' => false, + 'adjust_date_paid_to_work_day' => false, + 'specific_day_of_month' => false, + 'week_of_month' => false, + 'day_of_week' => false, + 'report_packs_to_run' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -126,9 +165,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -260,18 +351,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TIMESHEET_IMPORT_OPTION_NONE = 'None'; - const TIMESHEET_IMPORT_OPTION_THIS_PAY_PERIOD = 'ThisPayPeriod'; - const TIMESHEET_IMPORT_OPTION_ALL_OUTSTANDING = 'AllOutstanding'; - const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; - const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; - const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; - + public const TIMESHEET_IMPORT_OPTION_NONE = 'None'; + public const TIMESHEET_IMPORT_OPTION_THIS_PAY_PERIOD = 'ThisPayPeriod'; + public const TIMESHEET_IMPORT_OPTION_ALL_OUTSTANDING = 'AllOutstanding'; + public const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; + public const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; + public const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; - /** * Gets allowable values of the enum * @@ -285,7 +374,7 @@ public function getTimesheetImportOptionAllowableValues() self::TIMESHEET_IMPORT_OPTION_ALL_OUTSTANDING, ]; } - + /** * Gets allowable values of the enum * @@ -299,7 +388,6 @@ public function getPublishPaySlipsAllowableValues() self::PUBLISH_PAY_SLIPS_SCHEDULED, ]; } - /** * Associative array for storing property values @@ -316,28 +404,46 @@ public function getPublishPaySlipsAllowableValues() */ public function __construct(array $data = null) { - $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; - $this->container['paused'] = isset($data['paused']) ? $data['paused'] : null; - $this->container['initial_pay_period_ending'] = isset($data['initial_pay_period_ending']) ? $data['initial_pay_period_ending'] : null; - $this->container['initial_date_paid'] = isset($data['initial_date_paid']) ? $data['initial_date_paid'] : null; - $this->container['initial_pay_run_creation_date_time'] = isset($data['initial_pay_run_creation_date_time']) ? $data['initial_pay_run_creation_date_time'] : null; - $this->container['scheduled_end_date'] = isset($data['scheduled_end_date']) ? $data['scheduled_end_date'] : null; - $this->container['next_scheduled_creation_date_time_utc'] = isset($data['next_scheduled_creation_date_time_utc']) ? $data['next_scheduled_creation_date_time_utc'] : null; - $this->container['finalise'] = isset($data['finalise']) ? $data['finalise'] : null; - $this->container['timesheet_import_option'] = isset($data['timesheet_import_option']) ? $data['timesheet_import_option'] : null; - $this->container['export_journals'] = isset($data['export_journals']) ? $data['export_journals'] : null; - $this->container['lodge_pay_run'] = isset($data['lodge_pay_run']) ? $data['lodge_pay_run'] : null; - $this->container['publish_pay_slips'] = isset($data['publish_pay_slips']) ? $data['publish_pay_slips'] : null; - $this->container['publish_pay_slips_hour'] = isset($data['publish_pay_slips_hour']) ? $data['publish_pay_slips_hour'] : null; - $this->container['suppress_notifications'] = isset($data['suppress_notifications']) ? $data['suppress_notifications'] : null; - $this->container['users_to_notify'] = isset($data['users_to_notify']) ? $data['users_to_notify'] : null; - $this->container['run_on_specific_day_of_month'] = isset($data['run_on_specific_day_of_month']) ? $data['run_on_specific_day_of_month'] : null; - $this->container['adjust_run_date_to_work_day'] = isset($data['adjust_run_date_to_work_day']) ? $data['adjust_run_date_to_work_day'] : null; - $this->container['adjust_date_paid_to_work_day'] = isset($data['adjust_date_paid_to_work_day']) ? $data['adjust_date_paid_to_work_day'] : null; - $this->container['specific_day_of_month'] = isset($data['specific_day_of_month']) ? $data['specific_day_of_month'] : null; - $this->container['week_of_month'] = isset($data['week_of_month']) ? $data['week_of_month'] : null; - $this->container['day_of_week'] = isset($data['day_of_week']) ? $data['day_of_week'] : null; - $this->container['report_packs_to_run'] = isset($data['report_packs_to_run']) ? $data['report_packs_to_run'] : null; + $this->setIfExists('enabled', $data ?? [], null); + $this->setIfExists('paused', $data ?? [], null); + $this->setIfExists('initial_pay_period_ending', $data ?? [], null); + $this->setIfExists('initial_date_paid', $data ?? [], null); + $this->setIfExists('initial_pay_run_creation_date_time', $data ?? [], null); + $this->setIfExists('scheduled_end_date', $data ?? [], null); + $this->setIfExists('next_scheduled_creation_date_time_utc', $data ?? [], null); + $this->setIfExists('finalise', $data ?? [], null); + $this->setIfExists('timesheet_import_option', $data ?? [], null); + $this->setIfExists('export_journals', $data ?? [], null); + $this->setIfExists('lodge_pay_run', $data ?? [], null); + $this->setIfExists('publish_pay_slips', $data ?? [], null); + $this->setIfExists('publish_pay_slips_hour', $data ?? [], null); + $this->setIfExists('suppress_notifications', $data ?? [], null); + $this->setIfExists('users_to_notify', $data ?? [], null); + $this->setIfExists('run_on_specific_day_of_month', $data ?? [], null); + $this->setIfExists('adjust_run_date_to_work_day', $data ?? [], null); + $this->setIfExists('adjust_date_paid_to_work_day', $data ?? [], null); + $this->setIfExists('specific_day_of_month', $data ?? [], null); + $this->setIfExists('week_of_month', $data ?? [], null); + $this->setIfExists('day_of_week', $data ?? [], null); + $this->setIfExists('report_packs_to_run', $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; } /** @@ -352,7 +458,8 @@ public function listInvalidProperties() $allowedValues = $this->getTimesheetImportOptionAllowableValues(); if (!is_null($this->container['timesheet_import_option']) && !in_array($this->container['timesheet_import_option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'timesheet_import_option', must be one of '%s'", + "invalid value '%s' for 'timesheet_import_option', must be one of '%s'", + $this->container['timesheet_import_option'], implode("', '", $allowedValues) ); } @@ -360,7 +467,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPaySlipsAllowableValues(); if (!is_null($this->container['publish_pay_slips']) && !in_array($this->container['publish_pay_slips'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_pay_slips', must be one of '%s'", + "invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $this->container['publish_pay_slips'], implode("', '", $allowedValues) ); } @@ -383,7 +491,7 @@ public function valid() /** * Gets enabled * - * @return bool + * @return bool|null */ public function getEnabled() { @@ -393,12 +501,15 @@ public function getEnabled() /** * Sets enabled * - * @param bool $enabled + * @param bool|null $enabled * - * @return $this + * @return self */ public function setEnabled($enabled) { + if (is_null($enabled)) { + throw new \InvalidArgumentException('non-nullable enabled cannot be null'); + } $this->container['enabled'] = $enabled; return $this; @@ -407,7 +518,7 @@ public function setEnabled($enabled) /** * Gets paused * - * @return bool + * @return bool|null */ public function getPaused() { @@ -417,12 +528,15 @@ public function getPaused() /** * Sets paused * - * @param bool $paused + * @param bool|null $paused * - * @return $this + * @return self */ public function setPaused($paused) { + if (is_null($paused)) { + throw new \InvalidArgumentException('non-nullable paused cannot be null'); + } $this->container['paused'] = $paused; return $this; @@ -431,7 +545,7 @@ public function setPaused($paused) /** * Gets initial_pay_period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getInitialPayPeriodEnding() { @@ -441,12 +555,15 @@ public function getInitialPayPeriodEnding() /** * Sets initial_pay_period_ending * - * @param \DateTime $initial_pay_period_ending + * @param \DateTime|null $initial_pay_period_ending * - * @return $this + * @return self */ public function setInitialPayPeriodEnding($initial_pay_period_ending) { + if (is_null($initial_pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable initial_pay_period_ending cannot be null'); + } $this->container['initial_pay_period_ending'] = $initial_pay_period_ending; return $this; @@ -455,7 +572,7 @@ public function setInitialPayPeriodEnding($initial_pay_period_ending) /** * Gets initial_date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getInitialDatePaid() { @@ -465,12 +582,15 @@ public function getInitialDatePaid() /** * Sets initial_date_paid * - * @param \DateTime $initial_date_paid + * @param \DateTime|null $initial_date_paid * - * @return $this + * @return self */ public function setInitialDatePaid($initial_date_paid) { + if (is_null($initial_date_paid)) { + throw new \InvalidArgumentException('non-nullable initial_date_paid cannot be null'); + } $this->container['initial_date_paid'] = $initial_date_paid; return $this; @@ -479,7 +599,7 @@ public function setInitialDatePaid($initial_date_paid) /** * Gets initial_pay_run_creation_date_time * - * @return \DateTime + * @return \DateTime|null */ public function getInitialPayRunCreationDateTime() { @@ -489,12 +609,15 @@ public function getInitialPayRunCreationDateTime() /** * Sets initial_pay_run_creation_date_time * - * @param \DateTime $initial_pay_run_creation_date_time + * @param \DateTime|null $initial_pay_run_creation_date_time * - * @return $this + * @return self */ public function setInitialPayRunCreationDateTime($initial_pay_run_creation_date_time) { + if (is_null($initial_pay_run_creation_date_time)) { + throw new \InvalidArgumentException('non-nullable initial_pay_run_creation_date_time cannot be null'); + } $this->container['initial_pay_run_creation_date_time'] = $initial_pay_run_creation_date_time; return $this; @@ -503,7 +626,7 @@ public function setInitialPayRunCreationDateTime($initial_pay_run_creation_date_ /** * Gets scheduled_end_date * - * @return \DateTime + * @return \DateTime|null */ public function getScheduledEndDate() { @@ -513,12 +636,15 @@ public function getScheduledEndDate() /** * Sets scheduled_end_date * - * @param \DateTime $scheduled_end_date + * @param \DateTime|null $scheduled_end_date * - * @return $this + * @return self */ public function setScheduledEndDate($scheduled_end_date) { + if (is_null($scheduled_end_date)) { + throw new \InvalidArgumentException('non-nullable scheduled_end_date cannot be null'); + } $this->container['scheduled_end_date'] = $scheduled_end_date; return $this; @@ -527,7 +653,7 @@ public function setScheduledEndDate($scheduled_end_date) /** * Gets next_scheduled_creation_date_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getNextScheduledCreationDateTimeUtc() { @@ -537,12 +663,15 @@ public function getNextScheduledCreationDateTimeUtc() /** * Sets next_scheduled_creation_date_time_utc * - * @param \DateTime $next_scheduled_creation_date_time_utc + * @param \DateTime|null $next_scheduled_creation_date_time_utc * - * @return $this + * @return self */ public function setNextScheduledCreationDateTimeUtc($next_scheduled_creation_date_time_utc) { + if (is_null($next_scheduled_creation_date_time_utc)) { + throw new \InvalidArgumentException('non-nullable next_scheduled_creation_date_time_utc cannot be null'); + } $this->container['next_scheduled_creation_date_time_utc'] = $next_scheduled_creation_date_time_utc; return $this; @@ -551,7 +680,7 @@ public function setNextScheduledCreationDateTimeUtc($next_scheduled_creation_dat /** * Gets finalise * - * @return bool + * @return bool|null */ public function getFinalise() { @@ -561,12 +690,15 @@ public function getFinalise() /** * Sets finalise * - * @param bool $finalise + * @param bool|null $finalise * - * @return $this + * @return self */ public function setFinalise($finalise) { + if (is_null($finalise)) { + throw new \InvalidArgumentException('non-nullable finalise cannot be null'); + } $this->container['finalise'] = $finalise; return $this; @@ -575,7 +707,7 @@ public function setFinalise($finalise) /** * Gets timesheet_import_option * - * @return string + * @return string|null */ public function getTimesheetImportOption() { @@ -585,17 +717,21 @@ public function getTimesheetImportOption() /** * Sets timesheet_import_option * - * @param string $timesheet_import_option + * @param string|null $timesheet_import_option * - * @return $this + * @return self */ public function setTimesheetImportOption($timesheet_import_option) { + if (is_null($timesheet_import_option)) { + throw new \InvalidArgumentException('non-nullable timesheet_import_option cannot be null'); + } $allowedValues = $this->getTimesheetImportOptionAllowableValues(); - if (!is_null($timesheet_import_option) && !in_array($timesheet_import_option, $allowedValues, true)) { + if (!in_array($timesheet_import_option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'timesheet_import_option', must be one of '%s'", + "Invalid value '%s' for 'timesheet_import_option', must be one of '%s'", + $timesheet_import_option, implode("', '", $allowedValues) ) ); @@ -608,7 +744,7 @@ public function setTimesheetImportOption($timesheet_import_option) /** * Gets export_journals * - * @return bool + * @return bool|null */ public function getExportJournals() { @@ -618,12 +754,15 @@ public function getExportJournals() /** * Sets export_journals * - * @param bool $export_journals + * @param bool|null $export_journals * - * @return $this + * @return self */ public function setExportJournals($export_journals) { + if (is_null($export_journals)) { + throw new \InvalidArgumentException('non-nullable export_journals cannot be null'); + } $this->container['export_journals'] = $export_journals; return $this; @@ -632,7 +771,7 @@ public function setExportJournals($export_journals) /** * Gets lodge_pay_run * - * @return bool + * @return bool|null */ public function getLodgePayRun() { @@ -642,12 +781,15 @@ public function getLodgePayRun() /** * Sets lodge_pay_run * - * @param bool $lodge_pay_run + * @param bool|null $lodge_pay_run * - * @return $this + * @return self */ public function setLodgePayRun($lodge_pay_run) { + if (is_null($lodge_pay_run)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run cannot be null'); + } $this->container['lodge_pay_run'] = $lodge_pay_run; return $this; @@ -656,7 +798,7 @@ public function setLodgePayRun($lodge_pay_run) /** * Gets publish_pay_slips * - * @return string + * @return string|null */ public function getPublishPaySlips() { @@ -666,17 +808,21 @@ public function getPublishPaySlips() /** * Sets publish_pay_slips * - * @param string $publish_pay_slips + * @param string|null $publish_pay_slips * - * @return $this + * @return self */ public function setPublishPaySlips($publish_pay_slips) { + if (is_null($publish_pay_slips)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips cannot be null'); + } $allowedValues = $this->getPublishPaySlipsAllowableValues(); - if (!is_null($publish_pay_slips) && !in_array($publish_pay_slips, $allowedValues, true)) { + if (!in_array($publish_pay_slips, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_pay_slips', must be one of '%s'", + "Invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $publish_pay_slips, implode("', '", $allowedValues) ) ); @@ -689,7 +835,7 @@ public function setPublishPaySlips($publish_pay_slips) /** * Gets publish_pay_slips_hour * - * @return int + * @return int|null */ public function getPublishPaySlipsHour() { @@ -699,12 +845,15 @@ public function getPublishPaySlipsHour() /** * Sets publish_pay_slips_hour * - * @param int $publish_pay_slips_hour + * @param int|null $publish_pay_slips_hour * - * @return $this + * @return self */ public function setPublishPaySlipsHour($publish_pay_slips_hour) { + if (is_null($publish_pay_slips_hour)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_hour cannot be null'); + } $this->container['publish_pay_slips_hour'] = $publish_pay_slips_hour; return $this; @@ -713,7 +862,7 @@ public function setPublishPaySlipsHour($publish_pay_slips_hour) /** * Gets suppress_notifications * - * @return bool + * @return bool|null */ public function getSuppressNotifications() { @@ -723,12 +872,15 @@ public function getSuppressNotifications() /** * Sets suppress_notifications * - * @param bool $suppress_notifications + * @param bool|null $suppress_notifications * - * @return $this + * @return self */ public function setSuppressNotifications($suppress_notifications) { + if (is_null($suppress_notifications)) { + throw new \InvalidArgumentException('non-nullable suppress_notifications cannot be null'); + } $this->container['suppress_notifications'] = $suppress_notifications; return $this; @@ -737,7 +889,7 @@ public function setSuppressNotifications($suppress_notifications) /** * Gets users_to_notify * - * @return string[] + * @return string[]|null */ public function getUsersToNotify() { @@ -747,12 +899,15 @@ public function getUsersToNotify() /** * Sets users_to_notify * - * @param string[] $users_to_notify + * @param string[]|null $users_to_notify * - * @return $this + * @return self */ public function setUsersToNotify($users_to_notify) { + if (is_null($users_to_notify)) { + throw new \InvalidArgumentException('non-nullable users_to_notify cannot be null'); + } $this->container['users_to_notify'] = $users_to_notify; return $this; @@ -761,7 +916,7 @@ public function setUsersToNotify($users_to_notify) /** * Gets run_on_specific_day_of_month * - * @return bool + * @return bool|null */ public function getRunOnSpecificDayOfMonth() { @@ -771,12 +926,15 @@ public function getRunOnSpecificDayOfMonth() /** * Sets run_on_specific_day_of_month * - * @param bool $run_on_specific_day_of_month + * @param bool|null $run_on_specific_day_of_month * - * @return $this + * @return self */ public function setRunOnSpecificDayOfMonth($run_on_specific_day_of_month) { + if (is_null($run_on_specific_day_of_month)) { + throw new \InvalidArgumentException('non-nullable run_on_specific_day_of_month cannot be null'); + } $this->container['run_on_specific_day_of_month'] = $run_on_specific_day_of_month; return $this; @@ -785,7 +943,7 @@ public function setRunOnSpecificDayOfMonth($run_on_specific_day_of_month) /** * Gets adjust_run_date_to_work_day * - * @return bool + * @return bool|null */ public function getAdjustRunDateToWorkDay() { @@ -795,12 +953,15 @@ public function getAdjustRunDateToWorkDay() /** * Sets adjust_run_date_to_work_day * - * @param bool $adjust_run_date_to_work_day + * @param bool|null $adjust_run_date_to_work_day * - * @return $this + * @return self */ public function setAdjustRunDateToWorkDay($adjust_run_date_to_work_day) { + if (is_null($adjust_run_date_to_work_day)) { + throw new \InvalidArgumentException('non-nullable adjust_run_date_to_work_day cannot be null'); + } $this->container['adjust_run_date_to_work_day'] = $adjust_run_date_to_work_day; return $this; @@ -809,7 +970,7 @@ public function setAdjustRunDateToWorkDay($adjust_run_date_to_work_day) /** * Gets adjust_date_paid_to_work_day * - * @return bool + * @return bool|null */ public function getAdjustDatePaidToWorkDay() { @@ -819,12 +980,15 @@ public function getAdjustDatePaidToWorkDay() /** * Sets adjust_date_paid_to_work_day * - * @param bool $adjust_date_paid_to_work_day + * @param bool|null $adjust_date_paid_to_work_day * - * @return $this + * @return self */ public function setAdjustDatePaidToWorkDay($adjust_date_paid_to_work_day) { + if (is_null($adjust_date_paid_to_work_day)) { + throw new \InvalidArgumentException('non-nullable adjust_date_paid_to_work_day cannot be null'); + } $this->container['adjust_date_paid_to_work_day'] = $adjust_date_paid_to_work_day; return $this; @@ -833,7 +997,7 @@ public function setAdjustDatePaidToWorkDay($adjust_date_paid_to_work_day) /** * Gets specific_day_of_month * - * @return int + * @return int|null */ public function getSpecificDayOfMonth() { @@ -843,12 +1007,15 @@ public function getSpecificDayOfMonth() /** * Sets specific_day_of_month * - * @param int $specific_day_of_month + * @param int|null $specific_day_of_month * - * @return $this + * @return self */ public function setSpecificDayOfMonth($specific_day_of_month) { + if (is_null($specific_day_of_month)) { + throw new \InvalidArgumentException('non-nullable specific_day_of_month cannot be null'); + } $this->container['specific_day_of_month'] = $specific_day_of_month; return $this; @@ -857,7 +1024,7 @@ public function setSpecificDayOfMonth($specific_day_of_month) /** * Gets week_of_month * - * @return int + * @return int|null */ public function getWeekOfMonth() { @@ -867,12 +1034,15 @@ public function getWeekOfMonth() /** * Sets week_of_month * - * @param int $week_of_month + * @param int|null $week_of_month * - * @return $this + * @return self */ public function setWeekOfMonth($week_of_month) { + if (is_null($week_of_month)) { + throw new \InvalidArgumentException('non-nullable week_of_month cannot be null'); + } $this->container['week_of_month'] = $week_of_month; return $this; @@ -881,7 +1051,7 @@ public function setWeekOfMonth($week_of_month) /** * Gets day_of_week * - * @return int + * @return int|null */ public function getDayOfWeek() { @@ -891,12 +1061,15 @@ public function getDayOfWeek() /** * Sets day_of_week * - * @param int $day_of_week + * @param int|null $day_of_week * - * @return $this + * @return self */ public function setDayOfWeek($day_of_week) { + if (is_null($day_of_week)) { + throw new \InvalidArgumentException('non-nullable day_of_week cannot be null'); + } $this->container['day_of_week'] = $day_of_week; return $this; @@ -905,7 +1078,7 @@ public function setDayOfWeek($day_of_week) /** * Gets report_packs_to_run * - * @return int[] + * @return int[]|null */ public function getReportPacksToRun() { @@ -915,12 +1088,15 @@ public function getReportPacksToRun() /** * Sets report_packs_to_run * - * @param int[] $report_packs_to_run + * @param int[]|null $report_packs_to_run * - * @return $this + * @return self */ public function setReportPacksToRun($report_packs_to_run) { + if (is_null($report_packs_to_run)) { + throw new \InvalidArgumentException('non-nullable report_packs_to_run cannot be null'); + } $this->container['report_packs_to_run'] = $report_packs_to_run; return $this; @@ -932,7 +1108,7 @@ public function setReportPacksToRun($report_packs_to_run) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -942,22 +1118,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -973,11 +1150,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -985,13 +1175,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuAvailableBusinessModel.php b/src/lib/Model/AuAvailableBusinessModel.php index c6075f2..bc8af89 100644 --- a/src/lib/Model/AuAvailableBusinessModel.php +++ b/src/lib/Model/AuAvailableBusinessModel.php @@ -2,67 +2,67 @@ /** * AuAvailableBusinessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuAvailableBusinessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuAvailableBusinessModel implements ModelInterface, ArrayAccess +class AuAvailableBusinessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuAvailableBusinessModel'; + protected static $openAPIModelName = 'AuAvailableBusinessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'management_software_id' => 'string', 'sbr_software_provider' => 'string', 'sbr_software_id' => 'string', - 'kiosks' => '\Swagger\Client\Model\AuTimeAndAttendanceKioskModel[]', + 'kiosks' => '\OpenAPI\Client\Model\AuTimeAndAttendanceKioskModel[]', 'abn' => 'string', - 'branding' => '\Swagger\Client\Model\WhiteLabelBrandingModel', + 'branding' => '\OpenAPI\Client\Model\WhiteLabelBrandingModel', 'timesheet_entry_period_end' => '\DateTime', 'is_payroll_admin' => 'bool', 'can_approve_leave_requests' => 'bool', @@ -81,8 +81,8 @@ class AuAvailableBusinessModel implements ModelInterface, ArrayAccess 'can_manage_roster_shifts' => 'bool', 'billing_status' => 'string', 'paid_breaks_enabled' => 'bool', - 'location_permissions' => '\Swagger\Client\Model\LocationPermissionModel[]', - 'employee_group_permissions' => '\Swagger\Client\Model\EmployeeGroupPermissionModel[]', + 'location_permissions' => '\OpenAPI\Client\Model\LocationPermissionModel[]', + 'employee_group_permissions' => '\OpenAPI\Client\Model\EmployeeGroupPermissionModel[]', 'id' => 'int', 'name' => 'string', 'region' => 'string', @@ -94,12 +94,12 @@ class AuAvailableBusinessModel implements ModelInterface, ArrayAccess 'contact_phone_number' => 'string', 'contact_fax_number' => 'string', 'external_id' => 'string', - 'standard_hours_per_day' => 'double', + 'standard_hours_per_day' => 'float', 'journal_service' => 'string', 'end_of_week' => 'string', 'initial_financial_year_start' => 'int', 'managers_can_edit_roster_budgets' => 'bool', - 'budget_warning_percent' => 'double', + 'budget_warning_percent' => 'float', 'budget_entry_method' => 'string', 'address_line1' => 'string', 'address_line2' => 'string', @@ -119,8 +119,10 @@ class AuAvailableBusinessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'management_software_id' => null, 'sbr_software_provider' => null, 'sbr_software_id' => null, @@ -179,14 +181,85 @@ class AuAvailableBusinessModel implements ModelInterface, ArrayAccess 'auto_enrolment_staging_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'management_software_id' => false, + 'sbr_software_provider' => false, + 'sbr_software_id' => false, + 'kiosks' => false, + 'abn' => false, + 'branding' => false, + 'timesheet_entry_period_end' => false, + 'is_payroll_admin' => false, + 'can_approve_leave_requests' => false, + 'can_view_leave_requests' => false, + 'can_approve_timesheets' => false, + 'can_approve_expenses' => false, + 'can_view_expenses' => false, + 'can_view_shift_costs' => false, + 'timesheets_require_work_type' => false, + 'timesheets_require_location' => false, + 'allow_employee_timesheets_without_start_stop_times' => false, + 'can_create_timesheets' => false, + 'can_create_and_approve_timesheets' => false, + 'no_timesheet_permissions' => false, + 'can_view_roster_shifts' => false, + 'can_manage_roster_shifts' => false, + 'billing_status' => false, + 'paid_breaks_enabled' => false, + 'location_permissions' => false, + 'employee_group_permissions' => false, + 'id' => false, + 'name' => false, + 'region' => false, + 'registration_number' => false, + 'registration_number_validation_bypassed' => false, + 'legal_name' => false, + 'contact_name' => false, + 'contact_email_address' => false, + 'contact_phone_number' => false, + 'contact_fax_number' => false, + 'external_id' => false, + 'standard_hours_per_day' => false, + 'journal_service' => false, + 'end_of_week' => false, + 'initial_financial_year_start' => false, + 'managers_can_edit_roster_budgets' => false, + 'budget_warning_percent' => false, + 'budget_entry_method' => false, + 'address_line1' => false, + 'address_line2' => false, + 'suburb' => false, + 'post_code' => false, + 'state' => false, + 'white_label_name' => false, + 'promo_code' => false, + 'date_created' => false, + 'leave_accrual_start_date_type' => false, + 'leave_year_start' => false, + 'city' => false, + 'auto_enrolment_staging_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -194,9 +267,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -430,29 +555,27 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const BILLING_STATUS_NOT_BILLABLE = 'NotBillable'; - const BILLING_STATUS_TRIAL = 'Trial'; - const BILLING_STATUS_BILLABLE = 'Billable'; - const END_OF_WEEK_SUNDAY = 'Sunday'; - const END_OF_WEEK_MONDAY = 'Monday'; - const END_OF_WEEK_TUESDAY = 'Tuesday'; - const END_OF_WEEK_WEDNESDAY = 'Wednesday'; - const END_OF_WEEK_THURSDAY = 'Thursday'; - const END_OF_WEEK_FRIDAY = 'Friday'; - const END_OF_WEEK_SATURDAY = 'Saturday'; - const BUDGET_ENTRY_METHOD_PERCENTAGE_OF_SALES = 'PercentageOfSales'; - const BUDGET_ENTRY_METHOD_DIRECT = 'Direct'; - const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; - - - + return self::$openAPIModelName; + } + + public const BILLING_STATUS_NOT_BILLABLE = 'NotBillable'; + public const BILLING_STATUS_TRIAL = 'Trial'; + public const BILLING_STATUS_BILLABLE = 'Billable'; + public const END_OF_WEEK_SUNDAY = 'Sunday'; + public const END_OF_WEEK_MONDAY = 'Monday'; + public const END_OF_WEEK_TUESDAY = 'Tuesday'; + public const END_OF_WEEK_WEDNESDAY = 'Wednesday'; + public const END_OF_WEEK_THURSDAY = 'Thursday'; + public const END_OF_WEEK_FRIDAY = 'Friday'; + public const END_OF_WEEK_SATURDAY = 'Saturday'; + public const BUDGET_ENTRY_METHOD_PERCENTAGE_OF_SALES = 'PercentageOfSales'; + public const BUDGET_ENTRY_METHOD_DIRECT = 'Direct'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; + /** * Gets allowable values of the enum * @@ -466,7 +589,7 @@ public function getBillingStatusAllowableValues() self::BILLING_STATUS_BILLABLE, ]; } - + /** * Gets allowable values of the enum * @@ -484,7 +607,7 @@ public function getEndOfWeekAllowableValues() self::END_OF_WEEK_SATURDAY, ]; } - + /** * Gets allowable values of the enum * @@ -497,7 +620,7 @@ public function getBudgetEntryMethodAllowableValues() self::BUDGET_ENTRY_METHOD_DIRECT, ]; } - + /** * Gets allowable values of the enum * @@ -513,7 +636,6 @@ public function getLeaveAccrualStartDateTypeAllowableValues() self::LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH, ]; } - /** * Associative array for storing property values @@ -530,62 +652,80 @@ public function getLeaveAccrualStartDateTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['management_software_id'] = isset($data['management_software_id']) ? $data['management_software_id'] : null; - $this->container['sbr_software_provider'] = isset($data['sbr_software_provider']) ? $data['sbr_software_provider'] : null; - $this->container['sbr_software_id'] = isset($data['sbr_software_id']) ? $data['sbr_software_id'] : null; - $this->container['kiosks'] = isset($data['kiosks']) ? $data['kiosks'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['branding'] = isset($data['branding']) ? $data['branding'] : null; - $this->container['timesheet_entry_period_end'] = isset($data['timesheet_entry_period_end']) ? $data['timesheet_entry_period_end'] : null; - $this->container['is_payroll_admin'] = isset($data['is_payroll_admin']) ? $data['is_payroll_admin'] : null; - $this->container['can_approve_leave_requests'] = isset($data['can_approve_leave_requests']) ? $data['can_approve_leave_requests'] : null; - $this->container['can_view_leave_requests'] = isset($data['can_view_leave_requests']) ? $data['can_view_leave_requests'] : null; - $this->container['can_approve_timesheets'] = isset($data['can_approve_timesheets']) ? $data['can_approve_timesheets'] : null; - $this->container['can_approve_expenses'] = isset($data['can_approve_expenses']) ? $data['can_approve_expenses'] : null; - $this->container['can_view_expenses'] = isset($data['can_view_expenses']) ? $data['can_view_expenses'] : null; - $this->container['can_view_shift_costs'] = isset($data['can_view_shift_costs']) ? $data['can_view_shift_costs'] : null; - $this->container['timesheets_require_work_type'] = isset($data['timesheets_require_work_type']) ? $data['timesheets_require_work_type'] : null; - $this->container['timesheets_require_location'] = isset($data['timesheets_require_location']) ? $data['timesheets_require_location'] : null; - $this->container['allow_employee_timesheets_without_start_stop_times'] = isset($data['allow_employee_timesheets_without_start_stop_times']) ? $data['allow_employee_timesheets_without_start_stop_times'] : null; - $this->container['can_create_timesheets'] = isset($data['can_create_timesheets']) ? $data['can_create_timesheets'] : null; - $this->container['can_create_and_approve_timesheets'] = isset($data['can_create_and_approve_timesheets']) ? $data['can_create_and_approve_timesheets'] : null; - $this->container['no_timesheet_permissions'] = isset($data['no_timesheet_permissions']) ? $data['no_timesheet_permissions'] : null; - $this->container['can_view_roster_shifts'] = isset($data['can_view_roster_shifts']) ? $data['can_view_roster_shifts'] : null; - $this->container['can_manage_roster_shifts'] = isset($data['can_manage_roster_shifts']) ? $data['can_manage_roster_shifts'] : null; - $this->container['billing_status'] = isset($data['billing_status']) ? $data['billing_status'] : null; - $this->container['paid_breaks_enabled'] = isset($data['paid_breaks_enabled']) ? $data['paid_breaks_enabled'] : null; - $this->container['location_permissions'] = isset($data['location_permissions']) ? $data['location_permissions'] : null; - $this->container['employee_group_permissions'] = isset($data['employee_group_permissions']) ? $data['employee_group_permissions'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['region'] = isset($data['region']) ? $data['region'] : null; - $this->container['registration_number'] = isset($data['registration_number']) ? $data['registration_number'] : null; - $this->container['registration_number_validation_bypassed'] = isset($data['registration_number_validation_bypassed']) ? $data['registration_number_validation_bypassed'] : null; - $this->container['legal_name'] = isset($data['legal_name']) ? $data['legal_name'] : null; - $this->container['contact_name'] = isset($data['contact_name']) ? $data['contact_name'] : null; - $this->container['contact_email_address'] = isset($data['contact_email_address']) ? $data['contact_email_address'] : null; - $this->container['contact_phone_number'] = isset($data['contact_phone_number']) ? $data['contact_phone_number'] : null; - $this->container['contact_fax_number'] = isset($data['contact_fax_number']) ? $data['contact_fax_number'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['standard_hours_per_day'] = isset($data['standard_hours_per_day']) ? $data['standard_hours_per_day'] : null; - $this->container['journal_service'] = isset($data['journal_service']) ? $data['journal_service'] : null; - $this->container['end_of_week'] = isset($data['end_of_week']) ? $data['end_of_week'] : null; - $this->container['initial_financial_year_start'] = isset($data['initial_financial_year_start']) ? $data['initial_financial_year_start'] : null; - $this->container['managers_can_edit_roster_budgets'] = isset($data['managers_can_edit_roster_budgets']) ? $data['managers_can_edit_roster_budgets'] : null; - $this->container['budget_warning_percent'] = isset($data['budget_warning_percent']) ? $data['budget_warning_percent'] : null; - $this->container['budget_entry_method'] = isset($data['budget_entry_method']) ? $data['budget_entry_method'] : null; - $this->container['address_line1'] = isset($data['address_line1']) ? $data['address_line1'] : null; - $this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null; - $this->container['suburb'] = isset($data['suburb']) ? $data['suburb'] : null; - $this->container['post_code'] = isset($data['post_code']) ? $data['post_code'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['white_label_name'] = isset($data['white_label_name']) ? $data['white_label_name'] : null; - $this->container['promo_code'] = isset($data['promo_code']) ? $data['promo_code'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['leave_accrual_start_date_type'] = isset($data['leave_accrual_start_date_type']) ? $data['leave_accrual_start_date_type'] : null; - $this->container['leave_year_start'] = isset($data['leave_year_start']) ? $data['leave_year_start'] : null; - $this->container['city'] = isset($data['city']) ? $data['city'] : null; - $this->container['auto_enrolment_staging_date'] = isset($data['auto_enrolment_staging_date']) ? $data['auto_enrolment_staging_date'] : null; + $this->setIfExists('management_software_id', $data ?? [], null); + $this->setIfExists('sbr_software_provider', $data ?? [], null); + $this->setIfExists('sbr_software_id', $data ?? [], null); + $this->setIfExists('kiosks', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('branding', $data ?? [], null); + $this->setIfExists('timesheet_entry_period_end', $data ?? [], null); + $this->setIfExists('is_payroll_admin', $data ?? [], null); + $this->setIfExists('can_approve_leave_requests', $data ?? [], null); + $this->setIfExists('can_view_leave_requests', $data ?? [], null); + $this->setIfExists('can_approve_timesheets', $data ?? [], null); + $this->setIfExists('can_approve_expenses', $data ?? [], null); + $this->setIfExists('can_view_expenses', $data ?? [], null); + $this->setIfExists('can_view_shift_costs', $data ?? [], null); + $this->setIfExists('timesheets_require_work_type', $data ?? [], null); + $this->setIfExists('timesheets_require_location', $data ?? [], null); + $this->setIfExists('allow_employee_timesheets_without_start_stop_times', $data ?? [], null); + $this->setIfExists('can_create_timesheets', $data ?? [], null); + $this->setIfExists('can_create_and_approve_timesheets', $data ?? [], null); + $this->setIfExists('no_timesheet_permissions', $data ?? [], null); + $this->setIfExists('can_view_roster_shifts', $data ?? [], null); + $this->setIfExists('can_manage_roster_shifts', $data ?? [], null); + $this->setIfExists('billing_status', $data ?? [], null); + $this->setIfExists('paid_breaks_enabled', $data ?? [], null); + $this->setIfExists('location_permissions', $data ?? [], null); + $this->setIfExists('employee_group_permissions', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('registration_number', $data ?? [], null); + $this->setIfExists('registration_number_validation_bypassed', $data ?? [], null); + $this->setIfExists('legal_name', $data ?? [], null); + $this->setIfExists('contact_name', $data ?? [], null); + $this->setIfExists('contact_email_address', $data ?? [], null); + $this->setIfExists('contact_phone_number', $data ?? [], null); + $this->setIfExists('contact_fax_number', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('standard_hours_per_day', $data ?? [], null); + $this->setIfExists('journal_service', $data ?? [], null); + $this->setIfExists('end_of_week', $data ?? [], null); + $this->setIfExists('initial_financial_year_start', $data ?? [], null); + $this->setIfExists('managers_can_edit_roster_budgets', $data ?? [], null); + $this->setIfExists('budget_warning_percent', $data ?? [], null); + $this->setIfExists('budget_entry_method', $data ?? [], null); + $this->setIfExists('address_line1', $data ?? [], null); + $this->setIfExists('address_line2', $data ?? [], null); + $this->setIfExists('suburb', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('white_label_name', $data ?? [], null); + $this->setIfExists('promo_code', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('leave_accrual_start_date_type', $data ?? [], null); + $this->setIfExists('leave_year_start', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('auto_enrolment_staging_date', $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; } /** @@ -600,7 +740,8 @@ public function listInvalidProperties() $allowedValues = $this->getBillingStatusAllowableValues(); if (!is_null($this->container['billing_status']) && !in_array($this->container['billing_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'billing_status', must be one of '%s'", + "invalid value '%s' for 'billing_status', must be one of '%s'", + $this->container['billing_status'], implode("', '", $allowedValues) ); } @@ -608,7 +749,8 @@ public function listInvalidProperties() $allowedValues = $this->getEndOfWeekAllowableValues(); if (!is_null($this->container['end_of_week']) && !in_array($this->container['end_of_week'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'end_of_week', must be one of '%s'", + "invalid value '%s' for 'end_of_week', must be one of '%s'", + $this->container['end_of_week'], implode("', '", $allowedValues) ); } @@ -616,7 +758,8 @@ public function listInvalidProperties() $allowedValues = $this->getBudgetEntryMethodAllowableValues(); if (!is_null($this->container['budget_entry_method']) && !in_array($this->container['budget_entry_method'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'budget_entry_method', must be one of '%s'", + "invalid value '%s' for 'budget_entry_method', must be one of '%s'", + $this->container['budget_entry_method'], implode("', '", $allowedValues) ); } @@ -624,7 +767,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); if (!is_null($this->container['leave_accrual_start_date_type']) && !in_array($this->container['leave_accrual_start_date_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $this->container['leave_accrual_start_date_type'], implode("', '", $allowedValues) ); } @@ -647,7 +791,7 @@ public function valid() /** * Gets management_software_id * - * @return string + * @return string|null */ public function getManagementSoftwareId() { @@ -657,12 +801,15 @@ public function getManagementSoftwareId() /** * Sets management_software_id * - * @param string $management_software_id + * @param string|null $management_software_id * - * @return $this + * @return self */ public function setManagementSoftwareId($management_software_id) { + if (is_null($management_software_id)) { + throw new \InvalidArgumentException('non-nullable management_software_id cannot be null'); + } $this->container['management_software_id'] = $management_software_id; return $this; @@ -671,7 +818,7 @@ public function setManagementSoftwareId($management_software_id) /** * Gets sbr_software_provider * - * @return string + * @return string|null */ public function getSbrSoftwareProvider() { @@ -681,12 +828,15 @@ public function getSbrSoftwareProvider() /** * Sets sbr_software_provider * - * @param string $sbr_software_provider + * @param string|null $sbr_software_provider * - * @return $this + * @return self */ public function setSbrSoftwareProvider($sbr_software_provider) { + if (is_null($sbr_software_provider)) { + throw new \InvalidArgumentException('non-nullable sbr_software_provider cannot be null'); + } $this->container['sbr_software_provider'] = $sbr_software_provider; return $this; @@ -695,7 +845,7 @@ public function setSbrSoftwareProvider($sbr_software_provider) /** * Gets sbr_software_id * - * @return string + * @return string|null */ public function getSbrSoftwareId() { @@ -705,12 +855,15 @@ public function getSbrSoftwareId() /** * Sets sbr_software_id * - * @param string $sbr_software_id + * @param string|null $sbr_software_id * - * @return $this + * @return self */ public function setSbrSoftwareId($sbr_software_id) { + if (is_null($sbr_software_id)) { + throw new \InvalidArgumentException('non-nullable sbr_software_id cannot be null'); + } $this->container['sbr_software_id'] = $sbr_software_id; return $this; @@ -719,7 +872,7 @@ public function setSbrSoftwareId($sbr_software_id) /** * Gets kiosks * - * @return \Swagger\Client\Model\AuTimeAndAttendanceKioskModel[] + * @return \OpenAPI\Client\Model\AuTimeAndAttendanceKioskModel[]|null */ public function getKiosks() { @@ -729,12 +882,15 @@ public function getKiosks() /** * Sets kiosks * - * @param \Swagger\Client\Model\AuTimeAndAttendanceKioskModel[] $kiosks + * @param \OpenAPI\Client\Model\AuTimeAndAttendanceKioskModel[]|null $kiosks * - * @return $this + * @return self */ public function setKiosks($kiosks) { + if (is_null($kiosks)) { + throw new \InvalidArgumentException('non-nullable kiosks cannot be null'); + } $this->container['kiosks'] = $kiosks; return $this; @@ -743,7 +899,7 @@ public function setKiosks($kiosks) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -753,12 +909,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -767,7 +926,7 @@ public function setAbn($abn) /** * Gets branding * - * @return \Swagger\Client\Model\WhiteLabelBrandingModel + * @return \OpenAPI\Client\Model\WhiteLabelBrandingModel|null */ public function getBranding() { @@ -777,12 +936,15 @@ public function getBranding() /** * Sets branding * - * @param \Swagger\Client\Model\WhiteLabelBrandingModel $branding + * @param \OpenAPI\Client\Model\WhiteLabelBrandingModel|null $branding branding * - * @return $this + * @return self */ public function setBranding($branding) { + if (is_null($branding)) { + throw new \InvalidArgumentException('non-nullable branding cannot be null'); + } $this->container['branding'] = $branding; return $this; @@ -791,7 +953,7 @@ public function setBranding($branding) /** * Gets timesheet_entry_period_end * - * @return \DateTime + * @return \DateTime|null */ public function getTimesheetEntryPeriodEnd() { @@ -801,12 +963,15 @@ public function getTimesheetEntryPeriodEnd() /** * Sets timesheet_entry_period_end * - * @param \DateTime $timesheet_entry_period_end + * @param \DateTime|null $timesheet_entry_period_end * - * @return $this + * @return self */ public function setTimesheetEntryPeriodEnd($timesheet_entry_period_end) { + if (is_null($timesheet_entry_period_end)) { + throw new \InvalidArgumentException('non-nullable timesheet_entry_period_end cannot be null'); + } $this->container['timesheet_entry_period_end'] = $timesheet_entry_period_end; return $this; @@ -815,7 +980,7 @@ public function setTimesheetEntryPeriodEnd($timesheet_entry_period_end) /** * Gets is_payroll_admin * - * @return bool + * @return bool|null */ public function getIsPayrollAdmin() { @@ -825,12 +990,15 @@ public function getIsPayrollAdmin() /** * Sets is_payroll_admin * - * @param bool $is_payroll_admin + * @param bool|null $is_payroll_admin * - * @return $this + * @return self */ public function setIsPayrollAdmin($is_payroll_admin) { + if (is_null($is_payroll_admin)) { + throw new \InvalidArgumentException('non-nullable is_payroll_admin cannot be null'); + } $this->container['is_payroll_admin'] = $is_payroll_admin; return $this; @@ -839,7 +1007,7 @@ public function setIsPayrollAdmin($is_payroll_admin) /** * Gets can_approve_leave_requests * - * @return bool + * @return bool|null */ public function getCanApproveLeaveRequests() { @@ -849,12 +1017,15 @@ public function getCanApproveLeaveRequests() /** * Sets can_approve_leave_requests * - * @param bool $can_approve_leave_requests + * @param bool|null $can_approve_leave_requests * - * @return $this + * @return self */ public function setCanApproveLeaveRequests($can_approve_leave_requests) { + if (is_null($can_approve_leave_requests)) { + throw new \InvalidArgumentException('non-nullable can_approve_leave_requests cannot be null'); + } $this->container['can_approve_leave_requests'] = $can_approve_leave_requests; return $this; @@ -863,7 +1034,7 @@ public function setCanApproveLeaveRequests($can_approve_leave_requests) /** * Gets can_view_leave_requests * - * @return bool + * @return bool|null */ public function getCanViewLeaveRequests() { @@ -873,12 +1044,15 @@ public function getCanViewLeaveRequests() /** * Sets can_view_leave_requests * - * @param bool $can_view_leave_requests + * @param bool|null $can_view_leave_requests * - * @return $this + * @return self */ public function setCanViewLeaveRequests($can_view_leave_requests) { + if (is_null($can_view_leave_requests)) { + throw new \InvalidArgumentException('non-nullable can_view_leave_requests cannot be null'); + } $this->container['can_view_leave_requests'] = $can_view_leave_requests; return $this; @@ -887,7 +1061,7 @@ public function setCanViewLeaveRequests($can_view_leave_requests) /** * Gets can_approve_timesheets * - * @return bool + * @return bool|null */ public function getCanApproveTimesheets() { @@ -897,12 +1071,15 @@ public function getCanApproveTimesheets() /** * Sets can_approve_timesheets * - * @param bool $can_approve_timesheets + * @param bool|null $can_approve_timesheets * - * @return $this + * @return self */ public function setCanApproveTimesheets($can_approve_timesheets) { + if (is_null($can_approve_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_approve_timesheets cannot be null'); + } $this->container['can_approve_timesheets'] = $can_approve_timesheets; return $this; @@ -911,7 +1088,7 @@ public function setCanApproveTimesheets($can_approve_timesheets) /** * Gets can_approve_expenses * - * @return bool + * @return bool|null */ public function getCanApproveExpenses() { @@ -921,12 +1098,15 @@ public function getCanApproveExpenses() /** * Sets can_approve_expenses * - * @param bool $can_approve_expenses + * @param bool|null $can_approve_expenses * - * @return $this + * @return self */ public function setCanApproveExpenses($can_approve_expenses) { + if (is_null($can_approve_expenses)) { + throw new \InvalidArgumentException('non-nullable can_approve_expenses cannot be null'); + } $this->container['can_approve_expenses'] = $can_approve_expenses; return $this; @@ -935,7 +1115,7 @@ public function setCanApproveExpenses($can_approve_expenses) /** * Gets can_view_expenses * - * @return bool + * @return bool|null */ public function getCanViewExpenses() { @@ -945,12 +1125,15 @@ public function getCanViewExpenses() /** * Sets can_view_expenses * - * @param bool $can_view_expenses + * @param bool|null $can_view_expenses * - * @return $this + * @return self */ public function setCanViewExpenses($can_view_expenses) { + if (is_null($can_view_expenses)) { + throw new \InvalidArgumentException('non-nullable can_view_expenses cannot be null'); + } $this->container['can_view_expenses'] = $can_view_expenses; return $this; @@ -959,7 +1142,7 @@ public function setCanViewExpenses($can_view_expenses) /** * Gets can_view_shift_costs * - * @return bool + * @return bool|null */ public function getCanViewShiftCosts() { @@ -969,12 +1152,15 @@ public function getCanViewShiftCosts() /** * Sets can_view_shift_costs * - * @param bool $can_view_shift_costs + * @param bool|null $can_view_shift_costs * - * @return $this + * @return self */ public function setCanViewShiftCosts($can_view_shift_costs) { + if (is_null($can_view_shift_costs)) { + throw new \InvalidArgumentException('non-nullable can_view_shift_costs cannot be null'); + } $this->container['can_view_shift_costs'] = $can_view_shift_costs; return $this; @@ -983,7 +1169,7 @@ public function setCanViewShiftCosts($can_view_shift_costs) /** * Gets timesheets_require_work_type * - * @return bool + * @return bool|null */ public function getTimesheetsRequireWorkType() { @@ -993,12 +1179,15 @@ public function getTimesheetsRequireWorkType() /** * Sets timesheets_require_work_type * - * @param bool $timesheets_require_work_type + * @param bool|null $timesheets_require_work_type * - * @return $this + * @return self */ public function setTimesheetsRequireWorkType($timesheets_require_work_type) { + if (is_null($timesheets_require_work_type)) { + throw new \InvalidArgumentException('non-nullable timesheets_require_work_type cannot be null'); + } $this->container['timesheets_require_work_type'] = $timesheets_require_work_type; return $this; @@ -1007,7 +1196,7 @@ public function setTimesheetsRequireWorkType($timesheets_require_work_type) /** * Gets timesheets_require_location * - * @return bool + * @return bool|null */ public function getTimesheetsRequireLocation() { @@ -1017,12 +1206,15 @@ public function getTimesheetsRequireLocation() /** * Sets timesheets_require_location * - * @param bool $timesheets_require_location + * @param bool|null $timesheets_require_location * - * @return $this + * @return self */ public function setTimesheetsRequireLocation($timesheets_require_location) { + if (is_null($timesheets_require_location)) { + throw new \InvalidArgumentException('non-nullable timesheets_require_location cannot be null'); + } $this->container['timesheets_require_location'] = $timesheets_require_location; return $this; @@ -1031,7 +1223,7 @@ public function setTimesheetsRequireLocation($timesheets_require_location) /** * Gets allow_employee_timesheets_without_start_stop_times * - * @return bool + * @return bool|null */ public function getAllowEmployeeTimesheetsWithoutStartStopTimes() { @@ -1041,12 +1233,15 @@ public function getAllowEmployeeTimesheetsWithoutStartStopTimes() /** * Sets allow_employee_timesheets_without_start_stop_times * - * @param bool $allow_employee_timesheets_without_start_stop_times + * @param bool|null $allow_employee_timesheets_without_start_stop_times * - * @return $this + * @return self */ public function setAllowEmployeeTimesheetsWithoutStartStopTimes($allow_employee_timesheets_without_start_stop_times) { + if (is_null($allow_employee_timesheets_without_start_stop_times)) { + throw new \InvalidArgumentException('non-nullable allow_employee_timesheets_without_start_stop_times cannot be null'); + } $this->container['allow_employee_timesheets_without_start_stop_times'] = $allow_employee_timesheets_without_start_stop_times; return $this; @@ -1055,7 +1250,7 @@ public function setAllowEmployeeTimesheetsWithoutStartStopTimes($allow_employee_ /** * Gets can_create_timesheets * - * @return bool + * @return bool|null */ public function getCanCreateTimesheets() { @@ -1065,12 +1260,15 @@ public function getCanCreateTimesheets() /** * Sets can_create_timesheets * - * @param bool $can_create_timesheets + * @param bool|null $can_create_timesheets * - * @return $this + * @return self */ public function setCanCreateTimesheets($can_create_timesheets) { + if (is_null($can_create_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_create_timesheets cannot be null'); + } $this->container['can_create_timesheets'] = $can_create_timesheets; return $this; @@ -1079,7 +1277,7 @@ public function setCanCreateTimesheets($can_create_timesheets) /** * Gets can_create_and_approve_timesheets * - * @return bool + * @return bool|null */ public function getCanCreateAndApproveTimesheets() { @@ -1089,12 +1287,15 @@ public function getCanCreateAndApproveTimesheets() /** * Sets can_create_and_approve_timesheets * - * @param bool $can_create_and_approve_timesheets + * @param bool|null $can_create_and_approve_timesheets * - * @return $this + * @return self */ public function setCanCreateAndApproveTimesheets($can_create_and_approve_timesheets) { + if (is_null($can_create_and_approve_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_create_and_approve_timesheets cannot be null'); + } $this->container['can_create_and_approve_timesheets'] = $can_create_and_approve_timesheets; return $this; @@ -1103,7 +1304,7 @@ public function setCanCreateAndApproveTimesheets($can_create_and_approve_timeshe /** * Gets no_timesheet_permissions * - * @return bool + * @return bool|null */ public function getNoTimesheetPermissions() { @@ -1113,12 +1314,15 @@ public function getNoTimesheetPermissions() /** * Sets no_timesheet_permissions * - * @param bool $no_timesheet_permissions + * @param bool|null $no_timesheet_permissions * - * @return $this + * @return self */ public function setNoTimesheetPermissions($no_timesheet_permissions) { + if (is_null($no_timesheet_permissions)) { + throw new \InvalidArgumentException('non-nullable no_timesheet_permissions cannot be null'); + } $this->container['no_timesheet_permissions'] = $no_timesheet_permissions; return $this; @@ -1127,7 +1331,7 @@ public function setNoTimesheetPermissions($no_timesheet_permissions) /** * Gets can_view_roster_shifts * - * @return bool + * @return bool|null */ public function getCanViewRosterShifts() { @@ -1137,12 +1341,15 @@ public function getCanViewRosterShifts() /** * Sets can_view_roster_shifts * - * @param bool $can_view_roster_shifts + * @param bool|null $can_view_roster_shifts * - * @return $this + * @return self */ public function setCanViewRosterShifts($can_view_roster_shifts) { + if (is_null($can_view_roster_shifts)) { + throw new \InvalidArgumentException('non-nullable can_view_roster_shifts cannot be null'); + } $this->container['can_view_roster_shifts'] = $can_view_roster_shifts; return $this; @@ -1151,7 +1358,7 @@ public function setCanViewRosterShifts($can_view_roster_shifts) /** * Gets can_manage_roster_shifts * - * @return bool + * @return bool|null */ public function getCanManageRosterShifts() { @@ -1161,12 +1368,15 @@ public function getCanManageRosterShifts() /** * Sets can_manage_roster_shifts * - * @param bool $can_manage_roster_shifts + * @param bool|null $can_manage_roster_shifts * - * @return $this + * @return self */ public function setCanManageRosterShifts($can_manage_roster_shifts) { + if (is_null($can_manage_roster_shifts)) { + throw new \InvalidArgumentException('non-nullable can_manage_roster_shifts cannot be null'); + } $this->container['can_manage_roster_shifts'] = $can_manage_roster_shifts; return $this; @@ -1175,7 +1385,7 @@ public function setCanManageRosterShifts($can_manage_roster_shifts) /** * Gets billing_status * - * @return string + * @return string|null */ public function getBillingStatus() { @@ -1185,17 +1395,21 @@ public function getBillingStatus() /** * Sets billing_status * - * @param string $billing_status + * @param string|null $billing_status * - * @return $this + * @return self */ public function setBillingStatus($billing_status) { + if (is_null($billing_status)) { + throw new \InvalidArgumentException('non-nullable billing_status cannot be null'); + } $allowedValues = $this->getBillingStatusAllowableValues(); - if (!is_null($billing_status) && !in_array($billing_status, $allowedValues, true)) { + if (!in_array($billing_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'billing_status', must be one of '%s'", + "Invalid value '%s' for 'billing_status', must be one of '%s'", + $billing_status, implode("', '", $allowedValues) ) ); @@ -1208,7 +1422,7 @@ public function setBillingStatus($billing_status) /** * Gets paid_breaks_enabled * - * @return bool + * @return bool|null */ public function getPaidBreaksEnabled() { @@ -1218,12 +1432,15 @@ public function getPaidBreaksEnabled() /** * Sets paid_breaks_enabled * - * @param bool $paid_breaks_enabled + * @param bool|null $paid_breaks_enabled * - * @return $this + * @return self */ public function setPaidBreaksEnabled($paid_breaks_enabled) { + if (is_null($paid_breaks_enabled)) { + throw new \InvalidArgumentException('non-nullable paid_breaks_enabled cannot be null'); + } $this->container['paid_breaks_enabled'] = $paid_breaks_enabled; return $this; @@ -1232,7 +1449,7 @@ public function setPaidBreaksEnabled($paid_breaks_enabled) /** * Gets location_permissions * - * @return \Swagger\Client\Model\LocationPermissionModel[] + * @return \OpenAPI\Client\Model\LocationPermissionModel[]|null */ public function getLocationPermissions() { @@ -1242,12 +1459,15 @@ public function getLocationPermissions() /** * Sets location_permissions * - * @param \Swagger\Client\Model\LocationPermissionModel[] $location_permissions + * @param \OpenAPI\Client\Model\LocationPermissionModel[]|null $location_permissions * - * @return $this + * @return self */ public function setLocationPermissions($location_permissions) { + if (is_null($location_permissions)) { + throw new \InvalidArgumentException('non-nullable location_permissions cannot be null'); + } $this->container['location_permissions'] = $location_permissions; return $this; @@ -1256,7 +1476,7 @@ public function setLocationPermissions($location_permissions) /** * Gets employee_group_permissions * - * @return \Swagger\Client\Model\EmployeeGroupPermissionModel[] + * @return \OpenAPI\Client\Model\EmployeeGroupPermissionModel[]|null */ public function getEmployeeGroupPermissions() { @@ -1266,12 +1486,15 @@ public function getEmployeeGroupPermissions() /** * Sets employee_group_permissions * - * @param \Swagger\Client\Model\EmployeeGroupPermissionModel[] $employee_group_permissions + * @param \OpenAPI\Client\Model\EmployeeGroupPermissionModel[]|null $employee_group_permissions * - * @return $this + * @return self */ public function setEmployeeGroupPermissions($employee_group_permissions) { + if (is_null($employee_group_permissions)) { + throw new \InvalidArgumentException('non-nullable employee_group_permissions cannot be null'); + } $this->container['employee_group_permissions'] = $employee_group_permissions; return $this; @@ -1280,7 +1503,7 @@ public function setEmployeeGroupPermissions($employee_group_permissions) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -1290,12 +1513,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -1304,7 +1530,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -1314,12 +1540,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -1328,7 +1557,7 @@ public function setName($name) /** * Gets region * - * @return string + * @return string|null */ public function getRegion() { @@ -1338,12 +1567,15 @@ public function getRegion() /** * Sets region * - * @param string $region + * @param string|null $region * - * @return $this + * @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; @@ -1352,7 +1584,7 @@ public function setRegion($region) /** * Gets registration_number * - * @return string + * @return string|null */ public function getRegistrationNumber() { @@ -1362,12 +1594,15 @@ public function getRegistrationNumber() /** * Sets registration_number * - * @param string $registration_number + * @param string|null $registration_number * - * @return $this + * @return self */ public function setRegistrationNumber($registration_number) { + if (is_null($registration_number)) { + throw new \InvalidArgumentException('non-nullable registration_number cannot be null'); + } $this->container['registration_number'] = $registration_number; return $this; @@ -1376,7 +1611,7 @@ public function setRegistrationNumber($registration_number) /** * Gets registration_number_validation_bypassed * - * @return bool + * @return bool|null */ public function getRegistrationNumberValidationBypassed() { @@ -1386,12 +1621,15 @@ public function getRegistrationNumberValidationBypassed() /** * Sets registration_number_validation_bypassed * - * @param bool $registration_number_validation_bypassed + * @param bool|null $registration_number_validation_bypassed * - * @return $this + * @return self */ public function setRegistrationNumberValidationBypassed($registration_number_validation_bypassed) { + if (is_null($registration_number_validation_bypassed)) { + throw new \InvalidArgumentException('non-nullable registration_number_validation_bypassed cannot be null'); + } $this->container['registration_number_validation_bypassed'] = $registration_number_validation_bypassed; return $this; @@ -1400,7 +1638,7 @@ public function setRegistrationNumberValidationBypassed($registration_number_val /** * Gets legal_name * - * @return string + * @return string|null */ public function getLegalName() { @@ -1410,12 +1648,15 @@ public function getLegalName() /** * Sets legal_name * - * @param string $legal_name + * @param string|null $legal_name * - * @return $this + * @return self */ public function setLegalName($legal_name) { + if (is_null($legal_name)) { + throw new \InvalidArgumentException('non-nullable legal_name cannot be null'); + } $this->container['legal_name'] = $legal_name; return $this; @@ -1424,7 +1665,7 @@ public function setLegalName($legal_name) /** * Gets contact_name * - * @return string + * @return string|null */ public function getContactName() { @@ -1434,12 +1675,15 @@ public function getContactName() /** * Sets contact_name * - * @param string $contact_name + * @param string|null $contact_name * - * @return $this + * @return self */ public function setContactName($contact_name) { + if (is_null($contact_name)) { + throw new \InvalidArgumentException('non-nullable contact_name cannot be null'); + } $this->container['contact_name'] = $contact_name; return $this; @@ -1448,7 +1692,7 @@ public function setContactName($contact_name) /** * Gets contact_email_address * - * @return string + * @return string|null */ public function getContactEmailAddress() { @@ -1458,12 +1702,15 @@ public function getContactEmailAddress() /** * Sets contact_email_address * - * @param string $contact_email_address + * @param string|null $contact_email_address * - * @return $this + * @return self */ public function setContactEmailAddress($contact_email_address) { + if (is_null($contact_email_address)) { + throw new \InvalidArgumentException('non-nullable contact_email_address cannot be null'); + } $this->container['contact_email_address'] = $contact_email_address; return $this; @@ -1472,7 +1719,7 @@ public function setContactEmailAddress($contact_email_address) /** * Gets contact_phone_number * - * @return string + * @return string|null */ public function getContactPhoneNumber() { @@ -1482,12 +1729,15 @@ public function getContactPhoneNumber() /** * Sets contact_phone_number * - * @param string $contact_phone_number + * @param string|null $contact_phone_number * - * @return $this + * @return self */ public function setContactPhoneNumber($contact_phone_number) { + if (is_null($contact_phone_number)) { + throw new \InvalidArgumentException('non-nullable contact_phone_number cannot be null'); + } $this->container['contact_phone_number'] = $contact_phone_number; return $this; @@ -1496,7 +1746,7 @@ public function setContactPhoneNumber($contact_phone_number) /** * Gets contact_fax_number * - * @return string + * @return string|null */ public function getContactFaxNumber() { @@ -1506,12 +1756,15 @@ public function getContactFaxNumber() /** * Sets contact_fax_number * - * @param string $contact_fax_number + * @param string|null $contact_fax_number * - * @return $this + * @return self */ public function setContactFaxNumber($contact_fax_number) { + if (is_null($contact_fax_number)) { + throw new \InvalidArgumentException('non-nullable contact_fax_number cannot be null'); + } $this->container['contact_fax_number'] = $contact_fax_number; return $this; @@ -1520,7 +1773,7 @@ public function setContactFaxNumber($contact_fax_number) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -1530,12 +1783,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -1544,7 +1800,7 @@ public function setExternalId($external_id) /** * Gets standard_hours_per_day * - * @return double + * @return float|null */ public function getStandardHoursPerDay() { @@ -1554,12 +1810,15 @@ public function getStandardHoursPerDay() /** * Sets standard_hours_per_day * - * @param double $standard_hours_per_day + * @param float|null $standard_hours_per_day * - * @return $this + * @return self */ public function setStandardHoursPerDay($standard_hours_per_day) { + if (is_null($standard_hours_per_day)) { + throw new \InvalidArgumentException('non-nullable standard_hours_per_day cannot be null'); + } $this->container['standard_hours_per_day'] = $standard_hours_per_day; return $this; @@ -1568,7 +1827,7 @@ public function setStandardHoursPerDay($standard_hours_per_day) /** * Gets journal_service * - * @return string + * @return string|null */ public function getJournalService() { @@ -1578,12 +1837,15 @@ public function getJournalService() /** * Sets journal_service * - * @param string $journal_service + * @param string|null $journal_service * - * @return $this + * @return self */ public function setJournalService($journal_service) { + if (is_null($journal_service)) { + throw new \InvalidArgumentException('non-nullable journal_service cannot be null'); + } $this->container['journal_service'] = $journal_service; return $this; @@ -1592,7 +1854,7 @@ public function setJournalService($journal_service) /** * Gets end_of_week * - * @return string + * @return string|null */ public function getEndOfWeek() { @@ -1602,17 +1864,21 @@ public function getEndOfWeek() /** * Sets end_of_week * - * @param string $end_of_week + * @param string|null $end_of_week * - * @return $this + * @return self */ public function setEndOfWeek($end_of_week) { + if (is_null($end_of_week)) { + throw new \InvalidArgumentException('non-nullable end_of_week cannot be null'); + } $allowedValues = $this->getEndOfWeekAllowableValues(); - if (!is_null($end_of_week) && !in_array($end_of_week, $allowedValues, true)) { + if (!in_array($end_of_week, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'end_of_week', must be one of '%s'", + "Invalid value '%s' for 'end_of_week', must be one of '%s'", + $end_of_week, implode("', '", $allowedValues) ) ); @@ -1625,7 +1891,7 @@ public function setEndOfWeek($end_of_week) /** * Gets initial_financial_year_start * - * @return int + * @return int|null */ public function getInitialFinancialYearStart() { @@ -1635,12 +1901,15 @@ public function getInitialFinancialYearStart() /** * Sets initial_financial_year_start * - * @param int $initial_financial_year_start + * @param int|null $initial_financial_year_start * - * @return $this + * @return self */ public function setInitialFinancialYearStart($initial_financial_year_start) { + if (is_null($initial_financial_year_start)) { + throw new \InvalidArgumentException('non-nullable initial_financial_year_start cannot be null'); + } $this->container['initial_financial_year_start'] = $initial_financial_year_start; return $this; @@ -1649,7 +1918,7 @@ public function setInitialFinancialYearStart($initial_financial_year_start) /** * Gets managers_can_edit_roster_budgets * - * @return bool + * @return bool|null */ public function getManagersCanEditRosterBudgets() { @@ -1659,12 +1928,15 @@ public function getManagersCanEditRosterBudgets() /** * Sets managers_can_edit_roster_budgets * - * @param bool $managers_can_edit_roster_budgets + * @param bool|null $managers_can_edit_roster_budgets * - * @return $this + * @return self */ public function setManagersCanEditRosterBudgets($managers_can_edit_roster_budgets) { + if (is_null($managers_can_edit_roster_budgets)) { + throw new \InvalidArgumentException('non-nullable managers_can_edit_roster_budgets cannot be null'); + } $this->container['managers_can_edit_roster_budgets'] = $managers_can_edit_roster_budgets; return $this; @@ -1673,7 +1945,7 @@ public function setManagersCanEditRosterBudgets($managers_can_edit_roster_budget /** * Gets budget_warning_percent * - * @return double + * @return float|null */ public function getBudgetWarningPercent() { @@ -1683,12 +1955,15 @@ public function getBudgetWarningPercent() /** * Sets budget_warning_percent * - * @param double $budget_warning_percent + * @param float|null $budget_warning_percent * - * @return $this + * @return self */ public function setBudgetWarningPercent($budget_warning_percent) { + if (is_null($budget_warning_percent)) { + throw new \InvalidArgumentException('non-nullable budget_warning_percent cannot be null'); + } $this->container['budget_warning_percent'] = $budget_warning_percent; return $this; @@ -1697,7 +1972,7 @@ public function setBudgetWarningPercent($budget_warning_percent) /** * Gets budget_entry_method * - * @return string + * @return string|null */ public function getBudgetEntryMethod() { @@ -1707,17 +1982,21 @@ public function getBudgetEntryMethod() /** * Sets budget_entry_method * - * @param string $budget_entry_method + * @param string|null $budget_entry_method * - * @return $this + * @return self */ public function setBudgetEntryMethod($budget_entry_method) { + if (is_null($budget_entry_method)) { + throw new \InvalidArgumentException('non-nullable budget_entry_method cannot be null'); + } $allowedValues = $this->getBudgetEntryMethodAllowableValues(); - if (!is_null($budget_entry_method) && !in_array($budget_entry_method, $allowedValues, true)) { + if (!in_array($budget_entry_method, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'budget_entry_method', must be one of '%s'", + "Invalid value '%s' for 'budget_entry_method', must be one of '%s'", + $budget_entry_method, implode("', '", $allowedValues) ) ); @@ -1730,7 +2009,7 @@ public function setBudgetEntryMethod($budget_entry_method) /** * Gets address_line1 * - * @return string + * @return string|null */ public function getAddressLine1() { @@ -1740,12 +2019,15 @@ public function getAddressLine1() /** * Sets address_line1 * - * @param string $address_line1 + * @param string|null $address_line1 * - * @return $this + * @return self */ public function setAddressLine1($address_line1) { + if (is_null($address_line1)) { + throw new \InvalidArgumentException('non-nullable address_line1 cannot be null'); + } $this->container['address_line1'] = $address_line1; return $this; @@ -1754,7 +2036,7 @@ public function setAddressLine1($address_line1) /** * Gets address_line2 * - * @return string + * @return string|null */ public function getAddressLine2() { @@ -1764,12 +2046,15 @@ public function getAddressLine2() /** * Sets address_line2 * - * @param string $address_line2 + * @param string|null $address_line2 * - * @return $this + * @return self */ public function setAddressLine2($address_line2) { + if (is_null($address_line2)) { + throw new \InvalidArgumentException('non-nullable address_line2 cannot be null'); + } $this->container['address_line2'] = $address_line2; return $this; @@ -1778,7 +2063,7 @@ public function setAddressLine2($address_line2) /** * Gets suburb * - * @return string + * @return string|null */ public function getSuburb() { @@ -1788,12 +2073,15 @@ public function getSuburb() /** * Sets suburb * - * @param string $suburb + * @param string|null $suburb * - * @return $this + * @return self */ public function setSuburb($suburb) { + if (is_null($suburb)) { + throw new \InvalidArgumentException('non-nullable suburb cannot be null'); + } $this->container['suburb'] = $suburb; return $this; @@ -1802,7 +2090,7 @@ public function setSuburb($suburb) /** * Gets post_code * - * @return string + * @return string|null */ public function getPostCode() { @@ -1812,12 +2100,15 @@ public function getPostCode() /** * Sets post_code * - * @param string $post_code + * @param string|null $post_code * - * @return $this + * @return self */ public function setPostCode($post_code) { + if (is_null($post_code)) { + throw new \InvalidArgumentException('non-nullable post_code cannot be null'); + } $this->container['post_code'] = $post_code; return $this; @@ -1826,7 +2117,7 @@ public function setPostCode($post_code) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -1836,12 +2127,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -1850,7 +2144,7 @@ public function setState($state) /** * Gets white_label_name * - * @return string + * @return string|null */ public function getWhiteLabelName() { @@ -1860,12 +2154,15 @@ public function getWhiteLabelName() /** * Sets white_label_name * - * @param string $white_label_name + * @param string|null $white_label_name * - * @return $this + * @return self */ public function setWhiteLabelName($white_label_name) { + if (is_null($white_label_name)) { + throw new \InvalidArgumentException('non-nullable white_label_name cannot be null'); + } $this->container['white_label_name'] = $white_label_name; return $this; @@ -1874,7 +2171,7 @@ public function setWhiteLabelName($white_label_name) /** * Gets promo_code * - * @return string + * @return string|null */ public function getPromoCode() { @@ -1884,12 +2181,15 @@ public function getPromoCode() /** * Sets promo_code * - * @param string $promo_code + * @param string|null $promo_code * - * @return $this + * @return self */ public function setPromoCode($promo_code) { + if (is_null($promo_code)) { + throw new \InvalidArgumentException('non-nullable promo_code cannot be null'); + } $this->container['promo_code'] = $promo_code; return $this; @@ -1898,7 +2198,7 @@ public function setPromoCode($promo_code) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -1908,12 +2208,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -1922,7 +2225,7 @@ public function setDateCreated($date_created) /** * Gets leave_accrual_start_date_type * - * @return string + * @return string|null */ public function getLeaveAccrualStartDateType() { @@ -1932,17 +2235,21 @@ public function getLeaveAccrualStartDateType() /** * Sets leave_accrual_start_date_type * - * @param string $leave_accrual_start_date_type + * @param string|null $leave_accrual_start_date_type * - * @return $this + * @return self */ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) { + if (is_null($leave_accrual_start_date_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_start_date_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); - if (!is_null($leave_accrual_start_date_type) && !in_array($leave_accrual_start_date_type, $allowedValues, true)) { + if (!in_array($leave_accrual_start_date_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $leave_accrual_start_date_type, implode("', '", $allowedValues) ) ); @@ -1955,7 +2262,7 @@ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) /** * Gets leave_year_start * - * @return \DateTime + * @return \DateTime|null */ public function getLeaveYearStart() { @@ -1965,12 +2272,15 @@ public function getLeaveYearStart() /** * Sets leave_year_start * - * @param \DateTime $leave_year_start + * @param \DateTime|null $leave_year_start * - * @return $this + * @return self */ public function setLeaveYearStart($leave_year_start) { + if (is_null($leave_year_start)) { + throw new \InvalidArgumentException('non-nullable leave_year_start cannot be null'); + } $this->container['leave_year_start'] = $leave_year_start; return $this; @@ -1979,7 +2289,7 @@ public function setLeaveYearStart($leave_year_start) /** * Gets city * - * @return string + * @return string|null */ public function getCity() { @@ -1989,12 +2299,15 @@ public function getCity() /** * Sets city * - * @param string $city + * @param string|null $city * - * @return $this + * @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; @@ -2003,7 +2316,7 @@ public function setCity($city) /** * Gets auto_enrolment_staging_date * - * @return \DateTime + * @return \DateTime|null */ public function getAutoEnrolmentStagingDate() { @@ -2013,12 +2326,15 @@ public function getAutoEnrolmentStagingDate() /** * Sets auto_enrolment_staging_date * - * @param \DateTime $auto_enrolment_staging_date + * @param \DateTime|null $auto_enrolment_staging_date * - * @return $this + * @return self */ public function setAutoEnrolmentStagingDate($auto_enrolment_staging_date) { + if (is_null($auto_enrolment_staging_date)) { + throw new \InvalidArgumentException('non-nullable auto_enrolment_staging_date cannot be null'); + } $this->container['auto_enrolment_staging_date'] = $auto_enrolment_staging_date; return $this; @@ -2030,7 +2346,7 @@ public function setAutoEnrolmentStagingDate($auto_enrolment_staging_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -2040,22 +2356,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -2071,11 +2388,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -2083,13 +2413,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuBankAccountModel.php b/src/lib/Model/AuBankAccountModel.php index 0a94d97..04b7100 100644 --- a/src/lib/Model/AuBankAccountModel.php +++ b/src/lib/Model/AuBankAccountModel.php @@ -2,69 +2,69 @@ /** * AuBankAccountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuBankAccountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuBankAccountModel implements ModelInterface, ArrayAccess +class AuBankAccountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuBankAccountModel'; + protected static $openAPIModelName = 'AuBankAccountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'account_type' => 'string', 'id' => 'int', 'employee_id' => 'int', 'bsb' => 'string', 'account_name' => 'string', 'account_number' => 'string', - 'allocated_percentage' => 'double', - 'fixed_amount' => 'double', + 'allocated_percentage' => 'float', + 'fixed_amount' => 'float', 'allocate_balance' => 'bool', 'is_employee_editable' => 'bool', 'can_be_deleted' => 'bool', @@ -75,8 +75,10 @@ class AuBankAccountModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'account_type' => null, 'id' => 'int32', 'employee_id' => 'int32', @@ -91,14 +93,41 @@ class AuBankAccountModel implements ModelInterface, ArrayAccess 'external_reference_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'account_type' => false, + 'id' => false, + 'employee_id' => false, + 'bsb' => false, + 'account_name' => false, + 'account_number' => false, + 'allocated_percentage' => false, + 'fixed_amount' => false, + 'allocate_balance' => false, + 'is_employee_editable' => false, + 'can_be_deleted' => false, + 'external_reference_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,16 +291,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCOUNT_TYPE_ELECTRONIC = 'Electronic'; - const ACCOUNT_TYPE_MANUAL_DEPOSIT = 'ManualDeposit'; - const ACCOUNT_TYPE_CASH_OR_CHEQUE = 'CashOrCheque'; - const ACCOUNT_TYPE_BPAY = 'Bpay'; - + public const ACCOUNT_TYPE_ELECTRONIC = 'Electronic'; + public const ACCOUNT_TYPE_MANUAL_DEPOSIT = 'ManualDeposit'; + public const ACCOUNT_TYPE_CASH_OR_CHEQUE = 'CashOrCheque'; + public const ACCOUNT_TYPE_BPAY = 'Bpay'; - /** * Gets allowable values of the enum * @@ -234,7 +313,6 @@ public function getAccountTypeAllowableValues() self::ACCOUNT_TYPE_BPAY, ]; } - /** * Associative array for storing property values @@ -251,18 +329,36 @@ public function getAccountTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['fixed_amount'] = isset($data['fixed_amount']) ? $data['fixed_amount'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; - $this->container['is_employee_editable'] = isset($data['is_employee_editable']) ? $data['is_employee_editable'] : null; - $this->container['can_be_deleted'] = isset($data['can_be_deleted']) ? $data['can_be_deleted'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('fixed_amount', $data ?? [], null); + $this->setIfExists('allocate_balance', $data ?? [], null); + $this->setIfExists('is_employee_editable', $data ?? [], null); + $this->setIfExists('can_be_deleted', $data ?? [], null); + $this->setIfExists('external_reference_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; } /** @@ -277,7 +373,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccountTypeAllowableValues(); if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'account_type', must be one of '%s'", + "invalid value '%s' for 'account_type', must be one of '%s'", + $this->container['account_type'], implode("', '", $allowedValues) ); } @@ -300,7 +397,7 @@ public function valid() /** * Gets account_type * - * @return string + * @return string|null */ public function getAccountType() { @@ -310,17 +407,21 @@ public function getAccountType() /** * Sets account_type * - * @param string $account_type + * @param string|null $account_type * - * @return $this + * @return self */ public function setAccountType($account_type) { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } $allowedValues = $this->getAccountTypeAllowableValues(); - if (!is_null($account_type) && !in_array($account_type, $allowedValues, true)) { + if (!in_array($account_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'account_type', must be one of '%s'", + "Invalid value '%s' for 'account_type', must be one of '%s'", + $account_type, implode("', '", $allowedValues) ) ); @@ -333,7 +434,7 @@ public function setAccountType($account_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +444,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +461,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -367,12 +471,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -381,7 +488,7 @@ public function setEmployeeId($employee_id) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -391,12 +498,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -405,7 +515,7 @@ public function setBsb($bsb) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -415,12 +525,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -429,7 +542,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -439,12 +552,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -453,7 +569,7 @@ public function setAccountNumber($account_number) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -463,12 +579,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -477,7 +596,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets fixed_amount * - * @return double + * @return float|null */ public function getFixedAmount() { @@ -487,12 +606,15 @@ public function getFixedAmount() /** * Sets fixed_amount * - * @param double $fixed_amount + * @param float|null $fixed_amount * - * @return $this + * @return self */ public function setFixedAmount($fixed_amount) { + if (is_null($fixed_amount)) { + throw new \InvalidArgumentException('non-nullable fixed_amount cannot be null'); + } $this->container['fixed_amount'] = $fixed_amount; return $this; @@ -501,7 +623,7 @@ public function setFixedAmount($fixed_amount) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -511,12 +633,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -525,7 +650,7 @@ public function setAllocateBalance($allocate_balance) /** * Gets is_employee_editable * - * @return bool + * @return bool|null */ public function getIsEmployeeEditable() { @@ -535,12 +660,15 @@ public function getIsEmployeeEditable() /** * Sets is_employee_editable * - * @param bool $is_employee_editable + * @param bool|null $is_employee_editable * - * @return $this + * @return self */ public function setIsEmployeeEditable($is_employee_editable) { + if (is_null($is_employee_editable)) { + throw new \InvalidArgumentException('non-nullable is_employee_editable cannot be null'); + } $this->container['is_employee_editable'] = $is_employee_editable; return $this; @@ -549,7 +677,7 @@ public function setIsEmployeeEditable($is_employee_editable) /** * Gets can_be_deleted * - * @return bool + * @return bool|null */ public function getCanBeDeleted() { @@ -559,12 +687,15 @@ public function getCanBeDeleted() /** * Sets can_be_deleted * - * @param bool $can_be_deleted + * @param bool|null $can_be_deleted * - * @return $this + * @return self */ public function setCanBeDeleted($can_be_deleted) { + if (is_null($can_be_deleted)) { + throw new \InvalidArgumentException('non-nullable can_be_deleted cannot be null'); + } $this->container['can_be_deleted'] = $can_be_deleted; return $this; @@ -573,7 +704,7 @@ public function setCanBeDeleted($can_be_deleted) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -583,12 +714,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -600,7 +734,7 @@ public function setExternalReferenceId($external_reference_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -610,22 +744,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -641,11 +776,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -653,13 +801,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuBankPaymentModel.php b/src/lib/Model/AuBankPaymentModel.php index 0917f43..c144807 100644 --- a/src/lib/Model/AuBankPaymentModel.php +++ b/src/lib/Model/AuBankPaymentModel.php @@ -2,61 +2,61 @@ /** * AuBankPaymentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuBankPaymentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuBankPaymentModel implements ModelInterface, ArrayAccess +class AuBankPaymentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuBankPaymentModel'; + protected static $openAPIModelName = 'AuBankPaymentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'bsb' => 'string', 'employee_id' => 'int', 'employee_external_id' => 'string', @@ -64,7 +64,7 @@ class AuBankPaymentModel implements ModelInterface, ArrayAccess 'employee_surname' => 'string', 'account_name' => 'string', 'account_number' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'account_type' => 'string', 'lodgement_reference' => 'string' ]; @@ -73,8 +73,10 @@ class AuBankPaymentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'bsb' => null, 'employee_id' => 'int32', 'employee_external_id' => null, @@ -87,14 +89,39 @@ class AuBankPaymentModel implements ModelInterface, ArrayAccess 'lodgement_reference' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bsb' => false, + 'employee_id' => false, + 'employee_external_id' => false, + 'employee_first_name' => false, + 'employee_surname' => false, + 'account_name' => false, + 'account_number' => false, + 'amount' => false, + 'account_type' => false, + 'lodgement_reference' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['employee_first_name'] = isset($data['employee_first_name']) ? $data['employee_first_name'] : null; - $this->container['employee_surname'] = isset($data['employee_surname']) ? $data['employee_surname'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null; - $this->container['lodgement_reference'] = isset($data['lodgement_reference']) ? $data['lodgement_reference'] : null; + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('employee_first_name', $data ?? [], null); + $this->setIfExists('employee_surname', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('lodgement_reference', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -271,12 +365,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -285,7 +382,7 @@ public function setBsb($bsb) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -295,12 +392,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -309,7 +409,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -319,12 +419,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -333,7 +436,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets employee_first_name * - * @return string + * @return string|null */ public function getEmployeeFirstName() { @@ -343,12 +446,15 @@ public function getEmployeeFirstName() /** * Sets employee_first_name * - * @param string $employee_first_name + * @param string|null $employee_first_name * - * @return $this + * @return self */ public function setEmployeeFirstName($employee_first_name) { + if (is_null($employee_first_name)) { + throw new \InvalidArgumentException('non-nullable employee_first_name cannot be null'); + } $this->container['employee_first_name'] = $employee_first_name; return $this; @@ -357,7 +463,7 @@ public function setEmployeeFirstName($employee_first_name) /** * Gets employee_surname * - * @return string + * @return string|null */ public function getEmployeeSurname() { @@ -367,12 +473,15 @@ public function getEmployeeSurname() /** * Sets employee_surname * - * @param string $employee_surname + * @param string|null $employee_surname * - * @return $this + * @return self */ public function setEmployeeSurname($employee_surname) { + if (is_null($employee_surname)) { + throw new \InvalidArgumentException('non-nullable employee_surname cannot be null'); + } $this->container['employee_surname'] = $employee_surname; return $this; @@ -381,7 +490,7 @@ public function setEmployeeSurname($employee_surname) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -391,12 +500,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -405,7 +517,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -415,12 +527,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -429,7 +544,7 @@ public function setAccountNumber($account_number) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -439,12 +554,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -453,7 +571,7 @@ public function setAmount($amount) /** * Gets account_type * - * @return string + * @return string|null */ public function getAccountType() { @@ -463,12 +581,15 @@ public function getAccountType() /** * Sets account_type * - * @param string $account_type + * @param string|null $account_type * - * @return $this + * @return self */ public function setAccountType($account_type) { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } $this->container['account_type'] = $account_type; return $this; @@ -477,7 +598,7 @@ public function setAccountType($account_type) /** * Gets lodgement_reference * - * @return string + * @return string|null */ public function getLodgementReference() { @@ -487,12 +608,15 @@ public function getLodgementReference() /** * Sets lodgement_reference * - * @param string $lodgement_reference + * @param string|null $lodgement_reference * - * @return $this + * @return self */ public function setLodgementReference($lodgement_reference) { + if (is_null($lodgement_reference)) { + throw new \InvalidArgumentException('non-nullable lodgement_reference cannot be null'); + } $this->container['lodgement_reference'] = $lodgement_reference; return $this; @@ -504,7 +628,7 @@ public function setLodgementReference($lodgement_reference) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuBillingPlanResponseModel.php b/src/lib/Model/AuBillingPlanResponseModel.php index 8e0abe3..3ccba7c 100644 --- a/src/lib/Model/AuBillingPlanResponseModel.php +++ b/src/lib/Model/AuBillingPlanResponseModel.php @@ -2,69 +2,69 @@ /** * AuBillingPlanResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuBillingPlanResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuBillingPlanResponseModel implements ModelInterface, ArrayAccess +class AuBillingPlanResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuBillingPlanResponseModel'; + protected static $openAPIModelName = 'AuBillingPlanResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'super_inclusion' => 'string', 'function_pay_conditions' => 'string', 'function_awards' => 'string', 'id' => 'int', 'name' => 'string', 'type' => 'string', - 'price_per_unit' => 'double', - 'price_per_sms' => 'double', + 'price_per_unit' => 'float', + 'price_per_sms' => 'float', 'included_employees' => 'int', 'function_rostering' => 'string', 'function_time_and_attendance' => 'string', @@ -77,8 +77,10 @@ class AuBillingPlanResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_inclusion' => null, 'function_pay_conditions' => null, 'function_awards' => null, @@ -95,14 +97,43 @@ class AuBillingPlanResponseModel implements ModelInterface, ArrayAccess 'is_hidden' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_inclusion' => false, + 'function_pay_conditions' => false, + 'function_awards' => false, + 'id' => false, + 'name' => false, + 'type' => false, + 'price_per_unit' => false, + 'price_per_sms' => false, + 'included_employees' => false, + 'function_rostering' => false, + 'function_time_and_attendance' => false, + 'function_employee_onboarding' => false, + 'description' => false, + 'is_hidden' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -220,39 +303,37 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SUPER_INCLUSION_NONE = 'None'; - const SUPER_INCLUSION_WEEKLY = 'Weekly'; - const SUPER_INCLUSION_MONTHLY = 'Monthly'; - const SUPER_INCLUSION_QUARTERLY = 'Quarterly'; - const FUNCTION_PAY_CONDITIONS_DISABLED = 'Disabled'; - const FUNCTION_PAY_CONDITIONS_ENABLED = 'Enabled'; - const FUNCTION_PAY_CONDITIONS_UPSELL = 'Upsell'; - const FUNCTION_PAY_CONDITIONS_COMING_SOON = 'ComingSoon'; - const FUNCTION_AWARDS_DISABLED = 'Disabled'; - const FUNCTION_AWARDS_ENABLED = 'Enabled'; - const FUNCTION_AWARDS_UPSELL = 'Upsell'; - const FUNCTION_AWARDS_COMING_SOON = 'ComingSoon'; - const TYPE_PER_EMPLOYEE_PER_MONTH = 'PerEmployeePerMonth'; - const TYPE_LICENSE = 'License'; - const TYPE_PER_HOUR_PAID = 'PerHourPaid'; - const FUNCTION_ROSTERING_DISABLED = 'Disabled'; - const FUNCTION_ROSTERING_ENABLED = 'Enabled'; - const FUNCTION_ROSTERING_UPSELL = 'Upsell'; - const FUNCTION_ROSTERING_COMING_SOON = 'ComingSoon'; - const FUNCTION_TIME_AND_ATTENDANCE_DISABLED = 'Disabled'; - const FUNCTION_TIME_AND_ATTENDANCE_ENABLED = 'Enabled'; - const FUNCTION_TIME_AND_ATTENDANCE_UPSELL = 'Upsell'; - const FUNCTION_TIME_AND_ATTENDANCE_COMING_SOON = 'ComingSoon'; - const FUNCTION_EMPLOYEE_ONBOARDING_DISABLED = 'Disabled'; - const FUNCTION_EMPLOYEE_ONBOARDING_ENABLED = 'Enabled'; - const FUNCTION_EMPLOYEE_ONBOARDING_UPSELL = 'Upsell'; - const FUNCTION_EMPLOYEE_ONBOARDING_COMING_SOON = 'ComingSoon'; - - - + return self::$openAPIModelName; + } + + public const SUPER_INCLUSION_NONE = 'None'; + public const SUPER_INCLUSION_WEEKLY = 'Weekly'; + public const SUPER_INCLUSION_MONTHLY = 'Monthly'; + public const SUPER_INCLUSION_QUARTERLY = 'Quarterly'; + public const FUNCTION_PAY_CONDITIONS_DISABLED = 'Disabled'; + public const FUNCTION_PAY_CONDITIONS_ENABLED = 'Enabled'; + public const FUNCTION_PAY_CONDITIONS_UPSELL = 'Upsell'; + public const FUNCTION_PAY_CONDITIONS_COMING_SOON = 'ComingSoon'; + public const FUNCTION_AWARDS_DISABLED = 'Disabled'; + public const FUNCTION_AWARDS_ENABLED = 'Enabled'; + public const FUNCTION_AWARDS_UPSELL = 'Upsell'; + public const FUNCTION_AWARDS_COMING_SOON = 'ComingSoon'; + public const TYPE_PER_EMPLOYEE_PER_MONTH = 'PerEmployeePerMonth'; + public const TYPE_LICENSE = 'License'; + public const TYPE_PER_HOUR_PAID = 'PerHourPaid'; + public const FUNCTION_ROSTERING_DISABLED = 'Disabled'; + public const FUNCTION_ROSTERING_ENABLED = 'Enabled'; + public const FUNCTION_ROSTERING_UPSELL = 'Upsell'; + public const FUNCTION_ROSTERING_COMING_SOON = 'ComingSoon'; + public const FUNCTION_TIME_AND_ATTENDANCE_DISABLED = 'Disabled'; + public const FUNCTION_TIME_AND_ATTENDANCE_ENABLED = 'Enabled'; + public const FUNCTION_TIME_AND_ATTENDANCE_UPSELL = 'Upsell'; + public const FUNCTION_TIME_AND_ATTENDANCE_COMING_SOON = 'ComingSoon'; + public const FUNCTION_EMPLOYEE_ONBOARDING_DISABLED = 'Disabled'; + public const FUNCTION_EMPLOYEE_ONBOARDING_ENABLED = 'Enabled'; + public const FUNCTION_EMPLOYEE_ONBOARDING_UPSELL = 'Upsell'; + public const FUNCTION_EMPLOYEE_ONBOARDING_COMING_SOON = 'ComingSoon'; + /** * Gets allowable values of the enum * @@ -267,7 +348,7 @@ public function getSuperInclusionAllowableValues() self::SUPER_INCLUSION_QUARTERLY, ]; } - + /** * Gets allowable values of the enum * @@ -282,7 +363,7 @@ public function getFunctionPayConditionsAllowableValues() self::FUNCTION_PAY_CONDITIONS_COMING_SOON, ]; } - + /** * Gets allowable values of the enum * @@ -297,7 +378,7 @@ public function getFunctionAwardsAllowableValues() self::FUNCTION_AWARDS_COMING_SOON, ]; } - + /** * Gets allowable values of the enum * @@ -311,7 +392,7 @@ public function getTypeAllowableValues() self::TYPE_PER_HOUR_PAID, ]; } - + /** * Gets allowable values of the enum * @@ -326,7 +407,7 @@ public function getFunctionRosteringAllowableValues() self::FUNCTION_ROSTERING_COMING_SOON, ]; } - + /** * Gets allowable values of the enum * @@ -341,7 +422,7 @@ public function getFunctionTimeAndAttendanceAllowableValues() self::FUNCTION_TIME_AND_ATTENDANCE_COMING_SOON, ]; } - + /** * Gets allowable values of the enum * @@ -356,7 +437,6 @@ public function getFunctionEmployeeOnboardingAllowableValues() self::FUNCTION_EMPLOYEE_ONBOARDING_COMING_SOON, ]; } - /** * Associative array for storing property values @@ -373,20 +453,38 @@ public function getFunctionEmployeeOnboardingAllowableValues() */ public function __construct(array $data = null) { - $this->container['super_inclusion'] = isset($data['super_inclusion']) ? $data['super_inclusion'] : null; - $this->container['function_pay_conditions'] = isset($data['function_pay_conditions']) ? $data['function_pay_conditions'] : null; - $this->container['function_awards'] = isset($data['function_awards']) ? $data['function_awards'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['price_per_unit'] = isset($data['price_per_unit']) ? $data['price_per_unit'] : null; - $this->container['price_per_sms'] = isset($data['price_per_sms']) ? $data['price_per_sms'] : null; - $this->container['included_employees'] = isset($data['included_employees']) ? $data['included_employees'] : null; - $this->container['function_rostering'] = isset($data['function_rostering']) ? $data['function_rostering'] : null; - $this->container['function_time_and_attendance'] = isset($data['function_time_and_attendance']) ? $data['function_time_and_attendance'] : null; - $this->container['function_employee_onboarding'] = isset($data['function_employee_onboarding']) ? $data['function_employee_onboarding'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['is_hidden'] = isset($data['is_hidden']) ? $data['is_hidden'] : null; + $this->setIfExists('super_inclusion', $data ?? [], null); + $this->setIfExists('function_pay_conditions', $data ?? [], null); + $this->setIfExists('function_awards', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('price_per_unit', $data ?? [], null); + $this->setIfExists('price_per_sms', $data ?? [], null); + $this->setIfExists('included_employees', $data ?? [], null); + $this->setIfExists('function_rostering', $data ?? [], null); + $this->setIfExists('function_time_and_attendance', $data ?? [], null); + $this->setIfExists('function_employee_onboarding', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('is_hidden', $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; } /** @@ -401,7 +499,8 @@ public function listInvalidProperties() $allowedValues = $this->getSuperInclusionAllowableValues(); if (!is_null($this->container['super_inclusion']) && !in_array($this->container['super_inclusion'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'super_inclusion', must be one of '%s'", + "invalid value '%s' for 'super_inclusion', must be one of '%s'", + $this->container['super_inclusion'], implode("', '", $allowedValues) ); } @@ -409,7 +508,8 @@ public function listInvalidProperties() $allowedValues = $this->getFunctionPayConditionsAllowableValues(); if (!is_null($this->container['function_pay_conditions']) && !in_array($this->container['function_pay_conditions'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'function_pay_conditions', must be one of '%s'", + "invalid value '%s' for 'function_pay_conditions', must be one of '%s'", + $this->container['function_pay_conditions'], implode("', '", $allowedValues) ); } @@ -417,7 +517,8 @@ public function listInvalidProperties() $allowedValues = $this->getFunctionAwardsAllowableValues(); if (!is_null($this->container['function_awards']) && !in_array($this->container['function_awards'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'function_awards', must be one of '%s'", + "invalid value '%s' for 'function_awards', must be one of '%s'", + $this->container['function_awards'], implode("', '", $allowedValues) ); } @@ -425,7 +526,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -433,7 +535,8 @@ public function listInvalidProperties() $allowedValues = $this->getFunctionRosteringAllowableValues(); if (!is_null($this->container['function_rostering']) && !in_array($this->container['function_rostering'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'function_rostering', must be one of '%s'", + "invalid value '%s' for 'function_rostering', must be one of '%s'", + $this->container['function_rostering'], implode("', '", $allowedValues) ); } @@ -441,7 +544,8 @@ public function listInvalidProperties() $allowedValues = $this->getFunctionTimeAndAttendanceAllowableValues(); if (!is_null($this->container['function_time_and_attendance']) && !in_array($this->container['function_time_and_attendance'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'function_time_and_attendance', must be one of '%s'", + "invalid value '%s' for 'function_time_and_attendance', must be one of '%s'", + $this->container['function_time_and_attendance'], implode("', '", $allowedValues) ); } @@ -449,7 +553,8 @@ public function listInvalidProperties() $allowedValues = $this->getFunctionEmployeeOnboardingAllowableValues(); if (!is_null($this->container['function_employee_onboarding']) && !in_array($this->container['function_employee_onboarding'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'function_employee_onboarding', must be one of '%s'", + "invalid value '%s' for 'function_employee_onboarding', must be one of '%s'", + $this->container['function_employee_onboarding'], implode("', '", $allowedValues) ); } @@ -472,7 +577,7 @@ public function valid() /** * Gets super_inclusion * - * @return string + * @return string|null */ public function getSuperInclusion() { @@ -482,17 +587,21 @@ public function getSuperInclusion() /** * Sets super_inclusion * - * @param string $super_inclusion + * @param string|null $super_inclusion * - * @return $this + * @return self */ public function setSuperInclusion($super_inclusion) { + if (is_null($super_inclusion)) { + throw new \InvalidArgumentException('non-nullable super_inclusion cannot be null'); + } $allowedValues = $this->getSuperInclusionAllowableValues(); - if (!is_null($super_inclusion) && !in_array($super_inclusion, $allowedValues, true)) { + if (!in_array($super_inclusion, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'super_inclusion', must be one of '%s'", + "Invalid value '%s' for 'super_inclusion', must be one of '%s'", + $super_inclusion, implode("', '", $allowedValues) ) ); @@ -505,7 +614,7 @@ public function setSuperInclusion($super_inclusion) /** * Gets function_pay_conditions * - * @return string + * @return string|null */ public function getFunctionPayConditions() { @@ -515,17 +624,21 @@ public function getFunctionPayConditions() /** * Sets function_pay_conditions * - * @param string $function_pay_conditions + * @param string|null $function_pay_conditions * - * @return $this + * @return self */ public function setFunctionPayConditions($function_pay_conditions) { + if (is_null($function_pay_conditions)) { + throw new \InvalidArgumentException('non-nullable function_pay_conditions cannot be null'); + } $allowedValues = $this->getFunctionPayConditionsAllowableValues(); - if (!is_null($function_pay_conditions) && !in_array($function_pay_conditions, $allowedValues, true)) { + if (!in_array($function_pay_conditions, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'function_pay_conditions', must be one of '%s'", + "Invalid value '%s' for 'function_pay_conditions', must be one of '%s'", + $function_pay_conditions, implode("', '", $allowedValues) ) ); @@ -538,7 +651,7 @@ public function setFunctionPayConditions($function_pay_conditions) /** * Gets function_awards * - * @return string + * @return string|null */ public function getFunctionAwards() { @@ -548,17 +661,21 @@ public function getFunctionAwards() /** * Sets function_awards * - * @param string $function_awards + * @param string|null $function_awards * - * @return $this + * @return self */ public function setFunctionAwards($function_awards) { + if (is_null($function_awards)) { + throw new \InvalidArgumentException('non-nullable function_awards cannot be null'); + } $allowedValues = $this->getFunctionAwardsAllowableValues(); - if (!is_null($function_awards) && !in_array($function_awards, $allowedValues, true)) { + if (!in_array($function_awards, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'function_awards', must be one of '%s'", + "Invalid value '%s' for 'function_awards', must be one of '%s'", + $function_awards, implode("', '", $allowedValues) ) ); @@ -571,7 +688,7 @@ public function setFunctionAwards($function_awards) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -581,12 +698,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -595,7 +715,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -605,12 +725,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -619,7 +742,7 @@ public function setName($name) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -629,17 +752,21 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { + if (!in_array($type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -652,7 +779,7 @@ public function setType($type) /** * Gets price_per_unit * - * @return double + * @return float|null */ public function getPricePerUnit() { @@ -662,12 +789,15 @@ public function getPricePerUnit() /** * Sets price_per_unit * - * @param double $price_per_unit + * @param float|null $price_per_unit * - * @return $this + * @return self */ public function setPricePerUnit($price_per_unit) { + if (is_null($price_per_unit)) { + throw new \InvalidArgumentException('non-nullable price_per_unit cannot be null'); + } $this->container['price_per_unit'] = $price_per_unit; return $this; @@ -676,7 +806,7 @@ public function setPricePerUnit($price_per_unit) /** * Gets price_per_sms * - * @return double + * @return float|null */ public function getPricePerSms() { @@ -686,12 +816,15 @@ public function getPricePerSms() /** * Sets price_per_sms * - * @param double $price_per_sms + * @param float|null $price_per_sms * - * @return $this + * @return self */ public function setPricePerSms($price_per_sms) { + if (is_null($price_per_sms)) { + throw new \InvalidArgumentException('non-nullable price_per_sms cannot be null'); + } $this->container['price_per_sms'] = $price_per_sms; return $this; @@ -700,7 +833,7 @@ public function setPricePerSms($price_per_sms) /** * Gets included_employees * - * @return int + * @return int|null */ public function getIncludedEmployees() { @@ -710,12 +843,15 @@ public function getIncludedEmployees() /** * Sets included_employees * - * @param int $included_employees + * @param int|null $included_employees * - * @return $this + * @return self */ public function setIncludedEmployees($included_employees) { + if (is_null($included_employees)) { + throw new \InvalidArgumentException('non-nullable included_employees cannot be null'); + } $this->container['included_employees'] = $included_employees; return $this; @@ -724,7 +860,7 @@ public function setIncludedEmployees($included_employees) /** * Gets function_rostering * - * @return string + * @return string|null */ public function getFunctionRostering() { @@ -734,17 +870,21 @@ public function getFunctionRostering() /** * Sets function_rostering * - * @param string $function_rostering + * @param string|null $function_rostering * - * @return $this + * @return self */ public function setFunctionRostering($function_rostering) { + if (is_null($function_rostering)) { + throw new \InvalidArgumentException('non-nullable function_rostering cannot be null'); + } $allowedValues = $this->getFunctionRosteringAllowableValues(); - if (!is_null($function_rostering) && !in_array($function_rostering, $allowedValues, true)) { + if (!in_array($function_rostering, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'function_rostering', must be one of '%s'", + "Invalid value '%s' for 'function_rostering', must be one of '%s'", + $function_rostering, implode("', '", $allowedValues) ) ); @@ -757,7 +897,7 @@ public function setFunctionRostering($function_rostering) /** * Gets function_time_and_attendance * - * @return string + * @return string|null */ public function getFunctionTimeAndAttendance() { @@ -767,17 +907,21 @@ public function getFunctionTimeAndAttendance() /** * Sets function_time_and_attendance * - * @param string $function_time_and_attendance + * @param string|null $function_time_and_attendance * - * @return $this + * @return self */ public function setFunctionTimeAndAttendance($function_time_and_attendance) { + if (is_null($function_time_and_attendance)) { + throw new \InvalidArgumentException('non-nullable function_time_and_attendance cannot be null'); + } $allowedValues = $this->getFunctionTimeAndAttendanceAllowableValues(); - if (!is_null($function_time_and_attendance) && !in_array($function_time_and_attendance, $allowedValues, true)) { + if (!in_array($function_time_and_attendance, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'function_time_and_attendance', must be one of '%s'", + "Invalid value '%s' for 'function_time_and_attendance', must be one of '%s'", + $function_time_and_attendance, implode("', '", $allowedValues) ) ); @@ -790,7 +934,7 @@ public function setFunctionTimeAndAttendance($function_time_and_attendance) /** * Gets function_employee_onboarding * - * @return string + * @return string|null */ public function getFunctionEmployeeOnboarding() { @@ -800,17 +944,21 @@ public function getFunctionEmployeeOnboarding() /** * Sets function_employee_onboarding * - * @param string $function_employee_onboarding + * @param string|null $function_employee_onboarding * - * @return $this + * @return self */ public function setFunctionEmployeeOnboarding($function_employee_onboarding) { + if (is_null($function_employee_onboarding)) { + throw new \InvalidArgumentException('non-nullable function_employee_onboarding cannot be null'); + } $allowedValues = $this->getFunctionEmployeeOnboardingAllowableValues(); - if (!is_null($function_employee_onboarding) && !in_array($function_employee_onboarding, $allowedValues, true)) { + if (!in_array($function_employee_onboarding, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'function_employee_onboarding', must be one of '%s'", + "Invalid value '%s' for 'function_employee_onboarding', must be one of '%s'", + $function_employee_onboarding, implode("', '", $allowedValues) ) ); @@ -823,7 +971,7 @@ public function setFunctionEmployeeOnboarding($function_employee_onboarding) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -833,12 +981,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -847,7 +998,7 @@ public function setDescription($description) /** * Gets is_hidden * - * @return bool + * @return bool|null */ public function getIsHidden() { @@ -857,12 +1008,15 @@ public function getIsHidden() /** * Sets is_hidden * - * @param bool $is_hidden + * @param bool|null $is_hidden * - * @return $this + * @return self */ public function setIsHidden($is_hidden) { + if (is_null($is_hidden)) { + throw new \InvalidArgumentException('non-nullable is_hidden cannot be null'); + } $this->container['is_hidden'] = $is_hidden; return $this; @@ -874,7 +1028,7 @@ public function setIsHidden($is_hidden) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -884,22 +1038,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -915,11 +1070,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -927,13 +1095,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuBusinessExportModel.php b/src/lib/Model/AuBusinessExportModel.php index bfa7120..7a60813 100644 --- a/src/lib/Model/AuBusinessExportModel.php +++ b/src/lib/Model/AuBusinessExportModel.php @@ -2,61 +2,61 @@ /** * AuBusinessExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuBusinessExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuBusinessExportModel implements ModelInterface, ArrayAccess +class AuBusinessExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuBusinessExportModel'; + protected static $openAPIModelName = 'AuBusinessExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'abn' => 'string', 'suburb' => 'string', 'state' => 'string', @@ -65,7 +65,7 @@ class AuBusinessExportModel implements ModelInterface, ArrayAccess 'sbr_software_id' => 'string', 'is_foreign_entity' => 'bool', 'foreign_entity_country' => 'string', - 'default_super_rate' => 'double', + 'default_super_rate' => 'float', 'id' => 'int', 'name' => 'string', 'region' => 'string', @@ -75,12 +75,12 @@ class AuBusinessExportModel implements ModelInterface, ArrayAccess 'contact_phone_number' => 'string', 'contact_fax_number' => 'string', 'external_id' => 'string', - 'standard_hours_per_day' => 'double', + 'standard_hours_per_day' => 'float', 'journal_service' => 'string', 'end_of_week' => 'string', 'initial_financial_year_start' => 'int', 'managers_can_edit_roster_budgets' => 'bool', - 'budget_warning_percent' => 'double', + 'budget_warning_percent' => 'float', 'budget_entry_method' => 'string', 'address_line1' => 'string', 'address_line2' => 'string', @@ -101,8 +101,10 @@ class AuBusinessExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'abn' => null, 'suburb' => null, 'state' => null, @@ -143,14 +145,67 @@ class AuBusinessExportModel implements ModelInterface, ArrayAccess 'pay_cycle_frequency' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'abn' => false, + 'suburb' => false, + 'state' => false, + 'management_software_id' => false, + 'sbr_software_provider' => false, + 'sbr_software_id' => false, + 'is_foreign_entity' => false, + 'foreign_entity_country' => false, + 'default_super_rate' => false, + 'id' => false, + 'name' => false, + 'region' => false, + 'legal_name' => false, + 'contact_name' => false, + 'contact_email_address' => false, + 'contact_phone_number' => false, + 'contact_fax_number' => false, + 'external_id' => false, + 'standard_hours_per_day' => false, + 'journal_service' => false, + 'end_of_week' => false, + 'initial_financial_year_start' => false, + 'managers_can_edit_roster_budgets' => false, + 'budget_warning_percent' => false, + 'budget_entry_method' => false, + 'address_line1' => false, + 'address_line2' => false, + 'post_code' => false, + 'white_label_name' => false, + 'white_label_id' => false, + 'promo_code' => false, + 'date_created' => false, + 'leave_accrual_start_date_type' => false, + 'leave_year_start' => false, + 'source' => false, + 'number_of_employees' => false, + 'industry_name' => false, + 'pay_cycle_frequency' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -158,9 +213,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -340,113 +447,111 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const END_OF_WEEK_SUNDAY = 'Sunday'; - const END_OF_WEEK_MONDAY = 'Monday'; - const END_OF_WEEK_TUESDAY = 'Tuesday'; - const END_OF_WEEK_WEDNESDAY = 'Wednesday'; - const END_OF_WEEK_THURSDAY = 'Thursday'; - const END_OF_WEEK_FRIDAY = 'Friday'; - const END_OF_WEEK_SATURDAY = 'Saturday'; - const BUDGET_ENTRY_METHOD_PERCENTAGE_OF_SALES = 'PercentageOfSales'; - const BUDGET_ENTRY_METHOD_DIRECT = 'Direct'; - const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - const NUMBER_OF_EMPLOYEES_ONE_TO_TEN = 'OneToTen'; - const NUMBER_OF_EMPLOYEES_ELEVEN_TO_FIFTY = 'ElevenToFifty'; - const NUMBER_OF_EMPLOYEES_FIFTY_ONE_TO_TWO_FIFTY = 'FiftyOneToTwoFifty'; - const NUMBER_OF_EMPLOYEES_TWO_FIFTY_ONE_AND_UP = 'TwoFiftyOneAndUp'; - const PAY_CYCLE_FREQUENCY_WEEKLY = 'Weekly'; - const PAY_CYCLE_FREQUENCY_FORTNIGHTLY = 'Fortnightly'; - const PAY_CYCLE_FREQUENCY_MONTHLY = 'Monthly'; - const PAY_CYCLE_FREQUENCY_FOUR_WEEKLY = 'FourWeekly'; - const PAY_CYCLE_FREQUENCY_QUARTERLY = 'Quarterly'; - const PAY_CYCLE_FREQUENCY_ANNUALLY = 'Annually'; - const PAY_CYCLE_FREQUENCY_HALF_MONTHLY = 'HalfMonthly'; - - - + return self::$openAPIModelName; + } + + public const END_OF_WEEK_SUNDAY = 'Sunday'; + public const END_OF_WEEK_MONDAY = 'Monday'; + public const END_OF_WEEK_TUESDAY = 'Tuesday'; + public const END_OF_WEEK_WEDNESDAY = 'Wednesday'; + public const END_OF_WEEK_THURSDAY = 'Thursday'; + public const END_OF_WEEK_FRIDAY = 'Friday'; + public const END_OF_WEEK_SATURDAY = 'Saturday'; + public const BUDGET_ENTRY_METHOD_PERCENTAGE_OF_SALES = 'PercentageOfSales'; + public const BUDGET_ENTRY_METHOD_DIRECT = 'Direct'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + public const NUMBER_OF_EMPLOYEES_ONE_TO_TEN = 'OneToTen'; + public const NUMBER_OF_EMPLOYEES_ELEVEN_TO_FIFTY = 'ElevenToFifty'; + public const NUMBER_OF_EMPLOYEES_FIFTY_ONE_TO_TWO_FIFTY = 'FiftyOneToTwoFifty'; + public const NUMBER_OF_EMPLOYEES_TWO_FIFTY_ONE_AND_UP = 'TwoFiftyOneAndUp'; + public const PAY_CYCLE_FREQUENCY_WEEKLY = 'Weekly'; + public const PAY_CYCLE_FREQUENCY_FORTNIGHTLY = 'Fortnightly'; + public const PAY_CYCLE_FREQUENCY_MONTHLY = 'Monthly'; + public const PAY_CYCLE_FREQUENCY_FOUR_WEEKLY = 'FourWeekly'; + public const PAY_CYCLE_FREQUENCY_QUARTERLY = 'Quarterly'; + public const PAY_CYCLE_FREQUENCY_ANNUALLY = 'Annually'; + public const PAY_CYCLE_FREQUENCY_HALF_MONTHLY = 'HalfMonthly'; + /** * Gets allowable values of the enum * @@ -464,7 +569,7 @@ public function getEndOfWeekAllowableValues() self::END_OF_WEEK_SATURDAY, ]; } - + /** * Gets allowable values of the enum * @@ -477,7 +582,7 @@ public function getBudgetEntryMethodAllowableValues() self::BUDGET_ENTRY_METHOD_DIRECT, ]; } - + /** * Gets allowable values of the enum * @@ -493,7 +598,7 @@ public function getLeaveAccrualStartDateTypeAllowableValues() self::LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH, ]; } - + /** * Gets allowable values of the enum * @@ -580,7 +685,7 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - + /** * Gets allowable values of the enum * @@ -595,7 +700,7 @@ public function getNumberOfEmployeesAllowableValues() self::NUMBER_OF_EMPLOYEES_TWO_FIFTY_ONE_AND_UP, ]; } - + /** * Gets allowable values of the enum * @@ -613,7 +718,6 @@ public function getPayCycleFrequencyAllowableValues() self::PAY_CYCLE_FREQUENCY_HALF_MONTHLY, ]; } - /** * Associative array for storing property values @@ -630,44 +734,62 @@ public function getPayCycleFrequencyAllowableValues() */ public function __construct(array $data = null) { - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['suburb'] = isset($data['suburb']) ? $data['suburb'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['management_software_id'] = isset($data['management_software_id']) ? $data['management_software_id'] : null; - $this->container['sbr_software_provider'] = isset($data['sbr_software_provider']) ? $data['sbr_software_provider'] : null; - $this->container['sbr_software_id'] = isset($data['sbr_software_id']) ? $data['sbr_software_id'] : null; - $this->container['is_foreign_entity'] = isset($data['is_foreign_entity']) ? $data['is_foreign_entity'] : null; - $this->container['foreign_entity_country'] = isset($data['foreign_entity_country']) ? $data['foreign_entity_country'] : null; - $this->container['default_super_rate'] = isset($data['default_super_rate']) ? $data['default_super_rate'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['region'] = isset($data['region']) ? $data['region'] : null; - $this->container['legal_name'] = isset($data['legal_name']) ? $data['legal_name'] : null; - $this->container['contact_name'] = isset($data['contact_name']) ? $data['contact_name'] : null; - $this->container['contact_email_address'] = isset($data['contact_email_address']) ? $data['contact_email_address'] : null; - $this->container['contact_phone_number'] = isset($data['contact_phone_number']) ? $data['contact_phone_number'] : null; - $this->container['contact_fax_number'] = isset($data['contact_fax_number']) ? $data['contact_fax_number'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['standard_hours_per_day'] = isset($data['standard_hours_per_day']) ? $data['standard_hours_per_day'] : null; - $this->container['journal_service'] = isset($data['journal_service']) ? $data['journal_service'] : null; - $this->container['end_of_week'] = isset($data['end_of_week']) ? $data['end_of_week'] : null; - $this->container['initial_financial_year_start'] = isset($data['initial_financial_year_start']) ? $data['initial_financial_year_start'] : null; - $this->container['managers_can_edit_roster_budgets'] = isset($data['managers_can_edit_roster_budgets']) ? $data['managers_can_edit_roster_budgets'] : null; - $this->container['budget_warning_percent'] = isset($data['budget_warning_percent']) ? $data['budget_warning_percent'] : null; - $this->container['budget_entry_method'] = isset($data['budget_entry_method']) ? $data['budget_entry_method'] : null; - $this->container['address_line1'] = isset($data['address_line1']) ? $data['address_line1'] : null; - $this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null; - $this->container['post_code'] = isset($data['post_code']) ? $data['post_code'] : null; - $this->container['white_label_name'] = isset($data['white_label_name']) ? $data['white_label_name'] : null; - $this->container['white_label_id'] = isset($data['white_label_id']) ? $data['white_label_id'] : null; - $this->container['promo_code'] = isset($data['promo_code']) ? $data['promo_code'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['leave_accrual_start_date_type'] = isset($data['leave_accrual_start_date_type']) ? $data['leave_accrual_start_date_type'] : null; - $this->container['leave_year_start'] = isset($data['leave_year_start']) ? $data['leave_year_start'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['number_of_employees'] = isset($data['number_of_employees']) ? $data['number_of_employees'] : null; - $this->container['industry_name'] = isset($data['industry_name']) ? $data['industry_name'] : null; - $this->container['pay_cycle_frequency'] = isset($data['pay_cycle_frequency']) ? $data['pay_cycle_frequency'] : null; + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('suburb', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('management_software_id', $data ?? [], null); + $this->setIfExists('sbr_software_provider', $data ?? [], null); + $this->setIfExists('sbr_software_id', $data ?? [], null); + $this->setIfExists('is_foreign_entity', $data ?? [], null); + $this->setIfExists('foreign_entity_country', $data ?? [], null); + $this->setIfExists('default_super_rate', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('legal_name', $data ?? [], null); + $this->setIfExists('contact_name', $data ?? [], null); + $this->setIfExists('contact_email_address', $data ?? [], null); + $this->setIfExists('contact_phone_number', $data ?? [], null); + $this->setIfExists('contact_fax_number', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('standard_hours_per_day', $data ?? [], null); + $this->setIfExists('journal_service', $data ?? [], null); + $this->setIfExists('end_of_week', $data ?? [], null); + $this->setIfExists('initial_financial_year_start', $data ?? [], null); + $this->setIfExists('managers_can_edit_roster_budgets', $data ?? [], null); + $this->setIfExists('budget_warning_percent', $data ?? [], null); + $this->setIfExists('budget_entry_method', $data ?? [], null); + $this->setIfExists('address_line1', $data ?? [], null); + $this->setIfExists('address_line2', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('white_label_name', $data ?? [], null); + $this->setIfExists('white_label_id', $data ?? [], null); + $this->setIfExists('promo_code', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('leave_accrual_start_date_type', $data ?? [], null); + $this->setIfExists('leave_year_start', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('number_of_employees', $data ?? [], null); + $this->setIfExists('industry_name', $data ?? [], null); + $this->setIfExists('pay_cycle_frequency', $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; } /** @@ -682,7 +804,8 @@ public function listInvalidProperties() $allowedValues = $this->getEndOfWeekAllowableValues(); if (!is_null($this->container['end_of_week']) && !in_array($this->container['end_of_week'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'end_of_week', must be one of '%s'", + "invalid value '%s' for 'end_of_week', must be one of '%s'", + $this->container['end_of_week'], implode("', '", $allowedValues) ); } @@ -690,7 +813,8 @@ public function listInvalidProperties() $allowedValues = $this->getBudgetEntryMethodAllowableValues(); if (!is_null($this->container['budget_entry_method']) && !in_array($this->container['budget_entry_method'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'budget_entry_method', must be one of '%s'", + "invalid value '%s' for 'budget_entry_method', must be one of '%s'", + $this->container['budget_entry_method'], implode("', '", $allowedValues) ); } @@ -698,7 +822,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); if (!is_null($this->container['leave_accrual_start_date_type']) && !in_array($this->container['leave_accrual_start_date_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $this->container['leave_accrual_start_date_type'], implode("', '", $allowedValues) ); } @@ -706,7 +831,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -714,7 +840,8 @@ public function listInvalidProperties() $allowedValues = $this->getNumberOfEmployeesAllowableValues(); if (!is_null($this->container['number_of_employees']) && !in_array($this->container['number_of_employees'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'number_of_employees', must be one of '%s'", + "invalid value '%s' for 'number_of_employees', must be one of '%s'", + $this->container['number_of_employees'], implode("', '", $allowedValues) ); } @@ -722,7 +849,8 @@ public function listInvalidProperties() $allowedValues = $this->getPayCycleFrequencyAllowableValues(); if (!is_null($this->container['pay_cycle_frequency']) && !in_array($this->container['pay_cycle_frequency'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'pay_cycle_frequency', must be one of '%s'", + "invalid value '%s' for 'pay_cycle_frequency', must be one of '%s'", + $this->container['pay_cycle_frequency'], implode("', '", $allowedValues) ); } @@ -745,7 +873,7 @@ public function valid() /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -755,12 +883,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -769,7 +900,7 @@ public function setAbn($abn) /** * Gets suburb * - * @return string + * @return string|null */ public function getSuburb() { @@ -779,12 +910,15 @@ public function getSuburb() /** * Sets suburb * - * @param string $suburb + * @param string|null $suburb * - * @return $this + * @return self */ public function setSuburb($suburb) { + if (is_null($suburb)) { + throw new \InvalidArgumentException('non-nullable suburb cannot be null'); + } $this->container['suburb'] = $suburb; return $this; @@ -793,7 +927,7 @@ public function setSuburb($suburb) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -803,12 +937,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -817,7 +954,7 @@ public function setState($state) /** * Gets management_software_id * - * @return string + * @return string|null */ public function getManagementSoftwareId() { @@ -827,12 +964,15 @@ public function getManagementSoftwareId() /** * Sets management_software_id * - * @param string $management_software_id + * @param string|null $management_software_id * - * @return $this + * @return self */ public function setManagementSoftwareId($management_software_id) { + if (is_null($management_software_id)) { + throw new \InvalidArgumentException('non-nullable management_software_id cannot be null'); + } $this->container['management_software_id'] = $management_software_id; return $this; @@ -841,7 +981,7 @@ public function setManagementSoftwareId($management_software_id) /** * Gets sbr_software_provider * - * @return string + * @return string|null */ public function getSbrSoftwareProvider() { @@ -851,12 +991,15 @@ public function getSbrSoftwareProvider() /** * Sets sbr_software_provider * - * @param string $sbr_software_provider + * @param string|null $sbr_software_provider * - * @return $this + * @return self */ public function setSbrSoftwareProvider($sbr_software_provider) { + if (is_null($sbr_software_provider)) { + throw new \InvalidArgumentException('non-nullable sbr_software_provider cannot be null'); + } $this->container['sbr_software_provider'] = $sbr_software_provider; return $this; @@ -865,7 +1008,7 @@ public function setSbrSoftwareProvider($sbr_software_provider) /** * Gets sbr_software_id * - * @return string + * @return string|null */ public function getSbrSoftwareId() { @@ -875,12 +1018,15 @@ public function getSbrSoftwareId() /** * Sets sbr_software_id * - * @param string $sbr_software_id + * @param string|null $sbr_software_id * - * @return $this + * @return self */ public function setSbrSoftwareId($sbr_software_id) { + if (is_null($sbr_software_id)) { + throw new \InvalidArgumentException('non-nullable sbr_software_id cannot be null'); + } $this->container['sbr_software_id'] = $sbr_software_id; return $this; @@ -889,7 +1035,7 @@ public function setSbrSoftwareId($sbr_software_id) /** * Gets is_foreign_entity * - * @return bool + * @return bool|null */ public function getIsForeignEntity() { @@ -899,12 +1045,15 @@ public function getIsForeignEntity() /** * Sets is_foreign_entity * - * @param bool $is_foreign_entity + * @param bool|null $is_foreign_entity * - * @return $this + * @return self */ public function setIsForeignEntity($is_foreign_entity) { + if (is_null($is_foreign_entity)) { + throw new \InvalidArgumentException('non-nullable is_foreign_entity cannot be null'); + } $this->container['is_foreign_entity'] = $is_foreign_entity; return $this; @@ -913,7 +1062,7 @@ public function setIsForeignEntity($is_foreign_entity) /** * Gets foreign_entity_country * - * @return string + * @return string|null */ public function getForeignEntityCountry() { @@ -923,12 +1072,15 @@ public function getForeignEntityCountry() /** * Sets foreign_entity_country * - * @param string $foreign_entity_country + * @param string|null $foreign_entity_country * - * @return $this + * @return self */ public function setForeignEntityCountry($foreign_entity_country) { + if (is_null($foreign_entity_country)) { + throw new \InvalidArgumentException('non-nullable foreign_entity_country cannot be null'); + } $this->container['foreign_entity_country'] = $foreign_entity_country; return $this; @@ -937,7 +1089,7 @@ public function setForeignEntityCountry($foreign_entity_country) /** * Gets default_super_rate * - * @return double + * @return float|null */ public function getDefaultSuperRate() { @@ -947,12 +1099,15 @@ public function getDefaultSuperRate() /** * Sets default_super_rate * - * @param double $default_super_rate + * @param float|null $default_super_rate * - * @return $this + * @return self */ public function setDefaultSuperRate($default_super_rate) { + if (is_null($default_super_rate)) { + throw new \InvalidArgumentException('non-nullable default_super_rate cannot be null'); + } $this->container['default_super_rate'] = $default_super_rate; return $this; @@ -961,7 +1116,7 @@ public function setDefaultSuperRate($default_super_rate) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -971,12 +1126,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -985,7 +1143,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -995,12 +1153,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -1009,7 +1170,7 @@ public function setName($name) /** * Gets region * - * @return string + * @return string|null */ public function getRegion() { @@ -1019,12 +1180,15 @@ public function getRegion() /** * Sets region * - * @param string $region + * @param string|null $region * - * @return $this + * @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; @@ -1033,7 +1197,7 @@ public function setRegion($region) /** * Gets legal_name * - * @return string + * @return string|null */ public function getLegalName() { @@ -1043,12 +1207,15 @@ public function getLegalName() /** * Sets legal_name * - * @param string $legal_name + * @param string|null $legal_name * - * @return $this + * @return self */ public function setLegalName($legal_name) { + if (is_null($legal_name)) { + throw new \InvalidArgumentException('non-nullable legal_name cannot be null'); + } $this->container['legal_name'] = $legal_name; return $this; @@ -1057,7 +1224,7 @@ public function setLegalName($legal_name) /** * Gets contact_name * - * @return string + * @return string|null */ public function getContactName() { @@ -1067,12 +1234,15 @@ public function getContactName() /** * Sets contact_name * - * @param string $contact_name + * @param string|null $contact_name * - * @return $this + * @return self */ public function setContactName($contact_name) { + if (is_null($contact_name)) { + throw new \InvalidArgumentException('non-nullable contact_name cannot be null'); + } $this->container['contact_name'] = $contact_name; return $this; @@ -1081,7 +1251,7 @@ public function setContactName($contact_name) /** * Gets contact_email_address * - * @return string + * @return string|null */ public function getContactEmailAddress() { @@ -1091,12 +1261,15 @@ public function getContactEmailAddress() /** * Sets contact_email_address * - * @param string $contact_email_address + * @param string|null $contact_email_address * - * @return $this + * @return self */ public function setContactEmailAddress($contact_email_address) { + if (is_null($contact_email_address)) { + throw new \InvalidArgumentException('non-nullable contact_email_address cannot be null'); + } $this->container['contact_email_address'] = $contact_email_address; return $this; @@ -1105,7 +1278,7 @@ public function setContactEmailAddress($contact_email_address) /** * Gets contact_phone_number * - * @return string + * @return string|null */ public function getContactPhoneNumber() { @@ -1115,12 +1288,15 @@ public function getContactPhoneNumber() /** * Sets contact_phone_number * - * @param string $contact_phone_number + * @param string|null $contact_phone_number * - * @return $this + * @return self */ public function setContactPhoneNumber($contact_phone_number) { + if (is_null($contact_phone_number)) { + throw new \InvalidArgumentException('non-nullable contact_phone_number cannot be null'); + } $this->container['contact_phone_number'] = $contact_phone_number; return $this; @@ -1129,7 +1305,7 @@ public function setContactPhoneNumber($contact_phone_number) /** * Gets contact_fax_number * - * @return string + * @return string|null */ public function getContactFaxNumber() { @@ -1139,12 +1315,15 @@ public function getContactFaxNumber() /** * Sets contact_fax_number * - * @param string $contact_fax_number + * @param string|null $contact_fax_number * - * @return $this + * @return self */ public function setContactFaxNumber($contact_fax_number) { + if (is_null($contact_fax_number)) { + throw new \InvalidArgumentException('non-nullable contact_fax_number cannot be null'); + } $this->container['contact_fax_number'] = $contact_fax_number; return $this; @@ -1153,7 +1332,7 @@ public function setContactFaxNumber($contact_fax_number) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -1163,12 +1342,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -1177,7 +1359,7 @@ public function setExternalId($external_id) /** * Gets standard_hours_per_day * - * @return double + * @return float|null */ public function getStandardHoursPerDay() { @@ -1187,12 +1369,15 @@ public function getStandardHoursPerDay() /** * Sets standard_hours_per_day * - * @param double $standard_hours_per_day + * @param float|null $standard_hours_per_day * - * @return $this + * @return self */ public function setStandardHoursPerDay($standard_hours_per_day) { + if (is_null($standard_hours_per_day)) { + throw new \InvalidArgumentException('non-nullable standard_hours_per_day cannot be null'); + } $this->container['standard_hours_per_day'] = $standard_hours_per_day; return $this; @@ -1201,7 +1386,7 @@ public function setStandardHoursPerDay($standard_hours_per_day) /** * Gets journal_service * - * @return string + * @return string|null */ public function getJournalService() { @@ -1211,12 +1396,15 @@ public function getJournalService() /** * Sets journal_service * - * @param string $journal_service + * @param string|null $journal_service * - * @return $this + * @return self */ public function setJournalService($journal_service) { + if (is_null($journal_service)) { + throw new \InvalidArgumentException('non-nullable journal_service cannot be null'); + } $this->container['journal_service'] = $journal_service; return $this; @@ -1225,7 +1413,7 @@ public function setJournalService($journal_service) /** * Gets end_of_week * - * @return string + * @return string|null */ public function getEndOfWeek() { @@ -1235,17 +1423,21 @@ public function getEndOfWeek() /** * Sets end_of_week * - * @param string $end_of_week + * @param string|null $end_of_week * - * @return $this + * @return self */ public function setEndOfWeek($end_of_week) { + if (is_null($end_of_week)) { + throw new \InvalidArgumentException('non-nullable end_of_week cannot be null'); + } $allowedValues = $this->getEndOfWeekAllowableValues(); - if (!is_null($end_of_week) && !in_array($end_of_week, $allowedValues, true)) { + if (!in_array($end_of_week, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'end_of_week', must be one of '%s'", + "Invalid value '%s' for 'end_of_week', must be one of '%s'", + $end_of_week, implode("', '", $allowedValues) ) ); @@ -1258,7 +1450,7 @@ public function setEndOfWeek($end_of_week) /** * Gets initial_financial_year_start * - * @return int + * @return int|null */ public function getInitialFinancialYearStart() { @@ -1268,12 +1460,15 @@ public function getInitialFinancialYearStart() /** * Sets initial_financial_year_start * - * @param int $initial_financial_year_start + * @param int|null $initial_financial_year_start * - * @return $this + * @return self */ public function setInitialFinancialYearStart($initial_financial_year_start) { + if (is_null($initial_financial_year_start)) { + throw new \InvalidArgumentException('non-nullable initial_financial_year_start cannot be null'); + } $this->container['initial_financial_year_start'] = $initial_financial_year_start; return $this; @@ -1282,7 +1477,7 @@ public function setInitialFinancialYearStart($initial_financial_year_start) /** * Gets managers_can_edit_roster_budgets * - * @return bool + * @return bool|null */ public function getManagersCanEditRosterBudgets() { @@ -1292,12 +1487,15 @@ public function getManagersCanEditRosterBudgets() /** * Sets managers_can_edit_roster_budgets * - * @param bool $managers_can_edit_roster_budgets + * @param bool|null $managers_can_edit_roster_budgets * - * @return $this + * @return self */ public function setManagersCanEditRosterBudgets($managers_can_edit_roster_budgets) { + if (is_null($managers_can_edit_roster_budgets)) { + throw new \InvalidArgumentException('non-nullable managers_can_edit_roster_budgets cannot be null'); + } $this->container['managers_can_edit_roster_budgets'] = $managers_can_edit_roster_budgets; return $this; @@ -1306,7 +1504,7 @@ public function setManagersCanEditRosterBudgets($managers_can_edit_roster_budget /** * Gets budget_warning_percent * - * @return double + * @return float|null */ public function getBudgetWarningPercent() { @@ -1316,12 +1514,15 @@ public function getBudgetWarningPercent() /** * Sets budget_warning_percent * - * @param double $budget_warning_percent + * @param float|null $budget_warning_percent * - * @return $this + * @return self */ public function setBudgetWarningPercent($budget_warning_percent) { + if (is_null($budget_warning_percent)) { + throw new \InvalidArgumentException('non-nullable budget_warning_percent cannot be null'); + } $this->container['budget_warning_percent'] = $budget_warning_percent; return $this; @@ -1330,7 +1531,7 @@ public function setBudgetWarningPercent($budget_warning_percent) /** * Gets budget_entry_method * - * @return string + * @return string|null */ public function getBudgetEntryMethod() { @@ -1340,17 +1541,21 @@ public function getBudgetEntryMethod() /** * Sets budget_entry_method * - * @param string $budget_entry_method + * @param string|null $budget_entry_method * - * @return $this + * @return self */ public function setBudgetEntryMethod($budget_entry_method) { + if (is_null($budget_entry_method)) { + throw new \InvalidArgumentException('non-nullable budget_entry_method cannot be null'); + } $allowedValues = $this->getBudgetEntryMethodAllowableValues(); - if (!is_null($budget_entry_method) && !in_array($budget_entry_method, $allowedValues, true)) { + if (!in_array($budget_entry_method, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'budget_entry_method', must be one of '%s'", + "Invalid value '%s' for 'budget_entry_method', must be one of '%s'", + $budget_entry_method, implode("', '", $allowedValues) ) ); @@ -1363,7 +1568,7 @@ public function setBudgetEntryMethod($budget_entry_method) /** * Gets address_line1 * - * @return string + * @return string|null */ public function getAddressLine1() { @@ -1373,12 +1578,15 @@ public function getAddressLine1() /** * Sets address_line1 * - * @param string $address_line1 + * @param string|null $address_line1 * - * @return $this + * @return self */ public function setAddressLine1($address_line1) { + if (is_null($address_line1)) { + throw new \InvalidArgumentException('non-nullable address_line1 cannot be null'); + } $this->container['address_line1'] = $address_line1; return $this; @@ -1387,7 +1595,7 @@ public function setAddressLine1($address_line1) /** * Gets address_line2 * - * @return string + * @return string|null */ public function getAddressLine2() { @@ -1397,12 +1605,15 @@ public function getAddressLine2() /** * Sets address_line2 * - * @param string $address_line2 + * @param string|null $address_line2 * - * @return $this + * @return self */ public function setAddressLine2($address_line2) { + if (is_null($address_line2)) { + throw new \InvalidArgumentException('non-nullable address_line2 cannot be null'); + } $this->container['address_line2'] = $address_line2; return $this; @@ -1411,7 +1622,7 @@ public function setAddressLine2($address_line2) /** * Gets post_code * - * @return string + * @return string|null */ public function getPostCode() { @@ -1421,12 +1632,15 @@ public function getPostCode() /** * Sets post_code * - * @param string $post_code + * @param string|null $post_code * - * @return $this + * @return self */ public function setPostCode($post_code) { + if (is_null($post_code)) { + throw new \InvalidArgumentException('non-nullable post_code cannot be null'); + } $this->container['post_code'] = $post_code; return $this; @@ -1435,7 +1649,7 @@ public function setPostCode($post_code) /** * Gets white_label_name * - * @return string + * @return string|null */ public function getWhiteLabelName() { @@ -1445,12 +1659,15 @@ public function getWhiteLabelName() /** * Sets white_label_name * - * @param string $white_label_name + * @param string|null $white_label_name * - * @return $this + * @return self */ public function setWhiteLabelName($white_label_name) { + if (is_null($white_label_name)) { + throw new \InvalidArgumentException('non-nullable white_label_name cannot be null'); + } $this->container['white_label_name'] = $white_label_name; return $this; @@ -1459,7 +1676,7 @@ public function setWhiteLabelName($white_label_name) /** * Gets white_label_id * - * @return int + * @return int|null */ public function getWhiteLabelId() { @@ -1469,12 +1686,15 @@ public function getWhiteLabelId() /** * Sets white_label_id * - * @param int $white_label_id + * @param int|null $white_label_id * - * @return $this + * @return self */ public function setWhiteLabelId($white_label_id) { + if (is_null($white_label_id)) { + throw new \InvalidArgumentException('non-nullable white_label_id cannot be null'); + } $this->container['white_label_id'] = $white_label_id; return $this; @@ -1483,7 +1703,7 @@ public function setWhiteLabelId($white_label_id) /** * Gets promo_code * - * @return string + * @return string|null */ public function getPromoCode() { @@ -1493,12 +1713,15 @@ public function getPromoCode() /** * Sets promo_code * - * @param string $promo_code + * @param string|null $promo_code * - * @return $this + * @return self */ public function setPromoCode($promo_code) { + if (is_null($promo_code)) { + throw new \InvalidArgumentException('non-nullable promo_code cannot be null'); + } $this->container['promo_code'] = $promo_code; return $this; @@ -1507,7 +1730,7 @@ public function setPromoCode($promo_code) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -1517,12 +1740,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -1531,7 +1757,7 @@ public function setDateCreated($date_created) /** * Gets leave_accrual_start_date_type * - * @return string + * @return string|null */ public function getLeaveAccrualStartDateType() { @@ -1541,17 +1767,21 @@ public function getLeaveAccrualStartDateType() /** * Sets leave_accrual_start_date_type * - * @param string $leave_accrual_start_date_type + * @param string|null $leave_accrual_start_date_type * - * @return $this + * @return self */ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) { + if (is_null($leave_accrual_start_date_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_start_date_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); - if (!is_null($leave_accrual_start_date_type) && !in_array($leave_accrual_start_date_type, $allowedValues, true)) { + if (!in_array($leave_accrual_start_date_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $leave_accrual_start_date_type, implode("', '", $allowedValues) ) ); @@ -1564,7 +1794,7 @@ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) /** * Gets leave_year_start * - * @return \DateTime + * @return \DateTime|null */ public function getLeaveYearStart() { @@ -1574,12 +1804,15 @@ public function getLeaveYearStart() /** * Sets leave_year_start * - * @param \DateTime $leave_year_start + * @param \DateTime|null $leave_year_start * - * @return $this + * @return self */ public function setLeaveYearStart($leave_year_start) { + if (is_null($leave_year_start)) { + throw new \InvalidArgumentException('non-nullable leave_year_start cannot be null'); + } $this->container['leave_year_start'] = $leave_year_start; return $this; @@ -1588,7 +1821,7 @@ public function setLeaveYearStart($leave_year_start) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -1598,17 +1831,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -1621,7 +1858,7 @@ public function setSource($source) /** * Gets number_of_employees * - * @return string + * @return string|null */ public function getNumberOfEmployees() { @@ -1631,17 +1868,21 @@ public function getNumberOfEmployees() /** * Sets number_of_employees * - * @param string $number_of_employees + * @param string|null $number_of_employees * - * @return $this + * @return self */ public function setNumberOfEmployees($number_of_employees) { + if (is_null($number_of_employees)) { + throw new \InvalidArgumentException('non-nullable number_of_employees cannot be null'); + } $allowedValues = $this->getNumberOfEmployeesAllowableValues(); - if (!is_null($number_of_employees) && !in_array($number_of_employees, $allowedValues, true)) { + if (!in_array($number_of_employees, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'number_of_employees', must be one of '%s'", + "Invalid value '%s' for 'number_of_employees', must be one of '%s'", + $number_of_employees, implode("', '", $allowedValues) ) ); @@ -1654,7 +1895,7 @@ public function setNumberOfEmployees($number_of_employees) /** * Gets industry_name * - * @return string + * @return string|null */ public function getIndustryName() { @@ -1664,12 +1905,15 @@ public function getIndustryName() /** * Sets industry_name * - * @param string $industry_name + * @param string|null $industry_name * - * @return $this + * @return self */ public function setIndustryName($industry_name) { + if (is_null($industry_name)) { + throw new \InvalidArgumentException('non-nullable industry_name cannot be null'); + } $this->container['industry_name'] = $industry_name; return $this; @@ -1678,7 +1922,7 @@ public function setIndustryName($industry_name) /** * Gets pay_cycle_frequency * - * @return string + * @return string|null */ public function getPayCycleFrequency() { @@ -1688,17 +1932,21 @@ public function getPayCycleFrequency() /** * Sets pay_cycle_frequency * - * @param string $pay_cycle_frequency + * @param string|null $pay_cycle_frequency * - * @return $this + * @return self */ public function setPayCycleFrequency($pay_cycle_frequency) { + if (is_null($pay_cycle_frequency)) { + throw new \InvalidArgumentException('non-nullable pay_cycle_frequency cannot be null'); + } $allowedValues = $this->getPayCycleFrequencyAllowableValues(); - if (!is_null($pay_cycle_frequency) && !in_array($pay_cycle_frequency, $allowedValues, true)) { + if (!in_array($pay_cycle_frequency, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'pay_cycle_frequency', must be one of '%s'", + "Invalid value '%s' for 'pay_cycle_frequency', must be one of '%s'", + $pay_cycle_frequency, implode("', '", $allowedValues) ) ); @@ -1714,7 +1962,7 @@ public function setPayCycleFrequency($pay_cycle_frequency) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1724,22 +1972,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1755,11 +2004,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1767,13 +2029,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuBusinessTimesheetSettingsModel.php b/src/lib/Model/AuBusinessTimesheetSettingsModel.php index 84bb4d6..b685a90 100644 --- a/src/lib/Model/AuBusinessTimesheetSettingsModel.php +++ b/src/lib/Model/AuBusinessTimesheetSettingsModel.php @@ -2,61 +2,61 @@ /** * AuBusinessTimesheetSettingsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuBusinessTimesheetSettingsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuBusinessTimesheetSettingsModel implements ModelInterface, ArrayAccess +class AuBusinessTimesheetSettingsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuBusinessTimesheetSettingsModel'; + protected static $openAPIModelName = 'AuBusinessTimesheetSettingsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'allow_to_select_higher_classification' => 'bool', 'require_start_and_stop_times' => 'bool', 'require_work_type' => 'bool', @@ -76,8 +76,10 @@ class AuBusinessTimesheetSettingsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'allow_to_select_higher_classification' => null, 'require_start_and_stop_times' => null, 'require_work_type' => null, @@ -93,14 +95,42 @@ class AuBusinessTimesheetSettingsModel implements ModelInterface, ArrayAccess 'maximum_paid_break_duration' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'allow_to_select_higher_classification' => false, + 'require_start_and_stop_times' => false, + 'require_work_type' => false, + 'can_set_require_work_type_setting' => false, + 'require_location' => false, + 'include_all_timesheet_notes_in_pay_run' => false, + 'timesheet_rejection_notifications' => false, + 'managers_can_create_timesheets_for_employees_that_are_not_enabled' => false, + 'timesheets_enabled' => false, + 'approve_if_matches_roster_shift' => false, + 'allow_paid_breaks' => false, + 'has_maximum_paid_break_duration' => false, + 'maximum_paid_break_duration' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -215,12 +297,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -237,19 +316,37 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['allow_to_select_higher_classification'] = isset($data['allow_to_select_higher_classification']) ? $data['allow_to_select_higher_classification'] : null; - $this->container['require_start_and_stop_times'] = isset($data['require_start_and_stop_times']) ? $data['require_start_and_stop_times'] : null; - $this->container['require_work_type'] = isset($data['require_work_type']) ? $data['require_work_type'] : null; - $this->container['can_set_require_work_type_setting'] = isset($data['can_set_require_work_type_setting']) ? $data['can_set_require_work_type_setting'] : null; - $this->container['require_location'] = isset($data['require_location']) ? $data['require_location'] : null; - $this->container['include_all_timesheet_notes_in_pay_run'] = isset($data['include_all_timesheet_notes_in_pay_run']) ? $data['include_all_timesheet_notes_in_pay_run'] : null; - $this->container['timesheet_rejection_notifications'] = isset($data['timesheet_rejection_notifications']) ? $data['timesheet_rejection_notifications'] : null; - $this->container['managers_can_create_timesheets_for_employees_that_are_not_enabled'] = isset($data['managers_can_create_timesheets_for_employees_that_are_not_enabled']) ? $data['managers_can_create_timesheets_for_employees_that_are_not_enabled'] : null; - $this->container['timesheets_enabled'] = isset($data['timesheets_enabled']) ? $data['timesheets_enabled'] : null; - $this->container['approve_if_matches_roster_shift'] = isset($data['approve_if_matches_roster_shift']) ? $data['approve_if_matches_roster_shift'] : null; - $this->container['allow_paid_breaks'] = isset($data['allow_paid_breaks']) ? $data['allow_paid_breaks'] : null; - $this->container['has_maximum_paid_break_duration'] = isset($data['has_maximum_paid_break_duration']) ? $data['has_maximum_paid_break_duration'] : null; - $this->container['maximum_paid_break_duration'] = isset($data['maximum_paid_break_duration']) ? $data['maximum_paid_break_duration'] : null; + $this->setIfExists('allow_to_select_higher_classification', $data ?? [], null); + $this->setIfExists('require_start_and_stop_times', $data ?? [], null); + $this->setIfExists('require_work_type', $data ?? [], null); + $this->setIfExists('can_set_require_work_type_setting', $data ?? [], null); + $this->setIfExists('require_location', $data ?? [], null); + $this->setIfExists('include_all_timesheet_notes_in_pay_run', $data ?? [], null); + $this->setIfExists('timesheet_rejection_notifications', $data ?? [], null); + $this->setIfExists('managers_can_create_timesheets_for_employees_that_are_not_enabled', $data ?? [], null); + $this->setIfExists('timesheets_enabled', $data ?? [], null); + $this->setIfExists('approve_if_matches_roster_shift', $data ?? [], null); + $this->setIfExists('allow_paid_breaks', $data ?? [], null); + $this->setIfExists('has_maximum_paid_break_duration', $data ?? [], null); + $this->setIfExists('maximum_paid_break_duration', $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; } /** @@ -279,7 +376,7 @@ public function valid() /** * Gets allow_to_select_higher_classification * - * @return bool + * @return bool|null */ public function getAllowToSelectHigherClassification() { @@ -289,12 +386,15 @@ public function getAllowToSelectHigherClassification() /** * Sets allow_to_select_higher_classification * - * @param bool $allow_to_select_higher_classification + * @param bool|null $allow_to_select_higher_classification * - * @return $this + * @return self */ public function setAllowToSelectHigherClassification($allow_to_select_higher_classification) { + if (is_null($allow_to_select_higher_classification)) { + throw new \InvalidArgumentException('non-nullable allow_to_select_higher_classification cannot be null'); + } $this->container['allow_to_select_higher_classification'] = $allow_to_select_higher_classification; return $this; @@ -303,7 +403,7 @@ public function setAllowToSelectHigherClassification($allow_to_select_higher_cla /** * Gets require_start_and_stop_times * - * @return bool + * @return bool|null */ public function getRequireStartAndStopTimes() { @@ -313,12 +413,15 @@ public function getRequireStartAndStopTimes() /** * Sets require_start_and_stop_times * - * @param bool $require_start_and_stop_times + * @param bool|null $require_start_and_stop_times * - * @return $this + * @return self */ public function setRequireStartAndStopTimes($require_start_and_stop_times) { + if (is_null($require_start_and_stop_times)) { + throw new \InvalidArgumentException('non-nullable require_start_and_stop_times cannot be null'); + } $this->container['require_start_and_stop_times'] = $require_start_and_stop_times; return $this; @@ -327,7 +430,7 @@ public function setRequireStartAndStopTimes($require_start_and_stop_times) /** * Gets require_work_type * - * @return bool + * @return bool|null */ public function getRequireWorkType() { @@ -337,12 +440,15 @@ public function getRequireWorkType() /** * Sets require_work_type * - * @param bool $require_work_type + * @param bool|null $require_work_type * - * @return $this + * @return self */ public function setRequireWorkType($require_work_type) { + if (is_null($require_work_type)) { + throw new \InvalidArgumentException('non-nullable require_work_type cannot be null'); + } $this->container['require_work_type'] = $require_work_type; return $this; @@ -351,7 +457,7 @@ public function setRequireWorkType($require_work_type) /** * Gets can_set_require_work_type_setting * - * @return bool + * @return bool|null */ public function getCanSetRequireWorkTypeSetting() { @@ -361,12 +467,15 @@ public function getCanSetRequireWorkTypeSetting() /** * Sets can_set_require_work_type_setting * - * @param bool $can_set_require_work_type_setting + * @param bool|null $can_set_require_work_type_setting * - * @return $this + * @return self */ public function setCanSetRequireWorkTypeSetting($can_set_require_work_type_setting) { + if (is_null($can_set_require_work_type_setting)) { + throw new \InvalidArgumentException('non-nullable can_set_require_work_type_setting cannot be null'); + } $this->container['can_set_require_work_type_setting'] = $can_set_require_work_type_setting; return $this; @@ -375,7 +484,7 @@ public function setCanSetRequireWorkTypeSetting($can_set_require_work_type_setti /** * Gets require_location * - * @return bool + * @return bool|null */ public function getRequireLocation() { @@ -385,12 +494,15 @@ public function getRequireLocation() /** * Sets require_location * - * @param bool $require_location + * @param bool|null $require_location * - * @return $this + * @return self */ public function setRequireLocation($require_location) { + if (is_null($require_location)) { + throw new \InvalidArgumentException('non-nullable require_location cannot be null'); + } $this->container['require_location'] = $require_location; return $this; @@ -399,7 +511,7 @@ public function setRequireLocation($require_location) /** * Gets include_all_timesheet_notes_in_pay_run * - * @return bool + * @return bool|null */ public function getIncludeAllTimesheetNotesInPayRun() { @@ -409,12 +521,15 @@ public function getIncludeAllTimesheetNotesInPayRun() /** * Sets include_all_timesheet_notes_in_pay_run * - * @param bool $include_all_timesheet_notes_in_pay_run + * @param bool|null $include_all_timesheet_notes_in_pay_run * - * @return $this + * @return self */ public function setIncludeAllTimesheetNotesInPayRun($include_all_timesheet_notes_in_pay_run) { + if (is_null($include_all_timesheet_notes_in_pay_run)) { + throw new \InvalidArgumentException('non-nullable include_all_timesheet_notes_in_pay_run cannot be null'); + } $this->container['include_all_timesheet_notes_in_pay_run'] = $include_all_timesheet_notes_in_pay_run; return $this; @@ -423,7 +538,7 @@ public function setIncludeAllTimesheetNotesInPayRun($include_all_timesheet_notes /** * Gets timesheet_rejection_notifications * - * @return bool + * @return bool|null */ public function getTimesheetRejectionNotifications() { @@ -433,12 +548,15 @@ public function getTimesheetRejectionNotifications() /** * Sets timesheet_rejection_notifications * - * @param bool $timesheet_rejection_notifications + * @param bool|null $timesheet_rejection_notifications * - * @return $this + * @return self */ public function setTimesheetRejectionNotifications($timesheet_rejection_notifications) { + if (is_null($timesheet_rejection_notifications)) { + throw new \InvalidArgumentException('non-nullable timesheet_rejection_notifications cannot be null'); + } $this->container['timesheet_rejection_notifications'] = $timesheet_rejection_notifications; return $this; @@ -447,7 +565,7 @@ public function setTimesheetRejectionNotifications($timesheet_rejection_notifica /** * Gets managers_can_create_timesheets_for_employees_that_are_not_enabled * - * @return bool + * @return bool|null */ public function getManagersCanCreateTimesheetsForEmployeesThatAreNotEnabled() { @@ -457,12 +575,15 @@ public function getManagersCanCreateTimesheetsForEmployeesThatAreNotEnabled() /** * Sets managers_can_create_timesheets_for_employees_that_are_not_enabled * - * @param bool $managers_can_create_timesheets_for_employees_that_are_not_enabled + * @param bool|null $managers_can_create_timesheets_for_employees_that_are_not_enabled * - * @return $this + * @return self */ public function setManagersCanCreateTimesheetsForEmployeesThatAreNotEnabled($managers_can_create_timesheets_for_employees_that_are_not_enabled) { + if (is_null($managers_can_create_timesheets_for_employees_that_are_not_enabled)) { + throw new \InvalidArgumentException('non-nullable managers_can_create_timesheets_for_employees_that_are_not_enabled cannot be null'); + } $this->container['managers_can_create_timesheets_for_employees_that_are_not_enabled'] = $managers_can_create_timesheets_for_employees_that_are_not_enabled; return $this; @@ -471,7 +592,7 @@ public function setManagersCanCreateTimesheetsForEmployeesThatAreNotEnabled($man /** * Gets timesheets_enabled * - * @return bool + * @return bool|null */ public function getTimesheetsEnabled() { @@ -481,12 +602,15 @@ public function getTimesheetsEnabled() /** * Sets timesheets_enabled * - * @param bool $timesheets_enabled + * @param bool|null $timesheets_enabled * - * @return $this + * @return self */ public function setTimesheetsEnabled($timesheets_enabled) { + if (is_null($timesheets_enabled)) { + throw new \InvalidArgumentException('non-nullable timesheets_enabled cannot be null'); + } $this->container['timesheets_enabled'] = $timesheets_enabled; return $this; @@ -495,7 +619,7 @@ public function setTimesheetsEnabled($timesheets_enabled) /** * Gets approve_if_matches_roster_shift * - * @return bool + * @return bool|null */ public function getApproveIfMatchesRosterShift() { @@ -505,12 +629,15 @@ public function getApproveIfMatchesRosterShift() /** * Sets approve_if_matches_roster_shift * - * @param bool $approve_if_matches_roster_shift + * @param bool|null $approve_if_matches_roster_shift * - * @return $this + * @return self */ public function setApproveIfMatchesRosterShift($approve_if_matches_roster_shift) { + if (is_null($approve_if_matches_roster_shift)) { + throw new \InvalidArgumentException('non-nullable approve_if_matches_roster_shift cannot be null'); + } $this->container['approve_if_matches_roster_shift'] = $approve_if_matches_roster_shift; return $this; @@ -519,7 +646,7 @@ public function setApproveIfMatchesRosterShift($approve_if_matches_roster_shift) /** * Gets allow_paid_breaks * - * @return bool + * @return bool|null */ public function getAllowPaidBreaks() { @@ -529,12 +656,15 @@ public function getAllowPaidBreaks() /** * Sets allow_paid_breaks * - * @param bool $allow_paid_breaks + * @param bool|null $allow_paid_breaks * - * @return $this + * @return self */ public function setAllowPaidBreaks($allow_paid_breaks) { + if (is_null($allow_paid_breaks)) { + throw new \InvalidArgumentException('non-nullable allow_paid_breaks cannot be null'); + } $this->container['allow_paid_breaks'] = $allow_paid_breaks; return $this; @@ -543,7 +673,7 @@ public function setAllowPaidBreaks($allow_paid_breaks) /** * Gets has_maximum_paid_break_duration * - * @return bool + * @return bool|null */ public function getHasMaximumPaidBreakDuration() { @@ -553,12 +683,15 @@ public function getHasMaximumPaidBreakDuration() /** * Sets has_maximum_paid_break_duration * - * @param bool $has_maximum_paid_break_duration + * @param bool|null $has_maximum_paid_break_duration * - * @return $this + * @return self */ public function setHasMaximumPaidBreakDuration($has_maximum_paid_break_duration) { + if (is_null($has_maximum_paid_break_duration)) { + throw new \InvalidArgumentException('non-nullable has_maximum_paid_break_duration cannot be null'); + } $this->container['has_maximum_paid_break_duration'] = $has_maximum_paid_break_duration; return $this; @@ -567,7 +700,7 @@ public function setHasMaximumPaidBreakDuration($has_maximum_paid_break_duration) /** * Gets maximum_paid_break_duration * - * @return int + * @return int|null */ public function getMaximumPaidBreakDuration() { @@ -577,12 +710,15 @@ public function getMaximumPaidBreakDuration() /** * Sets maximum_paid_break_duration * - * @param int $maximum_paid_break_duration + * @param int|null $maximum_paid_break_duration * - * @return $this + * @return self */ public function setMaximumPaidBreakDuration($maximum_paid_break_duration) { + if (is_null($maximum_paid_break_duration)) { + throw new \InvalidArgumentException('non-nullable maximum_paid_break_duration cannot be null'); + } $this->container['maximum_paid_break_duration'] = $maximum_paid_break_duration; return $this; @@ -594,7 +730,7 @@ public function setMaximumPaidBreakDuration($maximum_paid_break_duration) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -604,22 +740,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -635,11 +772,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -647,13 +797,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuChartOfAccountsDefaultAccountsModel.php b/src/lib/Model/AuChartOfAccountsDefaultAccountsModel.php index 7c9122c..4d32ffa 100644 --- a/src/lib/Model/AuChartOfAccountsDefaultAccountsModel.php +++ b/src/lib/Model/AuChartOfAccountsDefaultAccountsModel.php @@ -2,61 +2,61 @@ /** * AuChartOfAccountsDefaultAccountsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuChartOfAccountsDefaultAccountsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuChartOfAccountsDefaultAccountsModel implements ModelInterface, ArrayAccess +class AuChartOfAccountsDefaultAccountsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuChartOfAccountsDefaultAccountsModel'; + protected static $openAPIModelName = 'AuChartOfAccountsDefaultAccountsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'payment_account_split_by_location' => 'bool', 'default_expense_split_by_location' => 'bool', 'employee_expense_split_by_location' => 'bool', @@ -83,8 +83,10 @@ class AuChartOfAccountsDefaultAccountsModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payment_account_split_by_location' => null, 'default_expense_split_by_location' => null, 'employee_expense_split_by_location' => null, @@ -107,14 +109,49 @@ class AuChartOfAccountsDefaultAccountsModel implements ModelInterface, ArrayAcce 'default_liability_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payment_account_split_by_location' => false, + 'default_expense_split_by_location' => false, + 'employee_expense_split_by_location' => false, + 'employer_liability_expense_split_by_location' => false, + 'employer_liability_liability_split_by_location' => false, + 'default_liability_split_by_location' => false, + 'payg_liability_account_split_by_location' => false, + 'payg_expense_split_by_location' => false, + 'superannuation_expense_split_by_location' => false, + 'superannuation_liability_split_by_location' => false, + 'payg_liability_account_id' => false, + 'payg_expense_account_id' => false, + 'superannuation_expense_account_id' => false, + 'superannuation_liability_account_id' => false, + 'payment_account_id' => false, + 'default_expense_account_id' => false, + 'employee_expense_account_id' => false, + 'employer_liability_expense_account_id' => false, + 'employer_liability_liability_account_id' => false, + 'default_liability_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -122,9 +159,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -250,12 +339,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -272,26 +358,44 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payment_account_split_by_location'] = isset($data['payment_account_split_by_location']) ? $data['payment_account_split_by_location'] : null; - $this->container['default_expense_split_by_location'] = isset($data['default_expense_split_by_location']) ? $data['default_expense_split_by_location'] : null; - $this->container['employee_expense_split_by_location'] = isset($data['employee_expense_split_by_location']) ? $data['employee_expense_split_by_location'] : null; - $this->container['employer_liability_expense_split_by_location'] = isset($data['employer_liability_expense_split_by_location']) ? $data['employer_liability_expense_split_by_location'] : null; - $this->container['employer_liability_liability_split_by_location'] = isset($data['employer_liability_liability_split_by_location']) ? $data['employer_liability_liability_split_by_location'] : null; - $this->container['default_liability_split_by_location'] = isset($data['default_liability_split_by_location']) ? $data['default_liability_split_by_location'] : null; - $this->container['payg_liability_account_split_by_location'] = isset($data['payg_liability_account_split_by_location']) ? $data['payg_liability_account_split_by_location'] : null; - $this->container['payg_expense_split_by_location'] = isset($data['payg_expense_split_by_location']) ? $data['payg_expense_split_by_location'] : null; - $this->container['superannuation_expense_split_by_location'] = isset($data['superannuation_expense_split_by_location']) ? $data['superannuation_expense_split_by_location'] : null; - $this->container['superannuation_liability_split_by_location'] = isset($data['superannuation_liability_split_by_location']) ? $data['superannuation_liability_split_by_location'] : null; - $this->container['payg_liability_account_id'] = isset($data['payg_liability_account_id']) ? $data['payg_liability_account_id'] : null; - $this->container['payg_expense_account_id'] = isset($data['payg_expense_account_id']) ? $data['payg_expense_account_id'] : null; - $this->container['superannuation_expense_account_id'] = isset($data['superannuation_expense_account_id']) ? $data['superannuation_expense_account_id'] : null; - $this->container['superannuation_liability_account_id'] = isset($data['superannuation_liability_account_id']) ? $data['superannuation_liability_account_id'] : null; - $this->container['payment_account_id'] = isset($data['payment_account_id']) ? $data['payment_account_id'] : null; - $this->container['default_expense_account_id'] = isset($data['default_expense_account_id']) ? $data['default_expense_account_id'] : null; - $this->container['employee_expense_account_id'] = isset($data['employee_expense_account_id']) ? $data['employee_expense_account_id'] : null; - $this->container['employer_liability_expense_account_id'] = isset($data['employer_liability_expense_account_id']) ? $data['employer_liability_expense_account_id'] : null; - $this->container['employer_liability_liability_account_id'] = isset($data['employer_liability_liability_account_id']) ? $data['employer_liability_liability_account_id'] : null; - $this->container['default_liability_account_id'] = isset($data['default_liability_account_id']) ? $data['default_liability_account_id'] : null; + $this->setIfExists('payment_account_split_by_location', $data ?? [], null); + $this->setIfExists('default_expense_split_by_location', $data ?? [], null); + $this->setIfExists('employee_expense_split_by_location', $data ?? [], null); + $this->setIfExists('employer_liability_expense_split_by_location', $data ?? [], null); + $this->setIfExists('employer_liability_liability_split_by_location', $data ?? [], null); + $this->setIfExists('default_liability_split_by_location', $data ?? [], null); + $this->setIfExists('payg_liability_account_split_by_location', $data ?? [], null); + $this->setIfExists('payg_expense_split_by_location', $data ?? [], null); + $this->setIfExists('superannuation_expense_split_by_location', $data ?? [], null); + $this->setIfExists('superannuation_liability_split_by_location', $data ?? [], null); + $this->setIfExists('payg_liability_account_id', $data ?? [], null); + $this->setIfExists('payg_expense_account_id', $data ?? [], null); + $this->setIfExists('superannuation_expense_account_id', $data ?? [], null); + $this->setIfExists('superannuation_liability_account_id', $data ?? [], null); + $this->setIfExists('payment_account_id', $data ?? [], null); + $this->setIfExists('default_expense_account_id', $data ?? [], null); + $this->setIfExists('employee_expense_account_id', $data ?? [], null); + $this->setIfExists('employer_liability_expense_account_id', $data ?? [], null); + $this->setIfExists('employer_liability_liability_account_id', $data ?? [], null); + $this->setIfExists('default_liability_account_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; } /** @@ -321,7 +425,7 @@ public function valid() /** * Gets payment_account_split_by_location * - * @return bool + * @return bool|null */ public function getPaymentAccountSplitByLocation() { @@ -331,12 +435,15 @@ public function getPaymentAccountSplitByLocation() /** * Sets payment_account_split_by_location * - * @param bool $payment_account_split_by_location + * @param bool|null $payment_account_split_by_location * - * @return $this + * @return self */ public function setPaymentAccountSplitByLocation($payment_account_split_by_location) { + if (is_null($payment_account_split_by_location)) { + throw new \InvalidArgumentException('non-nullable payment_account_split_by_location cannot be null'); + } $this->container['payment_account_split_by_location'] = $payment_account_split_by_location; return $this; @@ -345,7 +452,7 @@ public function setPaymentAccountSplitByLocation($payment_account_split_by_locat /** * Gets default_expense_split_by_location * - * @return bool + * @return bool|null */ public function getDefaultExpenseSplitByLocation() { @@ -355,12 +462,15 @@ public function getDefaultExpenseSplitByLocation() /** * Sets default_expense_split_by_location * - * @param bool $default_expense_split_by_location + * @param bool|null $default_expense_split_by_location * - * @return $this + * @return self */ public function setDefaultExpenseSplitByLocation($default_expense_split_by_location) { + if (is_null($default_expense_split_by_location)) { + throw new \InvalidArgumentException('non-nullable default_expense_split_by_location cannot be null'); + } $this->container['default_expense_split_by_location'] = $default_expense_split_by_location; return $this; @@ -369,7 +479,7 @@ public function setDefaultExpenseSplitByLocation($default_expense_split_by_locat /** * Gets employee_expense_split_by_location * - * @return bool + * @return bool|null */ public function getEmployeeExpenseSplitByLocation() { @@ -379,12 +489,15 @@ public function getEmployeeExpenseSplitByLocation() /** * Sets employee_expense_split_by_location * - * @param bool $employee_expense_split_by_location + * @param bool|null $employee_expense_split_by_location * - * @return $this + * @return self */ public function setEmployeeExpenseSplitByLocation($employee_expense_split_by_location) { + if (is_null($employee_expense_split_by_location)) { + throw new \InvalidArgumentException('non-nullable employee_expense_split_by_location cannot be null'); + } $this->container['employee_expense_split_by_location'] = $employee_expense_split_by_location; return $this; @@ -393,7 +506,7 @@ public function setEmployeeExpenseSplitByLocation($employee_expense_split_by_loc /** * Gets employer_liability_expense_split_by_location * - * @return bool + * @return bool|null */ public function getEmployerLiabilityExpenseSplitByLocation() { @@ -403,12 +516,15 @@ public function getEmployerLiabilityExpenseSplitByLocation() /** * Sets employer_liability_expense_split_by_location * - * @param bool $employer_liability_expense_split_by_location + * @param bool|null $employer_liability_expense_split_by_location * - * @return $this + * @return self */ public function setEmployerLiabilityExpenseSplitByLocation($employer_liability_expense_split_by_location) { + if (is_null($employer_liability_expense_split_by_location)) { + throw new \InvalidArgumentException('non-nullable employer_liability_expense_split_by_location cannot be null'); + } $this->container['employer_liability_expense_split_by_location'] = $employer_liability_expense_split_by_location; return $this; @@ -417,7 +533,7 @@ public function setEmployerLiabilityExpenseSplitByLocation($employer_liability_e /** * Gets employer_liability_liability_split_by_location * - * @return bool + * @return bool|null */ public function getEmployerLiabilityLiabilitySplitByLocation() { @@ -427,12 +543,15 @@ public function getEmployerLiabilityLiabilitySplitByLocation() /** * Sets employer_liability_liability_split_by_location * - * @param bool $employer_liability_liability_split_by_location + * @param bool|null $employer_liability_liability_split_by_location * - * @return $this + * @return self */ public function setEmployerLiabilityLiabilitySplitByLocation($employer_liability_liability_split_by_location) { + if (is_null($employer_liability_liability_split_by_location)) { + throw new \InvalidArgumentException('non-nullable employer_liability_liability_split_by_location cannot be null'); + } $this->container['employer_liability_liability_split_by_location'] = $employer_liability_liability_split_by_location; return $this; @@ -441,7 +560,7 @@ public function setEmployerLiabilityLiabilitySplitByLocation($employer_liability /** * Gets default_liability_split_by_location * - * @return bool + * @return bool|null */ public function getDefaultLiabilitySplitByLocation() { @@ -451,12 +570,15 @@ public function getDefaultLiabilitySplitByLocation() /** * Sets default_liability_split_by_location * - * @param bool $default_liability_split_by_location + * @param bool|null $default_liability_split_by_location * - * @return $this + * @return self */ public function setDefaultLiabilitySplitByLocation($default_liability_split_by_location) { + if (is_null($default_liability_split_by_location)) { + throw new \InvalidArgumentException('non-nullable default_liability_split_by_location cannot be null'); + } $this->container['default_liability_split_by_location'] = $default_liability_split_by_location; return $this; @@ -465,7 +587,7 @@ public function setDefaultLiabilitySplitByLocation($default_liability_split_by_l /** * Gets payg_liability_account_split_by_location * - * @return bool + * @return bool|null */ public function getPaygLiabilityAccountSplitByLocation() { @@ -475,12 +597,15 @@ public function getPaygLiabilityAccountSplitByLocation() /** * Sets payg_liability_account_split_by_location * - * @param bool $payg_liability_account_split_by_location + * @param bool|null $payg_liability_account_split_by_location * - * @return $this + * @return self */ public function setPaygLiabilityAccountSplitByLocation($payg_liability_account_split_by_location) { + if (is_null($payg_liability_account_split_by_location)) { + throw new \InvalidArgumentException('non-nullable payg_liability_account_split_by_location cannot be null'); + } $this->container['payg_liability_account_split_by_location'] = $payg_liability_account_split_by_location; return $this; @@ -489,7 +614,7 @@ public function setPaygLiabilityAccountSplitByLocation($payg_liability_account_s /** * Gets payg_expense_split_by_location * - * @return bool + * @return bool|null */ public function getPaygExpenseSplitByLocation() { @@ -499,12 +624,15 @@ public function getPaygExpenseSplitByLocation() /** * Sets payg_expense_split_by_location * - * @param bool $payg_expense_split_by_location + * @param bool|null $payg_expense_split_by_location * - * @return $this + * @return self */ public function setPaygExpenseSplitByLocation($payg_expense_split_by_location) { + if (is_null($payg_expense_split_by_location)) { + throw new \InvalidArgumentException('non-nullable payg_expense_split_by_location cannot be null'); + } $this->container['payg_expense_split_by_location'] = $payg_expense_split_by_location; return $this; @@ -513,7 +641,7 @@ public function setPaygExpenseSplitByLocation($payg_expense_split_by_location) /** * Gets superannuation_expense_split_by_location * - * @return bool + * @return bool|null */ public function getSuperannuationExpenseSplitByLocation() { @@ -523,12 +651,15 @@ public function getSuperannuationExpenseSplitByLocation() /** * Sets superannuation_expense_split_by_location * - * @param bool $superannuation_expense_split_by_location + * @param bool|null $superannuation_expense_split_by_location * - * @return $this + * @return self */ public function setSuperannuationExpenseSplitByLocation($superannuation_expense_split_by_location) { + if (is_null($superannuation_expense_split_by_location)) { + throw new \InvalidArgumentException('non-nullable superannuation_expense_split_by_location cannot be null'); + } $this->container['superannuation_expense_split_by_location'] = $superannuation_expense_split_by_location; return $this; @@ -537,7 +668,7 @@ public function setSuperannuationExpenseSplitByLocation($superannuation_expense_ /** * Gets superannuation_liability_split_by_location * - * @return bool + * @return bool|null */ public function getSuperannuationLiabilitySplitByLocation() { @@ -547,12 +678,15 @@ public function getSuperannuationLiabilitySplitByLocation() /** * Sets superannuation_liability_split_by_location * - * @param bool $superannuation_liability_split_by_location + * @param bool|null $superannuation_liability_split_by_location * - * @return $this + * @return self */ public function setSuperannuationLiabilitySplitByLocation($superannuation_liability_split_by_location) { + if (is_null($superannuation_liability_split_by_location)) { + throw new \InvalidArgumentException('non-nullable superannuation_liability_split_by_location cannot be null'); + } $this->container['superannuation_liability_split_by_location'] = $superannuation_liability_split_by_location; return $this; @@ -561,7 +695,7 @@ public function setSuperannuationLiabilitySplitByLocation($superannuation_liabil /** * Gets payg_liability_account_id * - * @return int + * @return int|null */ public function getPaygLiabilityAccountId() { @@ -571,12 +705,15 @@ public function getPaygLiabilityAccountId() /** * Sets payg_liability_account_id * - * @param int $payg_liability_account_id + * @param int|null $payg_liability_account_id * - * @return $this + * @return self */ public function setPaygLiabilityAccountId($payg_liability_account_id) { + if (is_null($payg_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable payg_liability_account_id cannot be null'); + } $this->container['payg_liability_account_id'] = $payg_liability_account_id; return $this; @@ -585,7 +722,7 @@ public function setPaygLiabilityAccountId($payg_liability_account_id) /** * Gets payg_expense_account_id * - * @return int + * @return int|null */ public function getPaygExpenseAccountId() { @@ -595,12 +732,15 @@ public function getPaygExpenseAccountId() /** * Sets payg_expense_account_id * - * @param int $payg_expense_account_id + * @param int|null $payg_expense_account_id * - * @return $this + * @return self */ public function setPaygExpenseAccountId($payg_expense_account_id) { + if (is_null($payg_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable payg_expense_account_id cannot be null'); + } $this->container['payg_expense_account_id'] = $payg_expense_account_id; return $this; @@ -609,7 +749,7 @@ public function setPaygExpenseAccountId($payg_expense_account_id) /** * Gets superannuation_expense_account_id * - * @return int + * @return int|null */ public function getSuperannuationExpenseAccountId() { @@ -619,12 +759,15 @@ public function getSuperannuationExpenseAccountId() /** * Sets superannuation_expense_account_id * - * @param int $superannuation_expense_account_id + * @param int|null $superannuation_expense_account_id * - * @return $this + * @return self */ public function setSuperannuationExpenseAccountId($superannuation_expense_account_id) { + if (is_null($superannuation_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable superannuation_expense_account_id cannot be null'); + } $this->container['superannuation_expense_account_id'] = $superannuation_expense_account_id; return $this; @@ -633,7 +776,7 @@ public function setSuperannuationExpenseAccountId($superannuation_expense_accoun /** * Gets superannuation_liability_account_id * - * @return int + * @return int|null */ public function getSuperannuationLiabilityAccountId() { @@ -643,12 +786,15 @@ public function getSuperannuationLiabilityAccountId() /** * Sets superannuation_liability_account_id * - * @param int $superannuation_liability_account_id + * @param int|null $superannuation_liability_account_id * - * @return $this + * @return self */ public function setSuperannuationLiabilityAccountId($superannuation_liability_account_id) { + if (is_null($superannuation_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable superannuation_liability_account_id cannot be null'); + } $this->container['superannuation_liability_account_id'] = $superannuation_liability_account_id; return $this; @@ -657,7 +803,7 @@ public function setSuperannuationLiabilityAccountId($superannuation_liability_ac /** * Gets payment_account_id * - * @return int + * @return int|null */ public function getPaymentAccountId() { @@ -667,12 +813,15 @@ public function getPaymentAccountId() /** * Sets payment_account_id * - * @param int $payment_account_id + * @param int|null $payment_account_id * - * @return $this + * @return self */ public function setPaymentAccountId($payment_account_id) { + if (is_null($payment_account_id)) { + throw new \InvalidArgumentException('non-nullable payment_account_id cannot be null'); + } $this->container['payment_account_id'] = $payment_account_id; return $this; @@ -681,7 +830,7 @@ public function setPaymentAccountId($payment_account_id) /** * Gets default_expense_account_id * - * @return int + * @return int|null */ public function getDefaultExpenseAccountId() { @@ -691,12 +840,15 @@ public function getDefaultExpenseAccountId() /** * Sets default_expense_account_id * - * @param int $default_expense_account_id + * @param int|null $default_expense_account_id * - * @return $this + * @return self */ public function setDefaultExpenseAccountId($default_expense_account_id) { + if (is_null($default_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable default_expense_account_id cannot be null'); + } $this->container['default_expense_account_id'] = $default_expense_account_id; return $this; @@ -705,7 +857,7 @@ public function setDefaultExpenseAccountId($default_expense_account_id) /** * Gets employee_expense_account_id * - * @return int + * @return int|null */ public function getEmployeeExpenseAccountId() { @@ -715,12 +867,15 @@ public function getEmployeeExpenseAccountId() /** * Sets employee_expense_account_id * - * @param int $employee_expense_account_id + * @param int|null $employee_expense_account_id * - * @return $this + * @return self */ public function setEmployeeExpenseAccountId($employee_expense_account_id) { + if (is_null($employee_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable employee_expense_account_id cannot be null'); + } $this->container['employee_expense_account_id'] = $employee_expense_account_id; return $this; @@ -729,7 +884,7 @@ public function setEmployeeExpenseAccountId($employee_expense_account_id) /** * Gets employer_liability_expense_account_id * - * @return int + * @return int|null */ public function getEmployerLiabilityExpenseAccountId() { @@ -739,12 +894,15 @@ public function getEmployerLiabilityExpenseAccountId() /** * Sets employer_liability_expense_account_id * - * @param int $employer_liability_expense_account_id + * @param int|null $employer_liability_expense_account_id * - * @return $this + * @return self */ public function setEmployerLiabilityExpenseAccountId($employer_liability_expense_account_id) { + if (is_null($employer_liability_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_expense_account_id cannot be null'); + } $this->container['employer_liability_expense_account_id'] = $employer_liability_expense_account_id; return $this; @@ -753,7 +911,7 @@ public function setEmployerLiabilityExpenseAccountId($employer_liability_expense /** * Gets employer_liability_liability_account_id * - * @return int + * @return int|null */ public function getEmployerLiabilityLiabilityAccountId() { @@ -763,12 +921,15 @@ public function getEmployerLiabilityLiabilityAccountId() /** * Sets employer_liability_liability_account_id * - * @param int $employer_liability_liability_account_id + * @param int|null $employer_liability_liability_account_id * - * @return $this + * @return self */ public function setEmployerLiabilityLiabilityAccountId($employer_liability_liability_account_id) { + if (is_null($employer_liability_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_liability_account_id cannot be null'); + } $this->container['employer_liability_liability_account_id'] = $employer_liability_liability_account_id; return $this; @@ -777,7 +938,7 @@ public function setEmployerLiabilityLiabilityAccountId($employer_liability_liabi /** * Gets default_liability_account_id * - * @return int + * @return int|null */ public function getDefaultLiabilityAccountId() { @@ -787,12 +948,15 @@ public function getDefaultLiabilityAccountId() /** * Sets default_liability_account_id * - * @param int $default_liability_account_id + * @param int|null $default_liability_account_id * - * @return $this + * @return self */ public function setDefaultLiabilityAccountId($default_liability_account_id) { + if (is_null($default_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable default_liability_account_id cannot be null'); + } $this->container['default_liability_account_id'] = $default_liability_account_id; return $this; @@ -804,7 +968,7 @@ public function setDefaultLiabilityAccountId($default_liability_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -814,22 +978,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -845,11 +1010,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -857,13 +1035,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuChartOfAccountsGroupModel.php b/src/lib/Model/AuChartOfAccountsGroupModel.php index 52cc417..e5f221f 100644 --- a/src/lib/Model/AuChartOfAccountsGroupModel.php +++ b/src/lib/Model/AuChartOfAccountsGroupModel.php @@ -2,75 +2,77 @@ /** * AuChartOfAccountsGroupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuChartOfAccountsGroupModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuChartOfAccountsGroupModel implements ModelInterface, ArrayAccess +class AuChartOfAccountsGroupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuChartOfAccountsGroupModel'; + protected static $openAPIModelName = 'AuChartOfAccountsGroupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'default_accounts' => '\Swagger\Client\Model\AuChartOfAccountsDefaultAccountsModel', - 'leave_categories' => '\Swagger\Client\Model\ChartOfAccountsLeaveCategoryModel[]', - 'pay_categories' => '\Swagger\Client\Model\ChartOfAccountsCategoryModel[]', - 'deduction_categories' => '\Swagger\Client\Model\ChartOfAccountsLiabilityCategoryModel[]', - 'employee_expense_categories' => '\Swagger\Client\Model\ChartOfAccountsCategoryModel[]', - 'employer_liability_categories' => '\Swagger\Client\Model\ChartOfAccountsLiabilityCategoryModel[]' + protected static $openAPITypes = [ + 'default_accounts' => '\OpenAPI\Client\Model\AuChartOfAccountsDefaultAccountsModel', + 'leave_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLeaveCategoryModel[]', + 'pay_categories' => '\OpenAPI\Client\Model\ChartOfAccountsCategoryModel[]', + 'deduction_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLiabilityCategoryModel[]', + 'employee_expense_categories' => '\OpenAPI\Client\Model\ChartOfAccountsCategoryModel[]', + 'employer_liability_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLiabilityCategoryModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'default_accounts' => null, 'leave_categories' => null, 'pay_categories' => null, @@ -79,14 +81,35 @@ class AuChartOfAccountsGroupModel implements ModelInterface, ArrayAccess 'employer_liability_categories' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'default_accounts' => false, + 'leave_categories' => false, + 'pay_categories' => false, + 'deduction_categories' => false, + 'employee_expense_categories' => false, + 'employer_liability_categories' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['default_accounts'] = isset($data['default_accounts']) ? $data['default_accounts'] : null; - $this->container['leave_categories'] = isset($data['leave_categories']) ? $data['leave_categories'] : null; - $this->container['pay_categories'] = isset($data['pay_categories']) ? $data['pay_categories'] : null; - $this->container['deduction_categories'] = isset($data['deduction_categories']) ? $data['deduction_categories'] : null; - $this->container['employee_expense_categories'] = isset($data['employee_expense_categories']) ? $data['employee_expense_categories'] : null; - $this->container['employer_liability_categories'] = isset($data['employer_liability_categories']) ? $data['employer_liability_categories'] : null; + $this->setIfExists('default_accounts', $data ?? [], null); + $this->setIfExists('leave_categories', $data ?? [], null); + $this->setIfExists('pay_categories', $data ?? [], null); + $this->setIfExists('deduction_categories', $data ?? [], null); + $this->setIfExists('employee_expense_categories', $data ?? [], null); + $this->setIfExists('employer_liability_categories', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets default_accounts * - * @return \Swagger\Client\Model\AuChartOfAccountsDefaultAccountsModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsDefaultAccountsModel|null */ public function getDefaultAccounts() { @@ -247,12 +337,15 @@ public function getDefaultAccounts() /** * Sets default_accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsDefaultAccountsModel $default_accounts + * @param \OpenAPI\Client\Model\AuChartOfAccountsDefaultAccountsModel|null $default_accounts default_accounts * - * @return $this + * @return self */ public function setDefaultAccounts($default_accounts) { + if (is_null($default_accounts)) { + throw new \InvalidArgumentException('non-nullable default_accounts cannot be null'); + } $this->container['default_accounts'] = $default_accounts; return $this; @@ -261,7 +354,7 @@ public function setDefaultAccounts($default_accounts) /** * Gets leave_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLeaveCategoryModel[]|null */ public function getLeaveCategories() { @@ -271,12 +364,15 @@ public function getLeaveCategories() /** * Sets leave_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLeaveCategoryModel[] $leave_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLeaveCategoryModel[]|null $leave_categories * - * @return $this + * @return self */ public function setLeaveCategories($leave_categories) { + if (is_null($leave_categories)) { + throw new \InvalidArgumentException('non-nullable leave_categories cannot be null'); + } $this->container['leave_categories'] = $leave_categories; return $this; @@ -285,7 +381,7 @@ public function setLeaveCategories($leave_categories) /** * Gets pay_categories * - * @return \Swagger\Client\Model\ChartOfAccountsCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsCategoryModel[]|null */ public function getPayCategories() { @@ -295,12 +391,15 @@ public function getPayCategories() /** * Sets pay_categories * - * @param \Swagger\Client\Model\ChartOfAccountsCategoryModel[] $pay_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsCategoryModel[]|null $pay_categories * - * @return $this + * @return self */ public function setPayCategories($pay_categories) { + if (is_null($pay_categories)) { + throw new \InvalidArgumentException('non-nullable pay_categories cannot be null'); + } $this->container['pay_categories'] = $pay_categories; return $this; @@ -309,7 +408,7 @@ public function setPayCategories($pay_categories) /** * Gets deduction_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLiabilityCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLiabilityCategoryModel[]|null */ public function getDeductionCategories() { @@ -319,12 +418,15 @@ public function getDeductionCategories() /** * Sets deduction_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLiabilityCategoryModel[] $deduction_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLiabilityCategoryModel[]|null $deduction_categories * - * @return $this + * @return self */ public function setDeductionCategories($deduction_categories) { + if (is_null($deduction_categories)) { + throw new \InvalidArgumentException('non-nullable deduction_categories cannot be null'); + } $this->container['deduction_categories'] = $deduction_categories; return $this; @@ -333,7 +435,7 @@ public function setDeductionCategories($deduction_categories) /** * Gets employee_expense_categories * - * @return \Swagger\Client\Model\ChartOfAccountsCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsCategoryModel[]|null */ public function getEmployeeExpenseCategories() { @@ -343,12 +445,15 @@ public function getEmployeeExpenseCategories() /** * Sets employee_expense_categories * - * @param \Swagger\Client\Model\ChartOfAccountsCategoryModel[] $employee_expense_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsCategoryModel[]|null $employee_expense_categories * - * @return $this + * @return self */ public function setEmployeeExpenseCategories($employee_expense_categories) { + if (is_null($employee_expense_categories)) { + throw new \InvalidArgumentException('non-nullable employee_expense_categories cannot be null'); + } $this->container['employee_expense_categories'] = $employee_expense_categories; return $this; @@ -357,7 +462,7 @@ public function setEmployeeExpenseCategories($employee_expense_categories) /** * Gets employer_liability_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLiabilityCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLiabilityCategoryModel[]|null */ public function getEmployerLiabilityCategories() { @@ -367,12 +472,15 @@ public function getEmployerLiabilityCategories() /** * Sets employer_liability_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLiabilityCategoryModel[] $employer_liability_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLiabilityCategoryModel[]|null $employer_liability_categories * - * @return $this + * @return self */ public function setEmployerLiabilityCategories($employer_liability_categories) { + if (is_null($employer_liability_categories)) { + throw new \InvalidArgumentException('non-nullable employer_liability_categories cannot be null'); + } $this->container['employer_liability_categories'] = $employer_liability_categories; return $this; @@ -384,7 +492,7 @@ public function setEmployerLiabilityCategories($employer_liability_categories) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuChartOfAccountsLocationAccountsModel.php b/src/lib/Model/AuChartOfAccountsLocationAccountsModel.php index 934adb3..68bb368 100644 --- a/src/lib/Model/AuChartOfAccountsLocationAccountsModel.php +++ b/src/lib/Model/AuChartOfAccountsLocationAccountsModel.php @@ -2,61 +2,61 @@ /** * AuChartOfAccountsLocationAccountsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuChartOfAccountsLocationAccountsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuChartOfAccountsLocationAccountsModel implements ModelInterface, ArrayAccess +class AuChartOfAccountsLocationAccountsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuChartOfAccountsLocationAccountsModel'; + protected static $openAPIModelName = 'AuChartOfAccountsLocationAccountsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'payg_liability_account_id' => 'int', 'payg_expense_account_id' => 'int', 'superannuation_expense_account_id' => 'int', @@ -73,8 +73,10 @@ class AuChartOfAccountsLocationAccountsModel implements ModelInterface, ArrayAcc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg_liability_account_id' => 'int32', 'payg_expense_account_id' => 'int32', 'superannuation_expense_account_id' => 'int32', @@ -87,14 +89,39 @@ class AuChartOfAccountsLocationAccountsModel implements ModelInterface, ArrayAcc 'default_liability_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg_liability_account_id' => false, + 'payg_expense_account_id' => false, + 'superannuation_expense_account_id' => false, + 'superannuation_liability_account_id' => false, + 'payment_account_id' => false, + 'default_expense_account_id' => false, + 'employee_expense_account_id' => false, + 'employer_liability_expense_account_id' => false, + 'employer_liability_liability_account_id' => false, + 'default_liability_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payg_liability_account_id'] = isset($data['payg_liability_account_id']) ? $data['payg_liability_account_id'] : null; - $this->container['payg_expense_account_id'] = isset($data['payg_expense_account_id']) ? $data['payg_expense_account_id'] : null; - $this->container['superannuation_expense_account_id'] = isset($data['superannuation_expense_account_id']) ? $data['superannuation_expense_account_id'] : null; - $this->container['superannuation_liability_account_id'] = isset($data['superannuation_liability_account_id']) ? $data['superannuation_liability_account_id'] : null; - $this->container['payment_account_id'] = isset($data['payment_account_id']) ? $data['payment_account_id'] : null; - $this->container['default_expense_account_id'] = isset($data['default_expense_account_id']) ? $data['default_expense_account_id'] : null; - $this->container['employee_expense_account_id'] = isset($data['employee_expense_account_id']) ? $data['employee_expense_account_id'] : null; - $this->container['employer_liability_expense_account_id'] = isset($data['employer_liability_expense_account_id']) ? $data['employer_liability_expense_account_id'] : null; - $this->container['employer_liability_liability_account_id'] = isset($data['employer_liability_liability_account_id']) ? $data['employer_liability_liability_account_id'] : null; - $this->container['default_liability_account_id'] = isset($data['default_liability_account_id']) ? $data['default_liability_account_id'] : null; + $this->setIfExists('payg_liability_account_id', $data ?? [], null); + $this->setIfExists('payg_expense_account_id', $data ?? [], null); + $this->setIfExists('superannuation_expense_account_id', $data ?? [], null); + $this->setIfExists('superannuation_liability_account_id', $data ?? [], null); + $this->setIfExists('payment_account_id', $data ?? [], null); + $this->setIfExists('default_expense_account_id', $data ?? [], null); + $this->setIfExists('employee_expense_account_id', $data ?? [], null); + $this->setIfExists('employer_liability_expense_account_id', $data ?? [], null); + $this->setIfExists('employer_liability_liability_account_id', $data ?? [], null); + $this->setIfExists('default_liability_account_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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets payg_liability_account_id * - * @return int + * @return int|null */ public function getPaygLiabilityAccountId() { @@ -271,12 +365,15 @@ public function getPaygLiabilityAccountId() /** * Sets payg_liability_account_id * - * @param int $payg_liability_account_id + * @param int|null $payg_liability_account_id * - * @return $this + * @return self */ public function setPaygLiabilityAccountId($payg_liability_account_id) { + if (is_null($payg_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable payg_liability_account_id cannot be null'); + } $this->container['payg_liability_account_id'] = $payg_liability_account_id; return $this; @@ -285,7 +382,7 @@ public function setPaygLiabilityAccountId($payg_liability_account_id) /** * Gets payg_expense_account_id * - * @return int + * @return int|null */ public function getPaygExpenseAccountId() { @@ -295,12 +392,15 @@ public function getPaygExpenseAccountId() /** * Sets payg_expense_account_id * - * @param int $payg_expense_account_id + * @param int|null $payg_expense_account_id * - * @return $this + * @return self */ public function setPaygExpenseAccountId($payg_expense_account_id) { + if (is_null($payg_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable payg_expense_account_id cannot be null'); + } $this->container['payg_expense_account_id'] = $payg_expense_account_id; return $this; @@ -309,7 +409,7 @@ public function setPaygExpenseAccountId($payg_expense_account_id) /** * Gets superannuation_expense_account_id * - * @return int + * @return int|null */ public function getSuperannuationExpenseAccountId() { @@ -319,12 +419,15 @@ public function getSuperannuationExpenseAccountId() /** * Sets superannuation_expense_account_id * - * @param int $superannuation_expense_account_id + * @param int|null $superannuation_expense_account_id * - * @return $this + * @return self */ public function setSuperannuationExpenseAccountId($superannuation_expense_account_id) { + if (is_null($superannuation_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable superannuation_expense_account_id cannot be null'); + } $this->container['superannuation_expense_account_id'] = $superannuation_expense_account_id; return $this; @@ -333,7 +436,7 @@ public function setSuperannuationExpenseAccountId($superannuation_expense_accoun /** * Gets superannuation_liability_account_id * - * @return int + * @return int|null */ public function getSuperannuationLiabilityAccountId() { @@ -343,12 +446,15 @@ public function getSuperannuationLiabilityAccountId() /** * Sets superannuation_liability_account_id * - * @param int $superannuation_liability_account_id + * @param int|null $superannuation_liability_account_id * - * @return $this + * @return self */ public function setSuperannuationLiabilityAccountId($superannuation_liability_account_id) { + if (is_null($superannuation_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable superannuation_liability_account_id cannot be null'); + } $this->container['superannuation_liability_account_id'] = $superannuation_liability_account_id; return $this; @@ -357,7 +463,7 @@ public function setSuperannuationLiabilityAccountId($superannuation_liability_ac /** * Gets payment_account_id * - * @return int + * @return int|null */ public function getPaymentAccountId() { @@ -367,12 +473,15 @@ public function getPaymentAccountId() /** * Sets payment_account_id * - * @param int $payment_account_id + * @param int|null $payment_account_id * - * @return $this + * @return self */ public function setPaymentAccountId($payment_account_id) { + if (is_null($payment_account_id)) { + throw new \InvalidArgumentException('non-nullable payment_account_id cannot be null'); + } $this->container['payment_account_id'] = $payment_account_id; return $this; @@ -381,7 +490,7 @@ public function setPaymentAccountId($payment_account_id) /** * Gets default_expense_account_id * - * @return int + * @return int|null */ public function getDefaultExpenseAccountId() { @@ -391,12 +500,15 @@ public function getDefaultExpenseAccountId() /** * Sets default_expense_account_id * - * @param int $default_expense_account_id + * @param int|null $default_expense_account_id * - * @return $this + * @return self */ public function setDefaultExpenseAccountId($default_expense_account_id) { + if (is_null($default_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable default_expense_account_id cannot be null'); + } $this->container['default_expense_account_id'] = $default_expense_account_id; return $this; @@ -405,7 +517,7 @@ public function setDefaultExpenseAccountId($default_expense_account_id) /** * Gets employee_expense_account_id * - * @return int + * @return int|null */ public function getEmployeeExpenseAccountId() { @@ -415,12 +527,15 @@ public function getEmployeeExpenseAccountId() /** * Sets employee_expense_account_id * - * @param int $employee_expense_account_id + * @param int|null $employee_expense_account_id * - * @return $this + * @return self */ public function setEmployeeExpenseAccountId($employee_expense_account_id) { + if (is_null($employee_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable employee_expense_account_id cannot be null'); + } $this->container['employee_expense_account_id'] = $employee_expense_account_id; return $this; @@ -429,7 +544,7 @@ public function setEmployeeExpenseAccountId($employee_expense_account_id) /** * Gets employer_liability_expense_account_id * - * @return int + * @return int|null */ public function getEmployerLiabilityExpenseAccountId() { @@ -439,12 +554,15 @@ public function getEmployerLiabilityExpenseAccountId() /** * Sets employer_liability_expense_account_id * - * @param int $employer_liability_expense_account_id + * @param int|null $employer_liability_expense_account_id * - * @return $this + * @return self */ public function setEmployerLiabilityExpenseAccountId($employer_liability_expense_account_id) { + if (is_null($employer_liability_expense_account_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_expense_account_id cannot be null'); + } $this->container['employer_liability_expense_account_id'] = $employer_liability_expense_account_id; return $this; @@ -453,7 +571,7 @@ public function setEmployerLiabilityExpenseAccountId($employer_liability_expense /** * Gets employer_liability_liability_account_id * - * @return int + * @return int|null */ public function getEmployerLiabilityLiabilityAccountId() { @@ -463,12 +581,15 @@ public function getEmployerLiabilityLiabilityAccountId() /** * Sets employer_liability_liability_account_id * - * @param int $employer_liability_liability_account_id + * @param int|null $employer_liability_liability_account_id * - * @return $this + * @return self */ public function setEmployerLiabilityLiabilityAccountId($employer_liability_liability_account_id) { + if (is_null($employer_liability_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_liability_account_id cannot be null'); + } $this->container['employer_liability_liability_account_id'] = $employer_liability_liability_account_id; return $this; @@ -477,7 +598,7 @@ public function setEmployerLiabilityLiabilityAccountId($employer_liability_liabi /** * Gets default_liability_account_id * - * @return int + * @return int|null */ public function getDefaultLiabilityAccountId() { @@ -487,12 +608,15 @@ public function getDefaultLiabilityAccountId() /** * Sets default_liability_account_id * - * @param int $default_liability_account_id + * @param int|null $default_liability_account_id * - * @return $this + * @return self */ public function setDefaultLiabilityAccountId($default_liability_account_id) { + if (is_null($default_liability_account_id)) { + throw new \InvalidArgumentException('non-nullable default_liability_account_id cannot be null'); + } $this->container['default_liability_account_id'] = $default_liability_account_id; return $this; @@ -504,7 +628,7 @@ public function setDefaultLiabilityAccountId($default_liability_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuChartOfAccountsLocationGroupModel.php b/src/lib/Model/AuChartOfAccountsLocationGroupModel.php index 7be669b..50e2762 100644 --- a/src/lib/Model/AuChartOfAccountsLocationGroupModel.php +++ b/src/lib/Model/AuChartOfAccountsLocationGroupModel.php @@ -2,76 +2,78 @@ /** * AuChartOfAccountsLocationGroupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuChartOfAccountsLocationGroupModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuChartOfAccountsLocationGroupModel implements ModelInterface, ArrayAccess +class AuChartOfAccountsLocationGroupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuChartOfAccountsLocationGroupModel'; + protected static $openAPIModelName = 'AuChartOfAccountsLocationGroupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'default_accounts' => '\Swagger\Client\Model\AuChartOfAccountsLocationAccountsModel', - 'leave_categories' => '\Swagger\Client\Model\ChartOfAccountsLocationLeaveCategoryModel[]', + protected static $openAPITypes = [ + 'default_accounts' => '\OpenAPI\Client\Model\AuChartOfAccountsLocationAccountsModel', + 'leave_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLocationLeaveCategoryModel[]', 'location_id' => 'int', - 'pay_categories' => '\Swagger\Client\Model\ChartOfAccountsLocationCategoryModel[]', - 'deduction_categories' => '\Swagger\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]', - 'employee_expense_categories' => '\Swagger\Client\Model\ChartOfAccountsLocationCategoryModel[]', - 'employer_liability_categories' => '\Swagger\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]' + 'pay_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLocationCategoryModel[]', + 'deduction_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]', + 'employee_expense_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLocationCategoryModel[]', + 'employer_liability_categories' => '\OpenAPI\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'default_accounts' => null, 'leave_categories' => null, 'location_id' => 'int32', @@ -81,14 +83,36 @@ class AuChartOfAccountsLocationGroupModel implements ModelInterface, ArrayAccess 'employer_liability_categories' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'default_accounts' => false, + 'leave_categories' => false, + 'location_id' => false, + 'pay_categories' => false, + 'deduction_categories' => false, + 'employee_expense_categories' => false, + 'employer_liability_categories' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['default_accounts'] = isset($data['default_accounts']) ? $data['default_accounts'] : null; - $this->container['leave_categories'] = isset($data['leave_categories']) ? $data['leave_categories'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['pay_categories'] = isset($data['pay_categories']) ? $data['pay_categories'] : null; - $this->container['deduction_categories'] = isset($data['deduction_categories']) ? $data['deduction_categories'] : null; - $this->container['employee_expense_categories'] = isset($data['employee_expense_categories']) ? $data['employee_expense_categories'] : null; - $this->container['employer_liability_categories'] = isset($data['employer_liability_categories']) ? $data['employer_liability_categories'] : null; + $this->setIfExists('default_accounts', $data ?? [], null); + $this->setIfExists('leave_categories', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('pay_categories', $data ?? [], null); + $this->setIfExists('deduction_categories', $data ?? [], null); + $this->setIfExists('employee_expense_categories', $data ?? [], null); + $this->setIfExists('employer_liability_categories', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets default_accounts * - * @return \Swagger\Client\Model\AuChartOfAccountsLocationAccountsModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsLocationAccountsModel|null */ public function getDefaultAccounts() { @@ -253,12 +344,15 @@ public function getDefaultAccounts() /** * Sets default_accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsLocationAccountsModel $default_accounts + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationAccountsModel|null $default_accounts default_accounts * - * @return $this + * @return self */ public function setDefaultAccounts($default_accounts) { + if (is_null($default_accounts)) { + throw new \InvalidArgumentException('non-nullable default_accounts cannot be null'); + } $this->container['default_accounts'] = $default_accounts; return $this; @@ -267,7 +361,7 @@ public function setDefaultAccounts($default_accounts) /** * Gets leave_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLocationLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLocationLeaveCategoryModel[]|null */ public function getLeaveCategories() { @@ -277,12 +371,15 @@ public function getLeaveCategories() /** * Sets leave_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLocationLeaveCategoryModel[] $leave_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLocationLeaveCategoryModel[]|null $leave_categories * - * @return $this + * @return self */ public function setLeaveCategories($leave_categories) { + if (is_null($leave_categories)) { + throw new \InvalidArgumentException('non-nullable leave_categories cannot be null'); + } $this->container['leave_categories'] = $leave_categories; return $this; @@ -291,7 +388,7 @@ public function setLeaveCategories($leave_categories) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -301,12 +398,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -315,7 +415,7 @@ public function setLocationId($location_id) /** * Gets pay_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLocationCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLocationCategoryModel[]|null */ public function getPayCategories() { @@ -325,12 +425,15 @@ public function getPayCategories() /** * Sets pay_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLocationCategoryModel[] $pay_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLocationCategoryModel[]|null $pay_categories * - * @return $this + * @return self */ public function setPayCategories($pay_categories) { + if (is_null($pay_categories)) { + throw new \InvalidArgumentException('non-nullable pay_categories cannot be null'); + } $this->container['pay_categories'] = $pay_categories; return $this; @@ -339,7 +442,7 @@ public function setPayCategories($pay_categories) /** * Gets deduction_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]|null */ public function getDeductionCategories() { @@ -349,12 +452,15 @@ public function getDeductionCategories() /** * Sets deduction_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[] $deduction_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]|null $deduction_categories * - * @return $this + * @return self */ public function setDeductionCategories($deduction_categories) { + if (is_null($deduction_categories)) { + throw new \InvalidArgumentException('non-nullable deduction_categories cannot be null'); + } $this->container['deduction_categories'] = $deduction_categories; return $this; @@ -363,7 +469,7 @@ public function setDeductionCategories($deduction_categories) /** * Gets employee_expense_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLocationCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLocationCategoryModel[]|null */ public function getEmployeeExpenseCategories() { @@ -373,12 +479,15 @@ public function getEmployeeExpenseCategories() /** * Sets employee_expense_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLocationCategoryModel[] $employee_expense_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLocationCategoryModel[]|null $employee_expense_categories * - * @return $this + * @return self */ public function setEmployeeExpenseCategories($employee_expense_categories) { + if (is_null($employee_expense_categories)) { + throw new \InvalidArgumentException('non-nullable employee_expense_categories cannot be null'); + } $this->container['employee_expense_categories'] = $employee_expense_categories; return $this; @@ -387,7 +496,7 @@ public function setEmployeeExpenseCategories($employee_expense_categories) /** * Gets employer_liability_categories * - * @return \Swagger\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[] + * @return \OpenAPI\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]|null */ public function getEmployerLiabilityCategories() { @@ -397,12 +506,15 @@ public function getEmployerLiabilityCategories() /** * Sets employer_liability_categories * - * @param \Swagger\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[] $employer_liability_categories + * @param \OpenAPI\Client\Model\ChartOfAccountsLiabilityLocationCategoryModel[]|null $employer_liability_categories * - * @return $this + * @return self */ public function setEmployerLiabilityCategories($employer_liability_categories) { + if (is_null($employer_liability_categories)) { + throw new \InvalidArgumentException('non-nullable employer_liability_categories cannot be null'); + } $this->container['employer_liability_categories'] = $employer_liability_categories; return $this; @@ -414,7 +526,7 @@ public function setEmployerLiabilityCategories($employer_liability_categories) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuChartOfAccountsModel.php b/src/lib/Model/AuChartOfAccountsModel.php index 2a4cd72..14abf97 100644 --- a/src/lib/Model/AuChartOfAccountsModel.php +++ b/src/lib/Model/AuChartOfAccountsModel.php @@ -2,85 +2,105 @@ /** * AuChartOfAccountsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuChartOfAccountsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuChartOfAccountsModel implements ModelInterface, ArrayAccess +class AuChartOfAccountsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuChartOfAccountsModel'; + protected static $openAPIModelName = 'AuChartOfAccountsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'complete' => 'bool', - 'chartof_accounts' => '\Swagger\Client\Model\AuChartOfAccountsGroupModel', - 'location_specific_chart_of_accounts' => '\Swagger\Client\Model\AuChartOfAccountsLocationGroupModel[]' + 'chartof_accounts' => '\OpenAPI\Client\Model\AuChartOfAccountsGroupModel', + 'location_specific_chart_of_accounts' => '\OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'complete' => null, 'chartof_accounts' => null, 'location_specific_chart_of_accounts' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'complete' => false, + 'chartof_accounts' => false, + 'location_specific_chart_of_accounts' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['complete'] = isset($data['complete']) ? $data['complete'] : null; - $this->container['chartof_accounts'] = isset($data['chartof_accounts']) ? $data['chartof_accounts'] : null; - $this->container['location_specific_chart_of_accounts'] = isset($data['location_specific_chart_of_accounts']) ? $data['location_specific_chart_of_accounts'] : null; + $this->setIfExists('complete', $data ?? [], null); + $this->setIfExists('chartof_accounts', $data ?? [], null); + $this->setIfExists('location_specific_chart_of_accounts', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets complete * - * @return bool + * @return bool|null */ public function getComplete() { @@ -229,12 +316,15 @@ public function getComplete() /** * Sets complete * - * @param bool $complete + * @param bool|null $complete * - * @return $this + * @return self */ public function setComplete($complete) { + if (is_null($complete)) { + throw new \InvalidArgumentException('non-nullable complete cannot be null'); + } $this->container['complete'] = $complete; return $this; @@ -243,7 +333,7 @@ public function setComplete($complete) /** * Gets chartof_accounts * - * @return \Swagger\Client\Model\AuChartOfAccountsGroupModel + * @return \OpenAPI\Client\Model\AuChartOfAccountsGroupModel|null */ public function getChartofAccounts() { @@ -253,12 +343,15 @@ public function getChartofAccounts() /** * Sets chartof_accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsGroupModel $chartof_accounts + * @param \OpenAPI\Client\Model\AuChartOfAccountsGroupModel|null $chartof_accounts chartof_accounts * - * @return $this + * @return self */ public function setChartofAccounts($chartof_accounts) { + if (is_null($chartof_accounts)) { + throw new \InvalidArgumentException('non-nullable chartof_accounts cannot be null'); + } $this->container['chartof_accounts'] = $chartof_accounts; return $this; @@ -267,7 +360,7 @@ public function setChartofAccounts($chartof_accounts) /** * Gets location_specific_chart_of_accounts * - * @return \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel[] + * @return \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel[]|null */ public function getLocationSpecificChartOfAccounts() { @@ -277,12 +370,15 @@ public function getLocationSpecificChartOfAccounts() /** * Sets location_specific_chart_of_accounts * - * @param \Swagger\Client\Model\AuChartOfAccountsLocationGroupModel[] $location_specific_chart_of_accounts + * @param \OpenAPI\Client\Model\AuChartOfAccountsLocationGroupModel[]|null $location_specific_chart_of_accounts * - * @return $this + * @return self */ public function setLocationSpecificChartOfAccounts($location_specific_chart_of_accounts) { + if (is_null($location_specific_chart_of_accounts)) { + throw new \InvalidArgumentException('non-nullable location_specific_chart_of_accounts cannot be null'); + } $this->container['location_specific_chart_of_accounts'] = $location_specific_chart_of_accounts; return $this; @@ -294,7 +390,7 @@ public function setLocationSpecificChartOfAccounts($location_specific_chart_of_a * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuClockOnModel.php b/src/lib/Model/AuClockOnModel.php index 6ad7fdb..ea4633c 100644 --- a/src/lib/Model/AuClockOnModel.php +++ b/src/lib/Model/AuClockOnModel.php @@ -2,69 +2,69 @@ /** * AuClockOnModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuClockOnModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuClockOnModel implements ModelInterface, ArrayAccess +class AuClockOnModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuClockOnModel'; + protected static $openAPIModelName = 'AuClockOnModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'classification_id' => 'int', 'work_type_id' => 'int', 'shift_condition_ids' => 'int[]', 'note' => 'string', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -78,8 +78,10 @@ class AuClockOnModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'classification_id' => 'int32', 'work_type_id' => 'int32', @@ -97,14 +99,44 @@ class AuClockOnModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'classification_id' => false, + 'work_type_id' => false, + 'shift_condition_ids' => false, + 'note' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -225,14 +309,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -245,7 +327,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -262,21 +343,39 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -295,7 +394,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -318,7 +418,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -328,12 +428,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -342,7 +445,7 @@ public function setLocationId($location_id) /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -352,12 +455,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -366,7 +472,7 @@ public function setClassificationId($classification_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -376,12 +482,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -390,7 +499,7 @@ public function setWorkTypeId($work_type_id) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -400,12 +509,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -414,7 +526,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -424,12 +536,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -438,7 +553,7 @@ public function setNote($note) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -448,12 +563,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -462,7 +580,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -472,12 +590,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -486,7 +607,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -496,12 +617,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -510,7 +634,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -520,12 +644,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -534,7 +661,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -544,12 +671,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -558,7 +688,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -568,15 +698,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling AuClockOnModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling AuClockOnModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -587,7 +720,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -597,12 +730,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -611,7 +747,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -621,12 +757,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -635,7 +774,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -645,12 +784,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -659,7 +801,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -669,17 +811,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -695,7 +841,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -705,22 +851,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -736,11 +883,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -748,13 +908,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuCostingReportApiModel.php b/src/lib/Model/AuCostingReportApiModel.php index e946d82..0fb4cee 100644 --- a/src/lib/Model/AuCostingReportApiModel.php +++ b/src/lib/Model/AuCostingReportApiModel.php @@ -2,87 +2,108 @@ /** * AuCostingReportApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuCostingReportApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuCostingReportApiModel implements ModelInterface, ArrayAccess +class AuCostingReportApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuCostingReportApiModel'; + protected static $openAPIModelName = 'AuCostingReportApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super_contribution' => 'double', + protected static $openAPITypes = [ + 'super_contribution' => 'float', 'location_id' => 'int', 'location_name' => 'string', - 'pay_categories' => 'map[string,double]' + 'pay_categories' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_contribution' => 'double', 'location_id' => 'int32', 'location_name' => null, 'pay_categories' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_contribution' => false, + 'location_id' => false, + 'location_name' => false, + 'pay_categories' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['pay_categories'] = isset($data['pay_categories']) ? $data['pay_categories'] : null; + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('pay_categories', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -235,12 +323,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -249,7 +340,7 @@ public function setSuperContribution($super_contribution) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -259,12 +350,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -273,7 +367,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -283,12 +377,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -297,7 +394,7 @@ public function setLocationName($location_name) /** * Gets pay_categories * - * @return map[string,double] + * @return array|null */ public function getPayCategories() { @@ -307,12 +404,15 @@ public function getPayCategories() /** * Sets pay_categories * - * @param map[string,double] $pay_categories + * @param array|null $pay_categories * - * @return $this + * @return self */ public function setPayCategories($pay_categories) { + if (is_null($pay_categories)) { + throw new \InvalidArgumentException('non-nullable pay_categories cannot be null'); + } $this->container['pay_categories'] = $pay_categories; return $this; @@ -324,7 +424,7 @@ public function setPayCategories($pay_categories) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuDashboardModel.php b/src/lib/Model/AuDashboardModel.php index 89e9aa2..1a33536 100644 --- a/src/lib/Model/AuDashboardModel.php +++ b/src/lib/Model/AuDashboardModel.php @@ -2,88 +2,88 @@ /** * AuDashboardModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuDashboardModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuDashboardModel implements ModelInterface, ArrayAccess +class AuDashboardModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuDashboardModel'; + protected static $openAPIModelName = 'AuDashboardModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'features' => '\Swagger\Client\Model\AuFeaturesModel', - 'next_shift' => '\Swagger\Client\Model\AuEssRosterShiftModel', - 'latest_payslip' => '\Swagger\Client\Model\EssPayslipModel', - 'leave_balances' => '\Swagger\Client\Model\LeaveBalanceModel[]', - 'titles' => '\Swagger\Client\Model\TitleViewModel[]', - 'work_types' => '\Swagger\Client\Model\EssWorkTypeModel[]', - 'shift_conditions' => '\Swagger\Client\Model\EssWorkTypeModel[]', - 'locations' => '\Swagger\Client\Model\LocationModel[]', - 'classifications' => '\Swagger\Client\Model\ClassificationSelectModel[]', - 'leave_categories' => '\Swagger\Client\Model\EssLeaveCategoryModel[]', - 'current_week_satisfaction_survey' => '\Swagger\Client\Model\EssSatisfactionSurvey', - 'timesheets' => '\Swagger\Client\Model\EssCurrentTimesheetsModel', + protected static $openAPITypes = [ + 'features' => '\OpenAPI\Client\Model\AuFeaturesModel', + 'next_shift' => '\OpenAPI\Client\Model\AuEssRosterShiftModel', + 'latest_payslip' => '\OpenAPI\Client\Model\EssPayslipModel', + 'leave_balances' => '\OpenAPI\Client\Model\LeaveBalanceModel[]', + 'titles' => '\OpenAPI\Client\Model\TitleViewModel[]', + 'work_types' => '\OpenAPI\Client\Model\EssWorkTypeModel[]', + 'shift_conditions' => '\OpenAPI\Client\Model\EssWorkTypeModel[]', + 'locations' => '\OpenAPI\Client\Model\LocationModel[]', + 'classifications' => '\OpenAPI\Client\Model\ClassificationSelectModel[]', + 'leave_categories' => '\OpenAPI\Client\Model\EssLeaveCategoryModel[]', + 'current_week_satisfaction_survey' => '\OpenAPI\Client\Model\EssSatisfactionSurvey', + 'timesheets' => '\OpenAPI\Client\Model\EssCurrentTimesheetsModel', 'timesheet_entry_period_end' => '\DateTime', - 'expense_categories' => '\Swagger\Client\Model\ExpenseCategoryResponseModel[]', - 'tax_codes' => '\Swagger\Client\Model\JournalServiceTaxCode[]', - 'expenses' => '\Swagger\Client\Model\EssCurrentExpensesModel', + 'expense_categories' => '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]', + 'tax_codes' => '\OpenAPI\Client\Model\JournalServiceTaxCode[]', + 'expenses' => '\OpenAPI\Client\Model\EssCurrentExpensesModel', 'pending_shift_count' => 'int', 'proposed_swap_count' => 'int', 'pending_leave_count' => 'int', - 'current_shift' => '\Swagger\Client\Model\EssCurrentShiftModel', + 'current_shift' => '\OpenAPI\Client\Model\EssCurrentShiftModel', 'documents_requiring_acknowledgement_count' => 'int', 'region' => 'string', 'biddable_shift_count' => 'int', 'is_terminated' => 'bool', 'google_maps_api_key' => 'string', 'start_date' => '\DateTime', - 'standard_hours' => '\Swagger\Client\Model\StandardHoursModel', + 'standard_hours' => '\OpenAPI\Client\Model\StandardHoursModel', 'not_accepted_shifts_count' => 'int' ]; @@ -91,8 +91,10 @@ class AuDashboardModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'features' => null, 'next_shift' => null, 'latest_payslip' => null, @@ -123,14 +125,57 @@ class AuDashboardModel implements ModelInterface, ArrayAccess 'not_accepted_shifts_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'features' => false, + 'next_shift' => false, + 'latest_payslip' => false, + 'leave_balances' => false, + 'titles' => false, + 'work_types' => false, + 'shift_conditions' => false, + 'locations' => false, + 'classifications' => false, + 'leave_categories' => false, + 'current_week_satisfaction_survey' => false, + 'timesheets' => false, + 'timesheet_entry_period_end' => false, + 'expense_categories' => false, + 'tax_codes' => false, + 'expenses' => false, + 'pending_shift_count' => false, + 'proposed_swap_count' => false, + 'pending_leave_count' => false, + 'current_shift' => false, + 'documents_requiring_acknowledgement_count' => false, + 'region' => false, + 'biddable_shift_count' => false, + 'is_terminated' => false, + 'google_maps_api_key' => false, + 'start_date' => false, + 'standard_hours' => false, + 'not_accepted_shifts_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -138,9 +183,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -290,12 +387,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -312,34 +406,52 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['features'] = isset($data['features']) ? $data['features'] : null; - $this->container['next_shift'] = isset($data['next_shift']) ? $data['next_shift'] : null; - $this->container['latest_payslip'] = isset($data['latest_payslip']) ? $data['latest_payslip'] : null; - $this->container['leave_balances'] = isset($data['leave_balances']) ? $data['leave_balances'] : null; - $this->container['titles'] = isset($data['titles']) ? $data['titles'] : null; - $this->container['work_types'] = isset($data['work_types']) ? $data['work_types'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; - $this->container['classifications'] = isset($data['classifications']) ? $data['classifications'] : null; - $this->container['leave_categories'] = isset($data['leave_categories']) ? $data['leave_categories'] : null; - $this->container['current_week_satisfaction_survey'] = isset($data['current_week_satisfaction_survey']) ? $data['current_week_satisfaction_survey'] : null; - $this->container['timesheets'] = isset($data['timesheets']) ? $data['timesheets'] : null; - $this->container['timesheet_entry_period_end'] = isset($data['timesheet_entry_period_end']) ? $data['timesheet_entry_period_end'] : null; - $this->container['expense_categories'] = isset($data['expense_categories']) ? $data['expense_categories'] : null; - $this->container['tax_codes'] = isset($data['tax_codes']) ? $data['tax_codes'] : null; - $this->container['expenses'] = isset($data['expenses']) ? $data['expenses'] : null; - $this->container['pending_shift_count'] = isset($data['pending_shift_count']) ? $data['pending_shift_count'] : null; - $this->container['proposed_swap_count'] = isset($data['proposed_swap_count']) ? $data['proposed_swap_count'] : null; - $this->container['pending_leave_count'] = isset($data['pending_leave_count']) ? $data['pending_leave_count'] : null; - $this->container['current_shift'] = isset($data['current_shift']) ? $data['current_shift'] : null; - $this->container['documents_requiring_acknowledgement_count'] = isset($data['documents_requiring_acknowledgement_count']) ? $data['documents_requiring_acknowledgement_count'] : null; - $this->container['region'] = isset($data['region']) ? $data['region'] : null; - $this->container['biddable_shift_count'] = isset($data['biddable_shift_count']) ? $data['biddable_shift_count'] : null; - $this->container['is_terminated'] = isset($data['is_terminated']) ? $data['is_terminated'] : null; - $this->container['google_maps_api_key'] = isset($data['google_maps_api_key']) ? $data['google_maps_api_key'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['standard_hours'] = isset($data['standard_hours']) ? $data['standard_hours'] : null; - $this->container['not_accepted_shifts_count'] = isset($data['not_accepted_shifts_count']) ? $data['not_accepted_shifts_count'] : null; + $this->setIfExists('features', $data ?? [], null); + $this->setIfExists('next_shift', $data ?? [], null); + $this->setIfExists('latest_payslip', $data ?? [], null); + $this->setIfExists('leave_balances', $data ?? [], null); + $this->setIfExists('titles', $data ?? [], null); + $this->setIfExists('work_types', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('locations', $data ?? [], null); + $this->setIfExists('classifications', $data ?? [], null); + $this->setIfExists('leave_categories', $data ?? [], null); + $this->setIfExists('current_week_satisfaction_survey', $data ?? [], null); + $this->setIfExists('timesheets', $data ?? [], null); + $this->setIfExists('timesheet_entry_period_end', $data ?? [], null); + $this->setIfExists('expense_categories', $data ?? [], null); + $this->setIfExists('tax_codes', $data ?? [], null); + $this->setIfExists('expenses', $data ?? [], null); + $this->setIfExists('pending_shift_count', $data ?? [], null); + $this->setIfExists('proposed_swap_count', $data ?? [], null); + $this->setIfExists('pending_leave_count', $data ?? [], null); + $this->setIfExists('current_shift', $data ?? [], null); + $this->setIfExists('documents_requiring_acknowledgement_count', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('biddable_shift_count', $data ?? [], null); + $this->setIfExists('is_terminated', $data ?? [], null); + $this->setIfExists('google_maps_api_key', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('standard_hours', $data ?? [], null); + $this->setIfExists('not_accepted_shifts_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; } /** @@ -369,7 +481,7 @@ public function valid() /** * Gets features * - * @return \Swagger\Client\Model\AuFeaturesModel + * @return \OpenAPI\Client\Model\AuFeaturesModel|null */ public function getFeatures() { @@ -379,12 +491,15 @@ public function getFeatures() /** * Sets features * - * @param \Swagger\Client\Model\AuFeaturesModel $features + * @param \OpenAPI\Client\Model\AuFeaturesModel|null $features features * - * @return $this + * @return self */ public function setFeatures($features) { + if (is_null($features)) { + throw new \InvalidArgumentException('non-nullable features cannot be null'); + } $this->container['features'] = $features; return $this; @@ -393,7 +508,7 @@ public function setFeatures($features) /** * Gets next_shift * - * @return \Swagger\Client\Model\AuEssRosterShiftModel + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel|null */ public function getNextShift() { @@ -403,12 +518,15 @@ public function getNextShift() /** * Sets next_shift * - * @param \Swagger\Client\Model\AuEssRosterShiftModel $next_shift + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel|null $next_shift next_shift * - * @return $this + * @return self */ public function setNextShift($next_shift) { + if (is_null($next_shift)) { + throw new \InvalidArgumentException('non-nullable next_shift cannot be null'); + } $this->container['next_shift'] = $next_shift; return $this; @@ -417,7 +535,7 @@ public function setNextShift($next_shift) /** * Gets latest_payslip * - * @return \Swagger\Client\Model\EssPayslipModel + * @return \OpenAPI\Client\Model\EssPayslipModel|null */ public function getLatestPayslip() { @@ -427,12 +545,15 @@ public function getLatestPayslip() /** * Sets latest_payslip * - * @param \Swagger\Client\Model\EssPayslipModel $latest_payslip + * @param \OpenAPI\Client\Model\EssPayslipModel|null $latest_payslip latest_payslip * - * @return $this + * @return self */ public function setLatestPayslip($latest_payslip) { + if (is_null($latest_payslip)) { + throw new \InvalidArgumentException('non-nullable latest_payslip cannot be null'); + } $this->container['latest_payslip'] = $latest_payslip; return $this; @@ -441,7 +562,7 @@ public function setLatestPayslip($latest_payslip) /** * Gets leave_balances * - * @return \Swagger\Client\Model\LeaveBalanceModel[] + * @return \OpenAPI\Client\Model\LeaveBalanceModel[]|null */ public function getLeaveBalances() { @@ -451,12 +572,15 @@ public function getLeaveBalances() /** * Sets leave_balances * - * @param \Swagger\Client\Model\LeaveBalanceModel[] $leave_balances + * @param \OpenAPI\Client\Model\LeaveBalanceModel[]|null $leave_balances * - * @return $this + * @return self */ public function setLeaveBalances($leave_balances) { + if (is_null($leave_balances)) { + throw new \InvalidArgumentException('non-nullable leave_balances cannot be null'); + } $this->container['leave_balances'] = $leave_balances; return $this; @@ -465,7 +589,7 @@ public function setLeaveBalances($leave_balances) /** * Gets titles * - * @return \Swagger\Client\Model\TitleViewModel[] + * @return \OpenAPI\Client\Model\TitleViewModel[]|null */ public function getTitles() { @@ -475,12 +599,15 @@ public function getTitles() /** * Sets titles * - * @param \Swagger\Client\Model\TitleViewModel[] $titles + * @param \OpenAPI\Client\Model\TitleViewModel[]|null $titles * - * @return $this + * @return self */ public function setTitles($titles) { + if (is_null($titles)) { + throw new \InvalidArgumentException('non-nullable titles cannot be null'); + } $this->container['titles'] = $titles; return $this; @@ -489,7 +616,7 @@ public function setTitles($titles) /** * Gets work_types * - * @return \Swagger\Client\Model\EssWorkTypeModel[] + * @return \OpenAPI\Client\Model\EssWorkTypeModel[]|null */ public function getWorkTypes() { @@ -499,12 +626,15 @@ public function getWorkTypes() /** * Sets work_types * - * @param \Swagger\Client\Model\EssWorkTypeModel[] $work_types + * @param \OpenAPI\Client\Model\EssWorkTypeModel[]|null $work_types * - * @return $this + * @return self */ public function setWorkTypes($work_types) { + if (is_null($work_types)) { + throw new \InvalidArgumentException('non-nullable work_types cannot be null'); + } $this->container['work_types'] = $work_types; return $this; @@ -513,7 +643,7 @@ public function setWorkTypes($work_types) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\EssWorkTypeModel[] + * @return \OpenAPI\Client\Model\EssWorkTypeModel[]|null */ public function getShiftConditions() { @@ -523,12 +653,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\EssWorkTypeModel[] $shift_conditions + * @param \OpenAPI\Client\Model\EssWorkTypeModel[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -537,7 +670,7 @@ public function setShiftConditions($shift_conditions) /** * Gets locations * - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[]|null */ public function getLocations() { @@ -547,12 +680,15 @@ public function getLocations() /** * Sets locations * - * @param \Swagger\Client\Model\LocationModel[] $locations + * @param \OpenAPI\Client\Model\LocationModel[]|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -561,7 +697,7 @@ public function setLocations($locations) /** * Gets classifications * - * @return \Swagger\Client\Model\ClassificationSelectModel[] + * @return \OpenAPI\Client\Model\ClassificationSelectModel[]|null */ public function getClassifications() { @@ -571,12 +707,15 @@ public function getClassifications() /** * Sets classifications * - * @param \Swagger\Client\Model\ClassificationSelectModel[] $classifications + * @param \OpenAPI\Client\Model\ClassificationSelectModel[]|null $classifications * - * @return $this + * @return self */ public function setClassifications($classifications) { + if (is_null($classifications)) { + throw new \InvalidArgumentException('non-nullable classifications cannot be null'); + } $this->container['classifications'] = $classifications; return $this; @@ -585,7 +724,7 @@ public function setClassifications($classifications) /** * Gets leave_categories * - * @return \Swagger\Client\Model\EssLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\EssLeaveCategoryModel[]|null */ public function getLeaveCategories() { @@ -595,12 +734,15 @@ public function getLeaveCategories() /** * Sets leave_categories * - * @param \Swagger\Client\Model\EssLeaveCategoryModel[] $leave_categories + * @param \OpenAPI\Client\Model\EssLeaveCategoryModel[]|null $leave_categories * - * @return $this + * @return self */ public function setLeaveCategories($leave_categories) { + if (is_null($leave_categories)) { + throw new \InvalidArgumentException('non-nullable leave_categories cannot be null'); + } $this->container['leave_categories'] = $leave_categories; return $this; @@ -609,7 +751,7 @@ public function setLeaveCategories($leave_categories) /** * Gets current_week_satisfaction_survey * - * @return \Swagger\Client\Model\EssSatisfactionSurvey + * @return \OpenAPI\Client\Model\EssSatisfactionSurvey|null */ public function getCurrentWeekSatisfactionSurvey() { @@ -619,12 +761,15 @@ public function getCurrentWeekSatisfactionSurvey() /** * Sets current_week_satisfaction_survey * - * @param \Swagger\Client\Model\EssSatisfactionSurvey $current_week_satisfaction_survey + * @param \OpenAPI\Client\Model\EssSatisfactionSurvey|null $current_week_satisfaction_survey current_week_satisfaction_survey * - * @return $this + * @return self */ public function setCurrentWeekSatisfactionSurvey($current_week_satisfaction_survey) { + if (is_null($current_week_satisfaction_survey)) { + throw new \InvalidArgumentException('non-nullable current_week_satisfaction_survey cannot be null'); + } $this->container['current_week_satisfaction_survey'] = $current_week_satisfaction_survey; return $this; @@ -633,7 +778,7 @@ public function setCurrentWeekSatisfactionSurvey($current_week_satisfaction_surv /** * Gets timesheets * - * @return \Swagger\Client\Model\EssCurrentTimesheetsModel + * @return \OpenAPI\Client\Model\EssCurrentTimesheetsModel|null */ public function getTimesheets() { @@ -643,12 +788,15 @@ public function getTimesheets() /** * Sets timesheets * - * @param \Swagger\Client\Model\EssCurrentTimesheetsModel $timesheets + * @param \OpenAPI\Client\Model\EssCurrentTimesheetsModel|null $timesheets timesheets * - * @return $this + * @return self */ public function setTimesheets($timesheets) { + if (is_null($timesheets)) { + throw new \InvalidArgumentException('non-nullable timesheets cannot be null'); + } $this->container['timesheets'] = $timesheets; return $this; @@ -657,7 +805,7 @@ public function setTimesheets($timesheets) /** * Gets timesheet_entry_period_end * - * @return \DateTime + * @return \DateTime|null */ public function getTimesheetEntryPeriodEnd() { @@ -667,12 +815,15 @@ public function getTimesheetEntryPeriodEnd() /** * Sets timesheet_entry_period_end * - * @param \DateTime $timesheet_entry_period_end + * @param \DateTime|null $timesheet_entry_period_end * - * @return $this + * @return self */ public function setTimesheetEntryPeriodEnd($timesheet_entry_period_end) { + if (is_null($timesheet_entry_period_end)) { + throw new \InvalidArgumentException('non-nullable timesheet_entry_period_end cannot be null'); + } $this->container['timesheet_entry_period_end'] = $timesheet_entry_period_end; return $this; @@ -681,7 +832,7 @@ public function setTimesheetEntryPeriodEnd($timesheet_entry_period_end) /** * Gets expense_categories * - * @return \Swagger\Client\Model\ExpenseCategoryResponseModel[] + * @return \OpenAPI\Client\Model\ExpenseCategoryResponseModel[]|null */ public function getExpenseCategories() { @@ -691,12 +842,15 @@ public function getExpenseCategories() /** * Sets expense_categories * - * @param \Swagger\Client\Model\ExpenseCategoryResponseModel[] $expense_categories + * @param \OpenAPI\Client\Model\ExpenseCategoryResponseModel[]|null $expense_categories * - * @return $this + * @return self */ public function setExpenseCategories($expense_categories) { + if (is_null($expense_categories)) { + throw new \InvalidArgumentException('non-nullable expense_categories cannot be null'); + } $this->container['expense_categories'] = $expense_categories; return $this; @@ -705,7 +859,7 @@ public function setExpenseCategories($expense_categories) /** * Gets tax_codes * - * @return \Swagger\Client\Model\JournalServiceTaxCode[] + * @return \OpenAPI\Client\Model\JournalServiceTaxCode[]|null */ public function getTaxCodes() { @@ -715,12 +869,15 @@ public function getTaxCodes() /** * Sets tax_codes * - * @param \Swagger\Client\Model\JournalServiceTaxCode[] $tax_codes + * @param \OpenAPI\Client\Model\JournalServiceTaxCode[]|null $tax_codes * - * @return $this + * @return self */ public function setTaxCodes($tax_codes) { + if (is_null($tax_codes)) { + throw new \InvalidArgumentException('non-nullable tax_codes cannot be null'); + } $this->container['tax_codes'] = $tax_codes; return $this; @@ -729,7 +886,7 @@ public function setTaxCodes($tax_codes) /** * Gets expenses * - * @return \Swagger\Client\Model\EssCurrentExpensesModel + * @return \OpenAPI\Client\Model\EssCurrentExpensesModel|null */ public function getExpenses() { @@ -739,12 +896,15 @@ public function getExpenses() /** * Sets expenses * - * @param \Swagger\Client\Model\EssCurrentExpensesModel $expenses + * @param \OpenAPI\Client\Model\EssCurrentExpensesModel|null $expenses expenses * - * @return $this + * @return self */ public function setExpenses($expenses) { + if (is_null($expenses)) { + throw new \InvalidArgumentException('non-nullable expenses cannot be null'); + } $this->container['expenses'] = $expenses; return $this; @@ -753,7 +913,7 @@ public function setExpenses($expenses) /** * Gets pending_shift_count * - * @return int + * @return int|null */ public function getPendingShiftCount() { @@ -763,12 +923,15 @@ public function getPendingShiftCount() /** * Sets pending_shift_count * - * @param int $pending_shift_count + * @param int|null $pending_shift_count * - * @return $this + * @return self */ public function setPendingShiftCount($pending_shift_count) { + if (is_null($pending_shift_count)) { + throw new \InvalidArgumentException('non-nullable pending_shift_count cannot be null'); + } $this->container['pending_shift_count'] = $pending_shift_count; return $this; @@ -777,7 +940,7 @@ public function setPendingShiftCount($pending_shift_count) /** * Gets proposed_swap_count * - * @return int + * @return int|null */ public function getProposedSwapCount() { @@ -787,12 +950,15 @@ public function getProposedSwapCount() /** * Sets proposed_swap_count * - * @param int $proposed_swap_count + * @param int|null $proposed_swap_count * - * @return $this + * @return self */ public function setProposedSwapCount($proposed_swap_count) { + if (is_null($proposed_swap_count)) { + throw new \InvalidArgumentException('non-nullable proposed_swap_count cannot be null'); + } $this->container['proposed_swap_count'] = $proposed_swap_count; return $this; @@ -801,7 +967,7 @@ public function setProposedSwapCount($proposed_swap_count) /** * Gets pending_leave_count * - * @return int + * @return int|null */ public function getPendingLeaveCount() { @@ -811,12 +977,15 @@ public function getPendingLeaveCount() /** * Sets pending_leave_count * - * @param int $pending_leave_count + * @param int|null $pending_leave_count * - * @return $this + * @return self */ public function setPendingLeaveCount($pending_leave_count) { + if (is_null($pending_leave_count)) { + throw new \InvalidArgumentException('non-nullable pending_leave_count cannot be null'); + } $this->container['pending_leave_count'] = $pending_leave_count; return $this; @@ -825,7 +994,7 @@ public function setPendingLeaveCount($pending_leave_count) /** * Gets current_shift * - * @return \Swagger\Client\Model\EssCurrentShiftModel + * @return \OpenAPI\Client\Model\EssCurrentShiftModel|null */ public function getCurrentShift() { @@ -835,12 +1004,15 @@ public function getCurrentShift() /** * Sets current_shift * - * @param \Swagger\Client\Model\EssCurrentShiftModel $current_shift + * @param \OpenAPI\Client\Model\EssCurrentShiftModel|null $current_shift current_shift * - * @return $this + * @return self */ public function setCurrentShift($current_shift) { + if (is_null($current_shift)) { + throw new \InvalidArgumentException('non-nullable current_shift cannot be null'); + } $this->container['current_shift'] = $current_shift; return $this; @@ -849,7 +1021,7 @@ public function setCurrentShift($current_shift) /** * Gets documents_requiring_acknowledgement_count * - * @return int + * @return int|null */ public function getDocumentsRequiringAcknowledgementCount() { @@ -859,12 +1031,15 @@ public function getDocumentsRequiringAcknowledgementCount() /** * Sets documents_requiring_acknowledgement_count * - * @param int $documents_requiring_acknowledgement_count + * @param int|null $documents_requiring_acknowledgement_count * - * @return $this + * @return self */ public function setDocumentsRequiringAcknowledgementCount($documents_requiring_acknowledgement_count) { + if (is_null($documents_requiring_acknowledgement_count)) { + throw new \InvalidArgumentException('non-nullable documents_requiring_acknowledgement_count cannot be null'); + } $this->container['documents_requiring_acknowledgement_count'] = $documents_requiring_acknowledgement_count; return $this; @@ -873,7 +1048,7 @@ public function setDocumentsRequiringAcknowledgementCount($documents_requiring_a /** * Gets region * - * @return string + * @return string|null */ public function getRegion() { @@ -883,12 +1058,15 @@ public function getRegion() /** * Sets region * - * @param string $region + * @param string|null $region * - * @return $this + * @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; @@ -897,7 +1075,7 @@ public function setRegion($region) /** * Gets biddable_shift_count * - * @return int + * @return int|null */ public function getBiddableShiftCount() { @@ -907,12 +1085,15 @@ public function getBiddableShiftCount() /** * Sets biddable_shift_count * - * @param int $biddable_shift_count + * @param int|null $biddable_shift_count * - * @return $this + * @return self */ public function setBiddableShiftCount($biddable_shift_count) { + if (is_null($biddable_shift_count)) { + throw new \InvalidArgumentException('non-nullable biddable_shift_count cannot be null'); + } $this->container['biddable_shift_count'] = $biddable_shift_count; return $this; @@ -921,7 +1102,7 @@ public function setBiddableShiftCount($biddable_shift_count) /** * Gets is_terminated * - * @return bool + * @return bool|null */ public function getIsTerminated() { @@ -931,12 +1112,15 @@ public function getIsTerminated() /** * Sets is_terminated * - * @param bool $is_terminated + * @param bool|null $is_terminated * - * @return $this + * @return self */ public function setIsTerminated($is_terminated) { + if (is_null($is_terminated)) { + throw new \InvalidArgumentException('non-nullable is_terminated cannot be null'); + } $this->container['is_terminated'] = $is_terminated; return $this; @@ -945,7 +1129,7 @@ public function setIsTerminated($is_terminated) /** * Gets google_maps_api_key * - * @return string + * @return string|null */ public function getGoogleMapsApiKey() { @@ -955,12 +1139,15 @@ public function getGoogleMapsApiKey() /** * Sets google_maps_api_key * - * @param string $google_maps_api_key + * @param string|null $google_maps_api_key * - * @return $this + * @return self */ public function setGoogleMapsApiKey($google_maps_api_key) { + if (is_null($google_maps_api_key)) { + throw new \InvalidArgumentException('non-nullable google_maps_api_key cannot be null'); + } $this->container['google_maps_api_key'] = $google_maps_api_key; return $this; @@ -969,7 +1156,7 @@ public function setGoogleMapsApiKey($google_maps_api_key) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -979,12 +1166,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -993,7 +1183,7 @@ public function setStartDate($start_date) /** * Gets standard_hours * - * @return \Swagger\Client\Model\StandardHoursModel + * @return \OpenAPI\Client\Model\StandardHoursModel|null */ public function getStandardHours() { @@ -1003,12 +1193,15 @@ public function getStandardHours() /** * Sets standard_hours * - * @param \Swagger\Client\Model\StandardHoursModel $standard_hours + * @param \OpenAPI\Client\Model\StandardHoursModel|null $standard_hours standard_hours * - * @return $this + * @return self */ public function setStandardHours($standard_hours) { + if (is_null($standard_hours)) { + throw new \InvalidArgumentException('non-nullable standard_hours cannot be null'); + } $this->container['standard_hours'] = $standard_hours; return $this; @@ -1017,7 +1210,7 @@ public function setStandardHours($standard_hours) /** * Gets not_accepted_shifts_count * - * @return int + * @return int|null */ public function getNotAcceptedShiftsCount() { @@ -1027,12 +1220,15 @@ public function getNotAcceptedShiftsCount() /** * Sets not_accepted_shifts_count * - * @param int $not_accepted_shifts_count + * @param int|null $not_accepted_shifts_count * - * @return $this + * @return self */ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) { + if (is_null($not_accepted_shifts_count)) { + throw new \InvalidArgumentException('non-nullable not_accepted_shifts_count cannot be null'); + } $this->container['not_accepted_shifts_count'] = $not_accepted_shifts_count; return $this; @@ -1044,7 +1240,7 @@ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1054,22 +1250,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1085,11 +1282,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1097,13 +1307,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuDeductionCategoryModel.php b/src/lib/Model/AuDeductionCategoryModel.php index 2a40388..6a4fe55 100644 --- a/src/lib/Model/AuDeductionCategoryModel.php +++ b/src/lib/Model/AuDeductionCategoryModel.php @@ -2,61 +2,61 @@ /** * AuDeductionCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuDeductionCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuDeductionCategoryModel implements ModelInterface, ArrayAccess +class AuDeductionCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuDeductionCategoryModel'; + protected static $openAPIModelName = 'AuDeductionCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'tax_exempt' => 'bool', 'expense_general_ledger_mapping_code' => 'string', 'liability_general_ledger_mapping_code' => 'string', @@ -74,8 +74,10 @@ class AuDeductionCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'tax_exempt' => null, 'expense_general_ledger_mapping_code' => null, 'liability_general_ledger_mapping_code' => null, @@ -89,14 +91,40 @@ class AuDeductionCategoryModel implements ModelInterface, ArrayAccess 'is_system' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tax_exempt' => false, + 'expense_general_ledger_mapping_code' => false, + 'liability_general_ledger_mapping_code' => false, + 'sgc_calculation_impact' => false, + 'payment_summary_classification' => false, + 'is_resc' => false, + 'id' => false, + 'name' => false, + 'source' => false, + 'external_id' => false, + 'is_system' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,97 +285,95 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SGC_CALCULATION_IMPACT_NONE = 'None'; - const SGC_CALCULATION_IMPACT_REDUCES_OTE = 'ReducesOTE'; - const PAYMENT_SUMMARY_CLASSIFICATION__DEFAULT = 'Default'; - const PAYMENT_SUMMARY_CLASSIFICATION_UNION_OR_PROFESSIONAL_ASSOCIATION_FEES = 'UnionOrProfessionalAssociationFees'; - const PAYMENT_SUMMARY_CLASSIFICATION_WORKPLACE_GIVING = 'WorkplaceGiving'; - const PAYMENT_SUMMARY_CLASSIFICATION_CHILD_SUPPORT_DEDUCTION = 'ChildSupportDeduction'; - const PAYMENT_SUMMARY_CLASSIFICATION_CHILD_SUPPORT_GARNISHEE = 'ChildSupportGarnishee'; - const PAYMENT_SUMMARY_CLASSIFICATION_SALARY_SACRIFICE_OTHER_EMPLOYEE_BENEFITS = 'SalarySacrificeOtherEmployeeBenefits'; - const PAYMENT_SUMMARY_CLASSIFICATION_SALARY_SACRIFICE_SUPERANNUATION = 'SalarySacrificeSuperannuation'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SGC_CALCULATION_IMPACT_NONE = 'None'; + public const SGC_CALCULATION_IMPACT_REDUCES_OTE = 'ReducesOTE'; + public const PAYMENT_SUMMARY_CLASSIFICATION__DEFAULT = 'Default'; + public const PAYMENT_SUMMARY_CLASSIFICATION_UNION_OR_PROFESSIONAL_ASSOCIATION_FEES = 'UnionOrProfessionalAssociationFees'; + public const PAYMENT_SUMMARY_CLASSIFICATION_WORKPLACE_GIVING = 'WorkplaceGiving'; + public const PAYMENT_SUMMARY_CLASSIFICATION_CHILD_SUPPORT_DEDUCTION = 'ChildSupportDeduction'; + public const PAYMENT_SUMMARY_CLASSIFICATION_CHILD_SUPPORT_GARNISHEE = 'ChildSupportGarnishee'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SALARY_SACRIFICE_OTHER_EMPLOYEE_BENEFITS = 'SalarySacrificeOtherEmployeeBenefits'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SALARY_SACRIFICE_SUPERANNUATION = 'SalarySacrificeSuperannuation'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -308,7 +386,7 @@ public function getSgcCalculationImpactAllowableValues() self::SGC_CALCULATION_IMPACT_REDUCES_OTE, ]; } - + /** * Gets allowable values of the enum * @@ -326,7 +404,7 @@ public function getPaymentSummaryClassificationAllowableValues() self::PAYMENT_SUMMARY_CLASSIFICATION_SALARY_SACRIFICE_SUPERANNUATION, ]; } - + /** * Gets allowable values of the enum * @@ -413,7 +491,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -430,17 +507,35 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['tax_exempt'] = isset($data['tax_exempt']) ? $data['tax_exempt'] : null; - $this->container['expense_general_ledger_mapping_code'] = isset($data['expense_general_ledger_mapping_code']) ? $data['expense_general_ledger_mapping_code'] : null; - $this->container['liability_general_ledger_mapping_code'] = isset($data['liability_general_ledger_mapping_code']) ? $data['liability_general_ledger_mapping_code'] : null; - $this->container['sgc_calculation_impact'] = isset($data['sgc_calculation_impact']) ? $data['sgc_calculation_impact'] : null; - $this->container['payment_summary_classification'] = isset($data['payment_summary_classification']) ? $data['payment_summary_classification'] : null; - $this->container['is_resc'] = isset($data['is_resc']) ? $data['is_resc'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['is_system'] = isset($data['is_system']) ? $data['is_system'] : null; + $this->setIfExists('tax_exempt', $data ?? [], null); + $this->setIfExists('expense_general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('liability_general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('sgc_calculation_impact', $data ?? [], null); + $this->setIfExists('payment_summary_classification', $data ?? [], null); + $this->setIfExists('is_resc', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('is_system', $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; } /** @@ -455,7 +550,8 @@ public function listInvalidProperties() $allowedValues = $this->getSgcCalculationImpactAllowableValues(); if (!is_null($this->container['sgc_calculation_impact']) && !in_array($this->container['sgc_calculation_impact'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'sgc_calculation_impact', must be one of '%s'", + "invalid value '%s' for 'sgc_calculation_impact', must be one of '%s'", + $this->container['sgc_calculation_impact'], implode("', '", $allowedValues) ); } @@ -463,7 +559,8 @@ public function listInvalidProperties() $allowedValues = $this->getPaymentSummaryClassificationAllowableValues(); if (!is_null($this->container['payment_summary_classification']) && !in_array($this->container['payment_summary_classification'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'payment_summary_classification', must be one of '%s'", + "invalid value '%s' for 'payment_summary_classification', must be one of '%s'", + $this->container['payment_summary_classification'], implode("', '", $allowedValues) ); } @@ -471,7 +568,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -494,7 +592,7 @@ public function valid() /** * Gets tax_exempt * - * @return bool + * @return bool|null */ public function getTaxExempt() { @@ -504,12 +602,15 @@ public function getTaxExempt() /** * Sets tax_exempt * - * @param bool $tax_exempt + * @param bool|null $tax_exempt * - * @return $this + * @return self */ public function setTaxExempt($tax_exempt) { + if (is_null($tax_exempt)) { + throw new \InvalidArgumentException('non-nullable tax_exempt cannot be null'); + } $this->container['tax_exempt'] = $tax_exempt; return $this; @@ -518,7 +619,7 @@ public function setTaxExempt($tax_exempt) /** * Gets expense_general_ledger_mapping_code * - * @return string + * @return string|null */ public function getExpenseGeneralLedgerMappingCode() { @@ -528,12 +629,15 @@ public function getExpenseGeneralLedgerMappingCode() /** * Sets expense_general_ledger_mapping_code * - * @param string $expense_general_ledger_mapping_code + * @param string|null $expense_general_ledger_mapping_code * - * @return $this + * @return self */ public function setExpenseGeneralLedgerMappingCode($expense_general_ledger_mapping_code) { + if (is_null($expense_general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable expense_general_ledger_mapping_code cannot be null'); + } $this->container['expense_general_ledger_mapping_code'] = $expense_general_ledger_mapping_code; return $this; @@ -542,7 +646,7 @@ public function setExpenseGeneralLedgerMappingCode($expense_general_ledger_mappi /** * Gets liability_general_ledger_mapping_code * - * @return string + * @return string|null */ public function getLiabilityGeneralLedgerMappingCode() { @@ -552,12 +656,15 @@ public function getLiabilityGeneralLedgerMappingCode() /** * Sets liability_general_ledger_mapping_code * - * @param string $liability_general_ledger_mapping_code + * @param string|null $liability_general_ledger_mapping_code * - * @return $this + * @return self */ public function setLiabilityGeneralLedgerMappingCode($liability_general_ledger_mapping_code) { + if (is_null($liability_general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable liability_general_ledger_mapping_code cannot be null'); + } $this->container['liability_general_ledger_mapping_code'] = $liability_general_ledger_mapping_code; return $this; @@ -566,7 +673,7 @@ public function setLiabilityGeneralLedgerMappingCode($liability_general_ledger_m /** * Gets sgc_calculation_impact * - * @return string + * @return string|null */ public function getSgcCalculationImpact() { @@ -576,17 +683,21 @@ public function getSgcCalculationImpact() /** * Sets sgc_calculation_impact * - * @param string $sgc_calculation_impact + * @param string|null $sgc_calculation_impact * - * @return $this + * @return self */ public function setSgcCalculationImpact($sgc_calculation_impact) { + if (is_null($sgc_calculation_impact)) { + throw new \InvalidArgumentException('non-nullable sgc_calculation_impact cannot be null'); + } $allowedValues = $this->getSgcCalculationImpactAllowableValues(); - if (!is_null($sgc_calculation_impact) && !in_array($sgc_calculation_impact, $allowedValues, true)) { + if (!in_array($sgc_calculation_impact, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'sgc_calculation_impact', must be one of '%s'", + "Invalid value '%s' for 'sgc_calculation_impact', must be one of '%s'", + $sgc_calculation_impact, implode("', '", $allowedValues) ) ); @@ -599,7 +710,7 @@ public function setSgcCalculationImpact($sgc_calculation_impact) /** * Gets payment_summary_classification * - * @return string + * @return string|null */ public function getPaymentSummaryClassification() { @@ -609,17 +720,21 @@ public function getPaymentSummaryClassification() /** * Sets payment_summary_classification * - * @param string $payment_summary_classification + * @param string|null $payment_summary_classification * - * @return $this + * @return self */ public function setPaymentSummaryClassification($payment_summary_classification) { + if (is_null($payment_summary_classification)) { + throw new \InvalidArgumentException('non-nullable payment_summary_classification cannot be null'); + } $allowedValues = $this->getPaymentSummaryClassificationAllowableValues(); - if (!is_null($payment_summary_classification) && !in_array($payment_summary_classification, $allowedValues, true)) { + if (!in_array($payment_summary_classification, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'payment_summary_classification', must be one of '%s'", + "Invalid value '%s' for 'payment_summary_classification', must be one of '%s'", + $payment_summary_classification, implode("', '", $allowedValues) ) ); @@ -632,7 +747,7 @@ public function setPaymentSummaryClassification($payment_summary_classification) /** * Gets is_resc * - * @return bool + * @return bool|null */ public function getIsResc() { @@ -642,12 +757,15 @@ public function getIsResc() /** * Sets is_resc * - * @param bool $is_resc + * @param bool|null $is_resc * - * @return $this + * @return self */ public function setIsResc($is_resc) { + if (is_null($is_resc)) { + throw new \InvalidArgumentException('non-nullable is_resc cannot be null'); + } $this->container['is_resc'] = $is_resc; return $this; @@ -656,7 +774,7 @@ public function setIsResc($is_resc) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -666,12 +784,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -680,7 +801,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -690,12 +811,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -704,7 +828,7 @@ public function setName($name) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -714,17 +838,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -737,7 +865,7 @@ public function setSource($source) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -747,12 +875,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -761,7 +892,7 @@ public function setExternalId($external_id) /** * Gets is_system * - * @return bool + * @return bool|null */ public function getIsSystem() { @@ -771,12 +902,15 @@ public function getIsSystem() /** * Sets is_system * - * @param bool $is_system + * @param bool|null $is_system * - * @return $this + * @return self */ public function setIsSystem($is_system) { + if (is_null($is_system)) { + throw new \InvalidArgumentException('non-nullable is_system cannot be null'); + } $this->container['is_system'] = $is_system; return $this; @@ -788,7 +922,7 @@ public function setIsSystem($is_system) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -798,22 +932,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -829,11 +964,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -841,13 +989,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuDeductionModel.php b/src/lib/Model/AuDeductionModel.php index 50ccfbe..611428b 100644 --- a/src/lib/Model/AuDeductionModel.php +++ b/src/lib/Model/AuDeductionModel.php @@ -2,64 +2,64 @@ /** * AuDeductionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuDeductionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuDeductionModel implements ModelInterface, ArrayAccess +class AuDeductionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuDeductionModel'; + protected static $openAPIModelName = 'AuDeductionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'deduction_category_id' => 'string', 'deduction_category_name' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'notes' => 'string', 'payment_reference' => 'string', 'note' => 'string', @@ -84,8 +84,10 @@ class AuDeductionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deduction_category_id' => null, 'deduction_category_name' => null, 'amount' => 'double', @@ -109,14 +111,50 @@ class AuDeductionModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deduction_category_id' => false, + 'deduction_category_name' => false, + 'amount' => false, + 'notes' => false, + 'payment_reference' => false, + 'note' => false, + 'associated_employee_deduction_category_id' => false, + 'pay_to_bank_account_bsb' => false, + 'pay_to_bank_account_bank_code' => false, + 'pay_to_bank_account_number' => false, + 'pay_to_super_fund_name' => false, + 'pay_to_super_fund_member_number' => false, + 'pay_to' => false, + 'additional_data' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -124,9 +162,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -255,12 +345,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -277,27 +364,45 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['deduction_category_id'] = isset($data['deduction_category_id']) ? $data['deduction_category_id'] : null; - $this->container['deduction_category_name'] = isset($data['deduction_category_name']) ? $data['deduction_category_name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['payment_reference'] = isset($data['payment_reference']) ? $data['payment_reference'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['associated_employee_deduction_category_id'] = isset($data['associated_employee_deduction_category_id']) ? $data['associated_employee_deduction_category_id'] : null; - $this->container['pay_to_bank_account_bsb'] = isset($data['pay_to_bank_account_bsb']) ? $data['pay_to_bank_account_bsb'] : null; - $this->container['pay_to_bank_account_bank_code'] = isset($data['pay_to_bank_account_bank_code']) ? $data['pay_to_bank_account_bank_code'] : null; - $this->container['pay_to_bank_account_number'] = isset($data['pay_to_bank_account_number']) ? $data['pay_to_bank_account_number'] : null; - $this->container['pay_to_super_fund_name'] = isset($data['pay_to_super_fund_name']) ? $data['pay_to_super_fund_name'] : null; - $this->container['pay_to_super_fund_member_number'] = isset($data['pay_to_super_fund_member_number']) ? $data['pay_to_super_fund_member_number'] : null; - $this->container['pay_to'] = isset($data['pay_to']) ? $data['pay_to'] : null; - $this->container['additional_data'] = isset($data['additional_data']) ? $data['additional_data'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('deduction_category_id', $data ?? [], null); + $this->setIfExists('deduction_category_name', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('payment_reference', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('associated_employee_deduction_category_id', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_bsb', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_bank_code', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_number', $data ?? [], null); + $this->setIfExists('pay_to_super_fund_name', $data ?? [], null); + $this->setIfExists('pay_to_super_fund_member_number', $data ?? [], null); + $this->setIfExists('pay_to', $data ?? [], null); + $this->setIfExists('additional_data', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -327,7 +432,7 @@ public function valid() /** * Gets deduction_category_id * - * @return string + * @return string|null */ public function getDeductionCategoryId() { @@ -337,12 +442,15 @@ public function getDeductionCategoryId() /** * Sets deduction_category_id * - * @param string $deduction_category_id + * @param string|null $deduction_category_id * - * @return $this + * @return self */ public function setDeductionCategoryId($deduction_category_id) { + if (is_null($deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id cannot be null'); + } $this->container['deduction_category_id'] = $deduction_category_id; return $this; @@ -351,7 +459,7 @@ public function setDeductionCategoryId($deduction_category_id) /** * Gets deduction_category_name * - * @return string + * @return string|null */ public function getDeductionCategoryName() { @@ -361,12 +469,15 @@ public function getDeductionCategoryName() /** * Sets deduction_category_name * - * @param string $deduction_category_name + * @param string|null $deduction_category_name * - * @return $this + * @return self */ public function setDeductionCategoryName($deduction_category_name) { + if (is_null($deduction_category_name)) { + throw new \InvalidArgumentException('non-nullable deduction_category_name cannot be null'); + } $this->container['deduction_category_name'] = $deduction_category_name; return $this; @@ -375,7 +486,7 @@ public function setDeductionCategoryName($deduction_category_name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -385,12 +496,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -399,7 +513,7 @@ public function setAmount($amount) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -409,12 +523,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -423,7 +540,7 @@ public function setNotes($notes) /** * Gets payment_reference * - * @return string + * @return string|null */ public function getPaymentReference() { @@ -433,12 +550,15 @@ public function getPaymentReference() /** * Sets payment_reference * - * @param string $payment_reference + * @param string|null $payment_reference * - * @return $this + * @return self */ public function setPaymentReference($payment_reference) { + if (is_null($payment_reference)) { + throw new \InvalidArgumentException('non-nullable payment_reference cannot be null'); + } $this->container['payment_reference'] = $payment_reference; return $this; @@ -447,7 +567,7 @@ public function setPaymentReference($payment_reference) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -457,12 +577,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -471,7 +594,7 @@ public function setNote($note) /** * Gets associated_employee_deduction_category_id * - * @return int + * @return int|null */ public function getAssociatedEmployeeDeductionCategoryId() { @@ -481,12 +604,15 @@ public function getAssociatedEmployeeDeductionCategoryId() /** * Sets associated_employee_deduction_category_id * - * @param int $associated_employee_deduction_category_id + * @param int|null $associated_employee_deduction_category_id * - * @return $this + * @return self */ public function setAssociatedEmployeeDeductionCategoryId($associated_employee_deduction_category_id) { + if (is_null($associated_employee_deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable associated_employee_deduction_category_id cannot be null'); + } $this->container['associated_employee_deduction_category_id'] = $associated_employee_deduction_category_id; return $this; @@ -495,7 +621,7 @@ public function setAssociatedEmployeeDeductionCategoryId($associated_employee_de /** * Gets pay_to_bank_account_bsb * - * @return string + * @return string|null */ public function getPayToBankAccountBsb() { @@ -505,12 +631,15 @@ public function getPayToBankAccountBsb() /** * Sets pay_to_bank_account_bsb * - * @param string $pay_to_bank_account_bsb + * @param string|null $pay_to_bank_account_bsb * - * @return $this + * @return self */ public function setPayToBankAccountBsb($pay_to_bank_account_bsb) { + if (is_null($pay_to_bank_account_bsb)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_bsb cannot be null'); + } $this->container['pay_to_bank_account_bsb'] = $pay_to_bank_account_bsb; return $this; @@ -519,7 +648,7 @@ public function setPayToBankAccountBsb($pay_to_bank_account_bsb) /** * Gets pay_to_bank_account_bank_code * - * @return string + * @return string|null */ public function getPayToBankAccountBankCode() { @@ -529,12 +658,15 @@ public function getPayToBankAccountBankCode() /** * Sets pay_to_bank_account_bank_code * - * @param string $pay_to_bank_account_bank_code + * @param string|null $pay_to_bank_account_bank_code * - * @return $this + * @return self */ public function setPayToBankAccountBankCode($pay_to_bank_account_bank_code) { + if (is_null($pay_to_bank_account_bank_code)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_bank_code cannot be null'); + } $this->container['pay_to_bank_account_bank_code'] = $pay_to_bank_account_bank_code; return $this; @@ -543,7 +675,7 @@ public function setPayToBankAccountBankCode($pay_to_bank_account_bank_code) /** * Gets pay_to_bank_account_number * - * @return string + * @return string|null */ public function getPayToBankAccountNumber() { @@ -553,12 +685,15 @@ public function getPayToBankAccountNumber() /** * Sets pay_to_bank_account_number * - * @param string $pay_to_bank_account_number + * @param string|null $pay_to_bank_account_number * - * @return $this + * @return self */ public function setPayToBankAccountNumber($pay_to_bank_account_number) { + if (is_null($pay_to_bank_account_number)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_number cannot be null'); + } $this->container['pay_to_bank_account_number'] = $pay_to_bank_account_number; return $this; @@ -567,7 +702,7 @@ public function setPayToBankAccountNumber($pay_to_bank_account_number) /** * Gets pay_to_super_fund_name * - * @return string + * @return string|null */ public function getPayToSuperFundName() { @@ -577,12 +712,15 @@ public function getPayToSuperFundName() /** * Sets pay_to_super_fund_name * - * @param string $pay_to_super_fund_name + * @param string|null $pay_to_super_fund_name * - * @return $this + * @return self */ public function setPayToSuperFundName($pay_to_super_fund_name) { + if (is_null($pay_to_super_fund_name)) { + throw new \InvalidArgumentException('non-nullable pay_to_super_fund_name cannot be null'); + } $this->container['pay_to_super_fund_name'] = $pay_to_super_fund_name; return $this; @@ -591,7 +729,7 @@ public function setPayToSuperFundName($pay_to_super_fund_name) /** * Gets pay_to_super_fund_member_number * - * @return string + * @return string|null */ public function getPayToSuperFundMemberNumber() { @@ -601,12 +739,15 @@ public function getPayToSuperFundMemberNumber() /** * Sets pay_to_super_fund_member_number * - * @param string $pay_to_super_fund_member_number + * @param string|null $pay_to_super_fund_member_number * - * @return $this + * @return self */ public function setPayToSuperFundMemberNumber($pay_to_super_fund_member_number) { + if (is_null($pay_to_super_fund_member_number)) { + throw new \InvalidArgumentException('non-nullable pay_to_super_fund_member_number cannot be null'); + } $this->container['pay_to_super_fund_member_number'] = $pay_to_super_fund_member_number; return $this; @@ -615,7 +756,7 @@ public function setPayToSuperFundMemberNumber($pay_to_super_fund_member_number) /** * Gets pay_to * - * @return string + * @return string|null */ public function getPayTo() { @@ -625,12 +766,15 @@ public function getPayTo() /** * Sets pay_to * - * @param string $pay_to + * @param string|null $pay_to * - * @return $this + * @return self */ public function setPayTo($pay_to) { + if (is_null($pay_to)) { + throw new \InvalidArgumentException('non-nullable pay_to cannot be null'); + } $this->container['pay_to'] = $pay_to; return $this; @@ -639,7 +783,7 @@ public function setPayTo($pay_to) /** * Gets additional_data * - * @return int + * @return int|null */ public function getAdditionalData() { @@ -649,12 +793,15 @@ public function getAdditionalData() /** * Sets additional_data * - * @param int $additional_data + * @param int|null $additional_data * - * @return $this + * @return self */ public function setAdditionalData($additional_data) { + if (is_null($additional_data)) { + throw new \InvalidArgumentException('non-nullable additional_data cannot be null'); + } $this->container['additional_data'] = $additional_data; return $this; @@ -663,7 +810,7 @@ public function setAdditionalData($additional_data) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -673,12 +820,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -687,7 +837,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -697,12 +847,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -711,7 +864,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -721,12 +874,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -735,7 +891,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -745,12 +901,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -759,7 +918,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -769,12 +928,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -783,7 +945,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -793,12 +955,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -807,7 +972,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -817,12 +982,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -834,7 +1002,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -844,22 +1012,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -875,11 +1044,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -887,13 +1069,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuDetailedActivityReportExportModel.php b/src/lib/Model/AuDetailedActivityReportExportModel.php index 394df4f..38a662e 100644 --- a/src/lib/Model/AuDetailedActivityReportExportModel.php +++ b/src/lib/Model/AuDetailedActivityReportExportModel.php @@ -2,87 +2,89 @@ /** * AuDetailedActivityReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuDetailedActivityReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuDetailedActivityReportExportModel implements ModelInterface, ArrayAccess +class AuDetailedActivityReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuDetailedActivityReportExportModel'; + protected static $openAPIModelName = 'AuDetailedActivityReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg' => 'double', - 'sfss' => 'double', - 'help' => 'double', - 'super' => 'double', - 'gross_plus_super' => 'double', + protected static $openAPITypes = [ + 'payg' => 'float', + 'sfss' => 'float', + 'help' => 'float', + 'super' => 'float', + 'gross_plus_super' => 'float', 'location' => 'string', 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', 'external_id' => 'string', - 'hours' => 'double', - 'gross_earnings' => 'double', - 'pre_tax_deductions' => 'double', + 'hours' => 'float', + 'gross_earnings' => 'float', + 'pre_tax_deductions' => 'float', 'post_tax_deductions' => 'object', - 'tax_exempt_earnings' => 'double', - 'taxable_earnings' => 'double', - 'net_earnings' => 'double', - 'employer_liabilities' => 'double' + 'tax_exempt_earnings' => 'float', + 'taxable_earnings' => 'float', + 'net_earnings' => 'float', + 'employer_liabilities' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg' => 'double', 'sfss' => 'double', 'help' => 'double', @@ -103,14 +105,47 @@ class AuDetailedActivityReportExportModel implements ModelInterface, ArrayAccess 'employer_liabilities' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg' => false, + 'sfss' => false, + 'help' => false, + 'super' => false, + 'gross_plus_super' => false, + 'location' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'hours' => false, + 'gross_earnings' => false, + 'pre_tax_deductions' => false, + 'post_tax_deductions' => false, + 'tax_exempt_earnings' => false, + 'taxable_earnings' => false, + 'net_earnings' => false, + 'employer_liabilities' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -118,9 +153,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -240,12 +327,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -262,24 +346,42 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payg'] = isset($data['payg']) ? $data['payg'] : null; - $this->container['sfss'] = isset($data['sfss']) ? $data['sfss'] : null; - $this->container['help'] = isset($data['help']) ? $data['help'] : null; - $this->container['super'] = isset($data['super']) ? $data['super'] : null; - $this->container['gross_plus_super'] = isset($data['gross_plus_super']) ? $data['gross_plus_super'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['pre_tax_deductions'] = isset($data['pre_tax_deductions']) ? $data['pre_tax_deductions'] : null; - $this->container['post_tax_deductions'] = isset($data['post_tax_deductions']) ? $data['post_tax_deductions'] : null; - $this->container['tax_exempt_earnings'] = isset($data['tax_exempt_earnings']) ? $data['tax_exempt_earnings'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['employer_liabilities'] = isset($data['employer_liabilities']) ? $data['employer_liabilities'] : null; + $this->setIfExists('payg', $data ?? [], null); + $this->setIfExists('sfss', $data ?? [], null); + $this->setIfExists('help', $data ?? [], null); + $this->setIfExists('super', $data ?? [], null); + $this->setIfExists('gross_plus_super', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('pre_tax_deductions', $data ?? [], null); + $this->setIfExists('post_tax_deductions', $data ?? [], null); + $this->setIfExists('tax_exempt_earnings', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('employer_liabilities', $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; } /** @@ -309,7 +411,7 @@ public function valid() /** * Gets payg * - * @return double + * @return float|null */ public function getPayg() { @@ -319,12 +421,15 @@ public function getPayg() /** * Sets payg * - * @param double $payg + * @param float|null $payg * - * @return $this + * @return self */ public function setPayg($payg) { + if (is_null($payg)) { + throw new \InvalidArgumentException('non-nullable payg cannot be null'); + } $this->container['payg'] = $payg; return $this; @@ -333,7 +438,7 @@ public function setPayg($payg) /** * Gets sfss * - * @return double + * @return float|null */ public function getSfss() { @@ -343,12 +448,15 @@ public function getSfss() /** * Sets sfss * - * @param double $sfss + * @param float|null $sfss * - * @return $this + * @return self */ public function setSfss($sfss) { + if (is_null($sfss)) { + throw new \InvalidArgumentException('non-nullable sfss cannot be null'); + } $this->container['sfss'] = $sfss; return $this; @@ -357,7 +465,7 @@ public function setSfss($sfss) /** * Gets help * - * @return double + * @return float|null */ public function getHelp() { @@ -367,12 +475,15 @@ public function getHelp() /** * Sets help * - * @param double $help + * @param float|null $help * - * @return $this + * @return self */ public function setHelp($help) { + if (is_null($help)) { + throw new \InvalidArgumentException('non-nullable help cannot be null'); + } $this->container['help'] = $help; return $this; @@ -381,7 +492,7 @@ public function setHelp($help) /** * Gets super * - * @return double + * @return float|null */ public function getSuper() { @@ -391,12 +502,15 @@ public function getSuper() /** * Sets super * - * @param double $super + * @param float|null $super * - * @return $this + * @return self */ public function setSuper($super) { + if (is_null($super)) { + throw new \InvalidArgumentException('non-nullable super cannot be null'); + } $this->container['super'] = $super; return $this; @@ -405,7 +519,7 @@ public function setSuper($super) /** * Gets gross_plus_super * - * @return double + * @return float|null */ public function getGrossPlusSuper() { @@ -415,12 +529,15 @@ public function getGrossPlusSuper() /** * Sets gross_plus_super * - * @param double $gross_plus_super + * @param float|null $gross_plus_super * - * @return $this + * @return self */ public function setGrossPlusSuper($gross_plus_super) { + if (is_null($gross_plus_super)) { + throw new \InvalidArgumentException('non-nullable gross_plus_super cannot be null'); + } $this->container['gross_plus_super'] = $gross_plus_super; return $this; @@ -429,7 +546,7 @@ public function setGrossPlusSuper($gross_plus_super) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -439,12 +556,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -453,7 +573,7 @@ public function setLocation($location) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -463,12 +583,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -477,7 +600,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -487,12 +610,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -501,7 +627,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -511,12 +637,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -525,7 +654,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -535,12 +664,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -549,7 +681,7 @@ public function setExternalId($external_id) /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -559,12 +691,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -573,7 +708,7 @@ public function setHours($hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -583,12 +718,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -597,7 +735,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets pre_tax_deductions * - * @return double + * @return float|null */ public function getPreTaxDeductions() { @@ -607,12 +745,15 @@ public function getPreTaxDeductions() /** * Sets pre_tax_deductions * - * @param double $pre_tax_deductions + * @param float|null $pre_tax_deductions * - * @return $this + * @return self */ public function setPreTaxDeductions($pre_tax_deductions) { + if (is_null($pre_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deductions cannot be null'); + } $this->container['pre_tax_deductions'] = $pre_tax_deductions; return $this; @@ -621,7 +762,7 @@ public function setPreTaxDeductions($pre_tax_deductions) /** * Gets post_tax_deductions * - * @return object + * @return object|null */ public function getPostTaxDeductions() { @@ -631,12 +772,15 @@ public function getPostTaxDeductions() /** * Sets post_tax_deductions * - * @param object $post_tax_deductions + * @param object|null $post_tax_deductions * - * @return $this + * @return self */ public function setPostTaxDeductions($post_tax_deductions) { + if (is_null($post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable post_tax_deductions cannot be null'); + } $this->container['post_tax_deductions'] = $post_tax_deductions; return $this; @@ -645,7 +789,7 @@ public function setPostTaxDeductions($post_tax_deductions) /** * Gets tax_exempt_earnings * - * @return double + * @return float|null */ public function getTaxExemptEarnings() { @@ -655,12 +799,15 @@ public function getTaxExemptEarnings() /** * Sets tax_exempt_earnings * - * @param double $tax_exempt_earnings + * @param float|null $tax_exempt_earnings * - * @return $this + * @return self */ public function setTaxExemptEarnings($tax_exempt_earnings) { + if (is_null($tax_exempt_earnings)) { + throw new \InvalidArgumentException('non-nullable tax_exempt_earnings cannot be null'); + } $this->container['tax_exempt_earnings'] = $tax_exempt_earnings; return $this; @@ -669,7 +816,7 @@ public function setTaxExemptEarnings($tax_exempt_earnings) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -679,12 +826,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -693,7 +843,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -703,12 +853,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -717,7 +870,7 @@ public function setNetEarnings($net_earnings) /** * Gets employer_liabilities * - * @return double + * @return float|null */ public function getEmployerLiabilities() { @@ -727,12 +880,15 @@ public function getEmployerLiabilities() /** * Sets employer_liabilities * - * @param double $employer_liabilities + * @param float|null $employer_liabilities * - * @return $this + * @return self */ public function setEmployerLiabilities($employer_liabilities) { + if (is_null($employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities cannot be null'); + } $this->container['employer_liabilities'] = $employer_liabilities; return $this; @@ -744,7 +900,7 @@ public function setEmployerLiabilities($employer_liabilities) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -754,22 +910,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -785,11 +942,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -797,13 +967,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuDetailedEmployeeGroupModel.php b/src/lib/Model/AuDetailedEmployeeGroupModel.php index f29ada5..bbdbc63 100644 --- a/src/lib/Model/AuDetailedEmployeeGroupModel.php +++ b/src/lib/Model/AuDetailedEmployeeGroupModel.php @@ -2,74 +2,76 @@ /** * AuDetailedEmployeeGroupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuDetailedEmployeeGroupModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuDetailedEmployeeGroupModel implements ModelInterface, ArrayAccess +class AuDetailedEmployeeGroupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuDetailedEmployeeGroupModel'; + protected static $openAPIModelName = 'AuDetailedEmployeeGroupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'matching_employees' => '\Swagger\Client\Model\MatchingEmployeeModel[]', + protected static $openAPITypes = [ + 'matching_employees' => '\OpenAPI\Client\Model\MatchingEmployeeModel[]', 'id' => 'int', 'name' => 'string', 'filter_combination_strategy' => 'string', - 'filters' => '\Swagger\Client\Model\AuEmployeeFilterModel[]' + 'filters' => '\OpenAPI\Client\Model\AuEmployeeFilterModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'matching_employees' => null, 'id' => 'int32', 'name' => null, @@ -77,14 +79,34 @@ class AuDetailedEmployeeGroupModel implements ModelInterface, ArrayAccess 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'matching_employees' => false, + 'id' => false, + 'name' => false, + 'filter_combination_strategy' => false, + 'filters' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,14 +249,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const FILTER_COMBINATION_STRATEGY__OR = 'Or'; - const FILTER_COMBINATION_STRATEGY__AND = 'And'; - + public const FILTER_COMBINATION_STRATEGY__OR = 'Or'; + public const FILTER_COMBINATION_STRATEGY__AND = 'And'; - /** * Gets allowable values of the enum * @@ -195,7 +267,6 @@ public function getFilterCombinationStrategyAllowableValues() self::FILTER_COMBINATION_STRATEGY__AND, ]; } - /** * Associative array for storing property values @@ -212,11 +283,29 @@ public function getFilterCombinationStrategyAllowableValues() */ public function __construct(array $data = null) { - $this->container['matching_employees'] = isset($data['matching_employees']) ? $data['matching_employees'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['filter_combination_strategy'] = isset($data['filter_combination_strategy']) ? $data['filter_combination_strategy'] : null; - $this->container['filters'] = isset($data['filters']) ? $data['filters'] : null; + $this->setIfExists('matching_employees', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('filter_combination_strategy', $data ?? [], null); + $this->setIfExists('filters', $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; } /** @@ -231,7 +320,8 @@ public function listInvalidProperties() $allowedValues = $this->getFilterCombinationStrategyAllowableValues(); if (!is_null($this->container['filter_combination_strategy']) && !in_array($this->container['filter_combination_strategy'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'filter_combination_strategy', must be one of '%s'", + "invalid value '%s' for 'filter_combination_strategy', must be one of '%s'", + $this->container['filter_combination_strategy'], implode("', '", $allowedValues) ); } @@ -254,7 +344,7 @@ public function valid() /** * Gets matching_employees * - * @return \Swagger\Client\Model\MatchingEmployeeModel[] + * @return \OpenAPI\Client\Model\MatchingEmployeeModel[]|null */ public function getMatchingEmployees() { @@ -264,12 +354,15 @@ public function getMatchingEmployees() /** * Sets matching_employees * - * @param \Swagger\Client\Model\MatchingEmployeeModel[] $matching_employees + * @param \OpenAPI\Client\Model\MatchingEmployeeModel[]|null $matching_employees * - * @return $this + * @return self */ public function setMatchingEmployees($matching_employees) { + if (is_null($matching_employees)) { + throw new \InvalidArgumentException('non-nullable matching_employees cannot be null'); + } $this->container['matching_employees'] = $matching_employees; return $this; @@ -278,7 +371,7 @@ public function setMatchingEmployees($matching_employees) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -288,12 +381,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -302,7 +398,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -312,12 +408,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -326,7 +425,7 @@ public function setName($name) /** * Gets filter_combination_strategy * - * @return string + * @return string|null */ public function getFilterCombinationStrategy() { @@ -336,17 +435,21 @@ public function getFilterCombinationStrategy() /** * Sets filter_combination_strategy * - * @param string $filter_combination_strategy + * @param string|null $filter_combination_strategy * - * @return $this + * @return self */ public function setFilterCombinationStrategy($filter_combination_strategy) { + if (is_null($filter_combination_strategy)) { + throw new \InvalidArgumentException('non-nullable filter_combination_strategy cannot be null'); + } $allowedValues = $this->getFilterCombinationStrategyAllowableValues(); - if (!is_null($filter_combination_strategy) && !in_array($filter_combination_strategy, $allowedValues, true)) { + if (!in_array($filter_combination_strategy, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'filter_combination_strategy', must be one of '%s'", + "Invalid value '%s' for 'filter_combination_strategy', must be one of '%s'", + $filter_combination_strategy, implode("', '", $allowedValues) ) ); @@ -359,7 +462,7 @@ public function setFilterCombinationStrategy($filter_combination_strategy) /** * Gets filters * - * @return \Swagger\Client\Model\AuEmployeeFilterModel[] + * @return \OpenAPI\Client\Model\AuEmployeeFilterModel[]|null */ public function getFilters() { @@ -369,12 +472,15 @@ public function getFilters() /** * Sets filters * - * @param \Swagger\Client\Model\AuEmployeeFilterModel[] $filters + * @param \OpenAPI\Client\Model\AuEmployeeFilterModel[]|null $filters * - * @return $this + * @return self */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; @@ -386,7 +492,7 @@ public function setFilters($filters) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -396,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -439,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEarningsLineModel.php b/src/lib/Model/AuEarningsLineModel.php index e1e1dee..516dc0f 100644 --- a/src/lib/Model/AuEarningsLineModel.php +++ b/src/lib/Model/AuEarningsLineModel.php @@ -2,79 +2,79 @@ /** * AuEarningsLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEarningsLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEarningsLineModel implements ModelInterface, ArrayAccess +class AuEarningsLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEarningsLineModel'; + protected static $openAPIModelName = 'AuEarningsLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super' => 'double', - 'sfss' => 'double', - 'help' => 'double', - 'payg' => 'double', + protected static $openAPITypes = [ + 'super' => 'float', + 'sfss' => 'float', + 'help' => 'float', + 'payg' => 'float', 'pay_category_id' => 'string', 'pay_category_name' => 'string', - 'units' => 'double', + 'units' => 'float', 'notes' => 'string', - 'rate' => 'double', - 'earnings' => 'double', - 'lump_sum_number_of_pay_periods' => 'double', + 'rate' => 'float', + 'earnings' => 'float', + 'lump_sum_number_of_pay_periods' => 'float', 'lump_sum_calculation_method' => 'string', 'lump_sum_e_financial_year' => 'int', 'timesheet_line_id' => 'int', 'timesheet_line_external_id' => 'string', 'reporting_dimension_value_ids' => 'int[]', - 'reporting_dimension_value_names' => 'map[string,string[]]', - 'net_payment' => 'double', + 'reporting_dimension_value_names' => 'array', + 'net_payment' => 'float', 'id' => 'int', 'external_id' => 'string', 'location_id' => 'string', @@ -88,8 +88,10 @@ class AuEarningsLineModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super' => 'double', 'sfss' => 'double', 'help' => 'double', @@ -117,14 +119,54 @@ class AuEarningsLineModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super' => false, + 'sfss' => false, + 'help' => false, + 'payg' => false, + 'pay_category_id' => false, + 'pay_category_name' => false, + 'units' => false, + 'notes' => false, + 'rate' => false, + 'earnings' => false, + 'lump_sum_number_of_pay_periods' => false, + 'lump_sum_calculation_method' => false, + 'lump_sum_e_financial_year' => false, + 'timesheet_line_id' => false, + 'timesheet_line_external_id' => false, + 'reporting_dimension_value_ids' => false, + 'reporting_dimension_value_names' => false, + 'net_payment' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -132,9 +174,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -275,15 +369,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const LUMP_SUM_CALCULATION_METHOD_A = 'A'; - const LUMP_SUM_CALCULATION_METHOD_B2 = 'B2'; - const LUMP_SUM_CALCULATION_METHOD_NOT_APPLICABLE = 'NotApplicable'; - + public const LUMP_SUM_CALCULATION_METHOD_A = 'A'; + public const LUMP_SUM_CALCULATION_METHOD_B2 = 'B2'; + public const LUMP_SUM_CALCULATION_METHOD_NOT_APPLICABLE = 'NotApplicable'; - /** * Gets allowable values of the enum * @@ -297,7 +389,6 @@ public function getLumpSumCalculationMethodAllowableValues() self::LUMP_SUM_CALCULATION_METHOD_NOT_APPLICABLE, ]; } - /** * Associative array for storing property values @@ -314,31 +405,49 @@ public function getLumpSumCalculationMethodAllowableValues() */ public function __construct(array $data = null) { - $this->container['super'] = isset($data['super']) ? $data['super'] : null; - $this->container['sfss'] = isset($data['sfss']) ? $data['sfss'] : null; - $this->container['help'] = isset($data['help']) ? $data['help'] : null; - $this->container['payg'] = isset($data['payg']) ? $data['payg'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['pay_category_name'] = isset($data['pay_category_name']) ? $data['pay_category_name'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['earnings'] = isset($data['earnings']) ? $data['earnings'] : null; - $this->container['lump_sum_number_of_pay_periods'] = isset($data['lump_sum_number_of_pay_periods']) ? $data['lump_sum_number_of_pay_periods'] : null; - $this->container['lump_sum_calculation_method'] = isset($data['lump_sum_calculation_method']) ? $data['lump_sum_calculation_method'] : null; - $this->container['lump_sum_e_financial_year'] = isset($data['lump_sum_e_financial_year']) ? $data['lump_sum_e_financial_year'] : null; - $this->container['timesheet_line_id'] = isset($data['timesheet_line_id']) ? $data['timesheet_line_id'] : null; - $this->container['timesheet_line_external_id'] = isset($data['timesheet_line_external_id']) ? $data['timesheet_line_external_id'] : null; - $this->container['reporting_dimension_value_ids'] = isset($data['reporting_dimension_value_ids']) ? $data['reporting_dimension_value_ids'] : null; - $this->container['reporting_dimension_value_names'] = isset($data['reporting_dimension_value_names']) ? $data['reporting_dimension_value_names'] : null; - $this->container['net_payment'] = isset($data['net_payment']) ? $data['net_payment'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('super', $data ?? [], null); + $this->setIfExists('sfss', $data ?? [], null); + $this->setIfExists('help', $data ?? [], null); + $this->setIfExists('payg', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('pay_category_name', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('earnings', $data ?? [], null); + $this->setIfExists('lump_sum_number_of_pay_periods', $data ?? [], null); + $this->setIfExists('lump_sum_calculation_method', $data ?? [], null); + $this->setIfExists('lump_sum_e_financial_year', $data ?? [], null); + $this->setIfExists('timesheet_line_id', $data ?? [], null); + $this->setIfExists('timesheet_line_external_id', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_ids', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_names', $data ?? [], null); + $this->setIfExists('net_payment', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -353,7 +462,8 @@ public function listInvalidProperties() $allowedValues = $this->getLumpSumCalculationMethodAllowableValues(); if (!is_null($this->container['lump_sum_calculation_method']) && !in_array($this->container['lump_sum_calculation_method'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'lump_sum_calculation_method', must be one of '%s'", + "invalid value '%s' for 'lump_sum_calculation_method', must be one of '%s'", + $this->container['lump_sum_calculation_method'], implode("', '", $allowedValues) ); } @@ -376,7 +486,7 @@ public function valid() /** * Gets super * - * @return double + * @return float|null */ public function getSuper() { @@ -386,12 +496,15 @@ public function getSuper() /** * Sets super * - * @param double $super + * @param float|null $super * - * @return $this + * @return self */ public function setSuper($super) { + if (is_null($super)) { + throw new \InvalidArgumentException('non-nullable super cannot be null'); + } $this->container['super'] = $super; return $this; @@ -400,7 +513,7 @@ public function setSuper($super) /** * Gets sfss * - * @return double + * @return float|null */ public function getSfss() { @@ -410,12 +523,15 @@ public function getSfss() /** * Sets sfss * - * @param double $sfss + * @param float|null $sfss * - * @return $this + * @return self */ public function setSfss($sfss) { + if (is_null($sfss)) { + throw new \InvalidArgumentException('non-nullable sfss cannot be null'); + } $this->container['sfss'] = $sfss; return $this; @@ -424,7 +540,7 @@ public function setSfss($sfss) /** * Gets help * - * @return double + * @return float|null */ public function getHelp() { @@ -434,12 +550,15 @@ public function getHelp() /** * Sets help * - * @param double $help + * @param float|null $help * - * @return $this + * @return self */ public function setHelp($help) { + if (is_null($help)) { + throw new \InvalidArgumentException('non-nullable help cannot be null'); + } $this->container['help'] = $help; return $this; @@ -448,7 +567,7 @@ public function setHelp($help) /** * Gets payg * - * @return double + * @return float|null */ public function getPayg() { @@ -458,12 +577,15 @@ public function getPayg() /** * Sets payg * - * @param double $payg + * @param float|null $payg * - * @return $this + * @return self */ public function setPayg($payg) { + if (is_null($payg)) { + throw new \InvalidArgumentException('non-nullable payg cannot be null'); + } $this->container['payg'] = $payg; return $this; @@ -472,7 +594,7 @@ public function setPayg($payg) /** * Gets pay_category_id * - * @return string + * @return string|null */ public function getPayCategoryId() { @@ -482,12 +604,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param string $pay_category_id + * @param string|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -496,7 +621,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets pay_category_name * - * @return string + * @return string|null */ public function getPayCategoryName() { @@ -506,12 +631,15 @@ public function getPayCategoryName() /** * Sets pay_category_name * - * @param string $pay_category_name + * @param string|null $pay_category_name * - * @return $this + * @return self */ public function setPayCategoryName($pay_category_name) { + if (is_null($pay_category_name)) { + throw new \InvalidArgumentException('non-nullable pay_category_name cannot be null'); + } $this->container['pay_category_name'] = $pay_category_name; return $this; @@ -520,7 +648,7 @@ public function setPayCategoryName($pay_category_name) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -530,12 +658,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -544,7 +675,7 @@ public function setUnits($units) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -554,12 +685,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -568,7 +702,7 @@ public function setNotes($notes) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -578,12 +712,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -592,7 +729,7 @@ public function setRate($rate) /** * Gets earnings * - * @return double + * @return float|null */ public function getEarnings() { @@ -602,12 +739,15 @@ public function getEarnings() /** * Sets earnings * - * @param double $earnings + * @param float|null $earnings * - * @return $this + * @return self */ public function setEarnings($earnings) { + if (is_null($earnings)) { + throw new \InvalidArgumentException('non-nullable earnings cannot be null'); + } $this->container['earnings'] = $earnings; return $this; @@ -616,7 +756,7 @@ public function setEarnings($earnings) /** * Gets lump_sum_number_of_pay_periods * - * @return double + * @return float|null */ public function getLumpSumNumberOfPayPeriods() { @@ -626,12 +766,15 @@ public function getLumpSumNumberOfPayPeriods() /** * Sets lump_sum_number_of_pay_periods * - * @param double $lump_sum_number_of_pay_periods + * @param float|null $lump_sum_number_of_pay_periods * - * @return $this + * @return self */ public function setLumpSumNumberOfPayPeriods($lump_sum_number_of_pay_periods) { + if (is_null($lump_sum_number_of_pay_periods)) { + throw new \InvalidArgumentException('non-nullable lump_sum_number_of_pay_periods cannot be null'); + } $this->container['lump_sum_number_of_pay_periods'] = $lump_sum_number_of_pay_periods; return $this; @@ -640,7 +783,7 @@ public function setLumpSumNumberOfPayPeriods($lump_sum_number_of_pay_periods) /** * Gets lump_sum_calculation_method * - * @return string + * @return string|null */ public function getLumpSumCalculationMethod() { @@ -650,17 +793,21 @@ public function getLumpSumCalculationMethod() /** * Sets lump_sum_calculation_method * - * @param string $lump_sum_calculation_method + * @param string|null $lump_sum_calculation_method * - * @return $this + * @return self */ public function setLumpSumCalculationMethod($lump_sum_calculation_method) { + if (is_null($lump_sum_calculation_method)) { + throw new \InvalidArgumentException('non-nullable lump_sum_calculation_method cannot be null'); + } $allowedValues = $this->getLumpSumCalculationMethodAllowableValues(); - if (!is_null($lump_sum_calculation_method) && !in_array($lump_sum_calculation_method, $allowedValues, true)) { + if (!in_array($lump_sum_calculation_method, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'lump_sum_calculation_method', must be one of '%s'", + "Invalid value '%s' for 'lump_sum_calculation_method', must be one of '%s'", + $lump_sum_calculation_method, implode("', '", $allowedValues) ) ); @@ -673,7 +820,7 @@ public function setLumpSumCalculationMethod($lump_sum_calculation_method) /** * Gets lump_sum_e_financial_year * - * @return int + * @return int|null */ public function getLumpSumEFinancialYear() { @@ -683,12 +830,15 @@ public function getLumpSumEFinancialYear() /** * Sets lump_sum_e_financial_year * - * @param int $lump_sum_e_financial_year + * @param int|null $lump_sum_e_financial_year * - * @return $this + * @return self */ public function setLumpSumEFinancialYear($lump_sum_e_financial_year) { + if (is_null($lump_sum_e_financial_year)) { + throw new \InvalidArgumentException('non-nullable lump_sum_e_financial_year cannot be null'); + } $this->container['lump_sum_e_financial_year'] = $lump_sum_e_financial_year; return $this; @@ -697,7 +847,7 @@ public function setLumpSumEFinancialYear($lump_sum_e_financial_year) /** * Gets timesheet_line_id * - * @return int + * @return int|null */ public function getTimesheetLineId() { @@ -707,12 +857,15 @@ public function getTimesheetLineId() /** * Sets timesheet_line_id * - * @param int $timesheet_line_id + * @param int|null $timesheet_line_id * - * @return $this + * @return self */ public function setTimesheetLineId($timesheet_line_id) { + if (is_null($timesheet_line_id)) { + throw new \InvalidArgumentException('non-nullable timesheet_line_id cannot be null'); + } $this->container['timesheet_line_id'] = $timesheet_line_id; return $this; @@ -721,7 +874,7 @@ public function setTimesheetLineId($timesheet_line_id) /** * Gets timesheet_line_external_id * - * @return string + * @return string|null */ public function getTimesheetLineExternalId() { @@ -731,12 +884,15 @@ public function getTimesheetLineExternalId() /** * Sets timesheet_line_external_id * - * @param string $timesheet_line_external_id + * @param string|null $timesheet_line_external_id * - * @return $this + * @return self */ public function setTimesheetLineExternalId($timesheet_line_external_id) { + if (is_null($timesheet_line_external_id)) { + throw new \InvalidArgumentException('non-nullable timesheet_line_external_id cannot be null'); + } $this->container['timesheet_line_external_id'] = $timesheet_line_external_id; return $this; @@ -745,7 +901,7 @@ public function setTimesheetLineExternalId($timesheet_line_external_id) /** * Gets reporting_dimension_value_ids * - * @return int[] + * @return int[]|null */ public function getReportingDimensionValueIds() { @@ -755,12 +911,15 @@ public function getReportingDimensionValueIds() /** * Sets reporting_dimension_value_ids * - * @param int[] $reporting_dimension_value_ids Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an array of dimension value ids (normally only one-per dimension) eg [1,3,7].

If you prefer to specify dimension values by name, use the ReportingDimensionValueNames field instead.

If this field is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) + * @param int[]|null $reporting_dimension_value_ids Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an array of dimension value ids (normally only one-per dimension) eg [1,3,7].

If you prefer to specify dimension values by name, use the ReportingDimensionValueNames field instead.

If this field is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) * - * @return $this + * @return self */ public function setReportingDimensionValueIds($reporting_dimension_value_ids) { + if (is_null($reporting_dimension_value_ids)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_ids cannot be null'); + } $this->container['reporting_dimension_value_ids'] = $reporting_dimension_value_ids; return $this; @@ -769,7 +928,7 @@ public function setReportingDimensionValueIds($reporting_dimension_value_ids) /** * Gets reporting_dimension_value_names * - * @return map[string,string[]] + * @return array|null */ public function getReportingDimensionValueNames() { @@ -779,12 +938,15 @@ public function getReportingDimensionValueNames() /** * Sets reporting_dimension_value_names * - * @param map[string,string[]] $reporting_dimension_value_names Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an object with dimension names and for each one, specify an array of associated value names (normally one-per dimension) eg { \"Department\": [\"Accounting\"], \"Job Code\": [\"JC1\"] }.

If you prefer to specify dimension values directly by Id, use the ReportingDimensionValueIds field instead.

If ReportingDimensionValueIds is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) + * @param array|null $reporting_dimension_value_names Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an object with dimension names and for each one, specify an array of associated value names (normally one-per dimension) eg { \"Department\": [\"Accounting\"], \"Job Code\": [\"JC1\"] }.

If you prefer to specify dimension values directly by Id, use the ReportingDimensionValueIds field instead.

If ReportingDimensionValueIds is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) * - * @return $this + * @return self */ public function setReportingDimensionValueNames($reporting_dimension_value_names) { + if (is_null($reporting_dimension_value_names)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_names cannot be null'); + } $this->container['reporting_dimension_value_names'] = $reporting_dimension_value_names; return $this; @@ -793,7 +955,7 @@ public function setReportingDimensionValueNames($reporting_dimension_value_names /** * Gets net_payment * - * @return double + * @return float|null */ public function getNetPayment() { @@ -803,12 +965,15 @@ public function getNetPayment() /** * Sets net_payment * - * @param double $net_payment + * @param float|null $net_payment * - * @return $this + * @return self */ public function setNetPayment($net_payment) { + if (is_null($net_payment)) { + throw new \InvalidArgumentException('non-nullable net_payment cannot be null'); + } $this->container['net_payment'] = $net_payment; return $this; @@ -817,7 +982,7 @@ public function setNetPayment($net_payment) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -827,12 +992,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -841,7 +1009,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -851,12 +1019,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -865,7 +1036,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -875,12 +1046,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -889,7 +1063,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -899,12 +1073,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -913,7 +1090,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -923,12 +1100,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -937,7 +1117,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -947,12 +1127,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -961,7 +1144,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -971,12 +1154,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -988,7 +1174,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -998,22 +1184,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1029,11 +1216,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1041,13 +1241,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEditBusinessPaySlipApiModel.php b/src/lib/Model/AuEditBusinessPaySlipApiModel.php index c9b566f..1780892 100644 --- a/src/lib/Model/AuEditBusinessPaySlipApiModel.php +++ b/src/lib/Model/AuEditBusinessPaySlipApiModel.php @@ -2,61 +2,61 @@ /** * AuEditBusinessPaySlipApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEditBusinessPaySlipApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEditBusinessPaySlipApiModel implements ModelInterface, ArrayAccess +class AuEditBusinessPaySlipApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEditBusinessPaySlipApiModel'; + protected static $openAPIModelName = 'AuEditBusinessPaySlipApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'super_contribution_processing_frequency_text_option' => 'string', 'show_classification' => 'bool', 'show_base_pay_rate' => 'bool', @@ -77,8 +77,10 @@ class AuEditBusinessPaySlipApiModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_contribution_processing_frequency_text_option' => null, 'show_classification' => null, 'show_base_pay_rate' => null, @@ -95,14 +97,43 @@ class AuEditBusinessPaySlipApiModel implements ModelInterface, ArrayAccess 'employees_must_login_to_download_payslips' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_contribution_processing_frequency_text_option' => false, + 'show_classification' => false, + 'show_base_pay_rate' => false, + 'show_employee_id' => false, + 'show_rate_for_annual_earnings' => false, + 'id' => false, + 'email_from' => false, + 'email_body_message' => false, + 'show_leave_accruals' => false, + 'show_line_notes' => false, + 'show_location_in_line_notes' => false, + 'alphabetise_pay_categories' => false, + 'show_employee_external_id' => false, + 'employees_must_login_to_download_payslips' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -220,15 +303,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_NONE = 'None'; - const SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_QUARTERLY = 'Quarterly'; - const SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_MONTHLY = 'Monthly'; - + public const SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_NONE = 'None'; + public const SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_QUARTERLY = 'Quarterly'; + public const SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_MONTHLY = 'Monthly'; - /** * Gets allowable values of the enum * @@ -242,7 +323,6 @@ public function getSuperContributionProcessingFrequencyTextOptionAllowableValues self::SUPER_CONTRIBUTION_PROCESSING_FREQUENCY_TEXT_OPTION_MONTHLY, ]; } - /** * Associative array for storing property values @@ -259,20 +339,38 @@ public function getSuperContributionProcessingFrequencyTextOptionAllowableValues */ public function __construct(array $data = null) { - $this->container['super_contribution_processing_frequency_text_option'] = isset($data['super_contribution_processing_frequency_text_option']) ? $data['super_contribution_processing_frequency_text_option'] : null; - $this->container['show_classification'] = isset($data['show_classification']) ? $data['show_classification'] : null; - $this->container['show_base_pay_rate'] = isset($data['show_base_pay_rate']) ? $data['show_base_pay_rate'] : null; - $this->container['show_employee_id'] = isset($data['show_employee_id']) ? $data['show_employee_id'] : null; - $this->container['show_rate_for_annual_earnings'] = isset($data['show_rate_for_annual_earnings']) ? $data['show_rate_for_annual_earnings'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['email_from'] = isset($data['email_from']) ? $data['email_from'] : null; - $this->container['email_body_message'] = isset($data['email_body_message']) ? $data['email_body_message'] : null; - $this->container['show_leave_accruals'] = isset($data['show_leave_accruals']) ? $data['show_leave_accruals'] : null; - $this->container['show_line_notes'] = isset($data['show_line_notes']) ? $data['show_line_notes'] : null; - $this->container['show_location_in_line_notes'] = isset($data['show_location_in_line_notes']) ? $data['show_location_in_line_notes'] : null; - $this->container['alphabetise_pay_categories'] = isset($data['alphabetise_pay_categories']) ? $data['alphabetise_pay_categories'] : null; - $this->container['show_employee_external_id'] = isset($data['show_employee_external_id']) ? $data['show_employee_external_id'] : null; - $this->container['employees_must_login_to_download_payslips'] = isset($data['employees_must_login_to_download_payslips']) ? $data['employees_must_login_to_download_payslips'] : null; + $this->setIfExists('super_contribution_processing_frequency_text_option', $data ?? [], null); + $this->setIfExists('show_classification', $data ?? [], null); + $this->setIfExists('show_base_pay_rate', $data ?? [], null); + $this->setIfExists('show_employee_id', $data ?? [], null); + $this->setIfExists('show_rate_for_annual_earnings', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email_from', $data ?? [], null); + $this->setIfExists('email_body_message', $data ?? [], null); + $this->setIfExists('show_leave_accruals', $data ?? [], null); + $this->setIfExists('show_line_notes', $data ?? [], null); + $this->setIfExists('show_location_in_line_notes', $data ?? [], null); + $this->setIfExists('alphabetise_pay_categories', $data ?? [], null); + $this->setIfExists('show_employee_external_id', $data ?? [], null); + $this->setIfExists('employees_must_login_to_download_payslips', $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; } /** @@ -287,7 +385,8 @@ public function listInvalidProperties() $allowedValues = $this->getSuperContributionProcessingFrequencyTextOptionAllowableValues(); if (!is_null($this->container['super_contribution_processing_frequency_text_option']) && !in_array($this->container['super_contribution_processing_frequency_text_option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'super_contribution_processing_frequency_text_option', must be one of '%s'", + "invalid value '%s' for 'super_contribution_processing_frequency_text_option', must be one of '%s'", + $this->container['super_contribution_processing_frequency_text_option'], implode("', '", $allowedValues) ); } @@ -310,7 +409,7 @@ public function valid() /** * Gets super_contribution_processing_frequency_text_option * - * @return string + * @return string|null */ public function getSuperContributionProcessingFrequencyTextOption() { @@ -320,17 +419,21 @@ public function getSuperContributionProcessingFrequencyTextOption() /** * Sets super_contribution_processing_frequency_text_option * - * @param string $super_contribution_processing_frequency_text_option + * @param string|null $super_contribution_processing_frequency_text_option * - * @return $this + * @return self */ public function setSuperContributionProcessingFrequencyTextOption($super_contribution_processing_frequency_text_option) { + if (is_null($super_contribution_processing_frequency_text_option)) { + throw new \InvalidArgumentException('non-nullable super_contribution_processing_frequency_text_option cannot be null'); + } $allowedValues = $this->getSuperContributionProcessingFrequencyTextOptionAllowableValues(); - if (!is_null($super_contribution_processing_frequency_text_option) && !in_array($super_contribution_processing_frequency_text_option, $allowedValues, true)) { + if (!in_array($super_contribution_processing_frequency_text_option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'super_contribution_processing_frequency_text_option', must be one of '%s'", + "Invalid value '%s' for 'super_contribution_processing_frequency_text_option', must be one of '%s'", + $super_contribution_processing_frequency_text_option, implode("', '", $allowedValues) ) ); @@ -343,7 +446,7 @@ public function setSuperContributionProcessingFrequencyTextOption($super_contrib /** * Gets show_classification * - * @return bool + * @return bool|null */ public function getShowClassification() { @@ -353,12 +456,15 @@ public function getShowClassification() /** * Sets show_classification * - * @param bool $show_classification + * @param bool|null $show_classification * - * @return $this + * @return self */ public function setShowClassification($show_classification) { + if (is_null($show_classification)) { + throw new \InvalidArgumentException('non-nullable show_classification cannot be null'); + } $this->container['show_classification'] = $show_classification; return $this; @@ -367,7 +473,7 @@ public function setShowClassification($show_classification) /** * Gets show_base_pay_rate * - * @return bool + * @return bool|null */ public function getShowBasePayRate() { @@ -377,12 +483,15 @@ public function getShowBasePayRate() /** * Sets show_base_pay_rate * - * @param bool $show_base_pay_rate + * @param bool|null $show_base_pay_rate * - * @return $this + * @return self */ public function setShowBasePayRate($show_base_pay_rate) { + if (is_null($show_base_pay_rate)) { + throw new \InvalidArgumentException('non-nullable show_base_pay_rate cannot be null'); + } $this->container['show_base_pay_rate'] = $show_base_pay_rate; return $this; @@ -391,7 +500,7 @@ public function setShowBasePayRate($show_base_pay_rate) /** * Gets show_employee_id * - * @return bool + * @return bool|null */ public function getShowEmployeeId() { @@ -401,12 +510,15 @@ public function getShowEmployeeId() /** * Sets show_employee_id * - * @param bool $show_employee_id + * @param bool|null $show_employee_id * - * @return $this + * @return self */ public function setShowEmployeeId($show_employee_id) { + if (is_null($show_employee_id)) { + throw new \InvalidArgumentException('non-nullable show_employee_id cannot be null'); + } $this->container['show_employee_id'] = $show_employee_id; return $this; @@ -415,7 +527,7 @@ public function setShowEmployeeId($show_employee_id) /** * Gets show_rate_for_annual_earnings * - * @return bool + * @return bool|null */ public function getShowRateForAnnualEarnings() { @@ -425,12 +537,15 @@ public function getShowRateForAnnualEarnings() /** * Sets show_rate_for_annual_earnings * - * @param bool $show_rate_for_annual_earnings + * @param bool|null $show_rate_for_annual_earnings * - * @return $this + * @return self */ public function setShowRateForAnnualEarnings($show_rate_for_annual_earnings) { + if (is_null($show_rate_for_annual_earnings)) { + throw new \InvalidArgumentException('non-nullable show_rate_for_annual_earnings cannot be null'); + } $this->container['show_rate_for_annual_earnings'] = $show_rate_for_annual_earnings; return $this; @@ -439,7 +554,7 @@ public function setShowRateForAnnualEarnings($show_rate_for_annual_earnings) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -449,12 +564,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -463,7 +581,7 @@ public function setId($id) /** * Gets email_from * - * @return string + * @return string|null */ public function getEmailFrom() { @@ -473,12 +591,15 @@ public function getEmailFrom() /** * Sets email_from * - * @param string $email_from + * @param string|null $email_from * - * @return $this + * @return self */ public function setEmailFrom($email_from) { + if (is_null($email_from)) { + throw new \InvalidArgumentException('non-nullable email_from cannot be null'); + } $this->container['email_from'] = $email_from; return $this; @@ -487,7 +608,7 @@ public function setEmailFrom($email_from) /** * Gets email_body_message * - * @return string + * @return string|null */ public function getEmailBodyMessage() { @@ -497,12 +618,15 @@ public function getEmailBodyMessage() /** * Sets email_body_message * - * @param string $email_body_message + * @param string|null $email_body_message * - * @return $this + * @return self */ public function setEmailBodyMessage($email_body_message) { + if (is_null($email_body_message)) { + throw new \InvalidArgumentException('non-nullable email_body_message cannot be null'); + } $this->container['email_body_message'] = $email_body_message; return $this; @@ -511,7 +635,7 @@ public function setEmailBodyMessage($email_body_message) /** * Gets show_leave_accruals * - * @return bool + * @return bool|null */ public function getShowLeaveAccruals() { @@ -521,12 +645,15 @@ public function getShowLeaveAccruals() /** * Sets show_leave_accruals * - * @param bool $show_leave_accruals + * @param bool|null $show_leave_accruals * - * @return $this + * @return self */ public function setShowLeaveAccruals($show_leave_accruals) { + if (is_null($show_leave_accruals)) { + throw new \InvalidArgumentException('non-nullable show_leave_accruals cannot be null'); + } $this->container['show_leave_accruals'] = $show_leave_accruals; return $this; @@ -535,7 +662,7 @@ public function setShowLeaveAccruals($show_leave_accruals) /** * Gets show_line_notes * - * @return bool + * @return bool|null */ public function getShowLineNotes() { @@ -545,12 +672,15 @@ public function getShowLineNotes() /** * Sets show_line_notes * - * @param bool $show_line_notes + * @param bool|null $show_line_notes * - * @return $this + * @return self */ public function setShowLineNotes($show_line_notes) { + if (is_null($show_line_notes)) { + throw new \InvalidArgumentException('non-nullable show_line_notes cannot be null'); + } $this->container['show_line_notes'] = $show_line_notes; return $this; @@ -559,7 +689,7 @@ public function setShowLineNotes($show_line_notes) /** * Gets show_location_in_line_notes * - * @return bool + * @return bool|null */ public function getShowLocationInLineNotes() { @@ -569,12 +699,15 @@ public function getShowLocationInLineNotes() /** * Sets show_location_in_line_notes * - * @param bool $show_location_in_line_notes + * @param bool|null $show_location_in_line_notes * - * @return $this + * @return self */ public function setShowLocationInLineNotes($show_location_in_line_notes) { + if (is_null($show_location_in_line_notes)) { + throw new \InvalidArgumentException('non-nullable show_location_in_line_notes cannot be null'); + } $this->container['show_location_in_line_notes'] = $show_location_in_line_notes; return $this; @@ -583,7 +716,7 @@ public function setShowLocationInLineNotes($show_location_in_line_notes) /** * Gets alphabetise_pay_categories * - * @return bool + * @return bool|null */ public function getAlphabetisePayCategories() { @@ -593,12 +726,15 @@ public function getAlphabetisePayCategories() /** * Sets alphabetise_pay_categories * - * @param bool $alphabetise_pay_categories + * @param bool|null $alphabetise_pay_categories * - * @return $this + * @return self */ public function setAlphabetisePayCategories($alphabetise_pay_categories) { + if (is_null($alphabetise_pay_categories)) { + throw new \InvalidArgumentException('non-nullable alphabetise_pay_categories cannot be null'); + } $this->container['alphabetise_pay_categories'] = $alphabetise_pay_categories; return $this; @@ -607,7 +743,7 @@ public function setAlphabetisePayCategories($alphabetise_pay_categories) /** * Gets show_employee_external_id * - * @return bool + * @return bool|null */ public function getShowEmployeeExternalId() { @@ -617,12 +753,15 @@ public function getShowEmployeeExternalId() /** * Sets show_employee_external_id * - * @param bool $show_employee_external_id + * @param bool|null $show_employee_external_id * - * @return $this + * @return self */ public function setShowEmployeeExternalId($show_employee_external_id) { + if (is_null($show_employee_external_id)) { + throw new \InvalidArgumentException('non-nullable show_employee_external_id cannot be null'); + } $this->container['show_employee_external_id'] = $show_employee_external_id; return $this; @@ -631,7 +770,7 @@ public function setShowEmployeeExternalId($show_employee_external_id) /** * Gets employees_must_login_to_download_payslips * - * @return bool + * @return bool|null */ public function getEmployeesMustLoginToDownloadPayslips() { @@ -641,12 +780,15 @@ public function getEmployeesMustLoginToDownloadPayslips() /** * Sets employees_must_login_to_download_payslips * - * @param bool $employees_must_login_to_download_payslips + * @param bool|null $employees_must_login_to_download_payslips * - * @return $this + * @return self */ public function setEmployeesMustLoginToDownloadPayslips($employees_must_login_to_download_payslips) { + if (is_null($employees_must_login_to_download_payslips)) { + throw new \InvalidArgumentException('non-nullable employees_must_login_to_download_payslips cannot be null'); + } $this->container['employees_must_login_to_download_payslips'] = $employees_must_login_to_download_payslips; return $this; @@ -658,7 +800,7 @@ public function setEmployeesMustLoginToDownloadPayslips($employees_must_login_to * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -668,22 +810,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -699,11 +842,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -711,13 +867,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEmployeeFilterModel.php b/src/lib/Model/AuEmployeeFilterModel.php index 6e87157..5eb70f7 100644 --- a/src/lib/Model/AuEmployeeFilterModel.php +++ b/src/lib/Model/AuEmployeeFilterModel.php @@ -2,61 +2,61 @@ /** * AuEmployeeFilterModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEmployeeFilterModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEmployeeFilterModel implements ModelInterface, ArrayAccess +class AuEmployeeFilterModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEmployeeFilterModel'; + protected static $openAPIModelName = 'AuEmployeeFilterModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'filter_type' => 'string', 'operator' => 'string', 'value' => 'string' @@ -66,21 +66,41 @@ class AuEmployeeFilterModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'filter_type' => null, 'operator' => null, 'value' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filter_type' => false, + 'operator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,21 +237,19 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const FILTER_TYPE_LOCATION = 'Location'; - const FILTER_TYPE_LOCATION_OR_PARENTS = 'LocationOrParents'; - const FILTER_TYPE_EMPLOYEE = 'Employee'; - const FILTER_TYPE_PAY_SCHEDULE = 'PaySchedule'; - const FILTER_TYPE_EMPLOYMENT_TYPE = 'EmploymentType'; - const FILTER_TYPE_EMPLOYING_ENTITY = 'EmployingEntity'; - const FILTER_TYPE_TAG = 'Tag'; - const OPERATOR_IN = 'In'; - const OPERATOR_NOT_IN = 'NotIn'; - + public const FILTER_TYPE_LOCATION = 'Location'; + public const FILTER_TYPE_LOCATION_OR_PARENTS = 'LocationOrParents'; + public const FILTER_TYPE_EMPLOYEE = 'Employee'; + public const FILTER_TYPE_PAY_SCHEDULE = 'PaySchedule'; + public const FILTER_TYPE_EMPLOYMENT_TYPE = 'EmploymentType'; + public const FILTER_TYPE_EMPLOYING_ENTITY = 'EmployingEntity'; + public const FILTER_TYPE_TAG = 'Tag'; + public const OPERATOR_IN = 'In'; + public const OPERATOR_NOT_IN = 'NotIn'; - /** * Gets allowable values of the enum * @@ -197,7 +267,7 @@ public function getFilterTypeAllowableValues() self::FILTER_TYPE_TAG, ]; } - + /** * Gets allowable values of the enum * @@ -210,7 +280,6 @@ public function getOperatorAllowableValues() self::OPERATOR_NOT_IN, ]; } - /** * Associative array for storing property values @@ -227,9 +296,27 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['filter_type'] = isset($data['filter_type']) ? $data['filter_type'] : null; - $this->container['operator'] = isset($data['operator']) ? $data['operator'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; + $this->setIfExists('filter_type', $data ?? [], null); + $this->setIfExists('operator', $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; } /** @@ -244,7 +331,8 @@ public function listInvalidProperties() $allowedValues = $this->getFilterTypeAllowableValues(); if (!is_null($this->container['filter_type']) && !in_array($this->container['filter_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'filter_type', must be one of '%s'", + "invalid value '%s' for 'filter_type', must be one of '%s'", + $this->container['filter_type'], implode("', '", $allowedValues) ); } @@ -252,7 +340,8 @@ public function listInvalidProperties() $allowedValues = $this->getOperatorAllowableValues(); if (!is_null($this->container['operator']) && !in_array($this->container['operator'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'operator', must be one of '%s'", + "invalid value '%s' for 'operator', must be one of '%s'", + $this->container['operator'], implode("', '", $allowedValues) ); } @@ -275,7 +364,7 @@ public function valid() /** * Gets filter_type * - * @return string + * @return string|null */ public function getFilterType() { @@ -285,17 +374,21 @@ public function getFilterType() /** * Sets filter_type * - * @param string $filter_type + * @param string|null $filter_type * - * @return $this + * @return self */ public function setFilterType($filter_type) { + if (is_null($filter_type)) { + throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); + } $allowedValues = $this->getFilterTypeAllowableValues(); - if (!is_null($filter_type) && !in_array($filter_type, $allowedValues, true)) { + if (!in_array($filter_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'filter_type', must be one of '%s'", + "Invalid value '%s' for 'filter_type', must be one of '%s'", + $filter_type, implode("', '", $allowedValues) ) ); @@ -308,7 +401,7 @@ public function setFilterType($filter_type) /** * Gets operator * - * @return string + * @return string|null */ public function getOperator() { @@ -318,17 +411,21 @@ public function getOperator() /** * Sets operator * - * @param string $operator + * @param string|null $operator * - * @return $this + * @return self */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); - if (!is_null($operator) && !in_array($operator, $allowedValues, true)) { + if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'operator', must be one of '%s'", + "Invalid value '%s' for 'operator', must be one of '%s'", + $operator, implode("', '", $allowedValues) ) ); @@ -341,7 +438,7 @@ public function setOperator($operator) /** * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -351,12 +448,15 @@ public function getValue() /** * Sets value * - * @param string $value + * @param string|null $value * - * @return $this + * @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; @@ -368,7 +468,7 @@ public function setValue($value) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -378,22 +478,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -409,11 +510,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -421,13 +535,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEmployeeGroupModel.php b/src/lib/Model/AuEmployeeGroupModel.php index 723872c..700f6bf 100644 --- a/src/lib/Model/AuEmployeeGroupModel.php +++ b/src/lib/Model/AuEmployeeGroupModel.php @@ -2,87 +2,108 @@ /** * AuEmployeeGroupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEmployeeGroupModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEmployeeGroupModel implements ModelInterface, ArrayAccess +class AuEmployeeGroupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEmployeeGroupModel'; + protected static $openAPIModelName = 'AuEmployeeGroupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'filter_combination_strategy' => 'string', - 'filters' => '\Swagger\Client\Model\AuEmployeeFilterModel[]' + 'filters' => '\OpenAPI\Client\Model\AuEmployeeFilterModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'filter_combination_strategy' => null, 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'filter_combination_strategy' => false, + 'filters' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,14 +243,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const FILTER_COMBINATION_STRATEGY__OR = 'Or'; - const FILTER_COMBINATION_STRATEGY__AND = 'And'; - + public const FILTER_COMBINATION_STRATEGY__OR = 'Or'; + public const FILTER_COMBINATION_STRATEGY__AND = 'And'; - /** * Gets allowable values of the enum * @@ -190,7 +261,6 @@ public function getFilterCombinationStrategyAllowableValues() self::FILTER_COMBINATION_STRATEGY__AND, ]; } - /** * Associative array for storing property values @@ -207,10 +277,28 @@ public function getFilterCombinationStrategyAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['filter_combination_strategy'] = isset($data['filter_combination_strategy']) ? $data['filter_combination_strategy'] : null; - $this->container['filters'] = isset($data['filters']) ? $data['filters'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('filter_combination_strategy', $data ?? [], null); + $this->setIfExists('filters', $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; } /** @@ -225,7 +313,8 @@ public function listInvalidProperties() $allowedValues = $this->getFilterCombinationStrategyAllowableValues(); if (!is_null($this->container['filter_combination_strategy']) && !in_array($this->container['filter_combination_strategy'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'filter_combination_strategy', must be one of '%s'", + "invalid value '%s' for 'filter_combination_strategy', must be one of '%s'", + $this->container['filter_combination_strategy'], implode("', '", $allowedValues) ); } @@ -248,7 +337,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -258,12 +347,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -272,7 +364,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -282,12 +374,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -296,7 +391,7 @@ public function setName($name) /** * Gets filter_combination_strategy * - * @return string + * @return string|null */ public function getFilterCombinationStrategy() { @@ -306,17 +401,21 @@ public function getFilterCombinationStrategy() /** * Sets filter_combination_strategy * - * @param string $filter_combination_strategy + * @param string|null $filter_combination_strategy * - * @return $this + * @return self */ public function setFilterCombinationStrategy($filter_combination_strategy) { + if (is_null($filter_combination_strategy)) { + throw new \InvalidArgumentException('non-nullable filter_combination_strategy cannot be null'); + } $allowedValues = $this->getFilterCombinationStrategyAllowableValues(); - if (!is_null($filter_combination_strategy) && !in_array($filter_combination_strategy, $allowedValues, true)) { + if (!in_array($filter_combination_strategy, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'filter_combination_strategy', must be one of '%s'", + "Invalid value '%s' for 'filter_combination_strategy', must be one of '%s'", + $filter_combination_strategy, implode("', '", $allowedValues) ) ); @@ -329,7 +428,7 @@ public function setFilterCombinationStrategy($filter_combination_strategy) /** * Gets filters * - * @return \Swagger\Client\Model\AuEmployeeFilterModel[] + * @return \OpenAPI\Client\Model\AuEmployeeFilterModel[]|null */ public function getFilters() { @@ -339,12 +438,15 @@ public function getFilters() /** * Sets filters * - * @param \Swagger\Client\Model\AuEmployeeFilterModel[] $filters + * @param \OpenAPI\Client\Model\AuEmployeeFilterModel[]|null $filters * - * @return $this + * @return self */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; @@ -356,7 +458,7 @@ public function setFilters($filters) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -366,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -397,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -409,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEmployeePayRateModel.php b/src/lib/Model/AuEmployeePayRateModel.php index 21d1372..2bf8dfe 100644 --- a/src/lib/Model/AuEmployeePayRateModel.php +++ b/src/lib/Model/AuEmployeePayRateModel.php @@ -2,78 +2,80 @@ /** * AuEmployeePayRateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEmployeePayRateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEmployeePayRateModel implements ModelInterface, ArrayAccess +class AuEmployeePayRateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEmployeePayRateModel'; + protected static $openAPIModelName = 'AuEmployeePayRateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'has_super_rate_override' => 'bool', - 'super_rate' => 'double', + 'super_rate' => 'float', 'pay_category_id' => 'int', 'pay_category_name' => 'string', 'is_primary_pay_category' => 'bool', 'accrues_leave' => 'bool', 'rate_unit' => 'string', - 'rate' => 'double', - 'calculated_rate' => 'double' + 'rate' => 'float', + 'calculated_rate' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'has_super_rate_override' => null, 'super_rate' => 'double', 'pay_category_id' => 'int32', @@ -85,14 +87,38 @@ class AuEmployeePayRateModel implements ModelInterface, ArrayAccess 'calculated_rate' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'has_super_rate_override' => false, + 'super_rate' => false, + 'pay_category_id' => false, + 'pay_category_name' => false, + 'is_primary_pay_category' => false, + 'accrues_leave' => false, + 'rate_unit' => false, + 'rate' => false, + 'calculated_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['has_super_rate_override'] = isset($data['has_super_rate_override']) ? $data['has_super_rate_override'] : null; - $this->container['super_rate'] = isset($data['super_rate']) ? $data['super_rate'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['pay_category_name'] = isset($data['pay_category_name']) ? $data['pay_category_name'] : null; - $this->container['is_primary_pay_category'] = isset($data['is_primary_pay_category']) ? $data['is_primary_pay_category'] : null; - $this->container['accrues_leave'] = isset($data['accrues_leave']) ? $data['accrues_leave'] : null; - $this->container['rate_unit'] = isset($data['rate_unit']) ? $data['rate_unit'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['calculated_rate'] = isset($data['calculated_rate']) ? $data['calculated_rate'] : null; + $this->setIfExists('has_super_rate_override', $data ?? [], null); + $this->setIfExists('super_rate', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('pay_category_name', $data ?? [], null); + $this->setIfExists('is_primary_pay_category', $data ?? [], null); + $this->setIfExists('accrues_leave', $data ?? [], null); + $this->setIfExists('rate_unit', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('calculated_rate', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets has_super_rate_override * - * @return bool + * @return bool|null */ public function getHasSuperRateOverride() { @@ -265,12 +358,15 @@ public function getHasSuperRateOverride() /** * Sets has_super_rate_override * - * @param bool $has_super_rate_override + * @param bool|null $has_super_rate_override * - * @return $this + * @return self */ public function setHasSuperRateOverride($has_super_rate_override) { + if (is_null($has_super_rate_override)) { + throw new \InvalidArgumentException('non-nullable has_super_rate_override cannot be null'); + } $this->container['has_super_rate_override'] = $has_super_rate_override; return $this; @@ -279,7 +375,7 @@ public function setHasSuperRateOverride($has_super_rate_override) /** * Gets super_rate * - * @return double + * @return float|null */ public function getSuperRate() { @@ -289,12 +385,15 @@ public function getSuperRate() /** * Sets super_rate * - * @param double $super_rate + * @param float|null $super_rate * - * @return $this + * @return self */ public function setSuperRate($super_rate) { + if (is_null($super_rate)) { + throw new \InvalidArgumentException('non-nullable super_rate cannot be null'); + } $this->container['super_rate'] = $super_rate; return $this; @@ -303,7 +402,7 @@ public function setSuperRate($super_rate) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -313,12 +412,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -327,7 +429,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets pay_category_name * - * @return string + * @return string|null */ public function getPayCategoryName() { @@ -337,12 +439,15 @@ public function getPayCategoryName() /** * Sets pay_category_name * - * @param string $pay_category_name + * @param string|null $pay_category_name * - * @return $this + * @return self */ public function setPayCategoryName($pay_category_name) { + if (is_null($pay_category_name)) { + throw new \InvalidArgumentException('non-nullable pay_category_name cannot be null'); + } $this->container['pay_category_name'] = $pay_category_name; return $this; @@ -351,7 +456,7 @@ public function setPayCategoryName($pay_category_name) /** * Gets is_primary_pay_category * - * @return bool + * @return bool|null */ public function getIsPrimaryPayCategory() { @@ -361,12 +466,15 @@ public function getIsPrimaryPayCategory() /** * Sets is_primary_pay_category * - * @param bool $is_primary_pay_category + * @param bool|null $is_primary_pay_category * - * @return $this + * @return self */ public function setIsPrimaryPayCategory($is_primary_pay_category) { + if (is_null($is_primary_pay_category)) { + throw new \InvalidArgumentException('non-nullable is_primary_pay_category cannot be null'); + } $this->container['is_primary_pay_category'] = $is_primary_pay_category; return $this; @@ -375,7 +483,7 @@ public function setIsPrimaryPayCategory($is_primary_pay_category) /** * Gets accrues_leave * - * @return bool + * @return bool|null */ public function getAccruesLeave() { @@ -385,12 +493,15 @@ public function getAccruesLeave() /** * Sets accrues_leave * - * @param bool $accrues_leave + * @param bool|null $accrues_leave * - * @return $this + * @return self */ public function setAccruesLeave($accrues_leave) { + if (is_null($accrues_leave)) { + throw new \InvalidArgumentException('non-nullable accrues_leave cannot be null'); + } $this->container['accrues_leave'] = $accrues_leave; return $this; @@ -399,7 +510,7 @@ public function setAccruesLeave($accrues_leave) /** * Gets rate_unit * - * @return string + * @return string|null */ public function getRateUnit() { @@ -409,12 +520,15 @@ public function getRateUnit() /** * Sets rate_unit * - * @param string $rate_unit + * @param string|null $rate_unit * - * @return $this + * @return self */ public function setRateUnit($rate_unit) { + if (is_null($rate_unit)) { + throw new \InvalidArgumentException('non-nullable rate_unit cannot be null'); + } $this->container['rate_unit'] = $rate_unit; return $this; @@ -423,7 +537,7 @@ public function setRateUnit($rate_unit) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -433,12 +547,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -447,7 +564,7 @@ public function setRate($rate) /** * Gets calculated_rate * - * @return double + * @return float|null */ public function getCalculatedRate() { @@ -457,12 +574,15 @@ public function getCalculatedRate() /** * Sets calculated_rate * - * @param double $calculated_rate + * @param float|null $calculated_rate * - * @return $this + * @return self */ public function setCalculatedRate($calculated_rate) { + if (is_null($calculated_rate)) { + throw new \InvalidArgumentException('non-nullable calculated_rate cannot be null'); + } $this->container['calculated_rate'] = $calculated_rate; return $this; @@ -474,7 +594,7 @@ public function setCalculatedRate($calculated_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEmployeePortalSettingsModel.php b/src/lib/Model/AuEmployeePortalSettingsModel.php index 08377bf..0f3ed78 100644 --- a/src/lib/Model/AuEmployeePortalSettingsModel.php +++ b/src/lib/Model/AuEmployeePortalSettingsModel.php @@ -2,61 +2,61 @@ /** * AuEmployeePortalSettingsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEmployeePortalSettingsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEmployeePortalSettingsModel implements ModelInterface, ArrayAccess +class AuEmployeePortalSettingsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEmployeePortalSettingsModel'; + protected static $openAPIModelName = 'AuEmployeePortalSettingsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'allow_employee_super_fund_self_service' => 'bool', 'can_specify_higher_classification' => 'bool', 'allow_employee_leave_self_service' => 'bool', @@ -85,8 +85,10 @@ class AuEmployeePortalSettingsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'allow_employee_super_fund_self_service' => null, 'can_specify_higher_classification' => null, 'allow_employee_leave_self_service' => null, @@ -111,14 +113,51 @@ class AuEmployeePortalSettingsModel implements ModelInterface, ArrayAccess 'send_employee_details_update_notifications' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'allow_employee_super_fund_self_service' => false, + 'can_specify_higher_classification' => false, + 'allow_employee_leave_self_service' => false, + 'allow_employee_self_editing' => false, + 'timesheet_setting' => false, + 'allow_employee_to_set_unavailability' => false, + 'allow_employee_bank_account_self_service' => false, + 'allow_employee_satisfaction_survey' => false, + 'allow_employees_to_view_all_approved_leave' => false, + 'unavailability_cut_off' => false, + 'allow_employees_to_upload_profile_picture' => false, + 'allow_employee_expenses_self_service' => false, + 'allow_employee_override_tax_codes' => false, + 'show_pay_days_in_employee_calendar' => false, + 'enable_work_zone_clock_on' => false, + 'require_photo' => false, + 'allow_employee_shift_selection' => false, + 'clock_on_window_minutes' => false, + 'clock_off_window_minutes' => false, + 'clock_on_reminder_notification_minutes' => false, + 'clock_off_reminder_notification_minutes' => false, + 'send_employee_details_update_notifications' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -126,9 +165,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -260,19 +351,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TIMESHEET_SETTING_DISABLED = 'Disabled'; - const TIMESHEET_SETTING_READ_ONLY = 'ReadOnly'; - const TIMESHEET_SETTING_READ_WRITE = 'ReadWrite'; - const TIMESHEET_SETTING_EDIT_KIOSK = 'EditKiosk'; - const TIMESHEET_SETTING_EDIT_WORK_ZONE_CLOCK_ON_OFF = 'EditWorkZoneClockOnOff'; - const TIMESHEET_SETTING_EDIT_KIOSK_OR_WORK_ZONE_CLOCK_ON_OFF = 'EditKioskOrWorkZoneClockOnOff'; - const TIMESHEET_SETTING_ENABLED = 'Enabled'; - + public const TIMESHEET_SETTING_DISABLED = 'Disabled'; + public const TIMESHEET_SETTING_READ_ONLY = 'ReadOnly'; + public const TIMESHEET_SETTING_READ_WRITE = 'ReadWrite'; + public const TIMESHEET_SETTING_EDIT_KIOSK = 'EditKiosk'; + public const TIMESHEET_SETTING_EDIT_WORK_ZONE_CLOCK_ON_OFF = 'EditWorkZoneClockOnOff'; + public const TIMESHEET_SETTING_EDIT_KIOSK_OR_WORK_ZONE_CLOCK_ON_OFF = 'EditKioskOrWorkZoneClockOnOff'; + public const TIMESHEET_SETTING_ENABLED = 'Enabled'; - /** * Gets allowable values of the enum * @@ -290,7 +379,6 @@ public function getTimesheetSettingAllowableValues() self::TIMESHEET_SETTING_ENABLED, ]; } - /** * Associative array for storing property values @@ -307,28 +395,46 @@ public function getTimesheetSettingAllowableValues() */ public function __construct(array $data = null) { - $this->container['allow_employee_super_fund_self_service'] = isset($data['allow_employee_super_fund_self_service']) ? $data['allow_employee_super_fund_self_service'] : null; - $this->container['can_specify_higher_classification'] = isset($data['can_specify_higher_classification']) ? $data['can_specify_higher_classification'] : null; - $this->container['allow_employee_leave_self_service'] = isset($data['allow_employee_leave_self_service']) ? $data['allow_employee_leave_self_service'] : null; - $this->container['allow_employee_self_editing'] = isset($data['allow_employee_self_editing']) ? $data['allow_employee_self_editing'] : null; - $this->container['timesheet_setting'] = isset($data['timesheet_setting']) ? $data['timesheet_setting'] : null; - $this->container['allow_employee_to_set_unavailability'] = isset($data['allow_employee_to_set_unavailability']) ? $data['allow_employee_to_set_unavailability'] : null; - $this->container['allow_employee_bank_account_self_service'] = isset($data['allow_employee_bank_account_self_service']) ? $data['allow_employee_bank_account_self_service'] : null; - $this->container['allow_employee_satisfaction_survey'] = isset($data['allow_employee_satisfaction_survey']) ? $data['allow_employee_satisfaction_survey'] : null; - $this->container['allow_employees_to_view_all_approved_leave'] = isset($data['allow_employees_to_view_all_approved_leave']) ? $data['allow_employees_to_view_all_approved_leave'] : null; - $this->container['unavailability_cut_off'] = isset($data['unavailability_cut_off']) ? $data['unavailability_cut_off'] : null; - $this->container['allow_employees_to_upload_profile_picture'] = isset($data['allow_employees_to_upload_profile_picture']) ? $data['allow_employees_to_upload_profile_picture'] : null; - $this->container['allow_employee_expenses_self_service'] = isset($data['allow_employee_expenses_self_service']) ? $data['allow_employee_expenses_self_service'] : null; - $this->container['allow_employee_override_tax_codes'] = isset($data['allow_employee_override_tax_codes']) ? $data['allow_employee_override_tax_codes'] : null; - $this->container['show_pay_days_in_employee_calendar'] = isset($data['show_pay_days_in_employee_calendar']) ? $data['show_pay_days_in_employee_calendar'] : null; - $this->container['enable_work_zone_clock_on'] = isset($data['enable_work_zone_clock_on']) ? $data['enable_work_zone_clock_on'] : null; - $this->container['require_photo'] = isset($data['require_photo']) ? $data['require_photo'] : null; - $this->container['allow_employee_shift_selection'] = isset($data['allow_employee_shift_selection']) ? $data['allow_employee_shift_selection'] : null; - $this->container['clock_on_window_minutes'] = isset($data['clock_on_window_minutes']) ? $data['clock_on_window_minutes'] : null; - $this->container['clock_off_window_minutes'] = isset($data['clock_off_window_minutes']) ? $data['clock_off_window_minutes'] : null; - $this->container['clock_on_reminder_notification_minutes'] = isset($data['clock_on_reminder_notification_minutes']) ? $data['clock_on_reminder_notification_minutes'] : null; - $this->container['clock_off_reminder_notification_minutes'] = isset($data['clock_off_reminder_notification_minutes']) ? $data['clock_off_reminder_notification_minutes'] : null; - $this->container['send_employee_details_update_notifications'] = isset($data['send_employee_details_update_notifications']) ? $data['send_employee_details_update_notifications'] : null; + $this->setIfExists('allow_employee_super_fund_self_service', $data ?? [], null); + $this->setIfExists('can_specify_higher_classification', $data ?? [], null); + $this->setIfExists('allow_employee_leave_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_self_editing', $data ?? [], null); + $this->setIfExists('timesheet_setting', $data ?? [], null); + $this->setIfExists('allow_employee_to_set_unavailability', $data ?? [], null); + $this->setIfExists('allow_employee_bank_account_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_satisfaction_survey', $data ?? [], null); + $this->setIfExists('allow_employees_to_view_all_approved_leave', $data ?? [], null); + $this->setIfExists('unavailability_cut_off', $data ?? [], null); + $this->setIfExists('allow_employees_to_upload_profile_picture', $data ?? [], null); + $this->setIfExists('allow_employee_expenses_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_override_tax_codes', $data ?? [], null); + $this->setIfExists('show_pay_days_in_employee_calendar', $data ?? [], null); + $this->setIfExists('enable_work_zone_clock_on', $data ?? [], null); + $this->setIfExists('require_photo', $data ?? [], null); + $this->setIfExists('allow_employee_shift_selection', $data ?? [], null); + $this->setIfExists('clock_on_window_minutes', $data ?? [], null); + $this->setIfExists('clock_off_window_minutes', $data ?? [], null); + $this->setIfExists('clock_on_reminder_notification_minutes', $data ?? [], null); + $this->setIfExists('clock_off_reminder_notification_minutes', $data ?? [], null); + $this->setIfExists('send_employee_details_update_notifications', $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; } /** @@ -343,7 +449,8 @@ public function listInvalidProperties() $allowedValues = $this->getTimesheetSettingAllowableValues(); if (!is_null($this->container['timesheet_setting']) && !in_array($this->container['timesheet_setting'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'timesheet_setting', must be one of '%s'", + "invalid value '%s' for 'timesheet_setting', must be one of '%s'", + $this->container['timesheet_setting'], implode("', '", $allowedValues) ); } @@ -366,7 +473,7 @@ public function valid() /** * Gets allow_employee_super_fund_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeSuperFundSelfService() { @@ -376,12 +483,15 @@ public function getAllowEmployeeSuperFundSelfService() /** * Sets allow_employee_super_fund_self_service * - * @param bool $allow_employee_super_fund_self_service + * @param bool|null $allow_employee_super_fund_self_service * - * @return $this + * @return self */ public function setAllowEmployeeSuperFundSelfService($allow_employee_super_fund_self_service) { + if (is_null($allow_employee_super_fund_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_super_fund_self_service cannot be null'); + } $this->container['allow_employee_super_fund_self_service'] = $allow_employee_super_fund_self_service; return $this; @@ -390,7 +500,7 @@ public function setAllowEmployeeSuperFundSelfService($allow_employee_super_fund_ /** * Gets can_specify_higher_classification * - * @return bool + * @return bool|null */ public function getCanSpecifyHigherClassification() { @@ -400,12 +510,15 @@ public function getCanSpecifyHigherClassification() /** * Sets can_specify_higher_classification * - * @param bool $can_specify_higher_classification + * @param bool|null $can_specify_higher_classification * - * @return $this + * @return self */ public function setCanSpecifyHigherClassification($can_specify_higher_classification) { + if (is_null($can_specify_higher_classification)) { + throw new \InvalidArgumentException('non-nullable can_specify_higher_classification cannot be null'); + } $this->container['can_specify_higher_classification'] = $can_specify_higher_classification; return $this; @@ -414,7 +527,7 @@ public function setCanSpecifyHigherClassification($can_specify_higher_classifica /** * Gets allow_employee_leave_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeLeaveSelfService() { @@ -424,12 +537,15 @@ public function getAllowEmployeeLeaveSelfService() /** * Sets allow_employee_leave_self_service * - * @param bool $allow_employee_leave_self_service + * @param bool|null $allow_employee_leave_self_service * - * @return $this + * @return self */ public function setAllowEmployeeLeaveSelfService($allow_employee_leave_self_service) { + if (is_null($allow_employee_leave_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_leave_self_service cannot be null'); + } $this->container['allow_employee_leave_self_service'] = $allow_employee_leave_self_service; return $this; @@ -438,7 +554,7 @@ public function setAllowEmployeeLeaveSelfService($allow_employee_leave_self_serv /** * Gets allow_employee_self_editing * - * @return bool + * @return bool|null */ public function getAllowEmployeeSelfEditing() { @@ -448,12 +564,15 @@ public function getAllowEmployeeSelfEditing() /** * Sets allow_employee_self_editing * - * @param bool $allow_employee_self_editing + * @param bool|null $allow_employee_self_editing * - * @return $this + * @return self */ public function setAllowEmployeeSelfEditing($allow_employee_self_editing) { + if (is_null($allow_employee_self_editing)) { + throw new \InvalidArgumentException('non-nullable allow_employee_self_editing cannot be null'); + } $this->container['allow_employee_self_editing'] = $allow_employee_self_editing; return $this; @@ -462,7 +581,7 @@ public function setAllowEmployeeSelfEditing($allow_employee_self_editing) /** * Gets timesheet_setting * - * @return string + * @return string|null */ public function getTimesheetSetting() { @@ -472,17 +591,21 @@ public function getTimesheetSetting() /** * Sets timesheet_setting * - * @param string $timesheet_setting + * @param string|null $timesheet_setting * - * @return $this + * @return self */ public function setTimesheetSetting($timesheet_setting) { + if (is_null($timesheet_setting)) { + throw new \InvalidArgumentException('non-nullable timesheet_setting cannot be null'); + } $allowedValues = $this->getTimesheetSettingAllowableValues(); - if (!is_null($timesheet_setting) && !in_array($timesheet_setting, $allowedValues, true)) { + if (!in_array($timesheet_setting, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'timesheet_setting', must be one of '%s'", + "Invalid value '%s' for 'timesheet_setting', must be one of '%s'", + $timesheet_setting, implode("', '", $allowedValues) ) ); @@ -495,7 +618,7 @@ public function setTimesheetSetting($timesheet_setting) /** * Gets allow_employee_to_set_unavailability * - * @return bool + * @return bool|null */ public function getAllowEmployeeToSetUnavailability() { @@ -505,12 +628,15 @@ public function getAllowEmployeeToSetUnavailability() /** * Sets allow_employee_to_set_unavailability * - * @param bool $allow_employee_to_set_unavailability + * @param bool|null $allow_employee_to_set_unavailability * - * @return $this + * @return self */ public function setAllowEmployeeToSetUnavailability($allow_employee_to_set_unavailability) { + if (is_null($allow_employee_to_set_unavailability)) { + throw new \InvalidArgumentException('non-nullable allow_employee_to_set_unavailability cannot be null'); + } $this->container['allow_employee_to_set_unavailability'] = $allow_employee_to_set_unavailability; return $this; @@ -519,7 +645,7 @@ public function setAllowEmployeeToSetUnavailability($allow_employee_to_set_unava /** * Gets allow_employee_bank_account_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeBankAccountSelfService() { @@ -529,12 +655,15 @@ public function getAllowEmployeeBankAccountSelfService() /** * Sets allow_employee_bank_account_self_service * - * @param bool $allow_employee_bank_account_self_service + * @param bool|null $allow_employee_bank_account_self_service * - * @return $this + * @return self */ public function setAllowEmployeeBankAccountSelfService($allow_employee_bank_account_self_service) { + if (is_null($allow_employee_bank_account_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_bank_account_self_service cannot be null'); + } $this->container['allow_employee_bank_account_self_service'] = $allow_employee_bank_account_self_service; return $this; @@ -543,7 +672,7 @@ public function setAllowEmployeeBankAccountSelfService($allow_employee_bank_acco /** * Gets allow_employee_satisfaction_survey * - * @return bool + * @return bool|null */ public function getAllowEmployeeSatisfactionSurvey() { @@ -553,12 +682,15 @@ public function getAllowEmployeeSatisfactionSurvey() /** * Sets allow_employee_satisfaction_survey * - * @param bool $allow_employee_satisfaction_survey + * @param bool|null $allow_employee_satisfaction_survey * - * @return $this + * @return self */ public function setAllowEmployeeSatisfactionSurvey($allow_employee_satisfaction_survey) { + if (is_null($allow_employee_satisfaction_survey)) { + throw new \InvalidArgumentException('non-nullable allow_employee_satisfaction_survey cannot be null'); + } $this->container['allow_employee_satisfaction_survey'] = $allow_employee_satisfaction_survey; return $this; @@ -567,7 +699,7 @@ public function setAllowEmployeeSatisfactionSurvey($allow_employee_satisfaction_ /** * Gets allow_employees_to_view_all_approved_leave * - * @return bool + * @return bool|null */ public function getAllowEmployeesToViewAllApprovedLeave() { @@ -577,12 +709,15 @@ public function getAllowEmployeesToViewAllApprovedLeave() /** * Sets allow_employees_to_view_all_approved_leave * - * @param bool $allow_employees_to_view_all_approved_leave + * @param bool|null $allow_employees_to_view_all_approved_leave * - * @return $this + * @return self */ public function setAllowEmployeesToViewAllApprovedLeave($allow_employees_to_view_all_approved_leave) { + if (is_null($allow_employees_to_view_all_approved_leave)) { + throw new \InvalidArgumentException('non-nullable allow_employees_to_view_all_approved_leave cannot be null'); + } $this->container['allow_employees_to_view_all_approved_leave'] = $allow_employees_to_view_all_approved_leave; return $this; @@ -591,7 +726,7 @@ public function setAllowEmployeesToViewAllApprovedLeave($allow_employees_to_view /** * Gets unavailability_cut_off * - * @return int + * @return int|null */ public function getUnavailabilityCutOff() { @@ -601,12 +736,15 @@ public function getUnavailabilityCutOff() /** * Sets unavailability_cut_off * - * @param int $unavailability_cut_off + * @param int|null $unavailability_cut_off * - * @return $this + * @return self */ public function setUnavailabilityCutOff($unavailability_cut_off) { + if (is_null($unavailability_cut_off)) { + throw new \InvalidArgumentException('non-nullable unavailability_cut_off cannot be null'); + } $this->container['unavailability_cut_off'] = $unavailability_cut_off; return $this; @@ -615,7 +753,7 @@ public function setUnavailabilityCutOff($unavailability_cut_off) /** * Gets allow_employees_to_upload_profile_picture * - * @return bool + * @return bool|null */ public function getAllowEmployeesToUploadProfilePicture() { @@ -625,12 +763,15 @@ public function getAllowEmployeesToUploadProfilePicture() /** * Sets allow_employees_to_upload_profile_picture * - * @param bool $allow_employees_to_upload_profile_picture + * @param bool|null $allow_employees_to_upload_profile_picture * - * @return $this + * @return self */ public function setAllowEmployeesToUploadProfilePicture($allow_employees_to_upload_profile_picture) { + if (is_null($allow_employees_to_upload_profile_picture)) { + throw new \InvalidArgumentException('non-nullable allow_employees_to_upload_profile_picture cannot be null'); + } $this->container['allow_employees_to_upload_profile_picture'] = $allow_employees_to_upload_profile_picture; return $this; @@ -639,7 +780,7 @@ public function setAllowEmployeesToUploadProfilePicture($allow_employees_to_uplo /** * Gets allow_employee_expenses_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeExpensesSelfService() { @@ -649,12 +790,15 @@ public function getAllowEmployeeExpensesSelfService() /** * Sets allow_employee_expenses_self_service * - * @param bool $allow_employee_expenses_self_service + * @param bool|null $allow_employee_expenses_self_service * - * @return $this + * @return self */ public function setAllowEmployeeExpensesSelfService($allow_employee_expenses_self_service) { + if (is_null($allow_employee_expenses_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_expenses_self_service cannot be null'); + } $this->container['allow_employee_expenses_self_service'] = $allow_employee_expenses_self_service; return $this; @@ -663,7 +807,7 @@ public function setAllowEmployeeExpensesSelfService($allow_employee_expenses_sel /** * Gets allow_employee_override_tax_codes * - * @return bool + * @return bool|null */ public function getAllowEmployeeOverrideTaxCodes() { @@ -673,12 +817,15 @@ public function getAllowEmployeeOverrideTaxCodes() /** * Sets allow_employee_override_tax_codes * - * @param bool $allow_employee_override_tax_codes + * @param bool|null $allow_employee_override_tax_codes * - * @return $this + * @return self */ public function setAllowEmployeeOverrideTaxCodes($allow_employee_override_tax_codes) { + if (is_null($allow_employee_override_tax_codes)) { + throw new \InvalidArgumentException('non-nullable allow_employee_override_tax_codes cannot be null'); + } $this->container['allow_employee_override_tax_codes'] = $allow_employee_override_tax_codes; return $this; @@ -687,7 +834,7 @@ public function setAllowEmployeeOverrideTaxCodes($allow_employee_override_tax_co /** * Gets show_pay_days_in_employee_calendar * - * @return bool + * @return bool|null */ public function getShowPayDaysInEmployeeCalendar() { @@ -697,12 +844,15 @@ public function getShowPayDaysInEmployeeCalendar() /** * Sets show_pay_days_in_employee_calendar * - * @param bool $show_pay_days_in_employee_calendar + * @param bool|null $show_pay_days_in_employee_calendar * - * @return $this + * @return self */ public function setShowPayDaysInEmployeeCalendar($show_pay_days_in_employee_calendar) { + if (is_null($show_pay_days_in_employee_calendar)) { + throw new \InvalidArgumentException('non-nullable show_pay_days_in_employee_calendar cannot be null'); + } $this->container['show_pay_days_in_employee_calendar'] = $show_pay_days_in_employee_calendar; return $this; @@ -711,7 +861,7 @@ public function setShowPayDaysInEmployeeCalendar($show_pay_days_in_employee_cale /** * Gets enable_work_zone_clock_on * - * @return bool + * @return bool|null */ public function getEnableWorkZoneClockOn() { @@ -721,12 +871,15 @@ public function getEnableWorkZoneClockOn() /** * Sets enable_work_zone_clock_on * - * @param bool $enable_work_zone_clock_on + * @param bool|null $enable_work_zone_clock_on * - * @return $this + * @return self */ public function setEnableWorkZoneClockOn($enable_work_zone_clock_on) { + if (is_null($enable_work_zone_clock_on)) { + throw new \InvalidArgumentException('non-nullable enable_work_zone_clock_on cannot be null'); + } $this->container['enable_work_zone_clock_on'] = $enable_work_zone_clock_on; return $this; @@ -735,7 +888,7 @@ public function setEnableWorkZoneClockOn($enable_work_zone_clock_on) /** * Gets require_photo * - * @return bool + * @return bool|null */ public function getRequirePhoto() { @@ -745,12 +898,15 @@ public function getRequirePhoto() /** * Sets require_photo * - * @param bool $require_photo + * @param bool|null $require_photo * - * @return $this + * @return self */ public function setRequirePhoto($require_photo) { + if (is_null($require_photo)) { + throw new \InvalidArgumentException('non-nullable require_photo cannot be null'); + } $this->container['require_photo'] = $require_photo; return $this; @@ -759,7 +915,7 @@ public function setRequirePhoto($require_photo) /** * Gets allow_employee_shift_selection * - * @return bool + * @return bool|null */ public function getAllowEmployeeShiftSelection() { @@ -769,12 +925,15 @@ public function getAllowEmployeeShiftSelection() /** * Sets allow_employee_shift_selection * - * @param bool $allow_employee_shift_selection + * @param bool|null $allow_employee_shift_selection * - * @return $this + * @return self */ public function setAllowEmployeeShiftSelection($allow_employee_shift_selection) { + if (is_null($allow_employee_shift_selection)) { + throw new \InvalidArgumentException('non-nullable allow_employee_shift_selection cannot be null'); + } $this->container['allow_employee_shift_selection'] = $allow_employee_shift_selection; return $this; @@ -783,7 +942,7 @@ public function setAllowEmployeeShiftSelection($allow_employee_shift_selection) /** * Gets clock_on_window_minutes * - * @return int + * @return int|null */ public function getClockOnWindowMinutes() { @@ -793,12 +952,15 @@ public function getClockOnWindowMinutes() /** * Sets clock_on_window_minutes * - * @param int $clock_on_window_minutes + * @param int|null $clock_on_window_minutes * - * @return $this + * @return self */ public function setClockOnWindowMinutes($clock_on_window_minutes) { + if (is_null($clock_on_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_on_window_minutes cannot be null'); + } $this->container['clock_on_window_minutes'] = $clock_on_window_minutes; return $this; @@ -807,7 +969,7 @@ public function setClockOnWindowMinutes($clock_on_window_minutes) /** * Gets clock_off_window_minutes * - * @return int + * @return int|null */ public function getClockOffWindowMinutes() { @@ -817,12 +979,15 @@ public function getClockOffWindowMinutes() /** * Sets clock_off_window_minutes * - * @param int $clock_off_window_minutes + * @param int|null $clock_off_window_minutes * - * @return $this + * @return self */ public function setClockOffWindowMinutes($clock_off_window_minutes) { + if (is_null($clock_off_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_off_window_minutes cannot be null'); + } $this->container['clock_off_window_minutes'] = $clock_off_window_minutes; return $this; @@ -831,7 +996,7 @@ public function setClockOffWindowMinutes($clock_off_window_minutes) /** * Gets clock_on_reminder_notification_minutes * - * @return int + * @return int|null */ public function getClockOnReminderNotificationMinutes() { @@ -841,12 +1006,15 @@ public function getClockOnReminderNotificationMinutes() /** * Sets clock_on_reminder_notification_minutes * - * @param int $clock_on_reminder_notification_minutes + * @param int|null $clock_on_reminder_notification_minutes * - * @return $this + * @return self */ public function setClockOnReminderNotificationMinutes($clock_on_reminder_notification_minutes) { + if (is_null($clock_on_reminder_notification_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_on_reminder_notification_minutes cannot be null'); + } $this->container['clock_on_reminder_notification_minutes'] = $clock_on_reminder_notification_minutes; return $this; @@ -855,7 +1023,7 @@ public function setClockOnReminderNotificationMinutes($clock_on_reminder_notific /** * Gets clock_off_reminder_notification_minutes * - * @return int + * @return int|null */ public function getClockOffReminderNotificationMinutes() { @@ -865,12 +1033,15 @@ public function getClockOffReminderNotificationMinutes() /** * Sets clock_off_reminder_notification_minutes * - * @param int $clock_off_reminder_notification_minutes + * @param int|null $clock_off_reminder_notification_minutes * - * @return $this + * @return self */ public function setClockOffReminderNotificationMinutes($clock_off_reminder_notification_minutes) { + if (is_null($clock_off_reminder_notification_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_off_reminder_notification_minutes cannot be null'); + } $this->container['clock_off_reminder_notification_minutes'] = $clock_off_reminder_notification_minutes; return $this; @@ -879,7 +1050,7 @@ public function setClockOffReminderNotificationMinutes($clock_off_reminder_notif /** * Gets send_employee_details_update_notifications * - * @return bool + * @return bool|null */ public function getSendEmployeeDetailsUpdateNotifications() { @@ -889,12 +1060,15 @@ public function getSendEmployeeDetailsUpdateNotifications() /** * Sets send_employee_details_update_notifications * - * @param bool $send_employee_details_update_notifications + * @param bool|null $send_employee_details_update_notifications * - * @return $this + * @return self */ public function setSendEmployeeDetailsUpdateNotifications($send_employee_details_update_notifications) { + if (is_null($send_employee_details_update_notifications)) { + throw new \InvalidArgumentException('non-nullable send_employee_details_update_notifications cannot be null'); + } $this->container['send_employee_details_update_notifications'] = $send_employee_details_update_notifications; return $this; @@ -906,7 +1080,7 @@ public function setSendEmployeeDetailsUpdateNotifications($send_employee_details * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -916,22 +1090,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -947,11 +1122,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -959,13 +1147,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEmployeeRecurringDeductionModel.php b/src/lib/Model/AuEmployeeRecurringDeductionModel.php index 462d455..2e49074 100644 --- a/src/lib/Model/AuEmployeeRecurringDeductionModel.php +++ b/src/lib/Model/AuEmployeeRecurringDeductionModel.php @@ -2,61 +2,61 @@ /** * AuEmployeeRecurringDeductionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEmployeeRecurringDeductionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEmployeeRecurringDeductionModel implements ModelInterface, ArrayAccess +class AuEmployeeRecurringDeductionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEmployeeRecurringDeductionModel'; + protected static $openAPIModelName = 'AuEmployeeRecurringDeductionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'deduction_type' => 'string', 'paid_to' => 'string', 'name' => 'string', @@ -68,17 +68,17 @@ class AuEmployeeRecurringDeductionModel implements ModelInterface, ArrayAccess 'carry_forward_unused_preserved_earnings' => 'bool', 'payment_reference' => 'string', 'preserved_earnings' => 'string', - 'preserved_earnings_amount' => 'double', + 'preserved_earnings_amount' => 'float', 'additional_data' => 'int', 'priority' => 'int', 'deleted' => 'bool', 'id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'expiry_date' => '\DateTime', 'from_date' => '\DateTime', - 'maximum_amount_paid' => 'double', - 'total_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', + 'total_amount_paid' => 'float', 'is_active' => 'bool', 'notes' => 'string' ]; @@ -87,8 +87,10 @@ class AuEmployeeRecurringDeductionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deduction_type' => null, 'paid_to' => null, 'name' => null, @@ -115,14 +117,53 @@ class AuEmployeeRecurringDeductionModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deduction_type' => false, + 'paid_to' => false, + 'name' => false, + 'deduction_category_id' => false, + 'paid_to_account_id' => false, + 'external_reference_id' => false, + 'preserved_earnings_amount_not_reached_action' => false, + 'carry_forward_unpaid_deductions' => false, + 'carry_forward_unused_preserved_earnings' => false, + 'payment_reference' => false, + 'preserved_earnings' => false, + 'preserved_earnings_amount' => false, + 'additional_data' => false, + 'priority' => false, + 'deleted' => false, + 'id' => false, + 'employee_id' => false, + 'amount' => false, + 'expiry_date' => false, + 'from_date' => false, + 'maximum_amount_paid' => false, + 'total_amount_paid' => false, + 'is_active' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -130,9 +171,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -270,32 +363,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const DEDUCTION_TYPE_NOT_SET = 'NotSet'; - const DEDUCTION_TYPE_FIXED = 'Fixed'; - const DEDUCTION_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; - const DEDUCTION_TYPE_PERCENTAGE_OTE = 'PercentageOTE'; - const DEDUCTION_TYPE_PERCENTAGE_STUDENT_LOAN = 'PercentageStudentLoan'; - const DEDUCTION_TYPE_PERCENTAGE_NET = 'PercentageNet'; - const DEDUCTION_TYPE_TIERED = 'Tiered'; - const DEDUCTION_TYPE_CUSTOM = 'Custom'; - const PAID_TO_MANUAL = 'Manual'; - const PAID_TO_BANK_ACCOUNT = 'BankAccount'; - const PAID_TO_SUPER_FUND = 'SuperFund'; - const PAID_TO_BPAY = 'Bpay'; - const PAID_TO_PENSION_SCHEME = 'PensionScheme'; - const PAID_TO_TAX_OFFICE = 'TaxOffice'; - const PAID_TO_CPFB = 'CPFB'; - const PRESERVED_EARNINGS_AMOUNT_NOT_REACHED_ACTION_DO_NOT_PAY = 'DoNotPay'; - const PRESERVED_EARNINGS_AMOUNT_NOT_REACHED_ACTION_PAY_TO_LIMIT = 'PayToLimit'; - const PRESERVED_EARNINGS_NEVER = 'Never'; - const PRESERVED_EARNINGS_AMOUNT = 'Amount'; - const PRESERVED_EARNINGS_PERCENTAGE = 'Percentage'; - - - + return self::$openAPIModelName; + } + + public const DEDUCTION_TYPE_NOT_SET = 'NotSet'; + public const DEDUCTION_TYPE_FIXED = 'Fixed'; + public const DEDUCTION_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; + public const DEDUCTION_TYPE_PERCENTAGE_OTE = 'PercentageOTE'; + public const DEDUCTION_TYPE_PERCENTAGE_STUDENT_LOAN = 'PercentageStudentLoan'; + public const DEDUCTION_TYPE_PERCENTAGE_NET = 'PercentageNet'; + public const DEDUCTION_TYPE_TIERED = 'Tiered'; + public const DEDUCTION_TYPE_CUSTOM = 'Custom'; + public const PAID_TO_MANUAL = 'Manual'; + public const PAID_TO_BANK_ACCOUNT = 'BankAccount'; + public const PAID_TO_SUPER_FUND = 'SuperFund'; + public const PAID_TO_BPAY = 'Bpay'; + public const PAID_TO_PENSION_SCHEME = 'PensionScheme'; + public const PAID_TO_TAX_OFFICE = 'TaxOffice'; + public const PAID_TO_CPFB = 'CPFB'; + public const PRESERVED_EARNINGS_AMOUNT_NOT_REACHED_ACTION_DO_NOT_PAY = 'DoNotPay'; + public const PRESERVED_EARNINGS_AMOUNT_NOT_REACHED_ACTION_PAY_TO_LIMIT = 'PayToLimit'; + public const PRESERVED_EARNINGS_NEVER = 'Never'; + public const PRESERVED_EARNINGS_AMOUNT = 'Amount'; + public const PRESERVED_EARNINGS_PERCENTAGE = 'Percentage'; + /** * Gets allowable values of the enum * @@ -314,7 +405,7 @@ public function getDeductionTypeAllowableValues() self::DEDUCTION_TYPE_CUSTOM, ]; } - + /** * Gets allowable values of the enum * @@ -332,7 +423,7 @@ public function getPaidToAllowableValues() self::PAID_TO_CPFB, ]; } - + /** * Gets allowable values of the enum * @@ -345,7 +436,7 @@ public function getPreservedEarningsAmountNotReachedActionAllowableValues() self::PRESERVED_EARNINGS_AMOUNT_NOT_REACHED_ACTION_PAY_TO_LIMIT, ]; } - + /** * Gets allowable values of the enum * @@ -359,7 +450,6 @@ public function getPreservedEarningsAllowableValues() self::PRESERVED_EARNINGS_PERCENTAGE, ]; } - /** * Associative array for storing property values @@ -376,30 +466,48 @@ public function getPreservedEarningsAllowableValues() */ public function __construct(array $data = null) { - $this->container['deduction_type'] = isset($data['deduction_type']) ? $data['deduction_type'] : null; - $this->container['paid_to'] = isset($data['paid_to']) ? $data['paid_to'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['deduction_category_id'] = isset($data['deduction_category_id']) ? $data['deduction_category_id'] : null; - $this->container['paid_to_account_id'] = isset($data['paid_to_account_id']) ? $data['paid_to_account_id'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['preserved_earnings_amount_not_reached_action'] = isset($data['preserved_earnings_amount_not_reached_action']) ? $data['preserved_earnings_amount_not_reached_action'] : null; - $this->container['carry_forward_unpaid_deductions'] = isset($data['carry_forward_unpaid_deductions']) ? $data['carry_forward_unpaid_deductions'] : null; - $this->container['carry_forward_unused_preserved_earnings'] = isset($data['carry_forward_unused_preserved_earnings']) ? $data['carry_forward_unused_preserved_earnings'] : null; - $this->container['payment_reference'] = isset($data['payment_reference']) ? $data['payment_reference'] : null; - $this->container['preserved_earnings'] = isset($data['preserved_earnings']) ? $data['preserved_earnings'] : null; - $this->container['preserved_earnings_amount'] = isset($data['preserved_earnings_amount']) ? $data['preserved_earnings_amount'] : null; - $this->container['additional_data'] = isset($data['additional_data']) ? $data['additional_data'] : null; - $this->container['priority'] = isset($data['priority']) ? $data['priority'] : null; - $this->container['deleted'] = isset($data['deleted']) ? $data['deleted'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['total_amount_paid'] = isset($data['total_amount_paid']) ? $data['total_amount_paid'] : null; - $this->container['is_active'] = isset($data['is_active']) ? $data['is_active'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('deduction_type', $data ?? [], null); + $this->setIfExists('paid_to', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('deduction_category_id', $data ?? [], null); + $this->setIfExists('paid_to_account_id', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('preserved_earnings_amount_not_reached_action', $data ?? [], null); + $this->setIfExists('carry_forward_unpaid_deductions', $data ?? [], null); + $this->setIfExists('carry_forward_unused_preserved_earnings', $data ?? [], null); + $this->setIfExists('payment_reference', $data ?? [], null); + $this->setIfExists('preserved_earnings', $data ?? [], null); + $this->setIfExists('preserved_earnings_amount', $data ?? [], null); + $this->setIfExists('additional_data', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('deleted', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('total_amount_paid', $data ?? [], null); + $this->setIfExists('is_active', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -414,7 +522,8 @@ public function listInvalidProperties() $allowedValues = $this->getDeductionTypeAllowableValues(); if (!is_null($this->container['deduction_type']) && !in_array($this->container['deduction_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'deduction_type', must be one of '%s'", + "invalid value '%s' for 'deduction_type', must be one of '%s'", + $this->container['deduction_type'], implode("', '", $allowedValues) ); } @@ -422,7 +531,8 @@ public function listInvalidProperties() $allowedValues = $this->getPaidToAllowableValues(); if (!is_null($this->container['paid_to']) && !in_array($this->container['paid_to'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'paid_to', must be one of '%s'", + "invalid value '%s' for 'paid_to', must be one of '%s'", + $this->container['paid_to'], implode("', '", $allowedValues) ); } @@ -430,7 +540,8 @@ public function listInvalidProperties() $allowedValues = $this->getPreservedEarningsAmountNotReachedActionAllowableValues(); if (!is_null($this->container['preserved_earnings_amount_not_reached_action']) && !in_array($this->container['preserved_earnings_amount_not_reached_action'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'preserved_earnings_amount_not_reached_action', must be one of '%s'", + "invalid value '%s' for 'preserved_earnings_amount_not_reached_action', must be one of '%s'", + $this->container['preserved_earnings_amount_not_reached_action'], implode("', '", $allowedValues) ); } @@ -438,7 +549,8 @@ public function listInvalidProperties() $allowedValues = $this->getPreservedEarningsAllowableValues(); if (!is_null($this->container['preserved_earnings']) && !in_array($this->container['preserved_earnings'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'preserved_earnings', must be one of '%s'", + "invalid value '%s' for 'preserved_earnings', must be one of '%s'", + $this->container['preserved_earnings'], implode("', '", $allowedValues) ); } @@ -461,7 +573,7 @@ public function valid() /** * Gets deduction_type * - * @return string + * @return string|null */ public function getDeductionType() { @@ -471,17 +583,21 @@ public function getDeductionType() /** * Sets deduction_type * - * @param string $deduction_type + * @param string|null $deduction_type * - * @return $this + * @return self */ public function setDeductionType($deduction_type) { + if (is_null($deduction_type)) { + throw new \InvalidArgumentException('non-nullable deduction_type cannot be null'); + } $allowedValues = $this->getDeductionTypeAllowableValues(); - if (!is_null($deduction_type) && !in_array($deduction_type, $allowedValues, true)) { + if (!in_array($deduction_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'deduction_type', must be one of '%s'", + "Invalid value '%s' for 'deduction_type', must be one of '%s'", + $deduction_type, implode("', '", $allowedValues) ) ); @@ -494,7 +610,7 @@ public function setDeductionType($deduction_type) /** * Gets paid_to * - * @return string + * @return string|null */ public function getPaidTo() { @@ -504,17 +620,21 @@ public function getPaidTo() /** * Sets paid_to * - * @param string $paid_to + * @param string|null $paid_to * - * @return $this + * @return self */ public function setPaidTo($paid_to) { + if (is_null($paid_to)) { + throw new \InvalidArgumentException('non-nullable paid_to cannot be null'); + } $allowedValues = $this->getPaidToAllowableValues(); - if (!is_null($paid_to) && !in_array($paid_to, $allowedValues, true)) { + if (!in_array($paid_to, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'paid_to', must be one of '%s'", + "Invalid value '%s' for 'paid_to', must be one of '%s'", + $paid_to, implode("', '", $allowedValues) ) ); @@ -527,7 +647,7 @@ public function setPaidTo($paid_to) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -537,12 +657,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -551,7 +674,7 @@ public function setName($name) /** * Gets deduction_category_id * - * @return int + * @return int|null */ public function getDeductionCategoryId() { @@ -561,12 +684,15 @@ public function getDeductionCategoryId() /** * Sets deduction_category_id * - * @param int $deduction_category_id + * @param int|null $deduction_category_id * - * @return $this + * @return self */ public function setDeductionCategoryId($deduction_category_id) { + if (is_null($deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id cannot be null'); + } $this->container['deduction_category_id'] = $deduction_category_id; return $this; @@ -575,7 +701,7 @@ public function setDeductionCategoryId($deduction_category_id) /** * Gets paid_to_account_id * - * @return int + * @return int|null */ public function getPaidToAccountId() { @@ -585,12 +711,15 @@ public function getPaidToAccountId() /** * Sets paid_to_account_id * - * @param int $paid_to_account_id + * @param int|null $paid_to_account_id * - * @return $this + * @return self */ public function setPaidToAccountId($paid_to_account_id) { + if (is_null($paid_to_account_id)) { + throw new \InvalidArgumentException('non-nullable paid_to_account_id cannot be null'); + } $this->container['paid_to_account_id'] = $paid_to_account_id; return $this; @@ -599,7 +728,7 @@ public function setPaidToAccountId($paid_to_account_id) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -609,12 +738,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -623,7 +755,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets preserved_earnings_amount_not_reached_action * - * @return string + * @return string|null */ public function getPreservedEarningsAmountNotReachedAction() { @@ -633,17 +765,21 @@ public function getPreservedEarningsAmountNotReachedAction() /** * Sets preserved_earnings_amount_not_reached_action * - * @param string $preserved_earnings_amount_not_reached_action + * @param string|null $preserved_earnings_amount_not_reached_action * - * @return $this + * @return self */ public function setPreservedEarningsAmountNotReachedAction($preserved_earnings_amount_not_reached_action) { + if (is_null($preserved_earnings_amount_not_reached_action)) { + throw new \InvalidArgumentException('non-nullable preserved_earnings_amount_not_reached_action cannot be null'); + } $allowedValues = $this->getPreservedEarningsAmountNotReachedActionAllowableValues(); - if (!is_null($preserved_earnings_amount_not_reached_action) && !in_array($preserved_earnings_amount_not_reached_action, $allowedValues, true)) { + if (!in_array($preserved_earnings_amount_not_reached_action, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'preserved_earnings_amount_not_reached_action', must be one of '%s'", + "Invalid value '%s' for 'preserved_earnings_amount_not_reached_action', must be one of '%s'", + $preserved_earnings_amount_not_reached_action, implode("', '", $allowedValues) ) ); @@ -656,7 +792,7 @@ public function setPreservedEarningsAmountNotReachedAction($preserved_earnings_a /** * Gets carry_forward_unpaid_deductions * - * @return bool + * @return bool|null */ public function getCarryForwardUnpaidDeductions() { @@ -666,12 +802,15 @@ public function getCarryForwardUnpaidDeductions() /** * Sets carry_forward_unpaid_deductions * - * @param bool $carry_forward_unpaid_deductions + * @param bool|null $carry_forward_unpaid_deductions * - * @return $this + * @return self */ public function setCarryForwardUnpaidDeductions($carry_forward_unpaid_deductions) { + if (is_null($carry_forward_unpaid_deductions)) { + throw new \InvalidArgumentException('non-nullable carry_forward_unpaid_deductions cannot be null'); + } $this->container['carry_forward_unpaid_deductions'] = $carry_forward_unpaid_deductions; return $this; @@ -680,7 +819,7 @@ public function setCarryForwardUnpaidDeductions($carry_forward_unpaid_deductions /** * Gets carry_forward_unused_preserved_earnings * - * @return bool + * @return bool|null */ public function getCarryForwardUnusedPreservedEarnings() { @@ -690,12 +829,15 @@ public function getCarryForwardUnusedPreservedEarnings() /** * Sets carry_forward_unused_preserved_earnings * - * @param bool $carry_forward_unused_preserved_earnings + * @param bool|null $carry_forward_unused_preserved_earnings * - * @return $this + * @return self */ public function setCarryForwardUnusedPreservedEarnings($carry_forward_unused_preserved_earnings) { + if (is_null($carry_forward_unused_preserved_earnings)) { + throw new \InvalidArgumentException('non-nullable carry_forward_unused_preserved_earnings cannot be null'); + } $this->container['carry_forward_unused_preserved_earnings'] = $carry_forward_unused_preserved_earnings; return $this; @@ -704,7 +846,7 @@ public function setCarryForwardUnusedPreservedEarnings($carry_forward_unused_pre /** * Gets payment_reference * - * @return string + * @return string|null */ public function getPaymentReference() { @@ -714,12 +856,15 @@ public function getPaymentReference() /** * Sets payment_reference * - * @param string $payment_reference + * @param string|null $payment_reference * - * @return $this + * @return self */ public function setPaymentReference($payment_reference) { + if (is_null($payment_reference)) { + throw new \InvalidArgumentException('non-nullable payment_reference cannot be null'); + } $this->container['payment_reference'] = $payment_reference; return $this; @@ -728,7 +873,7 @@ public function setPaymentReference($payment_reference) /** * Gets preserved_earnings * - * @return string + * @return string|null */ public function getPreservedEarnings() { @@ -738,17 +883,21 @@ public function getPreservedEarnings() /** * Sets preserved_earnings * - * @param string $preserved_earnings + * @param string|null $preserved_earnings * - * @return $this + * @return self */ public function setPreservedEarnings($preserved_earnings) { + if (is_null($preserved_earnings)) { + throw new \InvalidArgumentException('non-nullable preserved_earnings cannot be null'); + } $allowedValues = $this->getPreservedEarningsAllowableValues(); - if (!is_null($preserved_earnings) && !in_array($preserved_earnings, $allowedValues, true)) { + if (!in_array($preserved_earnings, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'preserved_earnings', must be one of '%s'", + "Invalid value '%s' for 'preserved_earnings', must be one of '%s'", + $preserved_earnings, implode("', '", $allowedValues) ) ); @@ -761,7 +910,7 @@ public function setPreservedEarnings($preserved_earnings) /** * Gets preserved_earnings_amount * - * @return double + * @return float|null */ public function getPreservedEarningsAmount() { @@ -771,12 +920,15 @@ public function getPreservedEarningsAmount() /** * Sets preserved_earnings_amount * - * @param double $preserved_earnings_amount + * @param float|null $preserved_earnings_amount * - * @return $this + * @return self */ public function setPreservedEarningsAmount($preserved_earnings_amount) { + if (is_null($preserved_earnings_amount)) { + throw new \InvalidArgumentException('non-nullable preserved_earnings_amount cannot be null'); + } $this->container['preserved_earnings_amount'] = $preserved_earnings_amount; return $this; @@ -785,7 +937,7 @@ public function setPreservedEarningsAmount($preserved_earnings_amount) /** * Gets additional_data * - * @return int + * @return int|null */ public function getAdditionalData() { @@ -795,12 +947,15 @@ public function getAdditionalData() /** * Sets additional_data * - * @param int $additional_data + * @param int|null $additional_data * - * @return $this + * @return self */ public function setAdditionalData($additional_data) { + if (is_null($additional_data)) { + throw new \InvalidArgumentException('non-nullable additional_data cannot be null'); + } $this->container['additional_data'] = $additional_data; return $this; @@ -809,7 +964,7 @@ public function setAdditionalData($additional_data) /** * Gets priority * - * @return int + * @return int|null */ public function getPriority() { @@ -819,12 +974,15 @@ public function getPriority() /** * Sets priority * - * @param int $priority + * @param int|null $priority * - * @return $this + * @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; @@ -833,7 +991,7 @@ public function setPriority($priority) /** * Gets deleted * - * @return bool + * @return bool|null */ public function getDeleted() { @@ -843,12 +1001,15 @@ public function getDeleted() /** * Sets deleted * - * @param bool $deleted + * @param bool|null $deleted * - * @return $this + * @return self */ public function setDeleted($deleted) { + if (is_null($deleted)) { + throw new \InvalidArgumentException('non-nullable deleted cannot be null'); + } $this->container['deleted'] = $deleted; return $this; @@ -857,7 +1018,7 @@ public function setDeleted($deleted) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -867,12 +1028,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -881,7 +1045,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -891,12 +1055,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -905,7 +1072,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -915,12 +1082,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -929,7 +1099,7 @@ public function setAmount($amount) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -939,12 +1109,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -953,7 +1126,7 @@ public function setExpiryDate($expiry_date) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -963,12 +1136,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -977,7 +1153,7 @@ public function setFromDate($from_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -987,12 +1163,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -1001,7 +1180,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets total_amount_paid * - * @return double + * @return float|null */ public function getTotalAmountPaid() { @@ -1011,12 +1190,15 @@ public function getTotalAmountPaid() /** * Sets total_amount_paid * - * @param double $total_amount_paid + * @param float|null $total_amount_paid * - * @return $this + * @return self */ public function setTotalAmountPaid($total_amount_paid) { + if (is_null($total_amount_paid)) { + throw new \InvalidArgumentException('non-nullable total_amount_paid cannot be null'); + } $this->container['total_amount_paid'] = $total_amount_paid; return $this; @@ -1025,7 +1207,7 @@ public function setTotalAmountPaid($total_amount_paid) /** * Gets is_active * - * @return bool + * @return bool|null */ public function getIsActive() { @@ -1035,12 +1217,15 @@ public function getIsActive() /** * Sets is_active * - * @param bool $is_active + * @param bool|null $is_active * - * @return $this + * @return self */ public function setIsActive($is_active) { + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + } $this->container['is_active'] = $is_active; return $this; @@ -1049,7 +1234,7 @@ public function setIsActive($is_active) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -1059,12 +1244,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -1076,7 +1264,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1086,22 +1274,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1117,11 +1306,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1129,13 +1331,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEmployingEntityModel.php b/src/lib/Model/AuEmployingEntityModel.php index 0222cbc..a2fdb43 100644 --- a/src/lib/Model/AuEmployingEntityModel.php +++ b/src/lib/Model/AuEmployingEntityModel.php @@ -2,61 +2,61 @@ /** * AuEmployingEntityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEmployingEntityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEmployingEntityModel implements ModelInterface, ArrayAccess +class AuEmployingEntityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEmployingEntityModel'; + protected static $openAPIModelName = 'AuEmployingEntityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'abn' => 'string', 'suburb' => 'string', 'state' => 'string', @@ -84,8 +84,10 @@ class AuEmployingEntityModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'abn' => null, 'suburb' => null, 'state' => null, @@ -109,14 +111,50 @@ class AuEmployingEntityModel implements ModelInterface, ArrayAccess 'pay_slip_from_email_address' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'abn' => false, + 'suburb' => false, + 'state' => false, + 'branch_code' => false, + 'is_exempt_from_fringe_benefits_tax' => false, + 'has_separate_entertainment_fringe_benefits_cap' => false, + 'fbt_exempt_organisation_type' => false, + 'is_foreign_entity' => false, + 'foreign_entity_country' => false, + 'id' => false, + 'name' => false, + 'contact_name' => false, + 'signatory_name' => false, + 'contact_email_address' => false, + 'contact_phone_number' => false, + 'contact_fax_number' => false, + 'address_line1' => false, + 'address_line2' => false, + 'postcode' => false, + 'external_reference_id' => false, + 'pay_slip_from_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -124,9 +162,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -255,20 +345,18 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const FBT_EXEMPT_ORGANISATION_TYPE_PUBLIC_BENEVOLENT_INSTITUTION = 'PublicBenevolentInstitution'; - const FBT_EXEMPT_ORGANISATION_TYPE_HEALTH_PROMOTION_CHARITY = 'HealthPromotionCharity'; - const FBT_EXEMPT_ORGANISATION_TYPE_PUBLIC_AND_NON_PROFIT_HOSPITAL = 'PublicAndNonProfitHospital'; - const FBT_EXEMPT_ORGANISATION_TYPE_PUBLIC_AMBULANCE_SERVICE = 'PublicAmbulanceService'; - const FBT_EXEMPT_ORGANISATION_TYPE_POVERTY_RELIEF = 'PovertyRelief'; - const FBT_EXEMPT_ORGANISATION_TYPE_EDUCATION_ADVANCEMENT = 'EducationAdvancement'; - const FBT_EXEMPT_ORGANISATION_TYPE_RELIGION_ADVANCEMENT = 'ReligionAdvancement'; - const FBT_EXEMPT_ORGANISATION_TYPE_COMMUNITY_BENEFIT = 'CommunityBenefit'; - + public const FBT_EXEMPT_ORGANISATION_TYPE_PUBLIC_BENEVOLENT_INSTITUTION = 'PublicBenevolentInstitution'; + public const FBT_EXEMPT_ORGANISATION_TYPE_HEALTH_PROMOTION_CHARITY = 'HealthPromotionCharity'; + public const FBT_EXEMPT_ORGANISATION_TYPE_PUBLIC_AND_NON_PROFIT_HOSPITAL = 'PublicAndNonProfitHospital'; + public const FBT_EXEMPT_ORGANISATION_TYPE_PUBLIC_AMBULANCE_SERVICE = 'PublicAmbulanceService'; + public const FBT_EXEMPT_ORGANISATION_TYPE_POVERTY_RELIEF = 'PovertyRelief'; + public const FBT_EXEMPT_ORGANISATION_TYPE_EDUCATION_ADVANCEMENT = 'EducationAdvancement'; + public const FBT_EXEMPT_ORGANISATION_TYPE_RELIGION_ADVANCEMENT = 'ReligionAdvancement'; + public const FBT_EXEMPT_ORGANISATION_TYPE_COMMUNITY_BENEFIT = 'CommunityBenefit'; - /** * Gets allowable values of the enum * @@ -287,7 +375,6 @@ public function getFbtExemptOrganisationTypeAllowableValues() self::FBT_EXEMPT_ORGANISATION_TYPE_COMMUNITY_BENEFIT, ]; } - /** * Associative array for storing property values @@ -304,27 +391,45 @@ public function getFbtExemptOrganisationTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['suburb'] = isset($data['suburb']) ? $data['suburb'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['branch_code'] = isset($data['branch_code']) ? $data['branch_code'] : null; - $this->container['is_exempt_from_fringe_benefits_tax'] = isset($data['is_exempt_from_fringe_benefits_tax']) ? $data['is_exempt_from_fringe_benefits_tax'] : null; - $this->container['has_separate_entertainment_fringe_benefits_cap'] = isset($data['has_separate_entertainment_fringe_benefits_cap']) ? $data['has_separate_entertainment_fringe_benefits_cap'] : null; - $this->container['fbt_exempt_organisation_type'] = isset($data['fbt_exempt_organisation_type']) ? $data['fbt_exempt_organisation_type'] : null; - $this->container['is_foreign_entity'] = isset($data['is_foreign_entity']) ? $data['is_foreign_entity'] : null; - $this->container['foreign_entity_country'] = isset($data['foreign_entity_country']) ? $data['foreign_entity_country'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['contact_name'] = isset($data['contact_name']) ? $data['contact_name'] : null; - $this->container['signatory_name'] = isset($data['signatory_name']) ? $data['signatory_name'] : null; - $this->container['contact_email_address'] = isset($data['contact_email_address']) ? $data['contact_email_address'] : null; - $this->container['contact_phone_number'] = isset($data['contact_phone_number']) ? $data['contact_phone_number'] : null; - $this->container['contact_fax_number'] = isset($data['contact_fax_number']) ? $data['contact_fax_number'] : null; - $this->container['address_line1'] = isset($data['address_line1']) ? $data['address_line1'] : null; - $this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null; - $this->container['postcode'] = isset($data['postcode']) ? $data['postcode'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['pay_slip_from_email_address'] = isset($data['pay_slip_from_email_address']) ? $data['pay_slip_from_email_address'] : null; + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('suburb', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('branch_code', $data ?? [], null); + $this->setIfExists('is_exempt_from_fringe_benefits_tax', $data ?? [], null); + $this->setIfExists('has_separate_entertainment_fringe_benefits_cap', $data ?? [], null); + $this->setIfExists('fbt_exempt_organisation_type', $data ?? [], null); + $this->setIfExists('is_foreign_entity', $data ?? [], null); + $this->setIfExists('foreign_entity_country', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('contact_name', $data ?? [], null); + $this->setIfExists('signatory_name', $data ?? [], null); + $this->setIfExists('contact_email_address', $data ?? [], null); + $this->setIfExists('contact_phone_number', $data ?? [], null); + $this->setIfExists('contact_fax_number', $data ?? [], null); + $this->setIfExists('address_line1', $data ?? [], null); + $this->setIfExists('address_line2', $data ?? [], null); + $this->setIfExists('postcode', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('pay_slip_from_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; } /** @@ -339,7 +444,8 @@ public function listInvalidProperties() $allowedValues = $this->getFbtExemptOrganisationTypeAllowableValues(); if (!is_null($this->container['fbt_exempt_organisation_type']) && !in_array($this->container['fbt_exempt_organisation_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'fbt_exempt_organisation_type', must be one of '%s'", + "invalid value '%s' for 'fbt_exempt_organisation_type', must be one of '%s'", + $this->container['fbt_exempt_organisation_type'], implode("', '", $allowedValues) ); } @@ -362,7 +468,7 @@ public function valid() /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -372,12 +478,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -386,7 +495,7 @@ public function setAbn($abn) /** * Gets suburb * - * @return string + * @return string|null */ public function getSuburb() { @@ -396,12 +505,15 @@ public function getSuburb() /** * Sets suburb * - * @param string $suburb + * @param string|null $suburb * - * @return $this + * @return self */ public function setSuburb($suburb) { + if (is_null($suburb)) { + throw new \InvalidArgumentException('non-nullable suburb cannot be null'); + } $this->container['suburb'] = $suburb; return $this; @@ -410,7 +522,7 @@ public function setSuburb($suburb) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -420,12 +532,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -434,7 +549,7 @@ public function setState($state) /** * Gets branch_code * - * @return string + * @return string|null */ public function getBranchCode() { @@ -444,12 +559,15 @@ public function getBranchCode() /** * Sets branch_code * - * @param string $branch_code + * @param string|null $branch_code * - * @return $this + * @return self */ public function setBranchCode($branch_code) { + if (is_null($branch_code)) { + throw new \InvalidArgumentException('non-nullable branch_code cannot be null'); + } $this->container['branch_code'] = $branch_code; return $this; @@ -458,7 +576,7 @@ public function setBranchCode($branch_code) /** * Gets is_exempt_from_fringe_benefits_tax * - * @return bool + * @return bool|null */ public function getIsExemptFromFringeBenefitsTax() { @@ -468,12 +586,15 @@ public function getIsExemptFromFringeBenefitsTax() /** * Sets is_exempt_from_fringe_benefits_tax * - * @param bool $is_exempt_from_fringe_benefits_tax + * @param bool|null $is_exempt_from_fringe_benefits_tax * - * @return $this + * @return self */ public function setIsExemptFromFringeBenefitsTax($is_exempt_from_fringe_benefits_tax) { + if (is_null($is_exempt_from_fringe_benefits_tax)) { + throw new \InvalidArgumentException('non-nullable is_exempt_from_fringe_benefits_tax cannot be null'); + } $this->container['is_exempt_from_fringe_benefits_tax'] = $is_exempt_from_fringe_benefits_tax; return $this; @@ -482,7 +603,7 @@ public function setIsExemptFromFringeBenefitsTax($is_exempt_from_fringe_benefits /** * Gets has_separate_entertainment_fringe_benefits_cap * - * @return bool + * @return bool|null */ public function getHasSeparateEntertainmentFringeBenefitsCap() { @@ -492,12 +613,15 @@ public function getHasSeparateEntertainmentFringeBenefitsCap() /** * Sets has_separate_entertainment_fringe_benefits_cap * - * @param bool $has_separate_entertainment_fringe_benefits_cap + * @param bool|null $has_separate_entertainment_fringe_benefits_cap * - * @return $this + * @return self */ public function setHasSeparateEntertainmentFringeBenefitsCap($has_separate_entertainment_fringe_benefits_cap) { + if (is_null($has_separate_entertainment_fringe_benefits_cap)) { + throw new \InvalidArgumentException('non-nullable has_separate_entertainment_fringe_benefits_cap cannot be null'); + } $this->container['has_separate_entertainment_fringe_benefits_cap'] = $has_separate_entertainment_fringe_benefits_cap; return $this; @@ -506,7 +630,7 @@ public function setHasSeparateEntertainmentFringeBenefitsCap($has_separate_enter /** * Gets fbt_exempt_organisation_type * - * @return string + * @return string|null */ public function getFbtExemptOrganisationType() { @@ -516,17 +640,21 @@ public function getFbtExemptOrganisationType() /** * Sets fbt_exempt_organisation_type * - * @param string $fbt_exempt_organisation_type + * @param string|null $fbt_exempt_organisation_type * - * @return $this + * @return self */ public function setFbtExemptOrganisationType($fbt_exempt_organisation_type) { + if (is_null($fbt_exempt_organisation_type)) { + throw new \InvalidArgumentException('non-nullable fbt_exempt_organisation_type cannot be null'); + } $allowedValues = $this->getFbtExemptOrganisationTypeAllowableValues(); - if (!is_null($fbt_exempt_organisation_type) && !in_array($fbt_exempt_organisation_type, $allowedValues, true)) { + if (!in_array($fbt_exempt_organisation_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'fbt_exempt_organisation_type', must be one of '%s'", + "Invalid value '%s' for 'fbt_exempt_organisation_type', must be one of '%s'", + $fbt_exempt_organisation_type, implode("', '", $allowedValues) ) ); @@ -539,7 +667,7 @@ public function setFbtExemptOrganisationType($fbt_exempt_organisation_type) /** * Gets is_foreign_entity * - * @return bool + * @return bool|null */ public function getIsForeignEntity() { @@ -549,12 +677,15 @@ public function getIsForeignEntity() /** * Sets is_foreign_entity * - * @param bool $is_foreign_entity + * @param bool|null $is_foreign_entity * - * @return $this + * @return self */ public function setIsForeignEntity($is_foreign_entity) { + if (is_null($is_foreign_entity)) { + throw new \InvalidArgumentException('non-nullable is_foreign_entity cannot be null'); + } $this->container['is_foreign_entity'] = $is_foreign_entity; return $this; @@ -563,7 +694,7 @@ public function setIsForeignEntity($is_foreign_entity) /** * Gets foreign_entity_country * - * @return string + * @return string|null */ public function getForeignEntityCountry() { @@ -573,12 +704,15 @@ public function getForeignEntityCountry() /** * Sets foreign_entity_country * - * @param string $foreign_entity_country + * @param string|null $foreign_entity_country * - * @return $this + * @return self */ public function setForeignEntityCountry($foreign_entity_country) { + if (is_null($foreign_entity_country)) { + throw new \InvalidArgumentException('non-nullable foreign_entity_country cannot be null'); + } $this->container['foreign_entity_country'] = $foreign_entity_country; return $this; @@ -587,7 +721,7 @@ public function setForeignEntityCountry($foreign_entity_country) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -597,12 +731,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -611,7 +748,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -621,12 +758,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -635,7 +775,7 @@ public function setName($name) /** * Gets contact_name * - * @return string + * @return string|null */ public function getContactName() { @@ -645,12 +785,15 @@ public function getContactName() /** * Sets contact_name * - * @param string $contact_name + * @param string|null $contact_name * - * @return $this + * @return self */ public function setContactName($contact_name) { + if (is_null($contact_name)) { + throw new \InvalidArgumentException('non-nullable contact_name cannot be null'); + } $this->container['contact_name'] = $contact_name; return $this; @@ -659,7 +802,7 @@ public function setContactName($contact_name) /** * Gets signatory_name * - * @return string + * @return string|null */ public function getSignatoryName() { @@ -669,12 +812,15 @@ public function getSignatoryName() /** * Sets signatory_name * - * @param string $signatory_name + * @param string|null $signatory_name * - * @return $this + * @return self */ public function setSignatoryName($signatory_name) { + if (is_null($signatory_name)) { + throw new \InvalidArgumentException('non-nullable signatory_name cannot be null'); + } $this->container['signatory_name'] = $signatory_name; return $this; @@ -683,7 +829,7 @@ public function setSignatoryName($signatory_name) /** * Gets contact_email_address * - * @return string + * @return string|null */ public function getContactEmailAddress() { @@ -693,12 +839,15 @@ public function getContactEmailAddress() /** * Sets contact_email_address * - * @param string $contact_email_address + * @param string|null $contact_email_address * - * @return $this + * @return self */ public function setContactEmailAddress($contact_email_address) { + if (is_null($contact_email_address)) { + throw new \InvalidArgumentException('non-nullable contact_email_address cannot be null'); + } $this->container['contact_email_address'] = $contact_email_address; return $this; @@ -707,7 +856,7 @@ public function setContactEmailAddress($contact_email_address) /** * Gets contact_phone_number * - * @return string + * @return string|null */ public function getContactPhoneNumber() { @@ -717,12 +866,15 @@ public function getContactPhoneNumber() /** * Sets contact_phone_number * - * @param string $contact_phone_number + * @param string|null $contact_phone_number * - * @return $this + * @return self */ public function setContactPhoneNumber($contact_phone_number) { + if (is_null($contact_phone_number)) { + throw new \InvalidArgumentException('non-nullable contact_phone_number cannot be null'); + } $this->container['contact_phone_number'] = $contact_phone_number; return $this; @@ -731,7 +883,7 @@ public function setContactPhoneNumber($contact_phone_number) /** * Gets contact_fax_number * - * @return string + * @return string|null */ public function getContactFaxNumber() { @@ -741,12 +893,15 @@ public function getContactFaxNumber() /** * Sets contact_fax_number * - * @param string $contact_fax_number + * @param string|null $contact_fax_number * - * @return $this + * @return self */ public function setContactFaxNumber($contact_fax_number) { + if (is_null($contact_fax_number)) { + throw new \InvalidArgumentException('non-nullable contact_fax_number cannot be null'); + } $this->container['contact_fax_number'] = $contact_fax_number; return $this; @@ -755,7 +910,7 @@ public function setContactFaxNumber($contact_fax_number) /** * Gets address_line1 * - * @return string + * @return string|null */ public function getAddressLine1() { @@ -765,12 +920,15 @@ public function getAddressLine1() /** * Sets address_line1 * - * @param string $address_line1 + * @param string|null $address_line1 * - * @return $this + * @return self */ public function setAddressLine1($address_line1) { + if (is_null($address_line1)) { + throw new \InvalidArgumentException('non-nullable address_line1 cannot be null'); + } $this->container['address_line1'] = $address_line1; return $this; @@ -779,7 +937,7 @@ public function setAddressLine1($address_line1) /** * Gets address_line2 * - * @return string + * @return string|null */ public function getAddressLine2() { @@ -789,12 +947,15 @@ public function getAddressLine2() /** * Sets address_line2 * - * @param string $address_line2 + * @param string|null $address_line2 * - * @return $this + * @return self */ public function setAddressLine2($address_line2) { + if (is_null($address_line2)) { + throw new \InvalidArgumentException('non-nullable address_line2 cannot be null'); + } $this->container['address_line2'] = $address_line2; return $this; @@ -803,7 +964,7 @@ public function setAddressLine2($address_line2) /** * Gets postcode * - * @return string + * @return string|null */ public function getPostcode() { @@ -813,12 +974,15 @@ public function getPostcode() /** * Sets postcode * - * @param string $postcode + * @param string|null $postcode * - * @return $this + * @return self */ public function setPostcode($postcode) { + if (is_null($postcode)) { + throw new \InvalidArgumentException('non-nullable postcode cannot be null'); + } $this->container['postcode'] = $postcode; return $this; @@ -827,7 +991,7 @@ public function setPostcode($postcode) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -837,12 +1001,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -851,7 +1018,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets pay_slip_from_email_address * - * @return string + * @return string|null */ public function getPaySlipFromEmailAddress() { @@ -861,12 +1028,15 @@ public function getPaySlipFromEmailAddress() /** * Sets pay_slip_from_email_address * - * @param string $pay_slip_from_email_address + * @param string|null $pay_slip_from_email_address * - * @return $this + * @return self */ public function setPaySlipFromEmailAddress($pay_slip_from_email_address) { + if (is_null($pay_slip_from_email_address)) { + throw new \InvalidArgumentException('non-nullable pay_slip_from_email_address cannot be null'); + } $this->container['pay_slip_from_email_address'] = $pay_slip_from_email_address; return $this; @@ -878,7 +1048,7 @@ public function setPaySlipFromEmailAddress($pay_slip_from_email_address) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -888,22 +1058,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -919,11 +1090,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -931,13 +1115,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssBankAccountModel.php b/src/lib/Model/AuEssBankAccountModel.php index bf8bbdf..d12fd0a 100644 --- a/src/lib/Model/AuEssBankAccountModel.php +++ b/src/lib/Model/AuEssBankAccountModel.php @@ -2,69 +2,69 @@ /** * AuEssBankAccountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssBankAccountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssBankAccountModel implements ModelInterface, ArrayAccess +class AuEssBankAccountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssBankAccountModel'; + protected static $openAPIModelName = 'AuEssBankAccountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'account_type' => 'string', 'id' => 'int', 'employee_id' => 'int', 'bsb' => 'string', 'account_name' => 'string', 'account_number' => 'string', - 'allocated_percentage' => 'double', - 'fixed_amount' => 'double', + 'allocated_percentage' => 'float', + 'fixed_amount' => 'float', 'allocate_balance' => 'bool', 'is_employee_editable' => 'bool', 'can_be_deleted' => 'bool', @@ -75,8 +75,10 @@ class AuEssBankAccountModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'account_type' => null, 'id' => 'int32', 'employee_id' => 'int32', @@ -91,14 +93,41 @@ class AuEssBankAccountModel implements ModelInterface, ArrayAccess 'external_reference_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'account_type' => false, + 'id' => false, + 'employee_id' => false, + 'bsb' => false, + 'account_name' => false, + 'account_number' => false, + 'allocated_percentage' => false, + 'fixed_amount' => false, + 'allocate_balance' => false, + 'is_employee_editable' => false, + 'can_be_deleted' => false, + 'external_reference_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,16 +291,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCOUNT_TYPE_ELECTRONIC = 'Electronic'; - const ACCOUNT_TYPE_MANUAL_DEPOSIT = 'ManualDeposit'; - const ACCOUNT_TYPE_CASH_OR_CHEQUE = 'CashOrCheque'; - const ACCOUNT_TYPE_BPAY = 'Bpay'; - + public const ACCOUNT_TYPE_ELECTRONIC = 'Electronic'; + public const ACCOUNT_TYPE_MANUAL_DEPOSIT = 'ManualDeposit'; + public const ACCOUNT_TYPE_CASH_OR_CHEQUE = 'CashOrCheque'; + public const ACCOUNT_TYPE_BPAY = 'Bpay'; - /** * Gets allowable values of the enum * @@ -234,7 +313,6 @@ public function getAccountTypeAllowableValues() self::ACCOUNT_TYPE_BPAY, ]; } - /** * Associative array for storing property values @@ -251,18 +329,36 @@ public function getAccountTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['fixed_amount'] = isset($data['fixed_amount']) ? $data['fixed_amount'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; - $this->container['is_employee_editable'] = isset($data['is_employee_editable']) ? $data['is_employee_editable'] : null; - $this->container['can_be_deleted'] = isset($data['can_be_deleted']) ? $data['can_be_deleted'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('fixed_amount', $data ?? [], null); + $this->setIfExists('allocate_balance', $data ?? [], null); + $this->setIfExists('is_employee_editable', $data ?? [], null); + $this->setIfExists('can_be_deleted', $data ?? [], null); + $this->setIfExists('external_reference_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; } /** @@ -277,7 +373,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccountTypeAllowableValues(); if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'account_type', must be one of '%s'", + "invalid value '%s' for 'account_type', must be one of '%s'", + $this->container['account_type'], implode("', '", $allowedValues) ); } @@ -300,7 +397,7 @@ public function valid() /** * Gets account_type * - * @return string + * @return string|null */ public function getAccountType() { @@ -310,17 +407,21 @@ public function getAccountType() /** * Sets account_type * - * @param string $account_type + * @param string|null $account_type * - * @return $this + * @return self */ public function setAccountType($account_type) { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } $allowedValues = $this->getAccountTypeAllowableValues(); - if (!is_null($account_type) && !in_array($account_type, $allowedValues, true)) { + if (!in_array($account_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'account_type', must be one of '%s'", + "Invalid value '%s' for 'account_type', must be one of '%s'", + $account_type, implode("', '", $allowedValues) ) ); @@ -333,7 +434,7 @@ public function setAccountType($account_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +444,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +461,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -367,12 +471,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -381,7 +488,7 @@ public function setEmployeeId($employee_id) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -391,12 +498,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -405,7 +515,7 @@ public function setBsb($bsb) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -415,12 +525,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -429,7 +542,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -439,12 +552,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -453,7 +569,7 @@ public function setAccountNumber($account_number) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -463,12 +579,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -477,7 +596,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets fixed_amount * - * @return double + * @return float|null */ public function getFixedAmount() { @@ -487,12 +606,15 @@ public function getFixedAmount() /** * Sets fixed_amount * - * @param double $fixed_amount + * @param float|null $fixed_amount * - * @return $this + * @return self */ public function setFixedAmount($fixed_amount) { + if (is_null($fixed_amount)) { + throw new \InvalidArgumentException('non-nullable fixed_amount cannot be null'); + } $this->container['fixed_amount'] = $fixed_amount; return $this; @@ -501,7 +623,7 @@ public function setFixedAmount($fixed_amount) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -511,12 +633,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -525,7 +650,7 @@ public function setAllocateBalance($allocate_balance) /** * Gets is_employee_editable * - * @return bool + * @return bool|null */ public function getIsEmployeeEditable() { @@ -535,12 +660,15 @@ public function getIsEmployeeEditable() /** * Sets is_employee_editable * - * @param bool $is_employee_editable + * @param bool|null $is_employee_editable * - * @return $this + * @return self */ public function setIsEmployeeEditable($is_employee_editable) { + if (is_null($is_employee_editable)) { + throw new \InvalidArgumentException('non-nullable is_employee_editable cannot be null'); + } $this->container['is_employee_editable'] = $is_employee_editable; return $this; @@ -549,7 +677,7 @@ public function setIsEmployeeEditable($is_employee_editable) /** * Gets can_be_deleted * - * @return bool + * @return bool|null */ public function getCanBeDeleted() { @@ -559,12 +687,15 @@ public function getCanBeDeleted() /** * Sets can_be_deleted * - * @param bool $can_be_deleted + * @param bool|null $can_be_deleted * - * @return $this + * @return self */ public function setCanBeDeleted($can_be_deleted) { + if (is_null($can_be_deleted)) { + throw new \InvalidArgumentException('non-nullable can_be_deleted cannot be null'); + } $this->container['can_be_deleted'] = $can_be_deleted; return $this; @@ -573,7 +704,7 @@ public function setCanBeDeleted($can_be_deleted) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -583,12 +714,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -600,7 +734,7 @@ public function setExternalReferenceId($external_reference_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -610,22 +744,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -641,11 +776,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -653,13 +801,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssBulkRosterShiftActionResponse.php b/src/lib/Model/AuEssBulkRosterShiftActionResponse.php index 924e201..3166800 100644 --- a/src/lib/Model/AuEssBulkRosterShiftActionResponse.php +++ b/src/lib/Model/AuEssBulkRosterShiftActionResponse.php @@ -2,62 +2,62 @@ /** * AuEssBulkRosterShiftActionResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssBulkRosterShiftActionResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssBulkRosterShiftActionResponse implements ModelInterface, ArrayAccess +class AuEssBulkRosterShiftActionResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssBulkRosterShiftActionResponse'; + protected static $openAPIModelName = 'AuEssBulkRosterShiftActionResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'shifts' => '\Swagger\Client\Model\AuEssRosterShiftModel[]', + protected static $openAPITypes = [ + 'shifts' => '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', 'pending_shift_count' => 'int', 'proposed_swap_count' => 'int', 'not_accepted_shifts_count' => 'int' @@ -67,22 +67,43 @@ class AuEssBulkRosterShiftActionResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shifts' => null, 'pending_shift_count' => 'int32', 'proposed_swap_count' => 'int32', 'not_accepted_shifts_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shifts' => false, + 'pending_shift_count' => false, + 'proposed_swap_count' => false, + 'not_accepted_shifts_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; - $this->container['pending_shift_count'] = isset($data['pending_shift_count']) ? $data['pending_shift_count'] : null; - $this->container['proposed_swap_count'] = isset($data['proposed_swap_count']) ? $data['proposed_swap_count'] : null; - $this->container['not_accepted_shifts_count'] = isset($data['not_accepted_shifts_count']) ? $data['not_accepted_shifts_count'] : null; + $this->setIfExists('shifts', $data ?? [], null); + $this->setIfExists('pending_shift_count', $data ?? [], null); + $this->setIfExists('proposed_swap_count', $data ?? [], null); + $this->setIfExists('not_accepted_shifts_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets shifts * - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[]|null */ public function getShifts() { @@ -235,12 +323,15 @@ public function getShifts() /** * Sets shifts * - * @param \Swagger\Client\Model\AuEssRosterShiftModel[] $shifts + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -249,7 +340,7 @@ public function setShifts($shifts) /** * Gets pending_shift_count * - * @return int + * @return int|null */ public function getPendingShiftCount() { @@ -259,12 +350,15 @@ public function getPendingShiftCount() /** * Sets pending_shift_count * - * @param int $pending_shift_count + * @param int|null $pending_shift_count * - * @return $this + * @return self */ public function setPendingShiftCount($pending_shift_count) { + if (is_null($pending_shift_count)) { + throw new \InvalidArgumentException('non-nullable pending_shift_count cannot be null'); + } $this->container['pending_shift_count'] = $pending_shift_count; return $this; @@ -273,7 +367,7 @@ public function setPendingShiftCount($pending_shift_count) /** * Gets proposed_swap_count * - * @return int + * @return int|null */ public function getProposedSwapCount() { @@ -283,12 +377,15 @@ public function getProposedSwapCount() /** * Sets proposed_swap_count * - * @param int $proposed_swap_count + * @param int|null $proposed_swap_count * - * @return $this + * @return self */ public function setProposedSwapCount($proposed_swap_count) { + if (is_null($proposed_swap_count)) { + throw new \InvalidArgumentException('non-nullable proposed_swap_count cannot be null'); + } $this->container['proposed_swap_count'] = $proposed_swap_count; return $this; @@ -297,7 +394,7 @@ public function setProposedSwapCount($proposed_swap_count) /** * Gets not_accepted_shifts_count * - * @return int + * @return int|null */ public function getNotAcceptedShiftsCount() { @@ -307,12 +404,15 @@ public function getNotAcceptedShiftsCount() /** * Sets not_accepted_shifts_count * - * @param int $not_accepted_shifts_count + * @param int|null $not_accepted_shifts_count * - * @return $this + * @return self */ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) { + if (is_null($not_accepted_shifts_count)) { + throw new \InvalidArgumentException('non-nullable not_accepted_shifts_count cannot be null'); + } $this->container['not_accepted_shifts_count'] = $not_accepted_shifts_count; return $this; @@ -324,7 +424,7 @@ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssEmployeeDetailsEditModel.php b/src/lib/Model/AuEssEmployeeDetailsEditModel.php index d2d39f6..8a71e87 100644 --- a/src/lib/Model/AuEssEmployeeDetailsEditModel.php +++ b/src/lib/Model/AuEssEmployeeDetailsEditModel.php @@ -2,63 +2,63 @@ /** * AuEssEmployeeDetailsEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssEmployeeDetailsEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssEmployeeDetailsEditModel implements ModelInterface, ArrayAccess +class AuEssEmployeeDetailsEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssEmployeeDetailsEditModel'; + protected static $openAPIModelName = 'AuEssEmployeeDetailsEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'residential_address' => '\Swagger\Client\Model\AuAddressModel', - 'postal_address' => '\Swagger\Client\Model\AuAddressModel', + protected static $openAPITypes = [ + 'residential_address' => '\OpenAPI\Client\Model\AuAddressModel', + 'postal_address' => '\OpenAPI\Client\Model\AuAddressModel', 'id' => 'int', 'title_id' => 'int', 'first_name' => 'string', @@ -79,8 +79,10 @@ class AuEssEmployeeDetailsEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'residential_address' => null, 'postal_address' => null, 'id' => 'int32', @@ -99,14 +101,45 @@ class AuEssEmployeeDetailsEditModel implements ModelInterface, ArrayAccess 'is_postal_address_same_as_residential' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'residential_address' => false, + 'postal_address' => false, + 'id' => false, + 'title_id' => false, + 'first_name' => false, + 'other_name' => false, + 'middle_name' => false, + 'surname' => false, + 'previous_surname' => false, + 'date_of_birth' => false, + 'gender' => false, + 'email' => false, + 'home_phone' => false, + 'work_phone' => false, + 'mobile_phone' => false, + 'is_postal_address_same_as_residential' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -114,9 +147,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -230,12 +315,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -252,22 +334,40 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['residential_address'] = isset($data['residential_address']) ? $data['residential_address'] : null; - $this->container['postal_address'] = isset($data['postal_address']) ? $data['postal_address'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title_id'] = isset($data['title_id']) ? $data['title_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['other_name'] = isset($data['other_name']) ? $data['other_name'] : null; - $this->container['middle_name'] = isset($data['middle_name']) ? $data['middle_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['previous_surname'] = isset($data['previous_surname']) ? $data['previous_surname'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['home_phone'] = isset($data['home_phone']) ? $data['home_phone'] : null; - $this->container['work_phone'] = isset($data['work_phone']) ? $data['work_phone'] : null; - $this->container['mobile_phone'] = isset($data['mobile_phone']) ? $data['mobile_phone'] : null; - $this->container['is_postal_address_same_as_residential'] = isset($data['is_postal_address_same_as_residential']) ? $data['is_postal_address_same_as_residential'] : null; + $this->setIfExists('residential_address', $data ?? [], null); + $this->setIfExists('postal_address', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('other_name', $data ?? [], null); + $this->setIfExists('middle_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('previous_surname', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('gender', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('home_phone', $data ?? [], null); + $this->setIfExists('work_phone', $data ?? [], null); + $this->setIfExists('mobile_phone', $data ?? [], null); + $this->setIfExists('is_postal_address_same_as_residential', $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; } /** @@ -297,7 +397,7 @@ public function valid() /** * Gets residential_address * - * @return \Swagger\Client\Model\AuAddressModel + * @return \OpenAPI\Client\Model\AuAddressModel|null */ public function getResidentialAddress() { @@ -307,12 +407,15 @@ public function getResidentialAddress() /** * Sets residential_address * - * @param \Swagger\Client\Model\AuAddressModel $residential_address + * @param \OpenAPI\Client\Model\AuAddressModel|null $residential_address residential_address * - * @return $this + * @return self */ public function setResidentialAddress($residential_address) { + if (is_null($residential_address)) { + throw new \InvalidArgumentException('non-nullable residential_address cannot be null'); + } $this->container['residential_address'] = $residential_address; return $this; @@ -321,7 +424,7 @@ public function setResidentialAddress($residential_address) /** * Gets postal_address * - * @return \Swagger\Client\Model\AuAddressModel + * @return \OpenAPI\Client\Model\AuAddressModel|null */ public function getPostalAddress() { @@ -331,12 +434,15 @@ public function getPostalAddress() /** * Sets postal_address * - * @param \Swagger\Client\Model\AuAddressModel $postal_address + * @param \OpenAPI\Client\Model\AuAddressModel|null $postal_address postal_address * - * @return $this + * @return self */ public function setPostalAddress($postal_address) { + if (is_null($postal_address)) { + throw new \InvalidArgumentException('non-nullable postal_address cannot be null'); + } $this->container['postal_address'] = $postal_address; return $this; @@ -345,7 +451,7 @@ public function setPostalAddress($postal_address) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -355,12 +461,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -369,7 +478,7 @@ public function setId($id) /** * Gets title_id * - * @return int + * @return int|null */ public function getTitleId() { @@ -379,12 +488,15 @@ public function getTitleId() /** * Sets title_id * - * @param int $title_id + * @param int|null $title_id * - * @return $this + * @return self */ public function setTitleId($title_id) { + if (is_null($title_id)) { + throw new \InvalidArgumentException('non-nullable title_id cannot be null'); + } $this->container['title_id'] = $title_id; return $this; @@ -393,7 +505,7 @@ public function setTitleId($title_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -403,12 +515,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -417,7 +532,7 @@ public function setFirstName($first_name) /** * Gets other_name * - * @return string + * @return string|null */ public function getOtherName() { @@ -427,12 +542,15 @@ public function getOtherName() /** * Sets other_name * - * @param string $other_name + * @param string|null $other_name * - * @return $this + * @return self */ public function setOtherName($other_name) { + if (is_null($other_name)) { + throw new \InvalidArgumentException('non-nullable other_name cannot be null'); + } $this->container['other_name'] = $other_name; return $this; @@ -441,7 +559,7 @@ public function setOtherName($other_name) /** * Gets middle_name * - * @return string + * @return string|null */ public function getMiddleName() { @@ -451,12 +569,15 @@ public function getMiddleName() /** * Sets middle_name * - * @param string $middle_name + * @param string|null $middle_name * - * @return $this + * @return self */ public function setMiddleName($middle_name) { + if (is_null($middle_name)) { + throw new \InvalidArgumentException('non-nullable middle_name cannot be null'); + } $this->container['middle_name'] = $middle_name; return $this; @@ -465,7 +586,7 @@ public function setMiddleName($middle_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -475,12 +596,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -489,7 +613,7 @@ public function setSurname($surname) /** * Gets previous_surname * - * @return string + * @return string|null */ public function getPreviousSurname() { @@ -499,12 +623,15 @@ public function getPreviousSurname() /** * Sets previous_surname * - * @param string $previous_surname + * @param string|null $previous_surname * - * @return $this + * @return self */ public function setPreviousSurname($previous_surname) { + if (is_null($previous_surname)) { + throw new \InvalidArgumentException('non-nullable previous_surname cannot be null'); + } $this->container['previous_surname'] = $previous_surname; return $this; @@ -513,7 +640,7 @@ public function setPreviousSurname($previous_surname) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -523,12 +650,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -537,7 +667,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets gender * - * @return string + * @return string|null */ public function getGender() { @@ -547,12 +677,15 @@ public function getGender() /** * Sets gender * - * @param string $gender + * @param string|null $gender * - * @return $this + * @return self */ public function setGender($gender) { + if (is_null($gender)) { + throw new \InvalidArgumentException('non-nullable gender cannot be null'); + } $this->container['gender'] = $gender; return $this; @@ -561,7 +694,7 @@ public function setGender($gender) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -571,12 +704,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -585,7 +721,7 @@ public function setEmail($email) /** * Gets home_phone * - * @return string + * @return string|null */ public function getHomePhone() { @@ -595,12 +731,15 @@ public function getHomePhone() /** * Sets home_phone * - * @param string $home_phone + * @param string|null $home_phone * - * @return $this + * @return self */ public function setHomePhone($home_phone) { + if (is_null($home_phone)) { + throw new \InvalidArgumentException('non-nullable home_phone cannot be null'); + } $this->container['home_phone'] = $home_phone; return $this; @@ -609,7 +748,7 @@ public function setHomePhone($home_phone) /** * Gets work_phone * - * @return string + * @return string|null */ public function getWorkPhone() { @@ -619,12 +758,15 @@ public function getWorkPhone() /** * Sets work_phone * - * @param string $work_phone + * @param string|null $work_phone * - * @return $this + * @return self */ public function setWorkPhone($work_phone) { + if (is_null($work_phone)) { + throw new \InvalidArgumentException('non-nullable work_phone cannot be null'); + } $this->container['work_phone'] = $work_phone; return $this; @@ -633,7 +775,7 @@ public function setWorkPhone($work_phone) /** * Gets mobile_phone * - * @return string + * @return string|null */ public function getMobilePhone() { @@ -643,12 +785,15 @@ public function getMobilePhone() /** * Sets mobile_phone * - * @param string $mobile_phone + * @param string|null $mobile_phone * - * @return $this + * @return self */ public function setMobilePhone($mobile_phone) { + if (is_null($mobile_phone)) { + throw new \InvalidArgumentException('non-nullable mobile_phone cannot be null'); + } $this->container['mobile_phone'] = $mobile_phone; return $this; @@ -657,7 +802,7 @@ public function setMobilePhone($mobile_phone) /** * Gets is_postal_address_same_as_residential * - * @return bool + * @return bool|null */ public function getIsPostalAddressSameAsResidential() { @@ -667,12 +812,15 @@ public function getIsPostalAddressSameAsResidential() /** * Sets is_postal_address_same_as_residential * - * @param bool $is_postal_address_same_as_residential + * @param bool|null $is_postal_address_same_as_residential * - * @return $this + * @return self */ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_residential) { + if (is_null($is_postal_address_same_as_residential)) { + throw new \InvalidArgumentException('non-nullable is_postal_address_same_as_residential cannot be null'); + } $this->container['is_postal_address_same_as_residential'] = $is_postal_address_same_as_residential; return $this; @@ -684,7 +832,7 @@ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_r * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -694,22 +842,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -725,11 +874,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -737,13 +899,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssEmployeeDetailsViewModel.php b/src/lib/Model/AuEssEmployeeDetailsViewModel.php index 16aa9ac..4206f6f 100644 --- a/src/lib/Model/AuEssEmployeeDetailsViewModel.php +++ b/src/lib/Model/AuEssEmployeeDetailsViewModel.php @@ -2,63 +2,63 @@ /** * AuEssEmployeeDetailsViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssEmployeeDetailsViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssEmployeeDetailsViewModel implements ModelInterface, ArrayAccess +class AuEssEmployeeDetailsViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssEmployeeDetailsViewModel'; + protected static $openAPIModelName = 'AuEssEmployeeDetailsViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'residential_address' => '\Swagger\Client\Model\AuAddressModel', - 'postal_address' => '\Swagger\Client\Model\AuAddressModel', + protected static $openAPITypes = [ + 'residential_address' => '\OpenAPI\Client\Model\AuAddressModel', + 'postal_address' => '\OpenAPI\Client\Model\AuAddressModel', 'can_edit' => 'bool', 'has_profile_image' => 'bool', 'can_edit_profile_image' => 'bool', @@ -85,8 +85,10 @@ class AuEssEmployeeDetailsViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'residential_address' => null, 'postal_address' => null, 'can_edit' => null, @@ -111,14 +113,51 @@ class AuEssEmployeeDetailsViewModel implements ModelInterface, ArrayAccess 'is_postal_address_same_as_residential' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'residential_address' => false, + 'postal_address' => false, + 'can_edit' => false, + 'has_profile_image' => false, + 'can_edit_profile_image' => false, + 'anniversary_date' => false, + 'start_date' => false, + 'end_date' => false, + 'id' => false, + 'title_id' => false, + 'first_name' => false, + 'other_name' => false, + 'middle_name' => false, + 'surname' => false, + 'previous_surname' => false, + 'date_of_birth' => false, + 'gender' => false, + 'email' => false, + 'home_phone' => false, + 'work_phone' => false, + 'mobile_phone' => false, + 'is_postal_address_same_as_residential' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -126,9 +165,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -260,12 +351,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -282,28 +370,46 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['residential_address'] = isset($data['residential_address']) ? $data['residential_address'] : null; - $this->container['postal_address'] = isset($data['postal_address']) ? $data['postal_address'] : null; - $this->container['can_edit'] = isset($data['can_edit']) ? $data['can_edit'] : null; - $this->container['has_profile_image'] = isset($data['has_profile_image']) ? $data['has_profile_image'] : null; - $this->container['can_edit_profile_image'] = isset($data['can_edit_profile_image']) ? $data['can_edit_profile_image'] : null; - $this->container['anniversary_date'] = isset($data['anniversary_date']) ? $data['anniversary_date'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title_id'] = isset($data['title_id']) ? $data['title_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['other_name'] = isset($data['other_name']) ? $data['other_name'] : null; - $this->container['middle_name'] = isset($data['middle_name']) ? $data['middle_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['previous_surname'] = isset($data['previous_surname']) ? $data['previous_surname'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['home_phone'] = isset($data['home_phone']) ? $data['home_phone'] : null; - $this->container['work_phone'] = isset($data['work_phone']) ? $data['work_phone'] : null; - $this->container['mobile_phone'] = isset($data['mobile_phone']) ? $data['mobile_phone'] : null; - $this->container['is_postal_address_same_as_residential'] = isset($data['is_postal_address_same_as_residential']) ? $data['is_postal_address_same_as_residential'] : null; + $this->setIfExists('residential_address', $data ?? [], null); + $this->setIfExists('postal_address', $data ?? [], null); + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('has_profile_image', $data ?? [], null); + $this->setIfExists('can_edit_profile_image', $data ?? [], null); + $this->setIfExists('anniversary_date', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('other_name', $data ?? [], null); + $this->setIfExists('middle_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('previous_surname', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('gender', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('home_phone', $data ?? [], null); + $this->setIfExists('work_phone', $data ?? [], null); + $this->setIfExists('mobile_phone', $data ?? [], null); + $this->setIfExists('is_postal_address_same_as_residential', $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; } /** @@ -333,7 +439,7 @@ public function valid() /** * Gets residential_address * - * @return \Swagger\Client\Model\AuAddressModel + * @return \OpenAPI\Client\Model\AuAddressModel|null */ public function getResidentialAddress() { @@ -343,12 +449,15 @@ public function getResidentialAddress() /** * Sets residential_address * - * @param \Swagger\Client\Model\AuAddressModel $residential_address + * @param \OpenAPI\Client\Model\AuAddressModel|null $residential_address residential_address * - * @return $this + * @return self */ public function setResidentialAddress($residential_address) { + if (is_null($residential_address)) { + throw new \InvalidArgumentException('non-nullable residential_address cannot be null'); + } $this->container['residential_address'] = $residential_address; return $this; @@ -357,7 +466,7 @@ public function setResidentialAddress($residential_address) /** * Gets postal_address * - * @return \Swagger\Client\Model\AuAddressModel + * @return \OpenAPI\Client\Model\AuAddressModel|null */ public function getPostalAddress() { @@ -367,12 +476,15 @@ public function getPostalAddress() /** * Sets postal_address * - * @param \Swagger\Client\Model\AuAddressModel $postal_address + * @param \OpenAPI\Client\Model\AuAddressModel|null $postal_address postal_address * - * @return $this + * @return self */ public function setPostalAddress($postal_address) { + if (is_null($postal_address)) { + throw new \InvalidArgumentException('non-nullable postal_address cannot be null'); + } $this->container['postal_address'] = $postal_address; return $this; @@ -381,7 +493,7 @@ public function setPostalAddress($postal_address) /** * Gets can_edit * - * @return bool + * @return bool|null */ public function getCanEdit() { @@ -391,12 +503,15 @@ public function getCanEdit() /** * Sets can_edit * - * @param bool $can_edit + * @param bool|null $can_edit * - * @return $this + * @return self */ public function setCanEdit($can_edit) { + if (is_null($can_edit)) { + throw new \InvalidArgumentException('non-nullable can_edit cannot be null'); + } $this->container['can_edit'] = $can_edit; return $this; @@ -405,7 +520,7 @@ public function setCanEdit($can_edit) /** * Gets has_profile_image * - * @return bool + * @return bool|null */ public function getHasProfileImage() { @@ -415,12 +530,15 @@ public function getHasProfileImage() /** * Sets has_profile_image * - * @param bool $has_profile_image + * @param bool|null $has_profile_image * - * @return $this + * @return self */ public function setHasProfileImage($has_profile_image) { + if (is_null($has_profile_image)) { + throw new \InvalidArgumentException('non-nullable has_profile_image cannot be null'); + } $this->container['has_profile_image'] = $has_profile_image; return $this; @@ -429,7 +547,7 @@ public function setHasProfileImage($has_profile_image) /** * Gets can_edit_profile_image * - * @return bool + * @return bool|null */ public function getCanEditProfileImage() { @@ -439,12 +557,15 @@ public function getCanEditProfileImage() /** * Sets can_edit_profile_image * - * @param bool $can_edit_profile_image + * @param bool|null $can_edit_profile_image * - * @return $this + * @return self */ public function setCanEditProfileImage($can_edit_profile_image) { + if (is_null($can_edit_profile_image)) { + throw new \InvalidArgumentException('non-nullable can_edit_profile_image cannot be null'); + } $this->container['can_edit_profile_image'] = $can_edit_profile_image; return $this; @@ -453,7 +574,7 @@ public function setCanEditProfileImage($can_edit_profile_image) /** * Gets anniversary_date * - * @return \DateTime + * @return \DateTime|null */ public function getAnniversaryDate() { @@ -463,12 +584,15 @@ public function getAnniversaryDate() /** * Sets anniversary_date * - * @param \DateTime $anniversary_date + * @param \DateTime|null $anniversary_date * - * @return $this + * @return self */ public function setAnniversaryDate($anniversary_date) { + if (is_null($anniversary_date)) { + throw new \InvalidArgumentException('non-nullable anniversary_date cannot be null'); + } $this->container['anniversary_date'] = $anniversary_date; return $this; @@ -477,7 +601,7 @@ public function setAnniversaryDate($anniversary_date) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -487,12 +611,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -501,7 +628,7 @@ public function setStartDate($start_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -511,12 +638,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -525,7 +655,7 @@ public function setEndDate($end_date) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -535,12 +665,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -549,7 +682,7 @@ public function setId($id) /** * Gets title_id * - * @return int + * @return int|null */ public function getTitleId() { @@ -559,12 +692,15 @@ public function getTitleId() /** * Sets title_id * - * @param int $title_id + * @param int|null $title_id * - * @return $this + * @return self */ public function setTitleId($title_id) { + if (is_null($title_id)) { + throw new \InvalidArgumentException('non-nullable title_id cannot be null'); + } $this->container['title_id'] = $title_id; return $this; @@ -573,7 +709,7 @@ public function setTitleId($title_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -583,12 +719,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -597,7 +736,7 @@ public function setFirstName($first_name) /** * Gets other_name * - * @return string + * @return string|null */ public function getOtherName() { @@ -607,12 +746,15 @@ public function getOtherName() /** * Sets other_name * - * @param string $other_name + * @param string|null $other_name * - * @return $this + * @return self */ public function setOtherName($other_name) { + if (is_null($other_name)) { + throw new \InvalidArgumentException('non-nullable other_name cannot be null'); + } $this->container['other_name'] = $other_name; return $this; @@ -621,7 +763,7 @@ public function setOtherName($other_name) /** * Gets middle_name * - * @return string + * @return string|null */ public function getMiddleName() { @@ -631,12 +773,15 @@ public function getMiddleName() /** * Sets middle_name * - * @param string $middle_name + * @param string|null $middle_name * - * @return $this + * @return self */ public function setMiddleName($middle_name) { + if (is_null($middle_name)) { + throw new \InvalidArgumentException('non-nullable middle_name cannot be null'); + } $this->container['middle_name'] = $middle_name; return $this; @@ -645,7 +790,7 @@ public function setMiddleName($middle_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -655,12 +800,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -669,7 +817,7 @@ public function setSurname($surname) /** * Gets previous_surname * - * @return string + * @return string|null */ public function getPreviousSurname() { @@ -679,12 +827,15 @@ public function getPreviousSurname() /** * Sets previous_surname * - * @param string $previous_surname + * @param string|null $previous_surname * - * @return $this + * @return self */ public function setPreviousSurname($previous_surname) { + if (is_null($previous_surname)) { + throw new \InvalidArgumentException('non-nullable previous_surname cannot be null'); + } $this->container['previous_surname'] = $previous_surname; return $this; @@ -693,7 +844,7 @@ public function setPreviousSurname($previous_surname) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -703,12 +854,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -717,7 +871,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets gender * - * @return string + * @return string|null */ public function getGender() { @@ -727,12 +881,15 @@ public function getGender() /** * Sets gender * - * @param string $gender + * @param string|null $gender * - * @return $this + * @return self */ public function setGender($gender) { + if (is_null($gender)) { + throw new \InvalidArgumentException('non-nullable gender cannot be null'); + } $this->container['gender'] = $gender; return $this; @@ -741,7 +898,7 @@ public function setGender($gender) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -751,12 +908,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -765,7 +925,7 @@ public function setEmail($email) /** * Gets home_phone * - * @return string + * @return string|null */ public function getHomePhone() { @@ -775,12 +935,15 @@ public function getHomePhone() /** * Sets home_phone * - * @param string $home_phone + * @param string|null $home_phone * - * @return $this + * @return self */ public function setHomePhone($home_phone) { + if (is_null($home_phone)) { + throw new \InvalidArgumentException('non-nullable home_phone cannot be null'); + } $this->container['home_phone'] = $home_phone; return $this; @@ -789,7 +952,7 @@ public function setHomePhone($home_phone) /** * Gets work_phone * - * @return string + * @return string|null */ public function getWorkPhone() { @@ -799,12 +962,15 @@ public function getWorkPhone() /** * Sets work_phone * - * @param string $work_phone + * @param string|null $work_phone * - * @return $this + * @return self */ public function setWorkPhone($work_phone) { + if (is_null($work_phone)) { + throw new \InvalidArgumentException('non-nullable work_phone cannot be null'); + } $this->container['work_phone'] = $work_phone; return $this; @@ -813,7 +979,7 @@ public function setWorkPhone($work_phone) /** * Gets mobile_phone * - * @return string + * @return string|null */ public function getMobilePhone() { @@ -823,12 +989,15 @@ public function getMobilePhone() /** * Sets mobile_phone * - * @param string $mobile_phone + * @param string|null $mobile_phone * - * @return $this + * @return self */ public function setMobilePhone($mobile_phone) { + if (is_null($mobile_phone)) { + throw new \InvalidArgumentException('non-nullable mobile_phone cannot be null'); + } $this->container['mobile_phone'] = $mobile_phone; return $this; @@ -837,7 +1006,7 @@ public function setMobilePhone($mobile_phone) /** * Gets is_postal_address_same_as_residential * - * @return bool + * @return bool|null */ public function getIsPostalAddressSameAsResidential() { @@ -847,12 +1016,15 @@ public function getIsPostalAddressSameAsResidential() /** * Sets is_postal_address_same_as_residential * - * @param bool $is_postal_address_same_as_residential + * @param bool|null $is_postal_address_same_as_residential * - * @return $this + * @return self */ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_residential) { + if (is_null($is_postal_address_same_as_residential)) { + throw new \InvalidArgumentException('non-nullable is_postal_address_same_as_residential cannot be null'); + } $this->container['is_postal_address_same_as_residential'] = $is_postal_address_same_as_residential; return $this; @@ -864,7 +1036,7 @@ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_r * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -874,22 +1046,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -905,11 +1078,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -917,13 +1103,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssRosterShiftActionResponse.php b/src/lib/Model/AuEssRosterShiftActionResponse.php index 92c0e47..87c0761 100644 --- a/src/lib/Model/AuEssRosterShiftActionResponse.php +++ b/src/lib/Model/AuEssRosterShiftActionResponse.php @@ -2,62 +2,62 @@ /** * AuEssRosterShiftActionResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssRosterShiftActionResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssRosterShiftActionResponse implements ModelInterface, ArrayAccess +class AuEssRosterShiftActionResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssRosterShiftActionResponse'; + protected static $openAPIModelName = 'AuEssRosterShiftActionResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'shift' => '\Swagger\Client\Model\AuEssRosterShiftModel', + protected static $openAPITypes = [ + 'shift' => '\OpenAPI\Client\Model\AuEssRosterShiftModel', 'pending_shift_count' => 'int', 'proposed_swap_count' => 'int', 'not_accepted_shifts_count' => 'int' @@ -67,22 +67,43 @@ class AuEssRosterShiftActionResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shift' => null, 'pending_shift_count' => 'int32', 'proposed_swap_count' => 'int32', 'not_accepted_shifts_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shift' => false, + 'pending_shift_count' => false, + 'proposed_swap_count' => false, + 'not_accepted_shifts_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shift'] = isset($data['shift']) ? $data['shift'] : null; - $this->container['pending_shift_count'] = isset($data['pending_shift_count']) ? $data['pending_shift_count'] : null; - $this->container['proposed_swap_count'] = isset($data['proposed_swap_count']) ? $data['proposed_swap_count'] : null; - $this->container['not_accepted_shifts_count'] = isset($data['not_accepted_shifts_count']) ? $data['not_accepted_shifts_count'] : null; + $this->setIfExists('shift', $data ?? [], null); + $this->setIfExists('pending_shift_count', $data ?? [], null); + $this->setIfExists('proposed_swap_count', $data ?? [], null); + $this->setIfExists('not_accepted_shifts_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets shift * - * @return \Swagger\Client\Model\AuEssRosterShiftModel + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel|null */ public function getShift() { @@ -235,12 +323,15 @@ public function getShift() /** * Sets shift * - * @param \Swagger\Client\Model\AuEssRosterShiftModel $shift + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel|null $shift shift * - * @return $this + * @return self */ public function setShift($shift) { + if (is_null($shift)) { + throw new \InvalidArgumentException('non-nullable shift cannot be null'); + } $this->container['shift'] = $shift; return $this; @@ -249,7 +340,7 @@ public function setShift($shift) /** * Gets pending_shift_count * - * @return int + * @return int|null */ public function getPendingShiftCount() { @@ -259,12 +350,15 @@ public function getPendingShiftCount() /** * Sets pending_shift_count * - * @param int $pending_shift_count + * @param int|null $pending_shift_count * - * @return $this + * @return self */ public function setPendingShiftCount($pending_shift_count) { + if (is_null($pending_shift_count)) { + throw new \InvalidArgumentException('non-nullable pending_shift_count cannot be null'); + } $this->container['pending_shift_count'] = $pending_shift_count; return $this; @@ -273,7 +367,7 @@ public function setPendingShiftCount($pending_shift_count) /** * Gets proposed_swap_count * - * @return int + * @return int|null */ public function getProposedSwapCount() { @@ -283,12 +377,15 @@ public function getProposedSwapCount() /** * Sets proposed_swap_count * - * @param int $proposed_swap_count + * @param int|null $proposed_swap_count * - * @return $this + * @return self */ public function setProposedSwapCount($proposed_swap_count) { + if (is_null($proposed_swap_count)) { + throw new \InvalidArgumentException('non-nullable proposed_swap_count cannot be null'); + } $this->container['proposed_swap_count'] = $proposed_swap_count; return $this; @@ -297,7 +394,7 @@ public function setProposedSwapCount($proposed_swap_count) /** * Gets not_accepted_shifts_count * - * @return int + * @return int|null */ public function getNotAcceptedShiftsCount() { @@ -307,12 +404,15 @@ public function getNotAcceptedShiftsCount() /** * Sets not_accepted_shifts_count * - * @param int $not_accepted_shifts_count + * @param int|null $not_accepted_shifts_count * - * @return $this + * @return self */ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) { + if (is_null($not_accepted_shifts_count)) { + throw new \InvalidArgumentException('non-nullable not_accepted_shifts_count cannot be null'); + } $this->container['not_accepted_shifts_count'] = $not_accepted_shifts_count; return $this; @@ -324,7 +424,7 @@ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssRosterShiftModel.php b/src/lib/Model/AuEssRosterShiftModel.php index e132598..6c758d0 100644 --- a/src/lib/Model/AuEssRosterShiftModel.php +++ b/src/lib/Model/AuEssRosterShiftModel.php @@ -2,80 +2,80 @@ /** * AuEssRosterShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssRosterShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssRosterShiftModel implements ModelInterface, ArrayAccess +class AuEssRosterShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssRosterShiftModel'; + protected static $openAPIModelName = 'AuEssRosterShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'int', 'classification_name' => 'string', 'id' => 'int', 'token' => 'string', - 'qualifications' => '\Swagger\Client\Model\QualificationModel[]', - 'breaks' => '\Swagger\Client\Model\RosterShiftBreakApiModel[]', + 'qualifications' => '\OpenAPI\Client\Model\QualificationModel[]', + 'breaks' => '\OpenAPI\Client\Model\RosterShiftBreakApiModel[]', 'employee_id' => 'int', 'employee_name' => 'string', 'location_id' => 'int', 'location_name' => 'string', 'work_type_id' => 'int', 'work_type_name' => 'string', - 'role' => '\Swagger\Client\Model\RosterShiftRole', + 'role' => '\OpenAPI\Client\Model\RosterShiftRole', 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'notes' => 'string', 'published' => 'bool', 'accepted' => 'bool', - 'pending_swap' => '\Swagger\Client\Model\RosterShiftSwapModel', + 'pending_swap' => '\OpenAPI\Client\Model\RosterShiftSwapModel', 'date_published' => '\DateTime', 'biddable' => 'bool', 'shift_swap_cutoff_time' => '\DateTime', @@ -86,8 +86,10 @@ class AuEssRosterShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => 'int32', 'classification_name' => null, 'id' => 'int32', @@ -113,14 +115,52 @@ class AuEssRosterShiftModel implements ModelInterface, ArrayAccess 'shift_assignment_status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification_name' => false, + 'id' => false, + 'token' => false, + 'qualifications' => false, + 'breaks' => false, + 'employee_id' => false, + 'employee_name' => false, + 'location_id' => false, + 'location_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'role' => false, + 'start_time' => false, + 'end_time' => false, + 'notes' => false, + 'published' => false, + 'accepted' => false, + 'pending_swap' => false, + 'date_published' => false, + 'biddable' => false, + 'shift_swap_cutoff_time' => false, + 'shift_assignment_status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -128,9 +168,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -265,19 +357,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; - const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; - const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - + public const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; + public const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; + public const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - /** * Gets allowable values of the enum * @@ -295,7 +385,6 @@ public function getShiftAssignmentStatusAllowableValues() self::SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL, ]; } - /** * Associative array for storing property values @@ -312,29 +401,47 @@ public function getShiftAssignmentStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification_name'] = isset($data['classification_name']) ? $data['classification_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['qualifications'] = isset($data['qualifications']) ? $data['qualifications'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['published'] = isset($data['published']) ? $data['published'] : null; - $this->container['accepted'] = isset($data['accepted']) ? $data['accepted'] : null; - $this->container['pending_swap'] = isset($data['pending_swap']) ? $data['pending_swap'] : null; - $this->container['date_published'] = isset($data['date_published']) ? $data['date_published'] : null; - $this->container['biddable'] = isset($data['biddable']) ? $data['biddable'] : null; - $this->container['shift_swap_cutoff_time'] = isset($data['shift_swap_cutoff_time']) ? $data['shift_swap_cutoff_time'] : null; - $this->container['shift_assignment_status'] = isset($data['shift_assignment_status']) ? $data['shift_assignment_status'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('qualifications', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('published', $data ?? [], null); + $this->setIfExists('accepted', $data ?? [], null); + $this->setIfExists('pending_swap', $data ?? [], null); + $this->setIfExists('date_published', $data ?? [], null); + $this->setIfExists('biddable', $data ?? [], null); + $this->setIfExists('shift_swap_cutoff_time', $data ?? [], null); + $this->setIfExists('shift_assignment_status', $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; } /** @@ -349,7 +456,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); if (!is_null($this->container['shift_assignment_status']) && !in_array($this->container['shift_assignment_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_assignment_status', must be one of '%s'", + "invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $this->container['shift_assignment_status'], implode("', '", $allowedValues) ); } @@ -372,7 +480,7 @@ public function valid() /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -382,12 +490,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -396,7 +507,7 @@ public function setClassificationId($classification_id) /** * Gets classification_name * - * @return string + * @return string|null */ public function getClassificationName() { @@ -406,12 +517,15 @@ public function getClassificationName() /** * Sets classification_name * - * @param string $classification_name + * @param string|null $classification_name * - * @return $this + * @return self */ public function setClassificationName($classification_name) { + if (is_null($classification_name)) { + throw new \InvalidArgumentException('non-nullable classification_name cannot be null'); + } $this->container['classification_name'] = $classification_name; return $this; @@ -420,7 +534,7 @@ public function setClassificationName($classification_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -430,12 +544,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -444,7 +561,7 @@ public function setId($id) /** * Gets token * - * @return string + * @return string|null */ public function getToken() { @@ -454,12 +571,15 @@ public function getToken() /** * Sets token * - * @param string $token + * @param string|null $token * - * @return $this + * @return self */ public function setToken($token) { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -468,7 +588,7 @@ public function setToken($token) /** * Gets qualifications * - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[]|null */ public function getQualifications() { @@ -478,12 +598,15 @@ public function getQualifications() /** * Sets qualifications * - * @param \Swagger\Client\Model\QualificationModel[] $qualifications + * @param \OpenAPI\Client\Model\QualificationModel[]|null $qualifications * - * @return $this + * @return self */ public function setQualifications($qualifications) { + if (is_null($qualifications)) { + throw new \InvalidArgumentException('non-nullable qualifications cannot be null'); + } $this->container['qualifications'] = $qualifications; return $this; @@ -492,7 +615,7 @@ public function setQualifications($qualifications) /** * Gets breaks * - * @return \Swagger\Client\Model\RosterShiftBreakApiModel[] + * @return \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null */ public function getBreaks() { @@ -502,12 +625,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\RosterShiftBreakApiModel[] $breaks + * @param \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -516,7 +642,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -526,12 +652,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -540,7 +669,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -550,12 +679,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -564,7 +696,7 @@ public function setEmployeeName($employee_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -574,12 +706,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -588,7 +723,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -598,12 +733,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -612,7 +750,7 @@ public function setLocationName($location_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -622,12 +760,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -636,7 +777,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -646,12 +787,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -660,7 +804,7 @@ public function setWorkTypeName($work_type_name) /** * Gets role * - * @return \Swagger\Client\Model\RosterShiftRole + * @return \OpenAPI\Client\Model\RosterShiftRole|null */ public function getRole() { @@ -670,12 +814,15 @@ public function getRole() /** * Sets role * - * @param \Swagger\Client\Model\RosterShiftRole $role + * @param \OpenAPI\Client\Model\RosterShiftRole|null $role role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -684,7 +831,7 @@ public function setRole($role) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -694,12 +841,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -708,7 +858,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -718,12 +868,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -732,7 +885,7 @@ public function setEndTime($end_time) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -742,12 +895,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -756,7 +912,7 @@ public function setNotes($notes) /** * Gets published * - * @return bool + * @return bool|null */ public function getPublished() { @@ -766,12 +922,15 @@ public function getPublished() /** * Sets published * - * @param bool $published + * @param bool|null $published * - * @return $this + * @return self */ public function setPublished($published) { + if (is_null($published)) { + throw new \InvalidArgumentException('non-nullable published cannot be null'); + } $this->container['published'] = $published; return $this; @@ -780,7 +939,7 @@ public function setPublished($published) /** * Gets accepted * - * @return bool + * @return bool|null */ public function getAccepted() { @@ -790,12 +949,15 @@ public function getAccepted() /** * Sets accepted * - * @param bool $accepted + * @param bool|null $accepted * - * @return $this + * @return self */ public function setAccepted($accepted) { + if (is_null($accepted)) { + throw new \InvalidArgumentException('non-nullable accepted cannot be null'); + } $this->container['accepted'] = $accepted; return $this; @@ -804,7 +966,7 @@ public function setAccepted($accepted) /** * Gets pending_swap * - * @return \Swagger\Client\Model\RosterShiftSwapModel + * @return \OpenAPI\Client\Model\RosterShiftSwapModel|null */ public function getPendingSwap() { @@ -814,12 +976,15 @@ public function getPendingSwap() /** * Sets pending_swap * - * @param \Swagger\Client\Model\RosterShiftSwapModel $pending_swap + * @param \OpenAPI\Client\Model\RosterShiftSwapModel|null $pending_swap pending_swap * - * @return $this + * @return self */ public function setPendingSwap($pending_swap) { + if (is_null($pending_swap)) { + throw new \InvalidArgumentException('non-nullable pending_swap cannot be null'); + } $this->container['pending_swap'] = $pending_swap; return $this; @@ -828,7 +993,7 @@ public function setPendingSwap($pending_swap) /** * Gets date_published * - * @return \DateTime + * @return \DateTime|null */ public function getDatePublished() { @@ -838,12 +1003,15 @@ public function getDatePublished() /** * Sets date_published * - * @param \DateTime $date_published + * @param \DateTime|null $date_published * - * @return $this + * @return self */ public function setDatePublished($date_published) { + if (is_null($date_published)) { + throw new \InvalidArgumentException('non-nullable date_published cannot be null'); + } $this->container['date_published'] = $date_published; return $this; @@ -852,7 +1020,7 @@ public function setDatePublished($date_published) /** * Gets biddable * - * @return bool + * @return bool|null */ public function getBiddable() { @@ -862,12 +1030,15 @@ public function getBiddable() /** * Sets biddable * - * @param bool $biddable + * @param bool|null $biddable * - * @return $this + * @return self */ public function setBiddable($biddable) { + if (is_null($biddable)) { + throw new \InvalidArgumentException('non-nullable biddable cannot be null'); + } $this->container['biddable'] = $biddable; return $this; @@ -876,7 +1047,7 @@ public function setBiddable($biddable) /** * Gets shift_swap_cutoff_time * - * @return \DateTime + * @return \DateTime|null */ public function getShiftSwapCutoffTime() { @@ -886,12 +1057,15 @@ public function getShiftSwapCutoffTime() /** * Sets shift_swap_cutoff_time * - * @param \DateTime $shift_swap_cutoff_time + * @param \DateTime|null $shift_swap_cutoff_time * - * @return $this + * @return self */ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) { + if (is_null($shift_swap_cutoff_time)) { + throw new \InvalidArgumentException('non-nullable shift_swap_cutoff_time cannot be null'); + } $this->container['shift_swap_cutoff_time'] = $shift_swap_cutoff_time; return $this; @@ -900,7 +1074,7 @@ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) /** * Gets shift_assignment_status * - * @return string + * @return string|null */ public function getShiftAssignmentStatus() { @@ -910,17 +1084,21 @@ public function getShiftAssignmentStatus() /** * Sets shift_assignment_status * - * @param string $shift_assignment_status + * @param string|null $shift_assignment_status * - * @return $this + * @return self */ public function setShiftAssignmentStatus($shift_assignment_status) { + if (is_null($shift_assignment_status)) { + throw new \InvalidArgumentException('non-nullable shift_assignment_status cannot be null'); + } $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); - if (!is_null($shift_assignment_status) && !in_array($shift_assignment_status, $allowedValues, true)) { + if (!in_array($shift_assignment_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_assignment_status', must be one of '%s'", + "Invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $shift_assignment_status, implode("', '", $allowedValues) ) ); @@ -936,7 +1114,7 @@ public function setShiftAssignmentStatus($shift_assignment_status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -946,22 +1124,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -977,11 +1156,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -989,13 +1181,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssSaveBankAccountResponseModel.php b/src/lib/Model/AuEssSaveBankAccountResponseModel.php index 9b16099..2c4a6c5 100644 --- a/src/lib/Model/AuEssSaveBankAccountResponseModel.php +++ b/src/lib/Model/AuEssSaveBankAccountResponseModel.php @@ -2,83 +2,102 @@ /** * AuEssSaveBankAccountResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssSaveBankAccountResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssSaveBankAccountResponseModel implements ModelInterface, ArrayAccess +class AuEssSaveBankAccountResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssSaveBankAccountResponseModel'; + protected static $openAPIModelName = 'AuEssSaveBankAccountResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'validation_warning' => 'string', - 'result' => '\Swagger\Client\Model\AuEssBankAccountModel' + 'result' => '\OpenAPI\Client\Model\AuEssBankAccountModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'validation_warning' => null, 'result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'validation_warning' => false, + 'result' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['validation_warning'] = isset($data['validation_warning']) ? $data['validation_warning'] : null; - $this->container['result'] = isset($data['result']) ? $data['result'] : null; + $this->setIfExists('validation_warning', $data ?? [], null); + $this->setIfExists('result', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets validation_warning * - * @return string + * @return string|null */ public function getValidationWarning() { @@ -223,12 +309,15 @@ public function getValidationWarning() /** * Sets validation_warning * - * @param string $validation_warning + * @param string|null $validation_warning * - * @return $this + * @return self */ public function setValidationWarning($validation_warning) { + if (is_null($validation_warning)) { + throw new \InvalidArgumentException('non-nullable validation_warning cannot be null'); + } $this->container['validation_warning'] = $validation_warning; return $this; @@ -237,7 +326,7 @@ public function setValidationWarning($validation_warning) /** * Gets result * - * @return \Swagger\Client\Model\AuEssBankAccountModel + * @return \OpenAPI\Client\Model\AuEssBankAccountModel|null */ public function getResult() { @@ -247,12 +336,15 @@ public function getResult() /** * Sets result * - * @param \Swagger\Client\Model\AuEssBankAccountModel $result + * @param \OpenAPI\Client\Model\AuEssBankAccountModel|null $result result * - * @return $this + * @return self */ public function setResult($result) { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } $this->container['result'] = $result; return $this; @@ -264,7 +356,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssTimesheetDataModel.php b/src/lib/Model/AuEssTimesheetDataModel.php index db1bf99..907f5b2 100644 --- a/src/lib/Model/AuEssTimesheetDataModel.php +++ b/src/lib/Model/AuEssTimesheetDataModel.php @@ -2,87 +2,108 @@ /** * AuEssTimesheetDataModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssTimesheetDataModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssTimesheetDataModel implements ModelInterface, ArrayAccess +class AuEssTimesheetDataModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssTimesheetDataModel'; + protected static $openAPIModelName = 'AuEssTimesheetDataModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'timesheets' => '\Swagger\Client\Model\EssTimesheetModel[]', - 'leave_requests' => '\Swagger\Client\Model\EssLeaveRequestModel[]', - 'roster_shifts' => '\Swagger\Client\Model\AuEssRosterShiftModel[]', - 'public_holidays' => '\Swagger\Client\Model\PublicHolidayModel[]' + protected static $openAPITypes = [ + 'timesheets' => '\OpenAPI\Client\Model\EssTimesheetModel[]', + 'leave_requests' => '\OpenAPI\Client\Model\EssLeaveRequestModel[]', + 'roster_shifts' => '\OpenAPI\Client\Model\AuEssRosterShiftModel[]', + 'public_holidays' => '\OpenAPI\Client\Model\PublicHolidayModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'timesheets' => null, 'leave_requests' => null, 'roster_shifts' => null, 'public_holidays' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'timesheets' => false, + 'leave_requests' => false, + 'roster_shifts' => false, + 'public_holidays' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['timesheets'] = isset($data['timesheets']) ? $data['timesheets'] : null; - $this->container['leave_requests'] = isset($data['leave_requests']) ? $data['leave_requests'] : null; - $this->container['roster_shifts'] = isset($data['roster_shifts']) ? $data['roster_shifts'] : null; - $this->container['public_holidays'] = isset($data['public_holidays']) ? $data['public_holidays'] : null; + $this->setIfExists('timesheets', $data ?? [], null); + $this->setIfExists('leave_requests', $data ?? [], null); + $this->setIfExists('roster_shifts', $data ?? [], null); + $this->setIfExists('public_holidays', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets timesheets * - * @return \Swagger\Client\Model\EssTimesheetModel[] + * @return \OpenAPI\Client\Model\EssTimesheetModel[]|null */ public function getTimesheets() { @@ -235,12 +323,15 @@ public function getTimesheets() /** * Sets timesheets * - * @param \Swagger\Client\Model\EssTimesheetModel[] $timesheets + * @param \OpenAPI\Client\Model\EssTimesheetModel[]|null $timesheets * - * @return $this + * @return self */ public function setTimesheets($timesheets) { + if (is_null($timesheets)) { + throw new \InvalidArgumentException('non-nullable timesheets cannot be null'); + } $this->container['timesheets'] = $timesheets; return $this; @@ -249,7 +340,7 @@ public function setTimesheets($timesheets) /** * Gets leave_requests * - * @return \Swagger\Client\Model\EssLeaveRequestModel[] + * @return \OpenAPI\Client\Model\EssLeaveRequestModel[]|null */ public function getLeaveRequests() { @@ -259,12 +350,15 @@ public function getLeaveRequests() /** * Sets leave_requests * - * @param \Swagger\Client\Model\EssLeaveRequestModel[] $leave_requests + * @param \OpenAPI\Client\Model\EssLeaveRequestModel[]|null $leave_requests * - * @return $this + * @return self */ public function setLeaveRequests($leave_requests) { + if (is_null($leave_requests)) { + throw new \InvalidArgumentException('non-nullable leave_requests cannot be null'); + } $this->container['leave_requests'] = $leave_requests; return $this; @@ -273,7 +367,7 @@ public function setLeaveRequests($leave_requests) /** * Gets roster_shifts * - * @return \Swagger\Client\Model\AuEssRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel[]|null */ public function getRosterShifts() { @@ -283,12 +377,15 @@ public function getRosterShifts() /** * Sets roster_shifts * - * @param \Swagger\Client\Model\AuEssRosterShiftModel[] $roster_shifts + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel[]|null $roster_shifts * - * @return $this + * @return self */ public function setRosterShifts($roster_shifts) { + if (is_null($roster_shifts)) { + throw new \InvalidArgumentException('non-nullable roster_shifts cannot be null'); + } $this->container['roster_shifts'] = $roster_shifts; return $this; @@ -297,7 +394,7 @@ public function setRosterShifts($roster_shifts) /** * Gets public_holidays * - * @return \Swagger\Client\Model\PublicHolidayModel[] + * @return \OpenAPI\Client\Model\PublicHolidayModel[]|null */ public function getPublicHolidays() { @@ -307,12 +404,15 @@ public function getPublicHolidays() /** * Sets public_holidays * - * @param \Swagger\Client\Model\PublicHolidayModel[] $public_holidays + * @param \OpenAPI\Client\Model\PublicHolidayModel[]|null $public_holidays * - * @return $this + * @return self */ public function setPublicHolidays($public_holidays) { + if (is_null($public_holidays)) { + throw new \InvalidArgumentException('non-nullable public_holidays cannot be null'); + } $this->container['public_holidays'] = $public_holidays; return $this; @@ -324,7 +424,7 @@ public function setPublicHolidays($public_holidays) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuEssWorkTypeModel.php b/src/lib/Model/AuEssWorkTypeModel.php index a62a8a3..9c35a24 100644 --- a/src/lib/Model/AuEssWorkTypeModel.php +++ b/src/lib/Model/AuEssWorkTypeModel.php @@ -2,61 +2,61 @@ /** * AuEssWorkTypeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuEssWorkTypeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuEssWorkTypeModel implements ModelInterface, ArrayAccess +class AuEssWorkTypeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuEssWorkTypeModel'; + protected static $openAPIModelName = 'AuEssWorkTypeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_unit_based_work_type' => 'bool', 'unit_type' => 'string', 'employment_types' => 'string[]', @@ -77,8 +77,10 @@ class AuEssWorkTypeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_unit_based_work_type' => null, 'unit_type' => null, 'employment_types' => null, @@ -95,14 +97,43 @@ class AuEssWorkTypeModel implements ModelInterface, ArrayAccess 'short_code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_unit_based_work_type' => false, + 'unit_type' => false, + 'employment_types' => false, + 'award_package_id' => false, + 'award_package_name' => false, + 'id' => false, + 'name' => false, + 'pay_category_id' => false, + 'leave_category_id' => false, + 'external_id' => false, + 'source' => false, + 'accrues_leave' => false, + 'mapping_type' => false, + 'short_code' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,22 +303,20 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYMENT_TYPES_UNKNOWN = 'Unknown'; - const EMPLOYMENT_TYPES_FULL_TIME = 'FullTime'; - const EMPLOYMENT_TYPES_PART_TIME = 'PartTime'; - const EMPLOYMENT_TYPES_LABOUR_HIRE = 'LabourHire'; - const EMPLOYMENT_TYPES_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; - const EMPLOYMENT_TYPES_CASUAL = 'Casual'; - const MAPPING_TYPE_PAY_CATEGORY = 'PayCategory'; - const MAPPING_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; - const MAPPING_TYPE_PRIMARY_PAY_CATEGORY = 'PrimaryPayCategory'; - const MAPPING_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - + public const EMPLOYMENT_TYPES_UNKNOWN = 'Unknown'; + public const EMPLOYMENT_TYPES_FULL_TIME = 'FullTime'; + public const EMPLOYMENT_TYPES_PART_TIME = 'PartTime'; + public const EMPLOYMENT_TYPES_LABOUR_HIRE = 'LabourHire'; + public const EMPLOYMENT_TYPES_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; + public const EMPLOYMENT_TYPES_CASUAL = 'Casual'; + public const MAPPING_TYPE_PAY_CATEGORY = 'PayCategory'; + public const MAPPING_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; + public const MAPPING_TYPE_PRIMARY_PAY_CATEGORY = 'PrimaryPayCategory'; + public const MAPPING_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - /** * Gets allowable values of the enum * @@ -252,7 +333,7 @@ public function getEmploymentTypesAllowableValues() self::EMPLOYMENT_TYPES_CASUAL, ]; } - + /** * Gets allowable values of the enum * @@ -267,7 +348,6 @@ public function getMappingTypeAllowableValues() self::MAPPING_TYPE_SHIFT_CONDITION, ]; } - /** * Associative array for storing property values @@ -284,20 +364,38 @@ public function getMappingTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['is_unit_based_work_type'] = isset($data['is_unit_based_work_type']) ? $data['is_unit_based_work_type'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['employment_types'] = isset($data['employment_types']) ? $data['employment_types'] : null; - $this->container['award_package_id'] = isset($data['award_package_id']) ? $data['award_package_id'] : null; - $this->container['award_package_name'] = isset($data['award_package_name']) ? $data['award_package_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['accrues_leave'] = isset($data['accrues_leave']) ? $data['accrues_leave'] : null; - $this->container['mapping_type'] = isset($data['mapping_type']) ? $data['mapping_type'] : null; - $this->container['short_code'] = isset($data['short_code']) ? $data['short_code'] : null; + $this->setIfExists('is_unit_based_work_type', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('employment_types', $data ?? [], null); + $this->setIfExists('award_package_id', $data ?? [], null); + $this->setIfExists('award_package_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('accrues_leave', $data ?? [], null); + $this->setIfExists('mapping_type', $data ?? [], null); + $this->setIfExists('short_code', $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; } /** @@ -312,7 +410,8 @@ public function listInvalidProperties() $allowedValues = $this->getMappingTypeAllowableValues(); if (!is_null($this->container['mapping_type']) && !in_array($this->container['mapping_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'mapping_type', must be one of '%s'", + "invalid value '%s' for 'mapping_type', must be one of '%s'", + $this->container['mapping_type'], implode("', '", $allowedValues) ); } @@ -335,7 +434,7 @@ public function valid() /** * Gets is_unit_based_work_type * - * @return bool + * @return bool|null */ public function getIsUnitBasedWorkType() { @@ -345,12 +444,15 @@ public function getIsUnitBasedWorkType() /** * Sets is_unit_based_work_type * - * @param bool $is_unit_based_work_type + * @param bool|null $is_unit_based_work_type * - * @return $this + * @return self */ public function setIsUnitBasedWorkType($is_unit_based_work_type) { + if (is_null($is_unit_based_work_type)) { + throw new \InvalidArgumentException('non-nullable is_unit_based_work_type cannot be null'); + } $this->container['is_unit_based_work_type'] = $is_unit_based_work_type; return $this; @@ -359,7 +461,7 @@ public function setIsUnitBasedWorkType($is_unit_based_work_type) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -369,12 +471,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -383,7 +488,7 @@ public function setUnitType($unit_type) /** * Gets employment_types * - * @return string[] + * @return string[]|null */ public function getEmploymentTypes() { @@ -393,14 +498,17 @@ public function getEmploymentTypes() /** * Sets employment_types * - * @param string[] $employment_types + * @param string[]|null $employment_types * - * @return $this + * @return self */ public function setEmploymentTypes($employment_types) { + if (is_null($employment_types)) { + throw new \InvalidArgumentException('non-nullable employment_types cannot be null'); + } $allowedValues = $this->getEmploymentTypesAllowableValues(); - if (!is_null($employment_types) && array_diff($employment_types, $allowedValues)) { + if (array_diff($employment_types, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'employment_types', must be one of '%s'", @@ -416,7 +524,7 @@ public function setEmploymentTypes($employment_types) /** * Gets award_package_id * - * @return int + * @return int|null */ public function getAwardPackageId() { @@ -426,12 +534,15 @@ public function getAwardPackageId() /** * Sets award_package_id * - * @param int $award_package_id + * @param int|null $award_package_id * - * @return $this + * @return self */ public function setAwardPackageId($award_package_id) { + if (is_null($award_package_id)) { + throw new \InvalidArgumentException('non-nullable award_package_id cannot be null'); + } $this->container['award_package_id'] = $award_package_id; return $this; @@ -440,7 +551,7 @@ public function setAwardPackageId($award_package_id) /** * Gets award_package_name * - * @return string + * @return string|null */ public function getAwardPackageName() { @@ -450,12 +561,15 @@ public function getAwardPackageName() /** * Sets award_package_name * - * @param string $award_package_name + * @param string|null $award_package_name * - * @return $this + * @return self */ public function setAwardPackageName($award_package_name) { + if (is_null($award_package_name)) { + throw new \InvalidArgumentException('non-nullable award_package_name cannot be null'); + } $this->container['award_package_name'] = $award_package_name; return $this; @@ -464,7 +578,7 @@ public function setAwardPackageName($award_package_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -474,12 +588,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -488,7 +605,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -498,12 +615,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -512,7 +632,7 @@ public function setName($name) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -522,12 +642,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -536,7 +659,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -546,12 +669,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -560,7 +686,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -570,12 +696,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -584,7 +713,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -594,12 +723,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -608,7 +740,7 @@ public function setSource($source) /** * Gets accrues_leave * - * @return bool + * @return bool|null */ public function getAccruesLeave() { @@ -618,12 +750,15 @@ public function getAccruesLeave() /** * Sets accrues_leave * - * @param bool $accrues_leave + * @param bool|null $accrues_leave * - * @return $this + * @return self */ public function setAccruesLeave($accrues_leave) { + if (is_null($accrues_leave)) { + throw new \InvalidArgumentException('non-nullable accrues_leave cannot be null'); + } $this->container['accrues_leave'] = $accrues_leave; return $this; @@ -632,7 +767,7 @@ public function setAccruesLeave($accrues_leave) /** * Gets mapping_type * - * @return string + * @return string|null */ public function getMappingType() { @@ -642,17 +777,21 @@ public function getMappingType() /** * Sets mapping_type * - * @param string $mapping_type + * @param string|null $mapping_type * - * @return $this + * @return self */ public function setMappingType($mapping_type) { + if (is_null($mapping_type)) { + throw new \InvalidArgumentException('non-nullable mapping_type cannot be null'); + } $allowedValues = $this->getMappingTypeAllowableValues(); - if (!is_null($mapping_type) && !in_array($mapping_type, $allowedValues, true)) { + if (!in_array($mapping_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'mapping_type', must be one of '%s'", + "Invalid value '%s' for 'mapping_type', must be one of '%s'", + $mapping_type, implode("', '", $allowedValues) ) ); @@ -665,7 +804,7 @@ public function setMappingType($mapping_type) /** * Gets short_code * - * @return string + * @return string|null */ public function getShortCode() { @@ -675,12 +814,15 @@ public function getShortCode() /** * Sets short_code * - * @param string $short_code + * @param string|null $short_code * - * @return $this + * @return self */ public function setShortCode($short_code) { + if (is_null($short_code)) { + throw new \InvalidArgumentException('non-nullable short_code cannot be null'); + } $this->container['short_code'] = $short_code; return $this; @@ -692,7 +834,7 @@ public function setShortCode($short_code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -702,22 +844,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -733,11 +876,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -745,13 +901,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuFeaturesModel.php b/src/lib/Model/AuFeaturesModel.php index 13054de..fadc39d 100644 --- a/src/lib/Model/AuFeaturesModel.php +++ b/src/lib/Model/AuFeaturesModel.php @@ -2,61 +2,61 @@ /** * AuFeaturesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuFeaturesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuFeaturesModel implements ModelInterface, ArrayAccess +class AuFeaturesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuFeaturesModel'; + protected static $openAPIModelName = 'AuFeaturesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'allow_employee_super_fund_self_service' => 'bool', 'clock_on_can_specify_higher_classification' => 'bool', 'allow_employee_leave_self_service' => 'bool', @@ -95,8 +95,10 @@ class AuFeaturesModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'allow_employee_super_fund_self_service' => null, 'clock_on_can_specify_higher_classification' => null, 'allow_employee_leave_self_service' => null, @@ -131,14 +133,61 @@ class AuFeaturesModel implements ModelInterface, ArrayAccess 'paid_breaks_enabled' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'allow_employee_super_fund_self_service' => false, + 'clock_on_can_specify_higher_classification' => false, + 'allow_employee_leave_self_service' => false, + 'allow_employee_self_editing' => false, + 'allow_employee_timesheets_self_service' => false, + 'allow_employee_to_set_unavailability' => false, + 'allow_employee_to_decline_shifts' => false, + 'allow_employee_bank_account_self_service' => false, + 'allow_employee_satisfaction_survey' => false, + 'allow_employees_to_view_all_approved_leave' => false, + 'unavailability_cut_off' => false, + 'allow_employees_to_upload_profile_picture' => false, + 'allow_employee_rostering_self_service' => false, + 'allow_employee_expenses_self_service' => false, + 'allow_employee_qualifications_self_service' => false, + 'allow_employee_override_tax_codes' => false, + 'allow_employees_to_edit_kiosk_timesheets' => false, + 'ess_timesheet_setting' => false, + 'employee_must_accept_shifts' => false, + 'allow_employee_timesheets_without_start_stop_times' => false, + 'allow_employee_to_swap_shifts' => false, + 'clock_on_require_photo' => false, + 'clock_on_allow_employee_shift_selection' => false, + 'clock_on_window_minutes' => false, + 'clock_off_window_minutes' => false, + 'timesheets_require_location' => false, + 'timesheets_require_work_type' => false, + 'enable_work_zone_clock_on' => false, + 'shift_bidding' => false, + 'allow_to_select_higher_classification' => false, + 'allow_employee_work_eligibility_self_service' => false, + 'paid_breaks_enabled' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -146,9 +195,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -310,17 +411,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ESS_TIMESHEET_SETTING_DISABLED = 'Disabled'; - const ESS_TIMESHEET_SETTING_READ_ONLY = 'ReadOnly'; - const ESS_TIMESHEET_SETTING_READ_WRITE = 'ReadWrite'; - const ESS_TIMESHEET_SETTING_EDIT_KIOSK = 'EditKiosk'; - const ESS_TIMESHEET_SETTING_EDIT_WORK_ZONE_CLOCK_ON_OFF = 'EditWorkZoneClockOnOff'; - + public const ESS_TIMESHEET_SETTING_DISABLED = 'Disabled'; + public const ESS_TIMESHEET_SETTING_READ_ONLY = 'ReadOnly'; + public const ESS_TIMESHEET_SETTING_READ_WRITE = 'ReadWrite'; + public const ESS_TIMESHEET_SETTING_EDIT_KIOSK = 'EditKiosk'; + public const ESS_TIMESHEET_SETTING_EDIT_WORK_ZONE_CLOCK_ON_OFF = 'EditWorkZoneClockOnOff'; - /** * Gets allowable values of the enum * @@ -336,7 +435,6 @@ public function getEssTimesheetSettingAllowableValues() self::ESS_TIMESHEET_SETTING_EDIT_WORK_ZONE_CLOCK_ON_OFF, ]; } - /** * Associative array for storing property values @@ -353,38 +451,56 @@ public function getEssTimesheetSettingAllowableValues() */ public function __construct(array $data = null) { - $this->container['allow_employee_super_fund_self_service'] = isset($data['allow_employee_super_fund_self_service']) ? $data['allow_employee_super_fund_self_service'] : null; - $this->container['clock_on_can_specify_higher_classification'] = isset($data['clock_on_can_specify_higher_classification']) ? $data['clock_on_can_specify_higher_classification'] : null; - $this->container['allow_employee_leave_self_service'] = isset($data['allow_employee_leave_self_service']) ? $data['allow_employee_leave_self_service'] : null; - $this->container['allow_employee_self_editing'] = isset($data['allow_employee_self_editing']) ? $data['allow_employee_self_editing'] : null; - $this->container['allow_employee_timesheets_self_service'] = isset($data['allow_employee_timesheets_self_service']) ? $data['allow_employee_timesheets_self_service'] : null; - $this->container['allow_employee_to_set_unavailability'] = isset($data['allow_employee_to_set_unavailability']) ? $data['allow_employee_to_set_unavailability'] : null; - $this->container['allow_employee_to_decline_shifts'] = isset($data['allow_employee_to_decline_shifts']) ? $data['allow_employee_to_decline_shifts'] : null; - $this->container['allow_employee_bank_account_self_service'] = isset($data['allow_employee_bank_account_self_service']) ? $data['allow_employee_bank_account_self_service'] : null; - $this->container['allow_employee_satisfaction_survey'] = isset($data['allow_employee_satisfaction_survey']) ? $data['allow_employee_satisfaction_survey'] : null; - $this->container['allow_employees_to_view_all_approved_leave'] = isset($data['allow_employees_to_view_all_approved_leave']) ? $data['allow_employees_to_view_all_approved_leave'] : null; - $this->container['unavailability_cut_off'] = isset($data['unavailability_cut_off']) ? $data['unavailability_cut_off'] : null; - $this->container['allow_employees_to_upload_profile_picture'] = isset($data['allow_employees_to_upload_profile_picture']) ? $data['allow_employees_to_upload_profile_picture'] : null; - $this->container['allow_employee_rostering_self_service'] = isset($data['allow_employee_rostering_self_service']) ? $data['allow_employee_rostering_self_service'] : null; - $this->container['allow_employee_expenses_self_service'] = isset($data['allow_employee_expenses_self_service']) ? $data['allow_employee_expenses_self_service'] : null; - $this->container['allow_employee_qualifications_self_service'] = isset($data['allow_employee_qualifications_self_service']) ? $data['allow_employee_qualifications_self_service'] : null; - $this->container['allow_employee_override_tax_codes'] = isset($data['allow_employee_override_tax_codes']) ? $data['allow_employee_override_tax_codes'] : null; - $this->container['allow_employees_to_edit_kiosk_timesheets'] = isset($data['allow_employees_to_edit_kiosk_timesheets']) ? $data['allow_employees_to_edit_kiosk_timesheets'] : null; - $this->container['ess_timesheet_setting'] = isset($data['ess_timesheet_setting']) ? $data['ess_timesheet_setting'] : null; - $this->container['employee_must_accept_shifts'] = isset($data['employee_must_accept_shifts']) ? $data['employee_must_accept_shifts'] : null; - $this->container['allow_employee_timesheets_without_start_stop_times'] = isset($data['allow_employee_timesheets_without_start_stop_times']) ? $data['allow_employee_timesheets_without_start_stop_times'] : null; - $this->container['allow_employee_to_swap_shifts'] = isset($data['allow_employee_to_swap_shifts']) ? $data['allow_employee_to_swap_shifts'] : null; - $this->container['clock_on_require_photo'] = isset($data['clock_on_require_photo']) ? $data['clock_on_require_photo'] : null; - $this->container['clock_on_allow_employee_shift_selection'] = isset($data['clock_on_allow_employee_shift_selection']) ? $data['clock_on_allow_employee_shift_selection'] : null; - $this->container['clock_on_window_minutes'] = isset($data['clock_on_window_minutes']) ? $data['clock_on_window_minutes'] : null; - $this->container['clock_off_window_minutes'] = isset($data['clock_off_window_minutes']) ? $data['clock_off_window_minutes'] : null; - $this->container['timesheets_require_location'] = isset($data['timesheets_require_location']) ? $data['timesheets_require_location'] : null; - $this->container['timesheets_require_work_type'] = isset($data['timesheets_require_work_type']) ? $data['timesheets_require_work_type'] : null; - $this->container['enable_work_zone_clock_on'] = isset($data['enable_work_zone_clock_on']) ? $data['enable_work_zone_clock_on'] : null; - $this->container['shift_bidding'] = isset($data['shift_bidding']) ? $data['shift_bidding'] : null; - $this->container['allow_to_select_higher_classification'] = isset($data['allow_to_select_higher_classification']) ? $data['allow_to_select_higher_classification'] : null; - $this->container['allow_employee_work_eligibility_self_service'] = isset($data['allow_employee_work_eligibility_self_service']) ? $data['allow_employee_work_eligibility_self_service'] : null; - $this->container['paid_breaks_enabled'] = isset($data['paid_breaks_enabled']) ? $data['paid_breaks_enabled'] : null; + $this->setIfExists('allow_employee_super_fund_self_service', $data ?? [], null); + $this->setIfExists('clock_on_can_specify_higher_classification', $data ?? [], null); + $this->setIfExists('allow_employee_leave_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_self_editing', $data ?? [], null); + $this->setIfExists('allow_employee_timesheets_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_to_set_unavailability', $data ?? [], null); + $this->setIfExists('allow_employee_to_decline_shifts', $data ?? [], null); + $this->setIfExists('allow_employee_bank_account_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_satisfaction_survey', $data ?? [], null); + $this->setIfExists('allow_employees_to_view_all_approved_leave', $data ?? [], null); + $this->setIfExists('unavailability_cut_off', $data ?? [], null); + $this->setIfExists('allow_employees_to_upload_profile_picture', $data ?? [], null); + $this->setIfExists('allow_employee_rostering_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_expenses_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_qualifications_self_service', $data ?? [], null); + $this->setIfExists('allow_employee_override_tax_codes', $data ?? [], null); + $this->setIfExists('allow_employees_to_edit_kiosk_timesheets', $data ?? [], null); + $this->setIfExists('ess_timesheet_setting', $data ?? [], null); + $this->setIfExists('employee_must_accept_shifts', $data ?? [], null); + $this->setIfExists('allow_employee_timesheets_without_start_stop_times', $data ?? [], null); + $this->setIfExists('allow_employee_to_swap_shifts', $data ?? [], null); + $this->setIfExists('clock_on_require_photo', $data ?? [], null); + $this->setIfExists('clock_on_allow_employee_shift_selection', $data ?? [], null); + $this->setIfExists('clock_on_window_minutes', $data ?? [], null); + $this->setIfExists('clock_off_window_minutes', $data ?? [], null); + $this->setIfExists('timesheets_require_location', $data ?? [], null); + $this->setIfExists('timesheets_require_work_type', $data ?? [], null); + $this->setIfExists('enable_work_zone_clock_on', $data ?? [], null); + $this->setIfExists('shift_bidding', $data ?? [], null); + $this->setIfExists('allow_to_select_higher_classification', $data ?? [], null); + $this->setIfExists('allow_employee_work_eligibility_self_service', $data ?? [], null); + $this->setIfExists('paid_breaks_enabled', $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; } /** @@ -399,7 +515,8 @@ public function listInvalidProperties() $allowedValues = $this->getEssTimesheetSettingAllowableValues(); if (!is_null($this->container['ess_timesheet_setting']) && !in_array($this->container['ess_timesheet_setting'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'ess_timesheet_setting', must be one of '%s'", + "invalid value '%s' for 'ess_timesheet_setting', must be one of '%s'", + $this->container['ess_timesheet_setting'], implode("', '", $allowedValues) ); } @@ -422,7 +539,7 @@ public function valid() /** * Gets allow_employee_super_fund_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeSuperFundSelfService() { @@ -432,12 +549,15 @@ public function getAllowEmployeeSuperFundSelfService() /** * Sets allow_employee_super_fund_self_service * - * @param bool $allow_employee_super_fund_self_service + * @param bool|null $allow_employee_super_fund_self_service * - * @return $this + * @return self */ public function setAllowEmployeeSuperFundSelfService($allow_employee_super_fund_self_service) { + if (is_null($allow_employee_super_fund_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_super_fund_self_service cannot be null'); + } $this->container['allow_employee_super_fund_self_service'] = $allow_employee_super_fund_self_service; return $this; @@ -446,7 +566,7 @@ public function setAllowEmployeeSuperFundSelfService($allow_employee_super_fund_ /** * Gets clock_on_can_specify_higher_classification * - * @return bool + * @return bool|null */ public function getClockOnCanSpecifyHigherClassification() { @@ -456,12 +576,15 @@ public function getClockOnCanSpecifyHigherClassification() /** * Sets clock_on_can_specify_higher_classification * - * @param bool $clock_on_can_specify_higher_classification + * @param bool|null $clock_on_can_specify_higher_classification * - * @return $this + * @return self */ public function setClockOnCanSpecifyHigherClassification($clock_on_can_specify_higher_classification) { + if (is_null($clock_on_can_specify_higher_classification)) { + throw new \InvalidArgumentException('non-nullable clock_on_can_specify_higher_classification cannot be null'); + } $this->container['clock_on_can_specify_higher_classification'] = $clock_on_can_specify_higher_classification; return $this; @@ -470,7 +593,7 @@ public function setClockOnCanSpecifyHigherClassification($clock_on_can_specify_h /** * Gets allow_employee_leave_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeLeaveSelfService() { @@ -480,12 +603,15 @@ public function getAllowEmployeeLeaveSelfService() /** * Sets allow_employee_leave_self_service * - * @param bool $allow_employee_leave_self_service + * @param bool|null $allow_employee_leave_self_service * - * @return $this + * @return self */ public function setAllowEmployeeLeaveSelfService($allow_employee_leave_self_service) { + if (is_null($allow_employee_leave_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_leave_self_service cannot be null'); + } $this->container['allow_employee_leave_self_service'] = $allow_employee_leave_self_service; return $this; @@ -494,7 +620,7 @@ public function setAllowEmployeeLeaveSelfService($allow_employee_leave_self_serv /** * Gets allow_employee_self_editing * - * @return bool + * @return bool|null */ public function getAllowEmployeeSelfEditing() { @@ -504,12 +630,15 @@ public function getAllowEmployeeSelfEditing() /** * Sets allow_employee_self_editing * - * @param bool $allow_employee_self_editing + * @param bool|null $allow_employee_self_editing * - * @return $this + * @return self */ public function setAllowEmployeeSelfEditing($allow_employee_self_editing) { + if (is_null($allow_employee_self_editing)) { + throw new \InvalidArgumentException('non-nullable allow_employee_self_editing cannot be null'); + } $this->container['allow_employee_self_editing'] = $allow_employee_self_editing; return $this; @@ -518,7 +647,7 @@ public function setAllowEmployeeSelfEditing($allow_employee_self_editing) /** * Gets allow_employee_timesheets_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeTimesheetsSelfService() { @@ -528,12 +657,15 @@ public function getAllowEmployeeTimesheetsSelfService() /** * Sets allow_employee_timesheets_self_service * - * @param bool $allow_employee_timesheets_self_service + * @param bool|null $allow_employee_timesheets_self_service * - * @return $this + * @return self */ public function setAllowEmployeeTimesheetsSelfService($allow_employee_timesheets_self_service) { + if (is_null($allow_employee_timesheets_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_timesheets_self_service cannot be null'); + } $this->container['allow_employee_timesheets_self_service'] = $allow_employee_timesheets_self_service; return $this; @@ -542,7 +674,7 @@ public function setAllowEmployeeTimesheetsSelfService($allow_employee_timesheets /** * Gets allow_employee_to_set_unavailability * - * @return bool + * @return bool|null */ public function getAllowEmployeeToSetUnavailability() { @@ -552,12 +684,15 @@ public function getAllowEmployeeToSetUnavailability() /** * Sets allow_employee_to_set_unavailability * - * @param bool $allow_employee_to_set_unavailability + * @param bool|null $allow_employee_to_set_unavailability * - * @return $this + * @return self */ public function setAllowEmployeeToSetUnavailability($allow_employee_to_set_unavailability) { + if (is_null($allow_employee_to_set_unavailability)) { + throw new \InvalidArgumentException('non-nullable allow_employee_to_set_unavailability cannot be null'); + } $this->container['allow_employee_to_set_unavailability'] = $allow_employee_to_set_unavailability; return $this; @@ -566,7 +701,7 @@ public function setAllowEmployeeToSetUnavailability($allow_employee_to_set_unava /** * Gets allow_employee_to_decline_shifts * - * @return bool + * @return bool|null */ public function getAllowEmployeeToDeclineShifts() { @@ -576,12 +711,15 @@ public function getAllowEmployeeToDeclineShifts() /** * Sets allow_employee_to_decline_shifts * - * @param bool $allow_employee_to_decline_shifts + * @param bool|null $allow_employee_to_decline_shifts * - * @return $this + * @return self */ public function setAllowEmployeeToDeclineShifts($allow_employee_to_decline_shifts) { + if (is_null($allow_employee_to_decline_shifts)) { + throw new \InvalidArgumentException('non-nullable allow_employee_to_decline_shifts cannot be null'); + } $this->container['allow_employee_to_decline_shifts'] = $allow_employee_to_decline_shifts; return $this; @@ -590,7 +728,7 @@ public function setAllowEmployeeToDeclineShifts($allow_employee_to_decline_shift /** * Gets allow_employee_bank_account_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeBankAccountSelfService() { @@ -600,12 +738,15 @@ public function getAllowEmployeeBankAccountSelfService() /** * Sets allow_employee_bank_account_self_service * - * @param bool $allow_employee_bank_account_self_service + * @param bool|null $allow_employee_bank_account_self_service * - * @return $this + * @return self */ public function setAllowEmployeeBankAccountSelfService($allow_employee_bank_account_self_service) { + if (is_null($allow_employee_bank_account_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_bank_account_self_service cannot be null'); + } $this->container['allow_employee_bank_account_self_service'] = $allow_employee_bank_account_self_service; return $this; @@ -614,7 +755,7 @@ public function setAllowEmployeeBankAccountSelfService($allow_employee_bank_acco /** * Gets allow_employee_satisfaction_survey * - * @return bool + * @return bool|null */ public function getAllowEmployeeSatisfactionSurvey() { @@ -624,12 +765,15 @@ public function getAllowEmployeeSatisfactionSurvey() /** * Sets allow_employee_satisfaction_survey * - * @param bool $allow_employee_satisfaction_survey + * @param bool|null $allow_employee_satisfaction_survey * - * @return $this + * @return self */ public function setAllowEmployeeSatisfactionSurvey($allow_employee_satisfaction_survey) { + if (is_null($allow_employee_satisfaction_survey)) { + throw new \InvalidArgumentException('non-nullable allow_employee_satisfaction_survey cannot be null'); + } $this->container['allow_employee_satisfaction_survey'] = $allow_employee_satisfaction_survey; return $this; @@ -638,7 +782,7 @@ public function setAllowEmployeeSatisfactionSurvey($allow_employee_satisfaction_ /** * Gets allow_employees_to_view_all_approved_leave * - * @return bool + * @return bool|null */ public function getAllowEmployeesToViewAllApprovedLeave() { @@ -648,12 +792,15 @@ public function getAllowEmployeesToViewAllApprovedLeave() /** * Sets allow_employees_to_view_all_approved_leave * - * @param bool $allow_employees_to_view_all_approved_leave + * @param bool|null $allow_employees_to_view_all_approved_leave * - * @return $this + * @return self */ public function setAllowEmployeesToViewAllApprovedLeave($allow_employees_to_view_all_approved_leave) { + if (is_null($allow_employees_to_view_all_approved_leave)) { + throw new \InvalidArgumentException('non-nullable allow_employees_to_view_all_approved_leave cannot be null'); + } $this->container['allow_employees_to_view_all_approved_leave'] = $allow_employees_to_view_all_approved_leave; return $this; @@ -662,7 +809,7 @@ public function setAllowEmployeesToViewAllApprovedLeave($allow_employees_to_view /** * Gets unavailability_cut_off * - * @return int + * @return int|null */ public function getUnavailabilityCutOff() { @@ -672,12 +819,15 @@ public function getUnavailabilityCutOff() /** * Sets unavailability_cut_off * - * @param int $unavailability_cut_off + * @param int|null $unavailability_cut_off * - * @return $this + * @return self */ public function setUnavailabilityCutOff($unavailability_cut_off) { + if (is_null($unavailability_cut_off)) { + throw new \InvalidArgumentException('non-nullable unavailability_cut_off cannot be null'); + } $this->container['unavailability_cut_off'] = $unavailability_cut_off; return $this; @@ -686,7 +836,7 @@ public function setUnavailabilityCutOff($unavailability_cut_off) /** * Gets allow_employees_to_upload_profile_picture * - * @return bool + * @return bool|null */ public function getAllowEmployeesToUploadProfilePicture() { @@ -696,12 +846,15 @@ public function getAllowEmployeesToUploadProfilePicture() /** * Sets allow_employees_to_upload_profile_picture * - * @param bool $allow_employees_to_upload_profile_picture + * @param bool|null $allow_employees_to_upload_profile_picture * - * @return $this + * @return self */ public function setAllowEmployeesToUploadProfilePicture($allow_employees_to_upload_profile_picture) { + if (is_null($allow_employees_to_upload_profile_picture)) { + throw new \InvalidArgumentException('non-nullable allow_employees_to_upload_profile_picture cannot be null'); + } $this->container['allow_employees_to_upload_profile_picture'] = $allow_employees_to_upload_profile_picture; return $this; @@ -710,7 +863,7 @@ public function setAllowEmployeesToUploadProfilePicture($allow_employees_to_uplo /** * Gets allow_employee_rostering_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeRosteringSelfService() { @@ -720,12 +873,15 @@ public function getAllowEmployeeRosteringSelfService() /** * Sets allow_employee_rostering_self_service * - * @param bool $allow_employee_rostering_self_service + * @param bool|null $allow_employee_rostering_self_service * - * @return $this + * @return self */ public function setAllowEmployeeRosteringSelfService($allow_employee_rostering_self_service) { + if (is_null($allow_employee_rostering_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_rostering_self_service cannot be null'); + } $this->container['allow_employee_rostering_self_service'] = $allow_employee_rostering_self_service; return $this; @@ -734,7 +890,7 @@ public function setAllowEmployeeRosteringSelfService($allow_employee_rostering_s /** * Gets allow_employee_expenses_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeExpensesSelfService() { @@ -744,12 +900,15 @@ public function getAllowEmployeeExpensesSelfService() /** * Sets allow_employee_expenses_self_service * - * @param bool $allow_employee_expenses_self_service + * @param bool|null $allow_employee_expenses_self_service * - * @return $this + * @return self */ public function setAllowEmployeeExpensesSelfService($allow_employee_expenses_self_service) { + if (is_null($allow_employee_expenses_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_expenses_self_service cannot be null'); + } $this->container['allow_employee_expenses_self_service'] = $allow_employee_expenses_self_service; return $this; @@ -758,7 +917,7 @@ public function setAllowEmployeeExpensesSelfService($allow_employee_expenses_sel /** * Gets allow_employee_qualifications_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeQualificationsSelfService() { @@ -768,12 +927,15 @@ public function getAllowEmployeeQualificationsSelfService() /** * Sets allow_employee_qualifications_self_service * - * @param bool $allow_employee_qualifications_self_service + * @param bool|null $allow_employee_qualifications_self_service * - * @return $this + * @return self */ public function setAllowEmployeeQualificationsSelfService($allow_employee_qualifications_self_service) { + if (is_null($allow_employee_qualifications_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_qualifications_self_service cannot be null'); + } $this->container['allow_employee_qualifications_self_service'] = $allow_employee_qualifications_self_service; return $this; @@ -782,7 +944,7 @@ public function setAllowEmployeeQualificationsSelfService($allow_employee_qualif /** * Gets allow_employee_override_tax_codes * - * @return bool + * @return bool|null */ public function getAllowEmployeeOverrideTaxCodes() { @@ -792,12 +954,15 @@ public function getAllowEmployeeOverrideTaxCodes() /** * Sets allow_employee_override_tax_codes * - * @param bool $allow_employee_override_tax_codes + * @param bool|null $allow_employee_override_tax_codes * - * @return $this + * @return self */ public function setAllowEmployeeOverrideTaxCodes($allow_employee_override_tax_codes) { + if (is_null($allow_employee_override_tax_codes)) { + throw new \InvalidArgumentException('non-nullable allow_employee_override_tax_codes cannot be null'); + } $this->container['allow_employee_override_tax_codes'] = $allow_employee_override_tax_codes; return $this; @@ -806,7 +971,7 @@ public function setAllowEmployeeOverrideTaxCodes($allow_employee_override_tax_co /** * Gets allow_employees_to_edit_kiosk_timesheets * - * @return bool + * @return bool|null */ public function getAllowEmployeesToEditKioskTimesheets() { @@ -816,12 +981,15 @@ public function getAllowEmployeesToEditKioskTimesheets() /** * Sets allow_employees_to_edit_kiosk_timesheets * - * @param bool $allow_employees_to_edit_kiosk_timesheets + * @param bool|null $allow_employees_to_edit_kiosk_timesheets * - * @return $this + * @return self */ public function setAllowEmployeesToEditKioskTimesheets($allow_employees_to_edit_kiosk_timesheets) { + if (is_null($allow_employees_to_edit_kiosk_timesheets)) { + throw new \InvalidArgumentException('non-nullable allow_employees_to_edit_kiosk_timesheets cannot be null'); + } $this->container['allow_employees_to_edit_kiosk_timesheets'] = $allow_employees_to_edit_kiosk_timesheets; return $this; @@ -830,7 +998,7 @@ public function setAllowEmployeesToEditKioskTimesheets($allow_employees_to_edit_ /** * Gets ess_timesheet_setting * - * @return string + * @return string|null */ public function getEssTimesheetSetting() { @@ -840,17 +1008,21 @@ public function getEssTimesheetSetting() /** * Sets ess_timesheet_setting * - * @param string $ess_timesheet_setting + * @param string|null $ess_timesheet_setting * - * @return $this + * @return self */ public function setEssTimesheetSetting($ess_timesheet_setting) { + if (is_null($ess_timesheet_setting)) { + throw new \InvalidArgumentException('non-nullable ess_timesheet_setting cannot be null'); + } $allowedValues = $this->getEssTimesheetSettingAllowableValues(); - if (!is_null($ess_timesheet_setting) && !in_array($ess_timesheet_setting, $allowedValues, true)) { + if (!in_array($ess_timesheet_setting, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'ess_timesheet_setting', must be one of '%s'", + "Invalid value '%s' for 'ess_timesheet_setting', must be one of '%s'", + $ess_timesheet_setting, implode("', '", $allowedValues) ) ); @@ -863,7 +1035,7 @@ public function setEssTimesheetSetting($ess_timesheet_setting) /** * Gets employee_must_accept_shifts * - * @return bool + * @return bool|null */ public function getEmployeeMustAcceptShifts() { @@ -873,12 +1045,15 @@ public function getEmployeeMustAcceptShifts() /** * Sets employee_must_accept_shifts * - * @param bool $employee_must_accept_shifts + * @param bool|null $employee_must_accept_shifts * - * @return $this + * @return self */ public function setEmployeeMustAcceptShifts($employee_must_accept_shifts) { + if (is_null($employee_must_accept_shifts)) { + throw new \InvalidArgumentException('non-nullable employee_must_accept_shifts cannot be null'); + } $this->container['employee_must_accept_shifts'] = $employee_must_accept_shifts; return $this; @@ -887,7 +1062,7 @@ public function setEmployeeMustAcceptShifts($employee_must_accept_shifts) /** * Gets allow_employee_timesheets_without_start_stop_times * - * @return bool + * @return bool|null */ public function getAllowEmployeeTimesheetsWithoutStartStopTimes() { @@ -897,12 +1072,15 @@ public function getAllowEmployeeTimesheetsWithoutStartStopTimes() /** * Sets allow_employee_timesheets_without_start_stop_times * - * @param bool $allow_employee_timesheets_without_start_stop_times + * @param bool|null $allow_employee_timesheets_without_start_stop_times * - * @return $this + * @return self */ public function setAllowEmployeeTimesheetsWithoutStartStopTimes($allow_employee_timesheets_without_start_stop_times) { + if (is_null($allow_employee_timesheets_without_start_stop_times)) { + throw new \InvalidArgumentException('non-nullable allow_employee_timesheets_without_start_stop_times cannot be null'); + } $this->container['allow_employee_timesheets_without_start_stop_times'] = $allow_employee_timesheets_without_start_stop_times; return $this; @@ -911,7 +1089,7 @@ public function setAllowEmployeeTimesheetsWithoutStartStopTimes($allow_employee_ /** * Gets allow_employee_to_swap_shifts * - * @return bool + * @return bool|null */ public function getAllowEmployeeToSwapShifts() { @@ -921,12 +1099,15 @@ public function getAllowEmployeeToSwapShifts() /** * Sets allow_employee_to_swap_shifts * - * @param bool $allow_employee_to_swap_shifts + * @param bool|null $allow_employee_to_swap_shifts * - * @return $this + * @return self */ public function setAllowEmployeeToSwapShifts($allow_employee_to_swap_shifts) { + if (is_null($allow_employee_to_swap_shifts)) { + throw new \InvalidArgumentException('non-nullable allow_employee_to_swap_shifts cannot be null'); + } $this->container['allow_employee_to_swap_shifts'] = $allow_employee_to_swap_shifts; return $this; @@ -935,7 +1116,7 @@ public function setAllowEmployeeToSwapShifts($allow_employee_to_swap_shifts) /** * Gets clock_on_require_photo * - * @return bool + * @return bool|null */ public function getClockOnRequirePhoto() { @@ -945,12 +1126,15 @@ public function getClockOnRequirePhoto() /** * Sets clock_on_require_photo * - * @param bool $clock_on_require_photo + * @param bool|null $clock_on_require_photo * - * @return $this + * @return self */ public function setClockOnRequirePhoto($clock_on_require_photo) { + if (is_null($clock_on_require_photo)) { + throw new \InvalidArgumentException('non-nullable clock_on_require_photo cannot be null'); + } $this->container['clock_on_require_photo'] = $clock_on_require_photo; return $this; @@ -959,7 +1143,7 @@ public function setClockOnRequirePhoto($clock_on_require_photo) /** * Gets clock_on_allow_employee_shift_selection * - * @return bool + * @return bool|null */ public function getClockOnAllowEmployeeShiftSelection() { @@ -969,12 +1153,15 @@ public function getClockOnAllowEmployeeShiftSelection() /** * Sets clock_on_allow_employee_shift_selection * - * @param bool $clock_on_allow_employee_shift_selection + * @param bool|null $clock_on_allow_employee_shift_selection * - * @return $this + * @return self */ public function setClockOnAllowEmployeeShiftSelection($clock_on_allow_employee_shift_selection) { + if (is_null($clock_on_allow_employee_shift_selection)) { + throw new \InvalidArgumentException('non-nullable clock_on_allow_employee_shift_selection cannot be null'); + } $this->container['clock_on_allow_employee_shift_selection'] = $clock_on_allow_employee_shift_selection; return $this; @@ -983,7 +1170,7 @@ public function setClockOnAllowEmployeeShiftSelection($clock_on_allow_employee_s /** * Gets clock_on_window_minutes * - * @return int + * @return int|null */ public function getClockOnWindowMinutes() { @@ -993,12 +1180,15 @@ public function getClockOnWindowMinutes() /** * Sets clock_on_window_minutes * - * @param int $clock_on_window_minutes + * @param int|null $clock_on_window_minutes * - * @return $this + * @return self */ public function setClockOnWindowMinutes($clock_on_window_minutes) { + if (is_null($clock_on_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_on_window_minutes cannot be null'); + } $this->container['clock_on_window_minutes'] = $clock_on_window_minutes; return $this; @@ -1007,7 +1197,7 @@ public function setClockOnWindowMinutes($clock_on_window_minutes) /** * Gets clock_off_window_minutes * - * @return int + * @return int|null */ public function getClockOffWindowMinutes() { @@ -1017,12 +1207,15 @@ public function getClockOffWindowMinutes() /** * Sets clock_off_window_minutes * - * @param int $clock_off_window_minutes + * @param int|null $clock_off_window_minutes * - * @return $this + * @return self */ public function setClockOffWindowMinutes($clock_off_window_minutes) { + if (is_null($clock_off_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_off_window_minutes cannot be null'); + } $this->container['clock_off_window_minutes'] = $clock_off_window_minutes; return $this; @@ -1031,7 +1224,7 @@ public function setClockOffWindowMinutes($clock_off_window_minutes) /** * Gets timesheets_require_location * - * @return bool + * @return bool|null */ public function getTimesheetsRequireLocation() { @@ -1041,12 +1234,15 @@ public function getTimesheetsRequireLocation() /** * Sets timesheets_require_location * - * @param bool $timesheets_require_location + * @param bool|null $timesheets_require_location * - * @return $this + * @return self */ public function setTimesheetsRequireLocation($timesheets_require_location) { + if (is_null($timesheets_require_location)) { + throw new \InvalidArgumentException('non-nullable timesheets_require_location cannot be null'); + } $this->container['timesheets_require_location'] = $timesheets_require_location; return $this; @@ -1055,7 +1251,7 @@ public function setTimesheetsRequireLocation($timesheets_require_location) /** * Gets timesheets_require_work_type * - * @return bool + * @return bool|null */ public function getTimesheetsRequireWorkType() { @@ -1065,12 +1261,15 @@ public function getTimesheetsRequireWorkType() /** * Sets timesheets_require_work_type * - * @param bool $timesheets_require_work_type + * @param bool|null $timesheets_require_work_type * - * @return $this + * @return self */ public function setTimesheetsRequireWorkType($timesheets_require_work_type) { + if (is_null($timesheets_require_work_type)) { + throw new \InvalidArgumentException('non-nullable timesheets_require_work_type cannot be null'); + } $this->container['timesheets_require_work_type'] = $timesheets_require_work_type; return $this; @@ -1079,7 +1278,7 @@ public function setTimesheetsRequireWorkType($timesheets_require_work_type) /** * Gets enable_work_zone_clock_on * - * @return bool + * @return bool|null */ public function getEnableWorkZoneClockOn() { @@ -1089,12 +1288,15 @@ public function getEnableWorkZoneClockOn() /** * Sets enable_work_zone_clock_on * - * @param bool $enable_work_zone_clock_on + * @param bool|null $enable_work_zone_clock_on * - * @return $this + * @return self */ public function setEnableWorkZoneClockOn($enable_work_zone_clock_on) { + if (is_null($enable_work_zone_clock_on)) { + throw new \InvalidArgumentException('non-nullable enable_work_zone_clock_on cannot be null'); + } $this->container['enable_work_zone_clock_on'] = $enable_work_zone_clock_on; return $this; @@ -1103,7 +1305,7 @@ public function setEnableWorkZoneClockOn($enable_work_zone_clock_on) /** * Gets shift_bidding * - * @return bool + * @return bool|null */ public function getShiftBidding() { @@ -1113,12 +1315,15 @@ public function getShiftBidding() /** * Sets shift_bidding * - * @param bool $shift_bidding + * @param bool|null $shift_bidding * - * @return $this + * @return self */ public function setShiftBidding($shift_bidding) { + if (is_null($shift_bidding)) { + throw new \InvalidArgumentException('non-nullable shift_bidding cannot be null'); + } $this->container['shift_bidding'] = $shift_bidding; return $this; @@ -1127,7 +1332,7 @@ public function setShiftBidding($shift_bidding) /** * Gets allow_to_select_higher_classification * - * @return bool + * @return bool|null */ public function getAllowToSelectHigherClassification() { @@ -1137,12 +1342,15 @@ public function getAllowToSelectHigherClassification() /** * Sets allow_to_select_higher_classification * - * @param bool $allow_to_select_higher_classification + * @param bool|null $allow_to_select_higher_classification * - * @return $this + * @return self */ public function setAllowToSelectHigherClassification($allow_to_select_higher_classification) { + if (is_null($allow_to_select_higher_classification)) { + throw new \InvalidArgumentException('non-nullable allow_to_select_higher_classification cannot be null'); + } $this->container['allow_to_select_higher_classification'] = $allow_to_select_higher_classification; return $this; @@ -1151,7 +1359,7 @@ public function setAllowToSelectHigherClassification($allow_to_select_higher_cla /** * Gets allow_employee_work_eligibility_self_service * - * @return bool + * @return bool|null */ public function getAllowEmployeeWorkEligibilitySelfService() { @@ -1161,12 +1369,15 @@ public function getAllowEmployeeWorkEligibilitySelfService() /** * Sets allow_employee_work_eligibility_self_service * - * @param bool $allow_employee_work_eligibility_self_service + * @param bool|null $allow_employee_work_eligibility_self_service * - * @return $this + * @return self */ public function setAllowEmployeeWorkEligibilitySelfService($allow_employee_work_eligibility_self_service) { + if (is_null($allow_employee_work_eligibility_self_service)) { + throw new \InvalidArgumentException('non-nullable allow_employee_work_eligibility_self_service cannot be null'); + } $this->container['allow_employee_work_eligibility_self_service'] = $allow_employee_work_eligibility_self_service; return $this; @@ -1175,7 +1386,7 @@ public function setAllowEmployeeWorkEligibilitySelfService($allow_employee_work_ /** * Gets paid_breaks_enabled * - * @return bool + * @return bool|null */ public function getPaidBreaksEnabled() { @@ -1185,12 +1396,15 @@ public function getPaidBreaksEnabled() /** * Sets paid_breaks_enabled * - * @param bool $paid_breaks_enabled + * @param bool|null $paid_breaks_enabled * - * @return $this + * @return self */ public function setPaidBreaksEnabled($paid_breaks_enabled) { + if (is_null($paid_breaks_enabled)) { + throw new \InvalidArgumentException('non-nullable paid_breaks_enabled cannot be null'); + } $this->container['paid_breaks_enabled'] = $paid_breaks_enabled; return $this; @@ -1202,7 +1416,7 @@ public function setPaidBreaksEnabled($paid_breaks_enabled) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1212,22 +1426,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1243,11 +1458,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1255,13 +1483,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuGrossToNetResponseModel.php b/src/lib/Model/AuGrossToNetResponseModel.php index 72700e2..5e50558 100644 --- a/src/lib/Model/AuGrossToNetResponseModel.php +++ b/src/lib/Model/AuGrossToNetResponseModel.php @@ -2,95 +2,97 @@ /** * AuGrossToNetResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuGrossToNetResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuGrossToNetResponseModel implements ModelInterface, ArrayAccess +class AuGrossToNetResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuGrossToNetResponseModel'; + protected static $openAPIModelName = 'AuGrossToNetResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg' => 'double', - 'sfss' => 'double', - 'help' => 'double', - 'net_earnings' => 'double', - 'sgc' => 'double', - 'employer_contribution' => 'double', - 'non_resc_employer_contribution' => 'double', - 'total_gross_plus_super' => 'double', + protected static $openAPITypes = [ + 'payg' => 'float', + 'sfss' => 'float', + 'help' => 'float', + 'net_earnings' => 'float', + 'sgc' => 'float', + 'employer_contribution' => 'float', + 'non_resc_employer_contribution' => 'float', + 'total_gross_plus_super' => 'float', 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', 'primary_location_id' => 'int', 'primary_location' => 'string', 'external_id' => 'string', - 'total_hours' => 'double', - 'gross_earnings' => 'map[string,double]', - 'total_gross_earnings' => 'double', - 'total_tax_exempt_earnings' => 'double', - 'pre_tax_deductions' => 'map[string,double]', - 'total_pre_tax_deductions' => 'double', - 'taxable_earnings' => 'double', - 'post_tax_deductions' => 'map[string,double]', - 'total_post_tax_deductions' => 'double', - 'expenses' => 'map[string,double]', - 'total_expenses' => 'double', - 'bank_payments' => 'double' + 'total_hours' => 'float', + 'gross_earnings' => 'array', + 'total_gross_earnings' => 'float', + 'total_tax_exempt_earnings' => 'float', + 'pre_tax_deductions' => 'array', + 'total_pre_tax_deductions' => 'float', + 'taxable_earnings' => 'float', + 'post_tax_deductions' => 'array', + 'total_post_tax_deductions' => 'float', + 'expenses' => 'array', + 'total_expenses' => 'float', + 'bank_payments' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg' => 'double', 'sfss' => 'double', 'help' => 'double', @@ -119,14 +121,55 @@ class AuGrossToNetResponseModel implements ModelInterface, ArrayAccess 'bank_payments' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg' => false, + 'sfss' => false, + 'help' => false, + 'net_earnings' => false, + 'sgc' => false, + 'employer_contribution' => false, + 'non_resc_employer_contribution' => false, + 'total_gross_plus_super' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'primary_location_id' => false, + 'primary_location' => false, + 'external_id' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'total_gross_earnings' => false, + 'total_tax_exempt_earnings' => false, + 'pre_tax_deductions' => false, + 'total_pre_tax_deductions' => false, + 'taxable_earnings' => false, + 'post_tax_deductions' => false, + 'total_post_tax_deductions' => false, + 'expenses' => false, + 'total_expenses' => false, + 'bank_payments' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -134,9 +177,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -280,12 +375,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -302,32 +394,50 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payg'] = isset($data['payg']) ? $data['payg'] : null; - $this->container['sfss'] = isset($data['sfss']) ? $data['sfss'] : null; - $this->container['help'] = isset($data['help']) ? $data['help'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['sgc'] = isset($data['sgc']) ? $data['sgc'] : null; - $this->container['employer_contribution'] = isset($data['employer_contribution']) ? $data['employer_contribution'] : null; - $this->container['non_resc_employer_contribution'] = isset($data['non_resc_employer_contribution']) ? $data['non_resc_employer_contribution'] : null; - $this->container['total_gross_plus_super'] = isset($data['total_gross_plus_super']) ? $data['total_gross_plus_super'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['primary_location_id'] = isset($data['primary_location_id']) ? $data['primary_location_id'] : null; - $this->container['primary_location'] = isset($data['primary_location']) ? $data['primary_location'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['total_gross_earnings'] = isset($data['total_gross_earnings']) ? $data['total_gross_earnings'] : null; - $this->container['total_tax_exempt_earnings'] = isset($data['total_tax_exempt_earnings']) ? $data['total_tax_exempt_earnings'] : null; - $this->container['pre_tax_deductions'] = isset($data['pre_tax_deductions']) ? $data['pre_tax_deductions'] : null; - $this->container['total_pre_tax_deductions'] = isset($data['total_pre_tax_deductions']) ? $data['total_pre_tax_deductions'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['post_tax_deductions'] = isset($data['post_tax_deductions']) ? $data['post_tax_deductions'] : null; - $this->container['total_post_tax_deductions'] = isset($data['total_post_tax_deductions']) ? $data['total_post_tax_deductions'] : null; - $this->container['expenses'] = isset($data['expenses']) ? $data['expenses'] : null; - $this->container['total_expenses'] = isset($data['total_expenses']) ? $data['total_expenses'] : null; - $this->container['bank_payments'] = isset($data['bank_payments']) ? $data['bank_payments'] : null; + $this->setIfExists('payg', $data ?? [], null); + $this->setIfExists('sfss', $data ?? [], null); + $this->setIfExists('help', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('sgc', $data ?? [], null); + $this->setIfExists('employer_contribution', $data ?? [], null); + $this->setIfExists('non_resc_employer_contribution', $data ?? [], null); + $this->setIfExists('total_gross_plus_super', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('primary_location_id', $data ?? [], null); + $this->setIfExists('primary_location', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('total_gross_earnings', $data ?? [], null); + $this->setIfExists('total_tax_exempt_earnings', $data ?? [], null); + $this->setIfExists('pre_tax_deductions', $data ?? [], null); + $this->setIfExists('total_pre_tax_deductions', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('post_tax_deductions', $data ?? [], null); + $this->setIfExists('total_post_tax_deductions', $data ?? [], null); + $this->setIfExists('expenses', $data ?? [], null); + $this->setIfExists('total_expenses', $data ?? [], null); + $this->setIfExists('bank_payments', $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; } /** @@ -357,7 +467,7 @@ public function valid() /** * Gets payg * - * @return double + * @return float|null */ public function getPayg() { @@ -367,12 +477,15 @@ public function getPayg() /** * Sets payg * - * @param double $payg + * @param float|null $payg * - * @return $this + * @return self */ public function setPayg($payg) { + if (is_null($payg)) { + throw new \InvalidArgumentException('non-nullable payg cannot be null'); + } $this->container['payg'] = $payg; return $this; @@ -381,7 +494,7 @@ public function setPayg($payg) /** * Gets sfss * - * @return double + * @return float|null */ public function getSfss() { @@ -391,12 +504,15 @@ public function getSfss() /** * Sets sfss * - * @param double $sfss + * @param float|null $sfss * - * @return $this + * @return self */ public function setSfss($sfss) { + if (is_null($sfss)) { + throw new \InvalidArgumentException('non-nullable sfss cannot be null'); + } $this->container['sfss'] = $sfss; return $this; @@ -405,7 +521,7 @@ public function setSfss($sfss) /** * Gets help * - * @return double + * @return float|null */ public function getHelp() { @@ -415,12 +531,15 @@ public function getHelp() /** * Sets help * - * @param double $help + * @param float|null $help * - * @return $this + * @return self */ public function setHelp($help) { + if (is_null($help)) { + throw new \InvalidArgumentException('non-nullable help cannot be null'); + } $this->container['help'] = $help; return $this; @@ -429,7 +548,7 @@ public function setHelp($help) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -439,12 +558,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -453,7 +575,7 @@ public function setNetEarnings($net_earnings) /** * Gets sgc * - * @return double + * @return float|null */ public function getSgc() { @@ -463,12 +585,15 @@ public function getSgc() /** * Sets sgc * - * @param double $sgc + * @param float|null $sgc * - * @return $this + * @return self */ public function setSgc($sgc) { + if (is_null($sgc)) { + throw new \InvalidArgumentException('non-nullable sgc cannot be null'); + } $this->container['sgc'] = $sgc; return $this; @@ -477,7 +602,7 @@ public function setSgc($sgc) /** * Gets employer_contribution * - * @return double + * @return float|null */ public function getEmployerContribution() { @@ -487,12 +612,15 @@ public function getEmployerContribution() /** * Sets employer_contribution * - * @param double $employer_contribution + * @param float|null $employer_contribution * - * @return $this + * @return self */ public function setEmployerContribution($employer_contribution) { + if (is_null($employer_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_contribution cannot be null'); + } $this->container['employer_contribution'] = $employer_contribution; return $this; @@ -501,7 +629,7 @@ public function setEmployerContribution($employer_contribution) /** * Gets non_resc_employer_contribution * - * @return double + * @return float|null */ public function getNonRescEmployerContribution() { @@ -511,12 +639,15 @@ public function getNonRescEmployerContribution() /** * Sets non_resc_employer_contribution * - * @param double $non_resc_employer_contribution + * @param float|null $non_resc_employer_contribution * - * @return $this + * @return self */ public function setNonRescEmployerContribution($non_resc_employer_contribution) { + if (is_null($non_resc_employer_contribution)) { + throw new \InvalidArgumentException('non-nullable non_resc_employer_contribution cannot be null'); + } $this->container['non_resc_employer_contribution'] = $non_resc_employer_contribution; return $this; @@ -525,7 +656,7 @@ public function setNonRescEmployerContribution($non_resc_employer_contribution) /** * Gets total_gross_plus_super * - * @return double + * @return float|null */ public function getTotalGrossPlusSuper() { @@ -535,12 +666,15 @@ public function getTotalGrossPlusSuper() /** * Sets total_gross_plus_super * - * @param double $total_gross_plus_super + * @param float|null $total_gross_plus_super * - * @return $this + * @return self */ public function setTotalGrossPlusSuper($total_gross_plus_super) { + if (is_null($total_gross_plus_super)) { + throw new \InvalidArgumentException('non-nullable total_gross_plus_super cannot be null'); + } $this->container['total_gross_plus_super'] = $total_gross_plus_super; return $this; @@ -549,7 +683,7 @@ public function setTotalGrossPlusSuper($total_gross_plus_super) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -559,12 +693,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -573,7 +710,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -583,12 +720,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -597,7 +737,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -607,12 +747,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -621,7 +764,7 @@ public function setSurname($surname) /** * Gets primary_location_id * - * @return int + * @return int|null */ public function getPrimaryLocationId() { @@ -631,12 +774,15 @@ public function getPrimaryLocationId() /** * Sets primary_location_id * - * @param int $primary_location_id + * @param int|null $primary_location_id * - * @return $this + * @return self */ public function setPrimaryLocationId($primary_location_id) { + if (is_null($primary_location_id)) { + throw new \InvalidArgumentException('non-nullable primary_location_id cannot be null'); + } $this->container['primary_location_id'] = $primary_location_id; return $this; @@ -645,7 +791,7 @@ public function setPrimaryLocationId($primary_location_id) /** * Gets primary_location * - * @return string + * @return string|null */ public function getPrimaryLocation() { @@ -655,12 +801,15 @@ public function getPrimaryLocation() /** * Sets primary_location * - * @param string $primary_location + * @param string|null $primary_location * - * @return $this + * @return self */ public function setPrimaryLocation($primary_location) { + if (is_null($primary_location)) { + throw new \InvalidArgumentException('non-nullable primary_location cannot be null'); + } $this->container['primary_location'] = $primary_location; return $this; @@ -669,7 +818,7 @@ public function setPrimaryLocation($primary_location) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -679,12 +828,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -693,7 +845,7 @@ public function setExternalId($external_id) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -703,12 +855,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -717,7 +872,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return map[string,double] + * @return array|null */ public function getGrossEarnings() { @@ -727,12 +882,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param map[string,double] $gross_earnings + * @param array|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -741,7 +899,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets total_gross_earnings * - * @return double + * @return float|null */ public function getTotalGrossEarnings() { @@ -751,12 +909,15 @@ public function getTotalGrossEarnings() /** * Sets total_gross_earnings * - * @param double $total_gross_earnings + * @param float|null $total_gross_earnings * - * @return $this + * @return self */ public function setTotalGrossEarnings($total_gross_earnings) { + if (is_null($total_gross_earnings)) { + throw new \InvalidArgumentException('non-nullable total_gross_earnings cannot be null'); + } $this->container['total_gross_earnings'] = $total_gross_earnings; return $this; @@ -765,7 +926,7 @@ public function setTotalGrossEarnings($total_gross_earnings) /** * Gets total_tax_exempt_earnings * - * @return double + * @return float|null */ public function getTotalTaxExemptEarnings() { @@ -775,12 +936,15 @@ public function getTotalTaxExemptEarnings() /** * Sets total_tax_exempt_earnings * - * @param double $total_tax_exempt_earnings + * @param float|null $total_tax_exempt_earnings * - * @return $this + * @return self */ public function setTotalTaxExemptEarnings($total_tax_exempt_earnings) { + if (is_null($total_tax_exempt_earnings)) { + throw new \InvalidArgumentException('non-nullable total_tax_exempt_earnings cannot be null'); + } $this->container['total_tax_exempt_earnings'] = $total_tax_exempt_earnings; return $this; @@ -789,7 +953,7 @@ public function setTotalTaxExemptEarnings($total_tax_exempt_earnings) /** * Gets pre_tax_deductions * - * @return map[string,double] + * @return array|null */ public function getPreTaxDeductions() { @@ -799,12 +963,15 @@ public function getPreTaxDeductions() /** * Sets pre_tax_deductions * - * @param map[string,double] $pre_tax_deductions + * @param array|null $pre_tax_deductions * - * @return $this + * @return self */ public function setPreTaxDeductions($pre_tax_deductions) { + if (is_null($pre_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deductions cannot be null'); + } $this->container['pre_tax_deductions'] = $pre_tax_deductions; return $this; @@ -813,7 +980,7 @@ public function setPreTaxDeductions($pre_tax_deductions) /** * Gets total_pre_tax_deductions * - * @return double + * @return float|null */ public function getTotalPreTaxDeductions() { @@ -823,12 +990,15 @@ public function getTotalPreTaxDeductions() /** * Sets total_pre_tax_deductions * - * @param double $total_pre_tax_deductions + * @param float|null $total_pre_tax_deductions * - * @return $this + * @return self */ public function setTotalPreTaxDeductions($total_pre_tax_deductions) { + if (is_null($total_pre_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable total_pre_tax_deductions cannot be null'); + } $this->container['total_pre_tax_deductions'] = $total_pre_tax_deductions; return $this; @@ -837,7 +1007,7 @@ public function setTotalPreTaxDeductions($total_pre_tax_deductions) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -847,12 +1017,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -861,7 +1034,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets post_tax_deductions * - * @return map[string,double] + * @return array|null */ public function getPostTaxDeductions() { @@ -871,12 +1044,15 @@ public function getPostTaxDeductions() /** * Sets post_tax_deductions * - * @param map[string,double] $post_tax_deductions + * @param array|null $post_tax_deductions * - * @return $this + * @return self */ public function setPostTaxDeductions($post_tax_deductions) { + if (is_null($post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable post_tax_deductions cannot be null'); + } $this->container['post_tax_deductions'] = $post_tax_deductions; return $this; @@ -885,7 +1061,7 @@ public function setPostTaxDeductions($post_tax_deductions) /** * Gets total_post_tax_deductions * - * @return double + * @return float|null */ public function getTotalPostTaxDeductions() { @@ -895,12 +1071,15 @@ public function getTotalPostTaxDeductions() /** * Sets total_post_tax_deductions * - * @param double $total_post_tax_deductions + * @param float|null $total_post_tax_deductions * - * @return $this + * @return self */ public function setTotalPostTaxDeductions($total_post_tax_deductions) { + if (is_null($total_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable total_post_tax_deductions cannot be null'); + } $this->container['total_post_tax_deductions'] = $total_post_tax_deductions; return $this; @@ -909,7 +1088,7 @@ public function setTotalPostTaxDeductions($total_post_tax_deductions) /** * Gets expenses * - * @return map[string,double] + * @return array|null */ public function getExpenses() { @@ -919,12 +1098,15 @@ public function getExpenses() /** * Sets expenses * - * @param map[string,double] $expenses + * @param array|null $expenses * - * @return $this + * @return self */ public function setExpenses($expenses) { + if (is_null($expenses)) { + throw new \InvalidArgumentException('non-nullable expenses cannot be null'); + } $this->container['expenses'] = $expenses; return $this; @@ -933,7 +1115,7 @@ public function setExpenses($expenses) /** * Gets total_expenses * - * @return double + * @return float|null */ public function getTotalExpenses() { @@ -943,12 +1125,15 @@ public function getTotalExpenses() /** * Sets total_expenses * - * @param double $total_expenses + * @param float|null $total_expenses * - * @return $this + * @return self */ public function setTotalExpenses($total_expenses) { + if (is_null($total_expenses)) { + throw new \InvalidArgumentException('non-nullable total_expenses cannot be null'); + } $this->container['total_expenses'] = $total_expenses; return $this; @@ -957,7 +1142,7 @@ public function setTotalExpenses($total_expenses) /** * Gets bank_payments * - * @return double + * @return float|null */ public function getBankPayments() { @@ -967,12 +1152,15 @@ public function getBankPayments() /** * Sets bank_payments * - * @param double $bank_payments + * @param float|null $bank_payments * - * @return $this + * @return self */ public function setBankPayments($bank_payments) { + if (is_null($bank_payments)) { + throw new \InvalidArgumentException('non-nullable bank_payments cannot be null'); + } $this->container['bank_payments'] = $bank_payments; return $this; @@ -984,7 +1172,7 @@ public function setBankPayments($bank_payments) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -994,22 +1182,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1025,11 +1214,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1037,13 +1239,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuIndividualTimesheetLineModel.php b/src/lib/Model/AuIndividualTimesheetLineModel.php index 9c770bc..b63ff33 100644 --- a/src/lib/Model/AuIndividualTimesheetLineModel.php +++ b/src/lib/Model/AuIndividualTimesheetLineModel.php @@ -2,61 +2,61 @@ /** * AuIndividualTimesheetLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuIndividualTimesheetLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuIndividualTimesheetLineModel implements ModelInterface, ArrayAccess +class AuIndividualTimesheetLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuIndividualTimesheetLineModel'; + protected static $openAPIModelName = 'AuIndividualTimesheetLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'int', 'classification' => 'string', 'location_is_deleted' => 'bool', @@ -64,13 +64,13 @@ class AuIndividualTimesheetLineModel implements ModelInterface, ArrayAccess 'employee_id' => 'int', 'start_time' => '\DateTime', 'end_time' => '\DateTime', - 'units' => 'double', + 'units' => 'float', 'work_type_id' => 'int', 'location_id' => 'int', 'comments' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakModelv3[]', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakModelv3[]', 'status' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'leave_category_id' => 'int', 'pay_category_id' => 'int', 'external_id' => 'string', @@ -79,17 +79,19 @@ class AuIndividualTimesheetLineModel implements ModelInterface, ArrayAccess 'shift_condition_ids' => 'int[]', 'work_type' => 'string', 'fully_qualified_location_name' => 'string', - 'shift_conditions' => '\Swagger\Client\Model\TimesheetShiftConditionModelv3[]', + 'shift_conditions' => '\OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]', 'hidden_comments' => 'string', - 'attachment' => '\Swagger\Client\Model\Attachment' + 'attachment' => '\OpenAPI\Client\Model\Attachment' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => 'int32', 'classification' => null, 'location_is_deleted' => null, @@ -117,14 +119,54 @@ class AuIndividualTimesheetLineModel implements ModelInterface, ArrayAccess 'attachment' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification' => false, + 'location_is_deleted' => false, + 'id' => false, + 'employee_id' => false, + 'start_time' => false, + 'end_time' => false, + 'units' => false, + 'work_type_id' => false, + 'location_id' => false, + 'comments' => false, + 'breaks' => false, + 'status' => false, + 'rate' => false, + 'leave_category_id' => false, + 'pay_category_id' => false, + 'external_id' => false, + 'source' => false, + 'attachment_id' => false, + 'shift_condition_ids' => false, + 'work_type' => false, + 'fully_qualified_location_name' => false, + 'shift_conditions' => false, + 'hidden_comments' => false, + 'attachment' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -132,9 +174,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -275,88 +369,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -443,7 +535,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -460,31 +551,49 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['location_is_deleted'] = isset($data['location_is_deleted']) ? $data['location_is_deleted'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['fully_qualified_location_name'] = isset($data['fully_qualified_location_name']) ? $data['fully_qualified_location_name'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('location_is_deleted', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('fully_qualified_location_name', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('attachment', $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; } /** @@ -499,7 +608,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -522,7 +632,7 @@ public function valid() /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -532,12 +642,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -546,7 +659,7 @@ public function setClassificationId($classification_id) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -556,12 +669,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -570,7 +686,7 @@ public function setClassification($classification) /** * Gets location_is_deleted * - * @return bool + * @return bool|null */ public function getLocationIsDeleted() { @@ -580,12 +696,15 @@ public function getLocationIsDeleted() /** * Sets location_is_deleted * - * @param bool $location_is_deleted + * @param bool|null $location_is_deleted * - * @return $this + * @return self */ public function setLocationIsDeleted($location_is_deleted) { + if (is_null($location_is_deleted)) { + throw new \InvalidArgumentException('non-nullable location_is_deleted cannot be null'); + } $this->container['location_is_deleted'] = $location_is_deleted; return $this; @@ -594,7 +713,7 @@ public function setLocationIsDeleted($location_is_deleted) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -604,12 +723,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -618,7 +740,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -628,12 +750,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -642,7 +767,7 @@ public function setEmployeeId($employee_id) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -652,12 +777,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -666,7 +794,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -676,12 +804,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -690,7 +821,7 @@ public function setEndTime($end_time) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -700,12 +831,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -714,7 +848,7 @@ public function setUnits($units) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -724,12 +858,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -738,7 +875,7 @@ public function setWorkTypeId($work_type_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -748,12 +885,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -762,7 +902,7 @@ public function setLocationId($location_id) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -772,12 +912,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -786,7 +929,7 @@ public function setComments($comments) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakModelv3[] + * @return \OpenAPI\Client\Model\TimesheetBreakModelv3[]|null */ public function getBreaks() { @@ -796,12 +939,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakModelv3[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakModelv3[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -810,7 +956,7 @@ public function setBreaks($breaks) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -820,12 +966,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -834,7 +983,7 @@ public function setStatus($status) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -844,12 +993,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -858,7 +1010,7 @@ public function setRate($rate) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -868,12 +1020,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -882,7 +1037,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -892,12 +1047,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -906,7 +1064,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -916,12 +1074,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -930,7 +1091,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -940,17 +1101,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -963,7 +1128,7 @@ public function setSource($source) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -973,12 +1138,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -987,7 +1155,7 @@ public function setAttachmentId($attachment_id) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -997,12 +1165,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -1011,7 +1182,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets work_type * - * @return string + * @return string|null */ public function getWorkType() { @@ -1021,12 +1192,15 @@ public function getWorkType() /** * Sets work_type * - * @param string $work_type + * @param string|null $work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -1035,7 +1209,7 @@ public function setWorkType($work_type) /** * Gets fully_qualified_location_name * - * @return string + * @return string|null */ public function getFullyQualifiedLocationName() { @@ -1045,12 +1219,15 @@ public function getFullyQualifiedLocationName() /** * Sets fully_qualified_location_name * - * @param string $fully_qualified_location_name + * @param string|null $fully_qualified_location_name * - * @return $this + * @return self */ public function setFullyQualifiedLocationName($fully_qualified_location_name) { + if (is_null($fully_qualified_location_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_location_name cannot be null'); + } $this->container['fully_qualified_location_name'] = $fully_qualified_location_name; return $this; @@ -1059,7 +1236,7 @@ public function setFullyQualifiedLocationName($fully_qualified_location_name) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\TimesheetShiftConditionModelv3[] + * @return \OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]|null */ public function getShiftConditions() { @@ -1069,12 +1246,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\TimesheetShiftConditionModelv3[] $shift_conditions + * @param \OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -1083,7 +1263,7 @@ public function setShiftConditions($shift_conditions) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -1093,12 +1273,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -1107,7 +1290,7 @@ public function setHiddenComments($hidden_comments) /** * Gets attachment * - * @return \Swagger\Client\Model\Attachment + * @return \OpenAPI\Client\Model\Attachment|null */ public function getAttachment() { @@ -1117,12 +1300,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\Attachment $attachment + * @param \OpenAPI\Client\Model\Attachment|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -1134,7 +1320,7 @@ public function setAttachment($attachment) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1144,22 +1330,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1175,11 +1362,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1187,13 +1387,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuInitialDeductionModel.php b/src/lib/Model/AuInitialDeductionModel.php index 048159f..5334eb3 100644 --- a/src/lib/Model/AuInitialDeductionModel.php +++ b/src/lib/Model/AuInitialDeductionModel.php @@ -2,76 +2,78 @@ /** * AuInitialDeductionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuInitialDeductionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuInitialDeductionModel implements ModelInterface, ArrayAccess +class AuInitialDeductionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuInitialDeductionModel'; + protected static $openAPIModelName = 'AuInitialDeductionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_resc' => 'bool', 'tax_exempt' => 'bool', 'is_member_voluntary' => 'bool', 'is_resc_status_read_only' => 'bool', 'deduction_category_id' => 'int', 'name' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_resc' => null, 'tax_exempt' => null, 'is_member_voluntary' => null, @@ -81,14 +83,36 @@ class AuInitialDeductionModel implements ModelInterface, ArrayAccess 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_resc' => false, + 'tax_exempt' => false, + 'is_member_voluntary' => false, + 'is_resc_status_read_only' => false, + 'deduction_category_id' => false, + 'name' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['is_resc'] = isset($data['is_resc']) ? $data['is_resc'] : null; - $this->container['tax_exempt'] = isset($data['tax_exempt']) ? $data['tax_exempt'] : null; - $this->container['is_member_voluntary'] = isset($data['is_member_voluntary']) ? $data['is_member_voluntary'] : null; - $this->container['is_resc_status_read_only'] = isset($data['is_resc_status_read_only']) ? $data['is_resc_status_read_only'] : null; - $this->container['deduction_category_id'] = isset($data['deduction_category_id']) ? $data['deduction_category_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('is_resc', $data ?? [], null); + $this->setIfExists('tax_exempt', $data ?? [], null); + $this->setIfExists('is_member_voluntary', $data ?? [], null); + $this->setIfExists('is_resc_status_read_only', $data ?? [], null); + $this->setIfExists('deduction_category_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets is_resc * - * @return bool + * @return bool|null */ public function getIsResc() { @@ -253,12 +344,15 @@ public function getIsResc() /** * Sets is_resc * - * @param bool $is_resc + * @param bool|null $is_resc * - * @return $this + * @return self */ public function setIsResc($is_resc) { + if (is_null($is_resc)) { + throw new \InvalidArgumentException('non-nullable is_resc cannot be null'); + } $this->container['is_resc'] = $is_resc; return $this; @@ -267,7 +361,7 @@ public function setIsResc($is_resc) /** * Gets tax_exempt * - * @return bool + * @return bool|null */ public function getTaxExempt() { @@ -277,12 +371,15 @@ public function getTaxExempt() /** * Sets tax_exempt * - * @param bool $tax_exempt + * @param bool|null $tax_exempt * - * @return $this + * @return self */ public function setTaxExempt($tax_exempt) { + if (is_null($tax_exempt)) { + throw new \InvalidArgumentException('non-nullable tax_exempt cannot be null'); + } $this->container['tax_exempt'] = $tax_exempt; return $this; @@ -291,7 +388,7 @@ public function setTaxExempt($tax_exempt) /** * Gets is_member_voluntary * - * @return bool + * @return bool|null */ public function getIsMemberVoluntary() { @@ -301,12 +398,15 @@ public function getIsMemberVoluntary() /** * Sets is_member_voluntary * - * @param bool $is_member_voluntary + * @param bool|null $is_member_voluntary * - * @return $this + * @return self */ public function setIsMemberVoluntary($is_member_voluntary) { + if (is_null($is_member_voluntary)) { + throw new \InvalidArgumentException('non-nullable is_member_voluntary cannot be null'); + } $this->container['is_member_voluntary'] = $is_member_voluntary; return $this; @@ -315,7 +415,7 @@ public function setIsMemberVoluntary($is_member_voluntary) /** * Gets is_resc_status_read_only * - * @return bool + * @return bool|null */ public function getIsRescStatusReadOnly() { @@ -325,12 +425,15 @@ public function getIsRescStatusReadOnly() /** * Sets is_resc_status_read_only * - * @param bool $is_resc_status_read_only + * @param bool|null $is_resc_status_read_only * - * @return $this + * @return self */ public function setIsRescStatusReadOnly($is_resc_status_read_only) { + if (is_null($is_resc_status_read_only)) { + throw new \InvalidArgumentException('non-nullable is_resc_status_read_only cannot be null'); + } $this->container['is_resc_status_read_only'] = $is_resc_status_read_only; return $this; @@ -339,7 +442,7 @@ public function setIsRescStatusReadOnly($is_resc_status_read_only) /** * Gets deduction_category_id * - * @return int + * @return int|null */ public function getDeductionCategoryId() { @@ -349,12 +452,15 @@ public function getDeductionCategoryId() /** * Sets deduction_category_id * - * @param int $deduction_category_id + * @param int|null $deduction_category_id * - * @return $this + * @return self */ public function setDeductionCategoryId($deduction_category_id) { + if (is_null($deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id cannot be null'); + } $this->container['deduction_category_id'] = $deduction_category_id; return $this; @@ -363,7 +469,7 @@ public function setDeductionCategoryId($deduction_category_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -373,12 +479,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -387,7 +496,7 @@ public function setName($name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -397,12 +506,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -414,7 +526,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuInitialEarningsModel.php b/src/lib/Model/AuInitialEarningsModel.php index 5514f92..eab19b4 100644 --- a/src/lib/Model/AuInitialEarningsModel.php +++ b/src/lib/Model/AuInitialEarningsModel.php @@ -2,74 +2,76 @@ /** * AuInitialEarningsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuInitialEarningsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuInitialEarningsModel implements ModelInterface, ArrayAccess +class AuInitialEarningsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuInitialEarningsModel'; + protected static $openAPIModelName = 'AuInitialEarningsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_category_type' => 'string', 'pay_category_id' => 'int', 'is_standard_pay_category' => 'bool', 'name' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_category_type' => null, 'pay_category_id' => 'int32', 'is_standard_pay_category' => null, @@ -77,14 +79,34 @@ class AuInitialEarningsModel implements ModelInterface, ArrayAccess 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_category_type' => false, + 'pay_category_id' => false, + 'is_standard_pay_category' => false, + 'name' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,36 +249,34 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const PAY_CATEGORY_TYPE_STANDARD = 'Standard'; - const PAY_CATEGORY_TYPE_LEAVE_LOADING = 'LeaveLoading'; - const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_PAYMENT = 'GenuineRedundancyLeavePayment'; - const PAY_CATEGORY_TYPE_OPENING_BALANCE_ALLOWANCES = 'OpeningBalanceAllowances'; - const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAXABLE = 'EtpTypeRTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAX_FREE = 'EtpTypeRTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAXABLE = 'EtpTypeOTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAX_FREE = 'EtpTypeOTaxFree'; - const PAY_CATEGORY_TYPE_ETP_LUMP_SUM_D = 'EtpLumpSumD'; - const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_LOADING = 'GenuineRedundancyLeaveLoading'; - const PAY_CATEGORY_TYPE_METHOD_B2_ADDITIONAL_PAYMENTS_OPENING_BALANCE = 'MethodB2AdditionalPaymentsOpeningBalance'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAXABLE = 'EtpSuperableTypeOTaxable'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAX_FREE = 'EtpSuperableTypeOTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_O_UNUSED_LEAVE_PAYMENT = 'EtpTypeOUnusedLeavePayment'; - const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAXABLE = 'EtpTypeSTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAX_FREE = 'EtpTypeSTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAXABLE = 'EtpTypePTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAX_FREE = 'EtpTypePTaxFree'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAXABLE = 'EtpSuperableTypePTaxable'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAX_FREE = 'EtpSuperableTypePTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_P_UNUSED_LEAVE_PAYMENT = 'EtpTypePUnusedLeavePayment'; - const PAY_CATEGORY_TYPE_NORMAL_TERMINATION_LEAVE_LOADING = 'NormalTerminationLeaveLoading'; - const PAY_CATEGORY_TYPE_UNUSED_LEAVE_PAYMENT_NORMAL_TERMINATION = 'UnusedLeavePaymentNormalTermination'; - const PAY_CATEGORY_TYPE_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'PaidFamilyAndDomesticViolenceLeave'; - - - + return self::$openAPIModelName; + } + + public const PAY_CATEGORY_TYPE_STANDARD = 'Standard'; + public const PAY_CATEGORY_TYPE_LEAVE_LOADING = 'LeaveLoading'; + public const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_PAYMENT = 'GenuineRedundancyLeavePayment'; + public const PAY_CATEGORY_TYPE_OPENING_BALANCE_ALLOWANCES = 'OpeningBalanceAllowances'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAXABLE = 'EtpTypeRTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAX_FREE = 'EtpTypeRTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAXABLE = 'EtpTypeOTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAX_FREE = 'EtpTypeOTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_LUMP_SUM_D = 'EtpLumpSumD'; + public const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_LOADING = 'GenuineRedundancyLeaveLoading'; + public const PAY_CATEGORY_TYPE_METHOD_B2_ADDITIONAL_PAYMENTS_OPENING_BALANCE = 'MethodB2AdditionalPaymentsOpeningBalance'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAXABLE = 'EtpSuperableTypeOTaxable'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAX_FREE = 'EtpSuperableTypeOTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_O_UNUSED_LEAVE_PAYMENT = 'EtpTypeOUnusedLeavePayment'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAXABLE = 'EtpTypeSTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAX_FREE = 'EtpTypeSTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAXABLE = 'EtpTypePTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAX_FREE = 'EtpTypePTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAXABLE = 'EtpSuperableTypePTaxable'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAX_FREE = 'EtpSuperableTypePTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_P_UNUSED_LEAVE_PAYMENT = 'EtpTypePUnusedLeavePayment'; + public const PAY_CATEGORY_TYPE_NORMAL_TERMINATION_LEAVE_LOADING = 'NormalTerminationLeaveLoading'; + public const PAY_CATEGORY_TYPE_UNUSED_LEAVE_PAYMENT_NORMAL_TERMINATION = 'UnusedLeavePaymentNormalTermination'; + public const PAY_CATEGORY_TYPE_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'PaidFamilyAndDomesticViolenceLeave'; + /** * Gets allowable values of the enum * @@ -239,7 +311,6 @@ public function getPayCategoryTypeAllowableValues() self::PAY_CATEGORY_TYPE_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE, ]; } - /** * Associative array for storing property values @@ -256,11 +327,29 @@ public function getPayCategoryTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['pay_category_type'] = isset($data['pay_category_type']) ? $data['pay_category_type'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['is_standard_pay_category'] = isset($data['is_standard_pay_category']) ? $data['is_standard_pay_category'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('pay_category_type', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('is_standard_pay_category', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -275,7 +364,8 @@ public function listInvalidProperties() $allowedValues = $this->getPayCategoryTypeAllowableValues(); if (!is_null($this->container['pay_category_type']) && !in_array($this->container['pay_category_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'pay_category_type', must be one of '%s'", + "invalid value '%s' for 'pay_category_type', must be one of '%s'", + $this->container['pay_category_type'], implode("', '", $allowedValues) ); } @@ -298,7 +388,7 @@ public function valid() /** * Gets pay_category_type * - * @return string + * @return string|null */ public function getPayCategoryType() { @@ -308,17 +398,21 @@ public function getPayCategoryType() /** * Sets pay_category_type * - * @param string $pay_category_type

Note: The amounts specified for any ETP-related pay categories (with the exception of Lump Sum D) must represent the total of the corresponding amounts supplied in the etps collection + * @param string|null $pay_category_type

Note: The amounts specified for any ETP-related pay categories (with the exception of Lump Sum D) must represent the total of the corresponding amounts supplied in the etps collection * - * @return $this + * @return self */ public function setPayCategoryType($pay_category_type) { + if (is_null($pay_category_type)) { + throw new \InvalidArgumentException('non-nullable pay_category_type cannot be null'); + } $allowedValues = $this->getPayCategoryTypeAllowableValues(); - if (!is_null($pay_category_type) && !in_array($pay_category_type, $allowedValues, true)) { + if (!in_array($pay_category_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'pay_category_type', must be one of '%s'", + "Invalid value '%s' for 'pay_category_type', must be one of '%s'", + $pay_category_type, implode("', '", $allowedValues) ) ); @@ -331,7 +425,7 @@ public function setPayCategoryType($pay_category_type) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -341,12 +435,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -355,7 +452,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets is_standard_pay_category * - * @return bool + * @return bool|null */ public function getIsStandardPayCategory() { @@ -365,12 +462,15 @@ public function getIsStandardPayCategory() /** * Sets is_standard_pay_category * - * @param bool $is_standard_pay_category + * @param bool|null $is_standard_pay_category * - * @return $this + * @return self */ public function setIsStandardPayCategory($is_standard_pay_category) { + if (is_null($is_standard_pay_category)) { + throw new \InvalidArgumentException('non-nullable is_standard_pay_category cannot be null'); + } $this->container['is_standard_pay_category'] = $is_standard_pay_category; return $this; @@ -379,7 +479,7 @@ public function setIsStandardPayCategory($is_standard_pay_category) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -389,12 +489,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -403,7 +506,7 @@ public function setName($name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -413,12 +516,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -430,7 +536,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -440,22 +546,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -471,11 +578,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -483,13 +603,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuInitiateEmployeeOnboardingApiModel.php b/src/lib/Model/AuInitiateEmployeeOnboardingApiModel.php index 321ea07..81280b6 100644 --- a/src/lib/Model/AuInitiateEmployeeOnboardingApiModel.php +++ b/src/lib/Model/AuInitiateEmployeeOnboardingApiModel.php @@ -2,61 +2,61 @@ /** * AuInitiateEmployeeOnboardingApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuInitiateEmployeeOnboardingApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuInitiateEmployeeOnboardingApiModel implements ModelInterface, ArrayAccess +class AuInitiateEmployeeOnboardingApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuInitiateEmployeeOnboardingApiModel'; + protected static $openAPIModelName = 'AuInitiateEmployeeOnboardingApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employing_entity_id' => 'int', 'id' => 'int', 'title' => 'int', @@ -72,8 +72,10 @@ class AuInitiateEmployeeOnboardingApiModel implements ModelInterface, ArrayAcces * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employing_entity_id' => 'int32', 'id' => 'int32', 'title' => 'int32', @@ -85,14 +87,38 @@ class AuInitiateEmployeeOnboardingApiModel implements ModelInterface, ArrayAcces 'emergency_contact_details_required' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employing_entity_id' => false, + 'id' => false, + 'title' => false, + 'first_name' => false, + 'surname' => false, + 'email' => false, + 'mobile' => false, + 'qualifications_required' => false, + 'emergency_contact_details_required' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['mobile'] = isset($data['mobile']) ? $data['mobile'] : null; - $this->container['qualifications_required'] = isset($data['qualifications_required']) ? $data['qualifications_required'] : null; - $this->container['emergency_contact_details_required'] = isset($data['emergency_contact_details_required']) ? $data['emergency_contact_details_required'] : null; + $this->setIfExists('employing_entity_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('mobile', $data ?? [], null); + $this->setIfExists('qualifications_required', $data ?? [], null); + $this->setIfExists('emergency_contact_details_required', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -265,12 +358,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -279,7 +375,7 @@ public function setEmployingEntityId($employing_entity_id) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -289,12 +385,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -303,7 +402,7 @@ public function setId($id) /** * Gets title * - * @return int + * @return int|null */ public function getTitle() { @@ -313,12 +412,15 @@ public function getTitle() /** * Sets title * - * @param int $title + * @param int|null $title * - * @return $this + * @return self */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -327,7 +429,7 @@ public function setTitle($title) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -337,12 +439,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -351,7 +456,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -361,12 +466,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -375,7 +483,7 @@ public function setSurname($surname) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -385,12 +493,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -399,7 +510,7 @@ public function setEmail($email) /** * Gets mobile * - * @return string + * @return string|null */ public function getMobile() { @@ -409,12 +520,15 @@ public function getMobile() /** * Sets mobile * - * @param string $mobile + * @param string|null $mobile * - * @return $this + * @return self */ public function setMobile($mobile) { + if (is_null($mobile)) { + throw new \InvalidArgumentException('non-nullable mobile cannot be null'); + } $this->container['mobile'] = $mobile; return $this; @@ -423,7 +537,7 @@ public function setMobile($mobile) /** * Gets qualifications_required * - * @return bool + * @return bool|null */ public function getQualificationsRequired() { @@ -433,12 +547,15 @@ public function getQualificationsRequired() /** * Sets qualifications_required * - * @param bool $qualifications_required + * @param bool|null $qualifications_required * - * @return $this + * @return self */ public function setQualificationsRequired($qualifications_required) { + if (is_null($qualifications_required)) { + throw new \InvalidArgumentException('non-nullable qualifications_required cannot be null'); + } $this->container['qualifications_required'] = $qualifications_required; return $this; @@ -447,7 +564,7 @@ public function setQualificationsRequired($qualifications_required) /** * Gets emergency_contact_details_required * - * @return bool + * @return bool|null */ public function getEmergencyContactDetailsRequired() { @@ -457,12 +574,15 @@ public function getEmergencyContactDetailsRequired() /** * Sets emergency_contact_details_required * - * @param bool $emergency_contact_details_required + * @param bool|null $emergency_contact_details_required * - * @return $this + * @return self */ public function setEmergencyContactDetailsRequired($emergency_contact_details_required) { + if (is_null($emergency_contact_details_required)) { + throw new \InvalidArgumentException('non-nullable emergency_contact_details_required cannot be null'); + } $this->container['emergency_contact_details_required'] = $emergency_contact_details_required; return $this; @@ -474,7 +594,7 @@ public function setEmergencyContactDetailsRequired($emergency_contact_details_re * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuJournalItemResponse.php b/src/lib/Model/AuJournalItemResponse.php index b514023..b235362 100644 --- a/src/lib/Model/AuJournalItemResponse.php +++ b/src/lib/Model/AuJournalItemResponse.php @@ -2,66 +2,66 @@ /** * AuJournalItemResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuJournalItemResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuJournalItemResponse implements ModelInterface, ArrayAccess +class AuJournalItemResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuJournalItemResponse'; + protected static $openAPIModelName = 'AuJournalItemResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'journal_item_type' => 'string', 'external_account_reference_id' => 'string', - 'units' => 'double', - 'amount' => 'double', - 'amount_unrounded' => 'double', + 'units' => 'float', + 'amount' => 'float', + 'amount_unrounded' => 'float', 'reference' => 'string', 'tax_code' => 'string', 'account_code' => 'string', @@ -72,15 +72,17 @@ class AuJournalItemResponse implements ModelInterface, ArrayAccess 'is_debit' => 'bool', 'location_external_reference_id' => 'string', 'reporting_dimension_value_ids' => 'int[]', - 'reporting_dimension_value_names' => 'map[string,string[]]' + 'reporting_dimension_value_names' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'journal_item_type' => null, 'external_account_reference_id' => null, 'units' => 'double', @@ -99,14 +101,45 @@ class AuJournalItemResponse implements ModelInterface, ArrayAccess 'reporting_dimension_value_names' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'journal_item_type' => false, + 'external_account_reference_id' => false, + 'units' => false, + 'amount' => false, + 'amount_unrounded' => false, + 'reference' => false, + 'tax_code' => false, + 'account_code' => false, + 'account_name' => false, + 'details' => false, + 'location' => false, + 'is_credit' => false, + 'is_debit' => false, + 'location_external_reference_id' => false, + 'reporting_dimension_value_ids' => false, + 'reporting_dimension_value_names' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -114,9 +147,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -230,46 +315,44 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const JOURNAL_ITEM_TYPE_ASSET = 'Asset'; - const JOURNAL_ITEM_TYPE_PAYG_EXPENSE = 'PaygExpense'; - const JOURNAL_ITEM_TYPE_PAYG_LIABILITY = 'PaygLiability'; - const JOURNAL_ITEM_TYPE_STUDENT_LOAN_LIABILITY = 'StudentLoanLiability'; - const JOURNAL_ITEM_TYPE_POST_GRADUATE_STUDENT_LOAN_LIABILITY = 'PostGraduateStudentLoanLiability'; - const JOURNAL_ITEM_TYPE_SUPER_EXPENSE = 'SuperExpense'; - const JOURNAL_ITEM_TYPE_SUPER_LIABILITY = 'SuperLiability'; - const JOURNAL_ITEM_TYPE_DEFAULT_EXPENSE = 'DefaultExpense'; - const JOURNAL_ITEM_TYPE_WAGES_EXPENSE = 'WagesExpense'; - const JOURNAL_ITEM_TYPE_DEFAULT_SALARY_SACRIFICE_EXPENSE = 'DefaultSalarySacrificeExpense'; - const JOURNAL_ITEM_TYPE_DEFAULT_SALARY_SACRIFICE_LIABILITY = 'DefaultSalarySacrificeLiability'; - const JOURNAL_ITEM_TYPE_DEFAULT_DEDUCTION_EXPENSE = 'DefaultDeductionExpense'; - const JOURNAL_ITEM_TYPE_DEFAULT_DEDUCTION_LIABILITY = 'DefaultDeductionLiability'; - const JOURNAL_ITEM_TYPE_DEFAULT_EMPLOYER_LIABILITY_EXPENSE = 'DefaultEmployerLiabilityExpense'; - const JOURNAL_ITEM_TYPE_DEFAULT_EMPLOYER_LIABILITY_LIABILITY = 'DefaultEmployerLiabilityLiability'; - const JOURNAL_ITEM_TYPE_DEDUCTION_EXPENSE = 'DeductionExpense'; - const JOURNAL_ITEM_TYPE_DEDUCTION_LIABILITY = 'DeductionLiability'; - const JOURNAL_ITEM_TYPE_DEDUCTION_ASSET = 'DeductionAsset'; - const JOURNAL_ITEM_TYPE_DEFAULT_EMPLOYEE_EXPENSE = 'DefaultEmployeeExpense'; - const JOURNAL_ITEM_TYPE_EMPLOYEE_EXPENSE = 'EmployeeExpense'; - const JOURNAL_ITEM_TYPE_PRE_TAX_DEDUCTION_LIABILITY = 'PreTaxDeductionLiability'; - const JOURNAL_ITEM_TYPE_POST_TAX_DEDUCTION_LIABILITY = 'PostTaxDeductionLiability'; - const JOURNAL_ITEM_TYPE_EMPLOYER_LIABILITY_EXPENSE = 'EmployerLiabilityExpense'; - const JOURNAL_ITEM_TYPE_EMPLOYER_LIABILITY_LIABILITY = 'EmployerLiabilityLiability'; - const JOURNAL_ITEM_TYPE_W1_EXEMPT_WAGES_EXPENSE = 'W1ExemptWagesExpense'; - const JOURNAL_ITEM_TYPE_PRE_TAX_DEDUCTION_ASSET = 'PreTaxDeductionAsset'; - const JOURNAL_ITEM_TYPE_INTER_COMPANY_LOAN_CREDIT = 'InterCompanyLoanCredit'; - const JOURNAL_ITEM_TYPE_INTER_COMPANY_LOAN_DEBIT = 'InterCompanyLoanDebit'; - const JOURNAL_ITEM_TYPE_LEAVE_ACCRUAL_LIABILITY = 'LeaveAccrualLiability'; - const JOURNAL_ITEM_TYPE_LEAVE_ACCRUAL_EXPENSE = 'LeaveAccrualExpense'; - const JOURNAL_ITEM_TYPE_LEAVE_TAKEN_LIABILITY = 'LeaveTakenLiability'; - const JOURNAL_ITEM_TYPE_LEAVE_TAKEN_EXPENSE = 'LeaveTakenExpense'; - const JOURNAL_ITEM_TYPE_LEAVE_ADJUSTMENT_LIABILITY = 'LeaveAdjustmentLiability'; - const JOURNAL_ITEM_TYPE_LEAVE_ADJUSTMENT_EXPENSE = 'LeaveAdjustmentExpense'; - - - + return self::$openAPIModelName; + } + + public const JOURNAL_ITEM_TYPE_ASSET = 'Asset'; + public const JOURNAL_ITEM_TYPE_PAYG_EXPENSE = 'PaygExpense'; + public const JOURNAL_ITEM_TYPE_PAYG_LIABILITY = 'PaygLiability'; + public const JOURNAL_ITEM_TYPE_STUDENT_LOAN_LIABILITY = 'StudentLoanLiability'; + public const JOURNAL_ITEM_TYPE_POST_GRADUATE_STUDENT_LOAN_LIABILITY = 'PostGraduateStudentLoanLiability'; + public const JOURNAL_ITEM_TYPE_SUPER_EXPENSE = 'SuperExpense'; + public const JOURNAL_ITEM_TYPE_SUPER_LIABILITY = 'SuperLiability'; + public const JOURNAL_ITEM_TYPE_DEFAULT_EXPENSE = 'DefaultExpense'; + public const JOURNAL_ITEM_TYPE_WAGES_EXPENSE = 'WagesExpense'; + public const JOURNAL_ITEM_TYPE_DEFAULT_SALARY_SACRIFICE_EXPENSE = 'DefaultSalarySacrificeExpense'; + public const JOURNAL_ITEM_TYPE_DEFAULT_SALARY_SACRIFICE_LIABILITY = 'DefaultSalarySacrificeLiability'; + public const JOURNAL_ITEM_TYPE_DEFAULT_DEDUCTION_EXPENSE = 'DefaultDeductionExpense'; + public const JOURNAL_ITEM_TYPE_DEFAULT_DEDUCTION_LIABILITY = 'DefaultDeductionLiability'; + public const JOURNAL_ITEM_TYPE_DEFAULT_EMPLOYER_LIABILITY_EXPENSE = 'DefaultEmployerLiabilityExpense'; + public const JOURNAL_ITEM_TYPE_DEFAULT_EMPLOYER_LIABILITY_LIABILITY = 'DefaultEmployerLiabilityLiability'; + public const JOURNAL_ITEM_TYPE_DEDUCTION_EXPENSE = 'DeductionExpense'; + public const JOURNAL_ITEM_TYPE_DEDUCTION_LIABILITY = 'DeductionLiability'; + public const JOURNAL_ITEM_TYPE_DEDUCTION_ASSET = 'DeductionAsset'; + public const JOURNAL_ITEM_TYPE_DEFAULT_EMPLOYEE_EXPENSE = 'DefaultEmployeeExpense'; + public const JOURNAL_ITEM_TYPE_EMPLOYEE_EXPENSE = 'EmployeeExpense'; + public const JOURNAL_ITEM_TYPE_PRE_TAX_DEDUCTION_LIABILITY = 'PreTaxDeductionLiability'; + public const JOURNAL_ITEM_TYPE_POST_TAX_DEDUCTION_LIABILITY = 'PostTaxDeductionLiability'; + public const JOURNAL_ITEM_TYPE_EMPLOYER_LIABILITY_EXPENSE = 'EmployerLiabilityExpense'; + public const JOURNAL_ITEM_TYPE_EMPLOYER_LIABILITY_LIABILITY = 'EmployerLiabilityLiability'; + public const JOURNAL_ITEM_TYPE_W1_EXEMPT_WAGES_EXPENSE = 'W1ExemptWagesExpense'; + public const JOURNAL_ITEM_TYPE_PRE_TAX_DEDUCTION_ASSET = 'PreTaxDeductionAsset'; + public const JOURNAL_ITEM_TYPE_INTER_COMPANY_LOAN_CREDIT = 'InterCompanyLoanCredit'; + public const JOURNAL_ITEM_TYPE_INTER_COMPANY_LOAN_DEBIT = 'InterCompanyLoanDebit'; + public const JOURNAL_ITEM_TYPE_LEAVE_ACCRUAL_LIABILITY = 'LeaveAccrualLiability'; + public const JOURNAL_ITEM_TYPE_LEAVE_ACCRUAL_EXPENSE = 'LeaveAccrualExpense'; + public const JOURNAL_ITEM_TYPE_LEAVE_TAKEN_LIABILITY = 'LeaveTakenLiability'; + public const JOURNAL_ITEM_TYPE_LEAVE_TAKEN_EXPENSE = 'LeaveTakenExpense'; + public const JOURNAL_ITEM_TYPE_LEAVE_ADJUSTMENT_LIABILITY = 'LeaveAdjustmentLiability'; + public const JOURNAL_ITEM_TYPE_LEAVE_ADJUSTMENT_EXPENSE = 'LeaveAdjustmentExpense'; + /** * Gets allowable values of the enum * @@ -314,7 +397,6 @@ public function getJournalItemTypeAllowableValues() self::JOURNAL_ITEM_TYPE_LEAVE_ADJUSTMENT_EXPENSE, ]; } - /** * Associative array for storing property values @@ -331,22 +413,40 @@ public function getJournalItemTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['journal_item_type'] = isset($data['journal_item_type']) ? $data['journal_item_type'] : null; - $this->container['external_account_reference_id'] = isset($data['external_account_reference_id']) ? $data['external_account_reference_id'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['amount_unrounded'] = isset($data['amount_unrounded']) ? $data['amount_unrounded'] : null; - $this->container['reference'] = isset($data['reference']) ? $data['reference'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['account_code'] = isset($data['account_code']) ? $data['account_code'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['details'] = isset($data['details']) ? $data['details'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['is_credit'] = isset($data['is_credit']) ? $data['is_credit'] : null; - $this->container['is_debit'] = isset($data['is_debit']) ? $data['is_debit'] : null; - $this->container['location_external_reference_id'] = isset($data['location_external_reference_id']) ? $data['location_external_reference_id'] : null; - $this->container['reporting_dimension_value_ids'] = isset($data['reporting_dimension_value_ids']) ? $data['reporting_dimension_value_ids'] : null; - $this->container['reporting_dimension_value_names'] = isset($data['reporting_dimension_value_names']) ? $data['reporting_dimension_value_names'] : null; + $this->setIfExists('journal_item_type', $data ?? [], null); + $this->setIfExists('external_account_reference_id', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('amount_unrounded', $data ?? [], null); + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('account_code', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('is_credit', $data ?? [], null); + $this->setIfExists('is_debit', $data ?? [], null); + $this->setIfExists('location_external_reference_id', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_ids', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_names', $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; } /** @@ -361,7 +461,8 @@ public function listInvalidProperties() $allowedValues = $this->getJournalItemTypeAllowableValues(); if (!is_null($this->container['journal_item_type']) && !in_array($this->container['journal_item_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'journal_item_type', must be one of '%s'", + "invalid value '%s' for 'journal_item_type', must be one of '%s'", + $this->container['journal_item_type'], implode("', '", $allowedValues) ); } @@ -384,7 +485,7 @@ public function valid() /** * Gets journal_item_type * - * @return string + * @return string|null */ public function getJournalItemType() { @@ -394,17 +495,21 @@ public function getJournalItemType() /** * Sets journal_item_type * - * @param string $journal_item_type + * @param string|null $journal_item_type * - * @return $this + * @return self */ public function setJournalItemType($journal_item_type) { + if (is_null($journal_item_type)) { + throw new \InvalidArgumentException('non-nullable journal_item_type cannot be null'); + } $allowedValues = $this->getJournalItemTypeAllowableValues(); - if (!is_null($journal_item_type) && !in_array($journal_item_type, $allowedValues, true)) { + if (!in_array($journal_item_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'journal_item_type', must be one of '%s'", + "Invalid value '%s' for 'journal_item_type', must be one of '%s'", + $journal_item_type, implode("', '", $allowedValues) ) ); @@ -417,7 +522,7 @@ public function setJournalItemType($journal_item_type) /** * Gets external_account_reference_id * - * @return string + * @return string|null */ public function getExternalAccountReferenceId() { @@ -427,12 +532,15 @@ public function getExternalAccountReferenceId() /** * Sets external_account_reference_id * - * @param string $external_account_reference_id + * @param string|null $external_account_reference_id * - * @return $this + * @return self */ public function setExternalAccountReferenceId($external_account_reference_id) { + if (is_null($external_account_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_account_reference_id cannot be null'); + } $this->container['external_account_reference_id'] = $external_account_reference_id; return $this; @@ -441,7 +549,7 @@ public function setExternalAccountReferenceId($external_account_reference_id) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -451,12 +559,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -465,7 +576,7 @@ public function setUnits($units) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -475,12 +586,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -489,7 +603,7 @@ public function setAmount($amount) /** * Gets amount_unrounded * - * @return double + * @return float|null */ public function getAmountUnrounded() { @@ -499,12 +613,15 @@ public function getAmountUnrounded() /** * Sets amount_unrounded * - * @param double $amount_unrounded + * @param float|null $amount_unrounded * - * @return $this + * @return self */ public function setAmountUnrounded($amount_unrounded) { + if (is_null($amount_unrounded)) { + throw new \InvalidArgumentException('non-nullable amount_unrounded cannot be null'); + } $this->container['amount_unrounded'] = $amount_unrounded; return $this; @@ -513,7 +630,7 @@ public function setAmountUnrounded($amount_unrounded) /** * Gets reference * - * @return string + * @return string|null */ public function getReference() { @@ -523,12 +640,15 @@ public function getReference() /** * Sets reference * - * @param string $reference + * @param string|null $reference * - * @return $this + * @return self */ public function setReference($reference) { + if (is_null($reference)) { + throw new \InvalidArgumentException('non-nullable reference cannot be null'); + } $this->container['reference'] = $reference; return $this; @@ -537,7 +657,7 @@ public function setReference($reference) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -547,12 +667,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -561,7 +684,7 @@ public function setTaxCode($tax_code) /** * Gets account_code * - * @return string + * @return string|null */ public function getAccountCode() { @@ -571,12 +694,15 @@ public function getAccountCode() /** * Sets account_code * - * @param string $account_code + * @param string|null $account_code * - * @return $this + * @return self */ public function setAccountCode($account_code) { + if (is_null($account_code)) { + throw new \InvalidArgumentException('non-nullable account_code cannot be null'); + } $this->container['account_code'] = $account_code; return $this; @@ -585,7 +711,7 @@ public function setAccountCode($account_code) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -595,12 +721,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -609,7 +738,7 @@ public function setAccountName($account_name) /** * Gets details * - * @return string + * @return string|null */ public function getDetails() { @@ -619,12 +748,15 @@ public function getDetails() /** * Sets details * - * @param string $details + * @param string|null $details * - * @return $this + * @return self */ public function setDetails($details) { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } $this->container['details'] = $details; return $this; @@ -633,7 +765,7 @@ public function setDetails($details) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -643,12 +775,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -657,7 +792,7 @@ public function setLocation($location) /** * Gets is_credit * - * @return bool + * @return bool|null */ public function getIsCredit() { @@ -667,12 +802,15 @@ public function getIsCredit() /** * Sets is_credit * - * @param bool $is_credit + * @param bool|null $is_credit * - * @return $this + * @return self */ public function setIsCredit($is_credit) { + if (is_null($is_credit)) { + throw new \InvalidArgumentException('non-nullable is_credit cannot be null'); + } $this->container['is_credit'] = $is_credit; return $this; @@ -681,7 +819,7 @@ public function setIsCredit($is_credit) /** * Gets is_debit * - * @return bool + * @return bool|null */ public function getIsDebit() { @@ -691,12 +829,15 @@ public function getIsDebit() /** * Sets is_debit * - * @param bool $is_debit + * @param bool|null $is_debit * - * @return $this + * @return self */ public function setIsDebit($is_debit) { + if (is_null($is_debit)) { + throw new \InvalidArgumentException('non-nullable is_debit cannot be null'); + } $this->container['is_debit'] = $is_debit; return $this; @@ -705,7 +846,7 @@ public function setIsDebit($is_debit) /** * Gets location_external_reference_id * - * @return string + * @return string|null */ public function getLocationExternalReferenceId() { @@ -715,12 +856,15 @@ public function getLocationExternalReferenceId() /** * Sets location_external_reference_id * - * @param string $location_external_reference_id + * @param string|null $location_external_reference_id * - * @return $this + * @return self */ public function setLocationExternalReferenceId($location_external_reference_id) { + if (is_null($location_external_reference_id)) { + throw new \InvalidArgumentException('non-nullable location_external_reference_id cannot be null'); + } $this->container['location_external_reference_id'] = $location_external_reference_id; return $this; @@ -729,7 +873,7 @@ public function setLocationExternalReferenceId($location_external_reference_id) /** * Gets reporting_dimension_value_ids * - * @return int[] + * @return int[]|null */ public function getReportingDimensionValueIds() { @@ -739,12 +883,15 @@ public function getReportingDimensionValueIds() /** * Sets reporting_dimension_value_ids * - * @param int[] $reporting_dimension_value_ids Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an array of dimension value ids (normally only one-per dimension) eg [1,3,7].

If you prefer to specify dimension values by name, use the ReportingDimensionValueNames field instead.

If this field is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) + * @param int[]|null $reporting_dimension_value_ids Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an array of dimension value ids (normally only one-per dimension) eg [1,3,7].

If you prefer to specify dimension values by name, use the ReportingDimensionValueNames field instead.

If this field is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) * - * @return $this + * @return self */ public function setReportingDimensionValueIds($reporting_dimension_value_ids) { + if (is_null($reporting_dimension_value_ids)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_ids cannot be null'); + } $this->container['reporting_dimension_value_ids'] = $reporting_dimension_value_ids; return $this; @@ -753,7 +900,7 @@ public function setReportingDimensionValueIds($reporting_dimension_value_ids) /** * Gets reporting_dimension_value_names * - * @return map[string,string[]] + * @return array|null */ public function getReportingDimensionValueNames() { @@ -763,12 +910,15 @@ public function getReportingDimensionValueNames() /** * Sets reporting_dimension_value_names * - * @param map[string,string[]] $reporting_dimension_value_names Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an object with dimension names and for each one, specify an array of associated value names (normally one-per dimension) eg { \"Department\": [\"Accounting\"], \"Job Code\": [\"JC1\"] }.

If you prefer to specify dimension values directly by Id, use the ReportingDimensionValueIds field instead.

If ReportingDimensionValueIds is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) + * @param array|null $reporting_dimension_value_names Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an object with dimension names and for each one, specify an array of associated value names (normally one-per dimension) eg { \"Department\": [\"Accounting\"], \"Job Code\": [\"JC1\"] }.

If you prefer to specify dimension values directly by Id, use the ReportingDimensionValueIds field instead.

If ReportingDimensionValueIds is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) * - * @return $this + * @return self */ public function setReportingDimensionValueNames($reporting_dimension_value_names) { + if (is_null($reporting_dimension_value_names)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_names cannot be null'); + } $this->container['reporting_dimension_value_names'] = $reporting_dimension_value_names; return $this; @@ -780,7 +930,7 @@ public function setReportingDimensionValueNames($reporting_dimension_value_names * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -790,22 +940,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -821,11 +972,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -833,13 +997,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveAccrualRuleModel.php b/src/lib/Model/AuLeaveAccrualRuleModel.php index e7ac9f7..359635e 100644 --- a/src/lib/Model/AuLeaveAccrualRuleModel.php +++ b/src/lib/Model/AuLeaveAccrualRuleModel.php @@ -2,67 +2,67 @@ /** * AuLeaveAccrualRuleModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveAccrualRuleModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveAccrualRuleModel implements ModelInterface, ArrayAccess +class AuLeaveAccrualRuleModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveAccrualRuleModel'; + protected static $openAPIModelName = 'AuLeaveAccrualRuleModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_year_offset_amount' => 'int', 'id' => 'int', 'cap_type' => 'string', - 'unit_cap' => 'double', + 'unit_cap' => 'float', 'carry_over_behaviour' => 'string', - 'carry_over_amount' => 'double', + 'carry_over_amount' => 'float', 'accrue_in_advance' => 'bool', 'accrual_type' => 'string' ]; @@ -71,8 +71,10 @@ class AuLeaveAccrualRuleModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_year_offset_amount' => 'int32', 'id' => 'int32', 'cap_type' => null, @@ -83,14 +85,37 @@ class AuLeaveAccrualRuleModel implements ModelInterface, ArrayAccess 'accrual_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_year_offset_amount' => false, + 'id' => false, + 'cap_type' => false, + 'unit_cap' => false, + 'carry_over_behaviour' => false, + 'carry_over_amount' => false, + 'accrue_in_advance' => false, + 'accrual_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -190,19 +267,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const CAP_TYPE_NOT_LIMITED = 'NotLimited'; - const CAP_TYPE_LIMITED = 'Limited'; - const CARRY_OVER_BEHAVIOUR_CARRY_ENTIRE_AMOUNT = 'CarryEntireAmount'; - const CARRY_OVER_BEHAVIOUR_CARRY_HOURS = 'CarryHours'; - const ACCRUAL_TYPE_ONGOING = 'Ongoing'; - const ACCRUAL_TYPE_YEARLY = 'Yearly'; - const ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE = 'BasedOnLengthOfService'; - + public const CAP_TYPE_NOT_LIMITED = 'NotLimited'; + public const CAP_TYPE_LIMITED = 'Limited'; + public const CARRY_OVER_BEHAVIOUR_CARRY_ENTIRE_AMOUNT = 'CarryEntireAmount'; + public const CARRY_OVER_BEHAVIOUR_CARRY_HOURS = 'CarryHours'; + public const ACCRUAL_TYPE_ONGOING = 'Ongoing'; + public const ACCRUAL_TYPE_YEARLY = 'Yearly'; + public const ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE = 'BasedOnLengthOfService'; - /** * Gets allowable values of the enum * @@ -215,7 +290,7 @@ public function getCapTypeAllowableValues() self::CAP_TYPE_LIMITED, ]; } - + /** * Gets allowable values of the enum * @@ -228,7 +303,7 @@ public function getCarryOverBehaviourAllowableValues() self::CARRY_OVER_BEHAVIOUR_CARRY_HOURS, ]; } - + /** * Gets allowable values of the enum * @@ -242,7 +317,6 @@ public function getAccrualTypeAllowableValues() self::ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE, ]; } - /** * Associative array for storing property values @@ -259,14 +333,32 @@ public function getAccrualTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_year_offset_amount'] = isset($data['leave_year_offset_amount']) ? $data['leave_year_offset_amount'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['cap_type'] = isset($data['cap_type']) ? $data['cap_type'] : null; - $this->container['unit_cap'] = isset($data['unit_cap']) ? $data['unit_cap'] : null; - $this->container['carry_over_behaviour'] = isset($data['carry_over_behaviour']) ? $data['carry_over_behaviour'] : null; - $this->container['carry_over_amount'] = isset($data['carry_over_amount']) ? $data['carry_over_amount'] : null; - $this->container['accrue_in_advance'] = isset($data['accrue_in_advance']) ? $data['accrue_in_advance'] : null; - $this->container['accrual_type'] = isset($data['accrual_type']) ? $data['accrual_type'] : null; + $this->setIfExists('leave_year_offset_amount', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('cap_type', $data ?? [], null); + $this->setIfExists('unit_cap', $data ?? [], null); + $this->setIfExists('carry_over_behaviour', $data ?? [], null); + $this->setIfExists('carry_over_amount', $data ?? [], null); + $this->setIfExists('accrue_in_advance', $data ?? [], null); + $this->setIfExists('accrual_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; } /** @@ -281,7 +373,8 @@ public function listInvalidProperties() $allowedValues = $this->getCapTypeAllowableValues(); if (!is_null($this->container['cap_type']) && !in_array($this->container['cap_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'cap_type', must be one of '%s'", + "invalid value '%s' for 'cap_type', must be one of '%s'", + $this->container['cap_type'], implode("', '", $allowedValues) ); } @@ -289,7 +382,8 @@ public function listInvalidProperties() $allowedValues = $this->getCarryOverBehaviourAllowableValues(); if (!is_null($this->container['carry_over_behaviour']) && !in_array($this->container['carry_over_behaviour'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'carry_over_behaviour', must be one of '%s'", + "invalid value '%s' for 'carry_over_behaviour', must be one of '%s'", + $this->container['carry_over_behaviour'], implode("', '", $allowedValues) ); } @@ -297,7 +391,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccrualTypeAllowableValues(); if (!is_null($this->container['accrual_type']) && !in_array($this->container['accrual_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'accrual_type', must be one of '%s'", + "invalid value '%s' for 'accrual_type', must be one of '%s'", + $this->container['accrual_type'], implode("', '", $allowedValues) ); } @@ -320,7 +415,7 @@ public function valid() /** * Gets leave_year_offset_amount * - * @return int + * @return int|null */ public function getLeaveYearOffsetAmount() { @@ -330,12 +425,15 @@ public function getLeaveYearOffsetAmount() /** * Sets leave_year_offset_amount * - * @param int $leave_year_offset_amount + * @param int|null $leave_year_offset_amount * - * @return $this + * @return self */ public function setLeaveYearOffsetAmount($leave_year_offset_amount) { + if (is_null($leave_year_offset_amount)) { + throw new \InvalidArgumentException('non-nullable leave_year_offset_amount cannot be null'); + } $this->container['leave_year_offset_amount'] = $leave_year_offset_amount; return $this; @@ -344,7 +442,7 @@ public function setLeaveYearOffsetAmount($leave_year_offset_amount) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -354,12 +452,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -368,7 +469,7 @@ public function setId($id) /** * Gets cap_type * - * @return string + * @return string|null */ public function getCapType() { @@ -378,17 +479,21 @@ public function getCapType() /** * Sets cap_type * - * @param string $cap_type + * @param string|null $cap_type * - * @return $this + * @return self */ public function setCapType($cap_type) { + if (is_null($cap_type)) { + throw new \InvalidArgumentException('non-nullable cap_type cannot be null'); + } $allowedValues = $this->getCapTypeAllowableValues(); - if (!is_null($cap_type) && !in_array($cap_type, $allowedValues, true)) { + if (!in_array($cap_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'cap_type', must be one of '%s'", + "Invalid value '%s' for 'cap_type', must be one of '%s'", + $cap_type, implode("', '", $allowedValues) ) ); @@ -401,7 +506,7 @@ public function setCapType($cap_type) /** * Gets unit_cap * - * @return double + * @return float|null */ public function getUnitCap() { @@ -411,12 +516,15 @@ public function getUnitCap() /** * Sets unit_cap * - * @param double $unit_cap + * @param float|null $unit_cap * - * @return $this + * @return self */ public function setUnitCap($unit_cap) { + if (is_null($unit_cap)) { + throw new \InvalidArgumentException('non-nullable unit_cap cannot be null'); + } $this->container['unit_cap'] = $unit_cap; return $this; @@ -425,7 +533,7 @@ public function setUnitCap($unit_cap) /** * Gets carry_over_behaviour * - * @return string + * @return string|null */ public function getCarryOverBehaviour() { @@ -435,17 +543,21 @@ public function getCarryOverBehaviour() /** * Sets carry_over_behaviour * - * @param string $carry_over_behaviour + * @param string|null $carry_over_behaviour * - * @return $this + * @return self */ public function setCarryOverBehaviour($carry_over_behaviour) { + if (is_null($carry_over_behaviour)) { + throw new \InvalidArgumentException('non-nullable carry_over_behaviour cannot be null'); + } $allowedValues = $this->getCarryOverBehaviourAllowableValues(); - if (!is_null($carry_over_behaviour) && !in_array($carry_over_behaviour, $allowedValues, true)) { + if (!in_array($carry_over_behaviour, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'carry_over_behaviour', must be one of '%s'", + "Invalid value '%s' for 'carry_over_behaviour', must be one of '%s'", + $carry_over_behaviour, implode("', '", $allowedValues) ) ); @@ -458,7 +570,7 @@ public function setCarryOverBehaviour($carry_over_behaviour) /** * Gets carry_over_amount * - * @return double + * @return float|null */ public function getCarryOverAmount() { @@ -468,12 +580,15 @@ public function getCarryOverAmount() /** * Sets carry_over_amount * - * @param double $carry_over_amount + * @param float|null $carry_over_amount * - * @return $this + * @return self */ public function setCarryOverAmount($carry_over_amount) { + if (is_null($carry_over_amount)) { + throw new \InvalidArgumentException('non-nullable carry_over_amount cannot be null'); + } $this->container['carry_over_amount'] = $carry_over_amount; return $this; @@ -482,7 +597,7 @@ public function setCarryOverAmount($carry_over_amount) /** * Gets accrue_in_advance * - * @return bool + * @return bool|null */ public function getAccrueInAdvance() { @@ -492,12 +607,15 @@ public function getAccrueInAdvance() /** * Sets accrue_in_advance * - * @param bool $accrue_in_advance + * @param bool|null $accrue_in_advance * - * @return $this + * @return self */ public function setAccrueInAdvance($accrue_in_advance) { + if (is_null($accrue_in_advance)) { + throw new \InvalidArgumentException('non-nullable accrue_in_advance cannot be null'); + } $this->container['accrue_in_advance'] = $accrue_in_advance; return $this; @@ -506,7 +624,7 @@ public function setAccrueInAdvance($accrue_in_advance) /** * Gets accrual_type * - * @return string + * @return string|null */ public function getAccrualType() { @@ -516,17 +634,21 @@ public function getAccrualType() /** * Sets accrual_type * - * @param string $accrual_type + * @param string|null $accrual_type * - * @return $this + * @return self */ public function setAccrualType($accrual_type) { + if (is_null($accrual_type)) { + throw new \InvalidArgumentException('non-nullable accrual_type cannot be null'); + } $allowedValues = $this->getAccrualTypeAllowableValues(); - if (!is_null($accrual_type) && !in_array($accrual_type, $allowedValues, true)) { + if (!in_array($accrual_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'accrual_type', must be one of '%s'", + "Invalid value '%s' for 'accrual_type', must be one of '%s'", + $accrual_type, implode("', '", $allowedValues) ) ); @@ -542,7 +664,7 @@ public function setAccrualType($accrual_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -552,22 +674,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -583,11 +706,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -595,13 +731,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveAllowanceModel.php b/src/lib/Model/AuLeaveAllowanceModel.php index e7ab62f..a69c0f5 100644 --- a/src/lib/Model/AuLeaveAllowanceModel.php +++ b/src/lib/Model/AuLeaveAllowanceModel.php @@ -2,69 +2,69 @@ /** * AuLeaveAllowanceModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveAllowanceModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveAllowanceModel implements ModelInterface, ArrayAccess +class AuLeaveAllowanceModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveAllowanceModel'; + protected static $openAPIModelName = 'AuLeaveAllowanceModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'leave_loading' => 'double', - 'leave_accrual_rule' => '\Swagger\Client\Model\AuLeaveAccrualRuleModel', + protected static $openAPITypes = [ + 'leave_loading' => 'float', + 'leave_accrual_rule' => '\OpenAPI\Client\Model\AuLeaveAccrualRuleModel', 'leave_category_id' => 'string', 'leave_category_name' => 'string', - 'units' => 'double', + 'units' => 'float', 'unit_type' => 'string', 'leave_unit_type' => 'string', - 'hours_per_year' => 'double', + 'hours_per_year' => 'float', 'automatically_accrues' => 'bool', 'can_apply_for_leave' => 'bool' ]; @@ -73,8 +73,10 @@ class AuLeaveAllowanceModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_loading' => 'double', 'leave_accrual_rule' => null, 'leave_category_id' => null, @@ -87,14 +89,39 @@ class AuLeaveAllowanceModel implements ModelInterface, ArrayAccess 'can_apply_for_leave' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_loading' => false, + 'leave_accrual_rule' => false, + 'leave_category_id' => false, + 'leave_category_name' => false, + 'units' => false, + 'unit_type' => false, + 'leave_unit_type' => false, + 'hours_per_year' => false, + 'automatically_accrues' => false, + 'can_apply_for_leave' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['leave_loading'] = isset($data['leave_loading']) ? $data['leave_loading'] : null; - $this->container['leave_accrual_rule'] = isset($data['leave_accrual_rule']) ? $data['leave_accrual_rule'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['leave_unit_type'] = isset($data['leave_unit_type']) ? $data['leave_unit_type'] : null; - $this->container['hours_per_year'] = isset($data['hours_per_year']) ? $data['hours_per_year'] : null; - $this->container['automatically_accrues'] = isset($data['automatically_accrues']) ? $data['automatically_accrues'] : null; - $this->container['can_apply_for_leave'] = isset($data['can_apply_for_leave']) ? $data['can_apply_for_leave'] : null; + $this->setIfExists('leave_loading', $data ?? [], null); + $this->setIfExists('leave_accrual_rule', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('leave_unit_type', $data ?? [], null); + $this->setIfExists('hours_per_year', $data ?? [], null); + $this->setIfExists('automatically_accrues', $data ?? [], null); + $this->setIfExists('can_apply_for_leave', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets leave_loading * - * @return double + * @return float|null */ public function getLeaveLoading() { @@ -271,12 +365,15 @@ public function getLeaveLoading() /** * Sets leave_loading * - * @param double $leave_loading + * @param float|null $leave_loading * - * @return $this + * @return self */ public function setLeaveLoading($leave_loading) { + if (is_null($leave_loading)) { + throw new \InvalidArgumentException('non-nullable leave_loading cannot be null'); + } $this->container['leave_loading'] = $leave_loading; return $this; @@ -285,7 +382,7 @@ public function setLeaveLoading($leave_loading) /** * Gets leave_accrual_rule * - * @return \Swagger\Client\Model\AuLeaveAccrualRuleModel + * @return \OpenAPI\Client\Model\AuLeaveAccrualRuleModel|null */ public function getLeaveAccrualRule() { @@ -295,12 +392,15 @@ public function getLeaveAccrualRule() /** * Sets leave_accrual_rule * - * @param \Swagger\Client\Model\AuLeaveAccrualRuleModel $leave_accrual_rule + * @param \OpenAPI\Client\Model\AuLeaveAccrualRuleModel|null $leave_accrual_rule leave_accrual_rule * - * @return $this + * @return self */ public function setLeaveAccrualRule($leave_accrual_rule) { + if (is_null($leave_accrual_rule)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule cannot be null'); + } $this->container['leave_accrual_rule'] = $leave_accrual_rule; return $this; @@ -309,7 +409,7 @@ public function setLeaveAccrualRule($leave_accrual_rule) /** * Gets leave_category_id * - * @return string + * @return string|null */ public function getLeaveCategoryId() { @@ -319,12 +419,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param string $leave_category_id + * @param string|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -333,7 +436,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -343,12 +446,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -357,7 +463,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -367,12 +473,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -381,7 +490,7 @@ public function setUnits($units) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -391,12 +500,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -405,7 +517,7 @@ public function setUnitType($unit_type) /** * Gets leave_unit_type * - * @return string + * @return string|null */ public function getLeaveUnitType() { @@ -415,12 +527,15 @@ public function getLeaveUnitType() /** * Sets leave_unit_type * - * @param string $leave_unit_type + * @param string|null $leave_unit_type * - * @return $this + * @return self */ public function setLeaveUnitType($leave_unit_type) { + if (is_null($leave_unit_type)) { + throw new \InvalidArgumentException('non-nullable leave_unit_type cannot be null'); + } $this->container['leave_unit_type'] = $leave_unit_type; return $this; @@ -429,7 +544,7 @@ public function setLeaveUnitType($leave_unit_type) /** * Gets hours_per_year * - * @return double + * @return float|null */ public function getHoursPerYear() { @@ -439,12 +554,15 @@ public function getHoursPerYear() /** * Sets hours_per_year * - * @param double $hours_per_year + * @param float|null $hours_per_year * - * @return $this + * @return self */ public function setHoursPerYear($hours_per_year) { + if (is_null($hours_per_year)) { + throw new \InvalidArgumentException('non-nullable hours_per_year cannot be null'); + } $this->container['hours_per_year'] = $hours_per_year; return $this; @@ -453,7 +571,7 @@ public function setHoursPerYear($hours_per_year) /** * Gets automatically_accrues * - * @return bool + * @return bool|null */ public function getAutomaticallyAccrues() { @@ -463,12 +581,15 @@ public function getAutomaticallyAccrues() /** * Sets automatically_accrues * - * @param bool $automatically_accrues + * @param bool|null $automatically_accrues * - * @return $this + * @return self */ public function setAutomaticallyAccrues($automatically_accrues) { + if (is_null($automatically_accrues)) { + throw new \InvalidArgumentException('non-nullable automatically_accrues cannot be null'); + } $this->container['automatically_accrues'] = $automatically_accrues; return $this; @@ -477,7 +598,7 @@ public function setAutomaticallyAccrues($automatically_accrues) /** * Gets can_apply_for_leave * - * @return bool + * @return bool|null */ public function getCanApplyForLeave() { @@ -487,12 +608,15 @@ public function getCanApplyForLeave() /** * Sets can_apply_for_leave * - * @param bool $can_apply_for_leave + * @param bool|null $can_apply_for_leave * - * @return $this + * @return self */ public function setCanApplyForLeave($can_apply_for_leave) { + if (is_null($can_apply_for_leave)) { + throw new \InvalidArgumentException('non-nullable can_apply_for_leave cannot be null'); + } $this->container['can_apply_for_leave'] = $can_apply_for_leave; return $this; @@ -504,7 +628,7 @@ public function setCanApplyForLeave($can_apply_for_leave) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveAllowanceTemplateLeaveCategoryApiModel.php b/src/lib/Model/AuLeaveAllowanceTemplateLeaveCategoryApiModel.php index 6ced0b4..99630c1 100644 --- a/src/lib/Model/AuLeaveAllowanceTemplateLeaveCategoryApiModel.php +++ b/src/lib/Model/AuLeaveAllowanceTemplateLeaveCategoryApiModel.php @@ -2,76 +2,76 @@ /** * AuLeaveAllowanceTemplateLeaveCategoryApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveAllowanceTemplateLeaveCategoryApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveAllowanceTemplateLeaveCategoryApiModel implements ModelInterface, ArrayAccess +class AuLeaveAllowanceTemplateLeaveCategoryApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveAllowanceTemplateLeaveCategoryApiModel'; + protected static $openAPIModelName = 'AuLeaveAllowanceTemplateLeaveCategoryApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'leave_loading' => 'double', - 'contingent_period' => 'double', - 'entitlement_period' => 'double', + protected static $openAPITypes = [ + 'leave_loading' => 'float', + 'contingent_period' => 'float', + 'entitlement_period' => 'float', 'unit_type' => 'string', 'leave_unit_type' => 'string', 'accrual_rule_leave_year_offset_amount' => 'int', 'leave_category_id' => 'int', 'leave_category_name' => 'string', - 'units' => 'double', + 'units' => 'float', 'can_apply_for_leave' => 'bool', 'leave_accrual_rule_accrual_type' => 'string', 'leave_accrual_rule_cap_type' => 'string', - 'leave_accrual_rule_unit_cap' => 'double', + 'leave_accrual_rule_unit_cap' => 'float', 'leave_accrual_rule_carry_over_behaviour' => 'string', - 'leave_accrual_rule_carry_over_amount' => 'double', + 'leave_accrual_rule_carry_over_amount' => 'float', 'leave_accrual_rule_accrue_in_advance' => 'bool' ]; @@ -79,8 +79,10 @@ class AuLeaveAllowanceTemplateLeaveCategoryApiModel implements ModelInterface, A * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_loading' => 'double', 'contingent_period' => 'double', 'entitlement_period' => 'double', @@ -99,14 +101,45 @@ class AuLeaveAllowanceTemplateLeaveCategoryApiModel implements ModelInterface, A 'leave_accrual_rule_accrue_in_advance' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_loading' => false, + 'contingent_period' => false, + 'entitlement_period' => false, + 'unit_type' => false, + 'leave_unit_type' => false, + 'accrual_rule_leave_year_offset_amount' => false, + 'leave_category_id' => false, + 'leave_category_name' => false, + 'units' => false, + 'can_apply_for_leave' => false, + 'leave_accrual_rule_accrual_type' => false, + 'leave_accrual_rule_cap_type' => false, + 'leave_accrual_rule_unit_cap' => false, + 'leave_accrual_rule_carry_over_behaviour' => false, + 'leave_accrual_rule_carry_over_amount' => false, + 'leave_accrual_rule_accrue_in_advance' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -114,9 +147,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -230,29 +315,27 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - const UNIT_TYPE_HOURS_PER_HOUR_WORKED = 'HoursPerHourWorked'; - const UNIT_TYPE_HOURS_PER_PAY_RUN = 'HoursPerPayRun'; - const UNIT_TYPE_STANDARD_DAYS = 'StandardDays'; - const UNIT_TYPE_STANDARD_WEEKS = 'StandardWeeks'; - const UNIT_TYPE_DAY_PER_CALENDAR_DAY = 'DayPerCalendarDay'; - const LEAVE_UNIT_TYPE_HOURS = 'Hours'; - const LEAVE_UNIT_TYPE_DAYS = 'Days'; - const LEAVE_UNIT_TYPE_WEEKS = 'Weeks'; - const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_ONGOING = 'Ongoing'; - const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_YEARLY = 'Yearly'; - const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE = 'BasedOnLengthOfService'; - const LEAVE_ACCRUAL_RULE_CAP_TYPE_NOT_LIMITED = 'NotLimited'; - const LEAVE_ACCRUAL_RULE_CAP_TYPE_LIMITED = 'Limited'; - const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_ENTIRE_AMOUNT = 'CarryEntireAmount'; - const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_HOURS = 'CarryHours'; - - - + return self::$openAPIModelName; + } + + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; + public const UNIT_TYPE_HOURS_PER_HOUR_WORKED = 'HoursPerHourWorked'; + public const UNIT_TYPE_HOURS_PER_PAY_RUN = 'HoursPerPayRun'; + public const UNIT_TYPE_STANDARD_DAYS = 'StandardDays'; + public const UNIT_TYPE_STANDARD_WEEKS = 'StandardWeeks'; + public const UNIT_TYPE_DAY_PER_CALENDAR_DAY = 'DayPerCalendarDay'; + public const LEAVE_UNIT_TYPE_HOURS = 'Hours'; + public const LEAVE_UNIT_TYPE_DAYS = 'Days'; + public const LEAVE_UNIT_TYPE_WEEKS = 'Weeks'; + public const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_ONGOING = 'Ongoing'; + public const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_YEARLY = 'Yearly'; + public const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE = 'BasedOnLengthOfService'; + public const LEAVE_ACCRUAL_RULE_CAP_TYPE_NOT_LIMITED = 'NotLimited'; + public const LEAVE_ACCRUAL_RULE_CAP_TYPE_LIMITED = 'Limited'; + public const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_ENTIRE_AMOUNT = 'CarryEntireAmount'; + public const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_HOURS = 'CarryHours'; + /** * Gets allowable values of the enum * @@ -270,7 +353,7 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_DAY_PER_CALENDAR_DAY, ]; } - + /** * Gets allowable values of the enum * @@ -284,7 +367,7 @@ public function getLeaveUnitTypeAllowableValues() self::LEAVE_UNIT_TYPE_WEEKS, ]; } - + /** * Gets allowable values of the enum * @@ -298,7 +381,7 @@ public function getLeaveAccrualRuleAccrualTypeAllowableValues() self::LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE, ]; } - + /** * Gets allowable values of the enum * @@ -311,7 +394,7 @@ public function getLeaveAccrualRuleCapTypeAllowableValues() self::LEAVE_ACCRUAL_RULE_CAP_TYPE_LIMITED, ]; } - + /** * Gets allowable values of the enum * @@ -324,7 +407,6 @@ public function getLeaveAccrualRuleCarryOverBehaviourAllowableValues() self::LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_HOURS, ]; } - /** * Associative array for storing property values @@ -341,22 +423,40 @@ public function getLeaveAccrualRuleCarryOverBehaviourAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_loading'] = isset($data['leave_loading']) ? $data['leave_loading'] : null; - $this->container['contingent_period'] = isset($data['contingent_period']) ? $data['contingent_period'] : null; - $this->container['entitlement_period'] = isset($data['entitlement_period']) ? $data['entitlement_period'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['leave_unit_type'] = isset($data['leave_unit_type']) ? $data['leave_unit_type'] : null; - $this->container['accrual_rule_leave_year_offset_amount'] = isset($data['accrual_rule_leave_year_offset_amount']) ? $data['accrual_rule_leave_year_offset_amount'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['can_apply_for_leave'] = isset($data['can_apply_for_leave']) ? $data['can_apply_for_leave'] : null; - $this->container['leave_accrual_rule_accrual_type'] = isset($data['leave_accrual_rule_accrual_type']) ? $data['leave_accrual_rule_accrual_type'] : null; - $this->container['leave_accrual_rule_cap_type'] = isset($data['leave_accrual_rule_cap_type']) ? $data['leave_accrual_rule_cap_type'] : null; - $this->container['leave_accrual_rule_unit_cap'] = isset($data['leave_accrual_rule_unit_cap']) ? $data['leave_accrual_rule_unit_cap'] : null; - $this->container['leave_accrual_rule_carry_over_behaviour'] = isset($data['leave_accrual_rule_carry_over_behaviour']) ? $data['leave_accrual_rule_carry_over_behaviour'] : null; - $this->container['leave_accrual_rule_carry_over_amount'] = isset($data['leave_accrual_rule_carry_over_amount']) ? $data['leave_accrual_rule_carry_over_amount'] : null; - $this->container['leave_accrual_rule_accrue_in_advance'] = isset($data['leave_accrual_rule_accrue_in_advance']) ? $data['leave_accrual_rule_accrue_in_advance'] : null; + $this->setIfExists('leave_loading', $data ?? [], null); + $this->setIfExists('contingent_period', $data ?? [], null); + $this->setIfExists('entitlement_period', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('leave_unit_type', $data ?? [], null); + $this->setIfExists('accrual_rule_leave_year_offset_amount', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('can_apply_for_leave', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_accrual_type', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_cap_type', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_unit_cap', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_carry_over_behaviour', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_carry_over_amount', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_accrue_in_advance', $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; } /** @@ -371,7 +471,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -379,7 +480,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveUnitTypeAllowableValues(); if (!is_null($this->container['leave_unit_type']) && !in_array($this->container['leave_unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_unit_type', must be one of '%s'", + "invalid value '%s' for 'leave_unit_type', must be one of '%s'", + $this->container['leave_unit_type'], implode("', '", $allowedValues) ); } @@ -387,7 +489,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualRuleAccrualTypeAllowableValues(); if (!is_null($this->container['leave_accrual_rule_accrual_type']) && !in_array($this->container['leave_accrual_rule_accrual_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_rule_accrual_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_rule_accrual_type', must be one of '%s'", + $this->container['leave_accrual_rule_accrual_type'], implode("', '", $allowedValues) ); } @@ -395,7 +498,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualRuleCapTypeAllowableValues(); if (!is_null($this->container['leave_accrual_rule_cap_type']) && !in_array($this->container['leave_accrual_rule_cap_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_rule_cap_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_rule_cap_type', must be one of '%s'", + $this->container['leave_accrual_rule_cap_type'], implode("', '", $allowedValues) ); } @@ -403,7 +507,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualRuleCarryOverBehaviourAllowableValues(); if (!is_null($this->container['leave_accrual_rule_carry_over_behaviour']) && !in_array($this->container['leave_accrual_rule_carry_over_behaviour'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + $this->container['leave_accrual_rule_carry_over_behaviour'], implode("', '", $allowedValues) ); } @@ -426,7 +531,7 @@ public function valid() /** * Gets leave_loading * - * @return double + * @return float|null */ public function getLeaveLoading() { @@ -436,12 +541,15 @@ public function getLeaveLoading() /** * Sets leave_loading * - * @param double $leave_loading + * @param float|null $leave_loading * - * @return $this + * @return self */ public function setLeaveLoading($leave_loading) { + if (is_null($leave_loading)) { + throw new \InvalidArgumentException('non-nullable leave_loading cannot be null'); + } $this->container['leave_loading'] = $leave_loading; return $this; @@ -450,7 +558,7 @@ public function setLeaveLoading($leave_loading) /** * Gets contingent_period * - * @return double + * @return float|null */ public function getContingentPeriod() { @@ -460,12 +568,15 @@ public function getContingentPeriod() /** * Sets contingent_period * - * @param double $contingent_period + * @param float|null $contingent_period * - * @return $this + * @return self */ public function setContingentPeriod($contingent_period) { + if (is_null($contingent_period)) { + throw new \InvalidArgumentException('non-nullable contingent_period cannot be null'); + } $this->container['contingent_period'] = $contingent_period; return $this; @@ -474,7 +585,7 @@ public function setContingentPeriod($contingent_period) /** * Gets entitlement_period * - * @return double + * @return float|null */ public function getEntitlementPeriod() { @@ -484,12 +595,15 @@ public function getEntitlementPeriod() /** * Sets entitlement_period * - * @param double $entitlement_period + * @param float|null $entitlement_period * - * @return $this + * @return self */ public function setEntitlementPeriod($entitlement_period) { + if (is_null($entitlement_period)) { + throw new \InvalidArgumentException('non-nullable entitlement_period cannot be null'); + } $this->container['entitlement_period'] = $entitlement_period; return $this; @@ -498,7 +612,7 @@ public function setEntitlementPeriod($entitlement_period) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -508,17 +622,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -531,7 +649,7 @@ public function setUnitType($unit_type) /** * Gets leave_unit_type * - * @return string + * @return string|null */ public function getLeaveUnitType() { @@ -541,17 +659,21 @@ public function getLeaveUnitType() /** * Sets leave_unit_type * - * @param string $leave_unit_type + * @param string|null $leave_unit_type * - * @return $this + * @return self */ public function setLeaveUnitType($leave_unit_type) { + if (is_null($leave_unit_type)) { + throw new \InvalidArgumentException('non-nullable leave_unit_type cannot be null'); + } $allowedValues = $this->getLeaveUnitTypeAllowableValues(); - if (!is_null($leave_unit_type) && !in_array($leave_unit_type, $allowedValues, true)) { + if (!in_array($leave_unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_unit_type', must be one of '%s'", + "Invalid value '%s' for 'leave_unit_type', must be one of '%s'", + $leave_unit_type, implode("', '", $allowedValues) ) ); @@ -564,7 +686,7 @@ public function setLeaveUnitType($leave_unit_type) /** * Gets accrual_rule_leave_year_offset_amount * - * @return int + * @return int|null */ public function getAccrualRuleLeaveYearOffsetAmount() { @@ -574,12 +696,15 @@ public function getAccrualRuleLeaveYearOffsetAmount() /** * Sets accrual_rule_leave_year_offset_amount * - * @param int $accrual_rule_leave_year_offset_amount + * @param int|null $accrual_rule_leave_year_offset_amount * - * @return $this + * @return self */ public function setAccrualRuleLeaveYearOffsetAmount($accrual_rule_leave_year_offset_amount) { + if (is_null($accrual_rule_leave_year_offset_amount)) { + throw new \InvalidArgumentException('non-nullable accrual_rule_leave_year_offset_amount cannot be null'); + } $this->container['accrual_rule_leave_year_offset_amount'] = $accrual_rule_leave_year_offset_amount; return $this; @@ -588,7 +713,7 @@ public function setAccrualRuleLeaveYearOffsetAmount($accrual_rule_leave_year_off /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -598,12 +723,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -612,7 +740,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -622,12 +750,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -636,7 +767,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -646,12 +777,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -660,7 +794,7 @@ public function setUnits($units) /** * Gets can_apply_for_leave * - * @return bool + * @return bool|null */ public function getCanApplyForLeave() { @@ -670,12 +804,15 @@ public function getCanApplyForLeave() /** * Sets can_apply_for_leave * - * @param bool $can_apply_for_leave + * @param bool|null $can_apply_for_leave * - * @return $this + * @return self */ public function setCanApplyForLeave($can_apply_for_leave) { + if (is_null($can_apply_for_leave)) { + throw new \InvalidArgumentException('non-nullable can_apply_for_leave cannot be null'); + } $this->container['can_apply_for_leave'] = $can_apply_for_leave; return $this; @@ -684,7 +821,7 @@ public function setCanApplyForLeave($can_apply_for_leave) /** * Gets leave_accrual_rule_accrual_type * - * @return string + * @return string|null */ public function getLeaveAccrualRuleAccrualType() { @@ -694,17 +831,21 @@ public function getLeaveAccrualRuleAccrualType() /** * Sets leave_accrual_rule_accrual_type * - * @param string $leave_accrual_rule_accrual_type + * @param string|null $leave_accrual_rule_accrual_type * - * @return $this + * @return self */ public function setLeaveAccrualRuleAccrualType($leave_accrual_rule_accrual_type) { + if (is_null($leave_accrual_rule_accrual_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_accrual_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualRuleAccrualTypeAllowableValues(); - if (!is_null($leave_accrual_rule_accrual_type) && !in_array($leave_accrual_rule_accrual_type, $allowedValues, true)) { + if (!in_array($leave_accrual_rule_accrual_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_rule_accrual_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_rule_accrual_type', must be one of '%s'", + $leave_accrual_rule_accrual_type, implode("', '", $allowedValues) ) ); @@ -717,7 +858,7 @@ public function setLeaveAccrualRuleAccrualType($leave_accrual_rule_accrual_type) /** * Gets leave_accrual_rule_cap_type * - * @return string + * @return string|null */ public function getLeaveAccrualRuleCapType() { @@ -727,17 +868,21 @@ public function getLeaveAccrualRuleCapType() /** * Sets leave_accrual_rule_cap_type * - * @param string $leave_accrual_rule_cap_type + * @param string|null $leave_accrual_rule_cap_type * - * @return $this + * @return self */ public function setLeaveAccrualRuleCapType($leave_accrual_rule_cap_type) { + if (is_null($leave_accrual_rule_cap_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_cap_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualRuleCapTypeAllowableValues(); - if (!is_null($leave_accrual_rule_cap_type) && !in_array($leave_accrual_rule_cap_type, $allowedValues, true)) { + if (!in_array($leave_accrual_rule_cap_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_rule_cap_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_rule_cap_type', must be one of '%s'", + $leave_accrual_rule_cap_type, implode("', '", $allowedValues) ) ); @@ -750,7 +895,7 @@ public function setLeaveAccrualRuleCapType($leave_accrual_rule_cap_type) /** * Gets leave_accrual_rule_unit_cap * - * @return double + * @return float|null */ public function getLeaveAccrualRuleUnitCap() { @@ -760,12 +905,15 @@ public function getLeaveAccrualRuleUnitCap() /** * Sets leave_accrual_rule_unit_cap * - * @param double $leave_accrual_rule_unit_cap + * @param float|null $leave_accrual_rule_unit_cap * - * @return $this + * @return self */ public function setLeaveAccrualRuleUnitCap($leave_accrual_rule_unit_cap) { + if (is_null($leave_accrual_rule_unit_cap)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_unit_cap cannot be null'); + } $this->container['leave_accrual_rule_unit_cap'] = $leave_accrual_rule_unit_cap; return $this; @@ -774,7 +922,7 @@ public function setLeaveAccrualRuleUnitCap($leave_accrual_rule_unit_cap) /** * Gets leave_accrual_rule_carry_over_behaviour * - * @return string + * @return string|null */ public function getLeaveAccrualRuleCarryOverBehaviour() { @@ -784,17 +932,21 @@ public function getLeaveAccrualRuleCarryOverBehaviour() /** * Sets leave_accrual_rule_carry_over_behaviour * - * @param string $leave_accrual_rule_carry_over_behaviour + * @param string|null $leave_accrual_rule_carry_over_behaviour * - * @return $this + * @return self */ public function setLeaveAccrualRuleCarryOverBehaviour($leave_accrual_rule_carry_over_behaviour) { + if (is_null($leave_accrual_rule_carry_over_behaviour)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_carry_over_behaviour cannot be null'); + } $allowedValues = $this->getLeaveAccrualRuleCarryOverBehaviourAllowableValues(); - if (!is_null($leave_accrual_rule_carry_over_behaviour) && !in_array($leave_accrual_rule_carry_over_behaviour, $allowedValues, true)) { + if (!in_array($leave_accrual_rule_carry_over_behaviour, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + $leave_accrual_rule_carry_over_behaviour, implode("', '", $allowedValues) ) ); @@ -807,7 +959,7 @@ public function setLeaveAccrualRuleCarryOverBehaviour($leave_accrual_rule_carry_ /** * Gets leave_accrual_rule_carry_over_amount * - * @return double + * @return float|null */ public function getLeaveAccrualRuleCarryOverAmount() { @@ -817,12 +969,15 @@ public function getLeaveAccrualRuleCarryOverAmount() /** * Sets leave_accrual_rule_carry_over_amount * - * @param double $leave_accrual_rule_carry_over_amount + * @param float|null $leave_accrual_rule_carry_over_amount * - * @return $this + * @return self */ public function setLeaveAccrualRuleCarryOverAmount($leave_accrual_rule_carry_over_amount) { + if (is_null($leave_accrual_rule_carry_over_amount)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_carry_over_amount cannot be null'); + } $this->container['leave_accrual_rule_carry_over_amount'] = $leave_accrual_rule_carry_over_amount; return $this; @@ -831,7 +986,7 @@ public function setLeaveAccrualRuleCarryOverAmount($leave_accrual_rule_carry_ove /** * Gets leave_accrual_rule_accrue_in_advance * - * @return bool + * @return bool|null */ public function getLeaveAccrualRuleAccrueInAdvance() { @@ -841,12 +996,15 @@ public function getLeaveAccrualRuleAccrueInAdvance() /** * Sets leave_accrual_rule_accrue_in_advance * - * @param bool $leave_accrual_rule_accrue_in_advance + * @param bool|null $leave_accrual_rule_accrue_in_advance * - * @return $this + * @return self */ public function setLeaveAccrualRuleAccrueInAdvance($leave_accrual_rule_accrue_in_advance) { + if (is_null($leave_accrual_rule_accrue_in_advance)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_accrue_in_advance cannot be null'); + } $this->container['leave_accrual_rule_accrue_in_advance'] = $leave_accrual_rule_accrue_in_advance; return $this; @@ -858,7 +1016,7 @@ public function setLeaveAccrualRuleAccrueInAdvance($leave_accrual_rule_accrue_in * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -868,22 +1026,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -899,11 +1058,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -911,13 +1083,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveAllowanceTemplateModel.php b/src/lib/Model/AuLeaveAllowanceTemplateModel.php index e427675..b66735d 100644 --- a/src/lib/Model/AuLeaveAllowanceTemplateModel.php +++ b/src/lib/Model/AuLeaveAllowanceTemplateModel.php @@ -2,63 +2,63 @@ /** * AuLeaveAllowanceTemplateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveAllowanceTemplateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess +class AuLeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveAllowanceTemplateModel'; + protected static $openAPIModelName = 'AuLeaveAllowanceTemplateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_loading_calculated_from_pay_category_id' => 'int', - 'leave_categories' => '\Swagger\Client\Model\AuLeaveAllowanceTemplateLeaveCategoryApiModel[]', + 'leave_categories' => '\OpenAPI\Client\Model\AuLeaveAllowanceTemplateLeaveCategoryApiModel[]', 'award_id' => 'int', 'award_name' => 'string', 'id' => 'int', @@ -73,8 +73,10 @@ class AuLeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_loading_calculated_from_pay_category_id' => 'int32', 'leave_categories' => null, 'award_id' => 'int32', @@ -87,14 +89,39 @@ class AuLeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess 'leave_accrual_start_date_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_loading_calculated_from_pay_category_id' => false, + 'leave_categories' => false, + 'award_id' => false, + 'award_name' => false, + 'id' => false, + 'name' => false, + 'external_id' => false, + 'source' => false, + 'leave_year_start' => false, + 'leave_accrual_start_date_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,93 +279,91 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; + /** * Gets allowable values of the enum * @@ -373,7 +450,7 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - + /** * Gets allowable values of the enum * @@ -389,7 +466,6 @@ public function getLeaveAccrualStartDateTypeAllowableValues() self::LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH, ]; } - /** * Associative array for storing property values @@ -406,16 +482,34 @@ public function getLeaveAccrualStartDateTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_loading_calculated_from_pay_category_id'] = isset($data['leave_loading_calculated_from_pay_category_id']) ? $data['leave_loading_calculated_from_pay_category_id'] : null; - $this->container['leave_categories'] = isset($data['leave_categories']) ? $data['leave_categories'] : null; - $this->container['award_id'] = isset($data['award_id']) ? $data['award_id'] : null; - $this->container['award_name'] = isset($data['award_name']) ? $data['award_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['leave_year_start'] = isset($data['leave_year_start']) ? $data['leave_year_start'] : null; - $this->container['leave_accrual_start_date_type'] = isset($data['leave_accrual_start_date_type']) ? $data['leave_accrual_start_date_type'] : null; + $this->setIfExists('leave_loading_calculated_from_pay_category_id', $data ?? [], null); + $this->setIfExists('leave_categories', $data ?? [], null); + $this->setIfExists('award_id', $data ?? [], null); + $this->setIfExists('award_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('leave_year_start', $data ?? [], null); + $this->setIfExists('leave_accrual_start_date_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; } /** @@ -430,7 +524,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -438,7 +533,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); if (!is_null($this->container['leave_accrual_start_date_type']) && !in_array($this->container['leave_accrual_start_date_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $this->container['leave_accrual_start_date_type'], implode("', '", $allowedValues) ); } @@ -461,7 +557,7 @@ public function valid() /** * Gets leave_loading_calculated_from_pay_category_id * - * @return int + * @return int|null */ public function getLeaveLoadingCalculatedFromPayCategoryId() { @@ -471,12 +567,15 @@ public function getLeaveLoadingCalculatedFromPayCategoryId() /** * Sets leave_loading_calculated_from_pay_category_id * - * @param int $leave_loading_calculated_from_pay_category_id + * @param int|null $leave_loading_calculated_from_pay_category_id * - * @return $this + * @return self */ public function setLeaveLoadingCalculatedFromPayCategoryId($leave_loading_calculated_from_pay_category_id) { + if (is_null($leave_loading_calculated_from_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_loading_calculated_from_pay_category_id cannot be null'); + } $this->container['leave_loading_calculated_from_pay_category_id'] = $leave_loading_calculated_from_pay_category_id; return $this; @@ -485,7 +584,7 @@ public function setLeaveLoadingCalculatedFromPayCategoryId($leave_loading_calcul /** * Gets leave_categories * - * @return \Swagger\Client\Model\AuLeaveAllowanceTemplateLeaveCategoryApiModel[] + * @return \OpenAPI\Client\Model\AuLeaveAllowanceTemplateLeaveCategoryApiModel[]|null */ public function getLeaveCategories() { @@ -495,12 +594,15 @@ public function getLeaveCategories() /** * Sets leave_categories * - * @param \Swagger\Client\Model\AuLeaveAllowanceTemplateLeaveCategoryApiModel[] $leave_categories + * @param \OpenAPI\Client\Model\AuLeaveAllowanceTemplateLeaveCategoryApiModel[]|null $leave_categories * - * @return $this + * @return self */ public function setLeaveCategories($leave_categories) { + if (is_null($leave_categories)) { + throw new \InvalidArgumentException('non-nullable leave_categories cannot be null'); + } $this->container['leave_categories'] = $leave_categories; return $this; @@ -509,7 +611,7 @@ public function setLeaveCategories($leave_categories) /** * Gets award_id * - * @return int + * @return int|null */ public function getAwardId() { @@ -519,12 +621,15 @@ public function getAwardId() /** * Sets award_id * - * @param int $award_id + * @param int|null $award_id * - * @return $this + * @return self */ public function setAwardId($award_id) { + if (is_null($award_id)) { + throw new \InvalidArgumentException('non-nullable award_id cannot be null'); + } $this->container['award_id'] = $award_id; return $this; @@ -533,7 +638,7 @@ public function setAwardId($award_id) /** * Gets award_name * - * @return string + * @return string|null */ public function getAwardName() { @@ -543,12 +648,15 @@ public function getAwardName() /** * Sets award_name * - * @param string $award_name + * @param string|null $award_name * - * @return $this + * @return self */ public function setAwardName($award_name) { + if (is_null($award_name)) { + throw new \InvalidArgumentException('non-nullable award_name cannot be null'); + } $this->container['award_name'] = $award_name; return $this; @@ -557,7 +665,7 @@ public function setAwardName($award_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -567,12 +675,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -581,7 +692,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -591,12 +702,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -605,7 +719,7 @@ public function setName($name) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -615,12 +729,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -629,7 +746,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -639,17 +756,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -662,7 +783,7 @@ public function setSource($source) /** * Gets leave_year_start * - * @return \DateTime + * @return \DateTime|null */ public function getLeaveYearStart() { @@ -672,12 +793,15 @@ public function getLeaveYearStart() /** * Sets leave_year_start * - * @param \DateTime $leave_year_start + * @param \DateTime|null $leave_year_start * - * @return $this + * @return self */ public function setLeaveYearStart($leave_year_start) { + if (is_null($leave_year_start)) { + throw new \InvalidArgumentException('non-nullable leave_year_start cannot be null'); + } $this->container['leave_year_start'] = $leave_year_start; return $this; @@ -686,7 +810,7 @@ public function setLeaveYearStart($leave_year_start) /** * Gets leave_accrual_start_date_type * - * @return string + * @return string|null */ public function getLeaveAccrualStartDateType() { @@ -696,17 +820,21 @@ public function getLeaveAccrualStartDateType() /** * Sets leave_accrual_start_date_type * - * @param string $leave_accrual_start_date_type + * @param string|null $leave_accrual_start_date_type * - * @return $this + * @return self */ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) { + if (is_null($leave_accrual_start_date_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_start_date_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); - if (!is_null($leave_accrual_start_date_type) && !in_array($leave_accrual_start_date_type, $allowedValues, true)) { + if (!in_array($leave_accrual_start_date_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $leave_accrual_start_date_type, implode("', '", $allowedValues) ) ); @@ -722,7 +850,7 @@ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -732,22 +860,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -763,11 +892,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -775,13 +917,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveAllowancesRequest.php b/src/lib/Model/AuLeaveAllowancesRequest.php index a51c34e..1bdb8e1 100644 --- a/src/lib/Model/AuLeaveAllowancesRequest.php +++ b/src/lib/Model/AuLeaveAllowancesRequest.php @@ -2,85 +2,105 @@ /** * AuLeaveAllowancesRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveAllowancesRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveAllowancesRequest implements ModelInterface, ArrayAccess +class AuLeaveAllowancesRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveAllowancesRequest'; + protected static $openAPIModelName = 'AuLeaveAllowancesRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id_type' => 'string', 'leave_category_id_type' => 'string', - 'leave_allowances' => 'map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]]' + 'leave_allowances' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id_type' => null, 'leave_category_id_type' => null, 'leave_allowances' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id_type' => false, + 'leave_category_id_type' => false, + 'leave_allowances' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,16 +237,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - const LEAVE_CATEGORY_ID_TYPE_STANDARD = 'Standard'; - const LEAVE_CATEGORY_ID_TYPE_EXTERNAL = 'External'; - + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; + public const LEAVE_CATEGORY_ID_TYPE_STANDARD = 'Standard'; + public const LEAVE_CATEGORY_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -187,7 +257,7 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -200,7 +270,6 @@ public function getLeaveCategoryIdTypeAllowableValues() self::LEAVE_CATEGORY_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -217,9 +286,27 @@ public function getLeaveCategoryIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['leave_category_id_type'] = isset($data['leave_category_id_type']) ? $data['leave_category_id_type'] : null; - $this->container['leave_allowances'] = isset($data['leave_allowances']) ? $data['leave_allowances'] : null; + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('leave_category_id_type', $data ?? [], null); + $this->setIfExists('leave_allowances', $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; } /** @@ -234,7 +321,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -242,7 +330,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveCategoryIdTypeAllowableValues(); if (!is_null($this->container['leave_category_id_type']) && !in_array($this->container['leave_category_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_category_id_type', must be one of '%s'", + "invalid value '%s' for 'leave_category_id_type', must be one of '%s'", + $this->container['leave_category_id_type'], implode("', '", $allowedValues) ); } @@ -265,7 +354,7 @@ public function valid() /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -275,17 +364,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -298,7 +391,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets leave_category_id_type * - * @return string + * @return string|null */ public function getLeaveCategoryIdType() { @@ -308,17 +401,21 @@ public function getLeaveCategoryIdType() /** * Sets leave_category_id_type * - * @param string $leave_category_id_type + * @param string|null $leave_category_id_type * - * @return $this + * @return self */ public function setLeaveCategoryIdType($leave_category_id_type) { + if (is_null($leave_category_id_type)) { + throw new \InvalidArgumentException('non-nullable leave_category_id_type cannot be null'); + } $allowedValues = $this->getLeaveCategoryIdTypeAllowableValues(); - if (!is_null($leave_category_id_type) && !in_array($leave_category_id_type, $allowedValues, true)) { + if (!in_array($leave_category_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_category_id_type', must be one of '%s'", + "Invalid value '%s' for 'leave_category_id_type', must be one of '%s'", + $leave_category_id_type, implode("', '", $allowedValues) ) ); @@ -331,7 +428,7 @@ public function setLeaveCategoryIdType($leave_category_id_type) /** * Gets leave_allowances * - * @return map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]] + * @return array|null */ public function getLeaveAllowances() { @@ -341,12 +438,15 @@ public function getLeaveAllowances() /** * Sets leave_allowances * - * @param map[string,\Swagger\Client\Model\AuLeaveAllowanceModel[]] $leave_allowances + * @param array|null $leave_allowances * - * @return $this + * @return self */ public function setLeaveAllowances($leave_allowances) { + if (is_null($leave_allowances)) { + throw new \InvalidArgumentException('non-nullable leave_allowances cannot be null'); + } $this->container['leave_allowances'] = $leave_allowances; return $this; @@ -358,7 +458,7 @@ public function setLeaveAllowances($leave_allowances) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -368,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -399,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -411,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveBalancesExportModel.php b/src/lib/Model/AuLeaveBalancesExportModel.php index 843fa79..14faacd 100644 --- a/src/lib/Model/AuLeaveBalancesExportModel.php +++ b/src/lib/Model/AuLeaveBalancesExportModel.php @@ -2,73 +2,73 @@ /** * AuLeaveBalancesExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveBalancesExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveBalancesExportModel implements ModelInterface, ArrayAccess +class AuLeaveBalancesExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveBalancesExportModel'; + protected static $openAPIModelName = 'AuLeaveBalancesExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'accrued_amount_in_days' => 'double', - 'leave_value' => 'double', - 'loading_value' => 'double', - 'leave_plus_loading' => 'double', + protected static $openAPITypes = [ + 'accrued_amount_in_days' => 'float', + 'leave_value' => 'float', + 'loading_value' => 'float', + 'leave_plus_loading' => 'float', 'employee_id' => 'int', 'external_id' => 'string', 'first_name' => 'string', 'surname' => 'string', 'location' => 'string', 'leave_category_name' => 'string', - 'accrued_amount' => 'double', - 'accrued_amount_in_hours' => 'double', + 'accrued_amount' => 'float', + 'accrued_amount_in_hours' => 'float', 'unit_type' => 'string' ]; @@ -76,8 +76,10 @@ class AuLeaveBalancesExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'accrued_amount_in_days' => 'double', 'leave_value' => 'double', 'loading_value' => 'double', @@ -93,14 +95,42 @@ class AuLeaveBalancesExportModel implements ModelInterface, ArrayAccess 'unit_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'accrued_amount_in_days' => false, + 'leave_value' => false, + 'loading_value' => false, + 'leave_plus_loading' => false, + 'employee_id' => false, + 'external_id' => false, + 'first_name' => false, + 'surname' => false, + 'location' => false, + 'leave_category_name' => false, + 'accrued_amount' => false, + 'accrued_amount_in_hours' => false, + 'unit_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -215,15 +297,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -237,7 +317,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -254,19 +333,37 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['accrued_amount_in_days'] = isset($data['accrued_amount_in_days']) ? $data['accrued_amount_in_days'] : null; - $this->container['leave_value'] = isset($data['leave_value']) ? $data['leave_value'] : null; - $this->container['loading_value'] = isset($data['loading_value']) ? $data['loading_value'] : null; - $this->container['leave_plus_loading'] = isset($data['leave_plus_loading']) ? $data['leave_plus_loading'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['accrued_amount'] = isset($data['accrued_amount']) ? $data['accrued_amount'] : null; - $this->container['accrued_amount_in_hours'] = isset($data['accrued_amount_in_hours']) ? $data['accrued_amount_in_hours'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; + $this->setIfExists('accrued_amount_in_days', $data ?? [], null); + $this->setIfExists('leave_value', $data ?? [], null); + $this->setIfExists('loading_value', $data ?? [], null); + $this->setIfExists('leave_plus_loading', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('accrued_amount', $data ?? [], null); + $this->setIfExists('accrued_amount_in_hours', $data ?? [], null); + $this->setIfExists('unit_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; } /** @@ -281,7 +378,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -304,7 +402,7 @@ public function valid() /** * Gets accrued_amount_in_days * - * @return double + * @return float|null */ public function getAccruedAmountInDays() { @@ -314,12 +412,15 @@ public function getAccruedAmountInDays() /** * Sets accrued_amount_in_days * - * @param double $accrued_amount_in_days + * @param float|null $accrued_amount_in_days * - * @return $this + * @return self */ public function setAccruedAmountInDays($accrued_amount_in_days) { + if (is_null($accrued_amount_in_days)) { + throw new \InvalidArgumentException('non-nullable accrued_amount_in_days cannot be null'); + } $this->container['accrued_amount_in_days'] = $accrued_amount_in_days; return $this; @@ -328,7 +429,7 @@ public function setAccruedAmountInDays($accrued_amount_in_days) /** * Gets leave_value * - * @return double + * @return float|null */ public function getLeaveValue() { @@ -338,12 +439,15 @@ public function getLeaveValue() /** * Sets leave_value * - * @param double $leave_value + * @param float|null $leave_value * - * @return $this + * @return self */ public function setLeaveValue($leave_value) { + if (is_null($leave_value)) { + throw new \InvalidArgumentException('non-nullable leave_value cannot be null'); + } $this->container['leave_value'] = $leave_value; return $this; @@ -352,7 +456,7 @@ public function setLeaveValue($leave_value) /** * Gets loading_value * - * @return double + * @return float|null */ public function getLoadingValue() { @@ -362,12 +466,15 @@ public function getLoadingValue() /** * Sets loading_value * - * @param double $loading_value + * @param float|null $loading_value * - * @return $this + * @return self */ public function setLoadingValue($loading_value) { + if (is_null($loading_value)) { + throw new \InvalidArgumentException('non-nullable loading_value cannot be null'); + } $this->container['loading_value'] = $loading_value; return $this; @@ -376,7 +483,7 @@ public function setLoadingValue($loading_value) /** * Gets leave_plus_loading * - * @return double + * @return float|null */ public function getLeavePlusLoading() { @@ -386,12 +493,15 @@ public function getLeavePlusLoading() /** * Sets leave_plus_loading * - * @param double $leave_plus_loading + * @param float|null $leave_plus_loading * - * @return $this + * @return self */ public function setLeavePlusLoading($leave_plus_loading) { + if (is_null($leave_plus_loading)) { + throw new \InvalidArgumentException('non-nullable leave_plus_loading cannot be null'); + } $this->container['leave_plus_loading'] = $leave_plus_loading; return $this; @@ -400,7 +510,7 @@ public function setLeavePlusLoading($leave_plus_loading) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -410,12 +520,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -424,7 +537,7 @@ public function setEmployeeId($employee_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -434,12 +547,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -448,7 +564,7 @@ public function setExternalId($external_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -458,12 +574,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -472,7 +591,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -482,12 +601,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -496,7 +618,7 @@ public function setSurname($surname) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -506,12 +628,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -520,7 +645,7 @@ public function setLocation($location) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -530,12 +655,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -544,7 +672,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets accrued_amount * - * @return double + * @return float|null */ public function getAccruedAmount() { @@ -554,12 +682,15 @@ public function getAccruedAmount() /** * Sets accrued_amount * - * @param double $accrued_amount + * @param float|null $accrued_amount * - * @return $this + * @return self */ public function setAccruedAmount($accrued_amount) { + if (is_null($accrued_amount)) { + throw new \InvalidArgumentException('non-nullable accrued_amount cannot be null'); + } $this->container['accrued_amount'] = $accrued_amount; return $this; @@ -568,7 +699,7 @@ public function setAccruedAmount($accrued_amount) /** * Gets accrued_amount_in_hours * - * @return double + * @return float|null */ public function getAccruedAmountInHours() { @@ -578,12 +709,15 @@ public function getAccruedAmountInHours() /** * Sets accrued_amount_in_hours * - * @param double $accrued_amount_in_hours + * @param float|null $accrued_amount_in_hours * - * @return $this + * @return self */ public function setAccruedAmountInHours($accrued_amount_in_hours) { + if (is_null($accrued_amount_in_hours)) { + throw new \InvalidArgumentException('non-nullable accrued_amount_in_hours cannot be null'); + } $this->container['accrued_amount_in_hours'] = $accrued_amount_in_hours; return $this; @@ -592,7 +726,7 @@ public function setAccruedAmountInHours($accrued_amount_in_hours) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -602,17 +736,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -628,7 +766,7 @@ public function setUnitType($unit_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -638,22 +776,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -669,11 +808,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -681,13 +833,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveCategoryModel.php b/src/lib/Model/AuLeaveCategoryModel.php index 900716f..5c2558b 100644 --- a/src/lib/Model/AuLeaveCategoryModel.php +++ b/src/lib/Model/AuLeaveCategoryModel.php @@ -2,71 +2,71 @@ /** * AuLeaveCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveCategoryModel implements ModelInterface, ArrayAccess +class AuLeaveCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveCategoryModel'; + protected static $openAPIModelName = 'AuLeaveCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'contingent_period' => 'double', - 'entitlement_period' => 'double', - 'leave_loading' => 'double', + protected static $openAPITypes = [ + 'contingent_period' => 'float', + 'entitlement_period' => 'float', + 'leave_loading' => 'float', 'unit_type' => 'string', 'leave_category_type' => 'string', - 'leave_accrual_rule' => '\Swagger\Client\Model\AuLeaveAccrualRuleModel', + 'leave_accrual_rule' => '\OpenAPI\Client\Model\AuLeaveAccrualRuleModel', 'transfer_on_termination_to_pay_category_id' => 'int', 'id' => 'int', 'name' => 'string', - 'units' => 'double', + 'units' => 'float', 'automatically_accrues' => 'bool', 'is_private' => 'bool', 'exclude_from_termination_payout' => 'bool', @@ -89,8 +89,10 @@ class AuLeaveCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'contingent_period' => 'double', 'entitlement_period' => 'double', 'leave_loading' => 'double', @@ -119,14 +121,55 @@ class AuLeaveCategoryModel implements ModelInterface, ArrayAccess 'prevent_negative_balance_unpaid_leave_category_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contingent_period' => false, + 'entitlement_period' => false, + 'leave_loading' => false, + 'unit_type' => false, + 'leave_category_type' => false, + 'leave_accrual_rule' => false, + 'transfer_on_termination_to_pay_category_id' => false, + 'id' => false, + 'name' => false, + 'units' => false, + 'automatically_accrues' => false, + 'is_private' => false, + 'exclude_from_termination_payout' => false, + 'external_id' => false, + 'source' => false, + 'is_balance_untracked' => false, + 'deduct_from_primary_pay_category' => false, + 'deduct_from_pay_category_id' => false, + 'transfer_to_pay_category_id' => false, + 'hide_accruals_on_payslip' => false, + 'use_deduct_from_pay_category_rate' => false, + 'is_name_private' => false, + 'leave_unit_type' => false, + 'payout_as_etp' => false, + 'accrues_first_pay_run_per_period_only' => false, + 'prevent_negative_balance_unpaid_leave_category_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -134,9 +177,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -280,25 +375,23 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - const UNIT_TYPE_HOURS_PER_HOUR_WORKED = 'HoursPerHourWorked'; - const UNIT_TYPE_HOURS_PER_PAY_RUN = 'HoursPerPayRun'; - const UNIT_TYPE_STANDARD_DAYS = 'StandardDays'; - const UNIT_TYPE_STANDARD_WEEKS = 'StandardWeeks'; - const UNIT_TYPE_DAY_PER_CALENDAR_DAY = 'DayPerCalendarDay'; - const LEAVE_CATEGORY_TYPE_STANDARD = 'Standard'; - const LEAVE_CATEGORY_TYPE_LONG_SERVICE_LEAVE = 'LongServiceLeave'; - const LEAVE_CATEGORY_TYPE_PERSONAL_CARERS_LEAVE = 'PersonalCarersLeave'; - const LEAVE_UNIT_TYPE_HOURS = 'Hours'; - const LEAVE_UNIT_TYPE_DAYS = 'Days'; - const LEAVE_UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; + public const UNIT_TYPE_HOURS_PER_HOUR_WORKED = 'HoursPerHourWorked'; + public const UNIT_TYPE_HOURS_PER_PAY_RUN = 'HoursPerPayRun'; + public const UNIT_TYPE_STANDARD_DAYS = 'StandardDays'; + public const UNIT_TYPE_STANDARD_WEEKS = 'StandardWeeks'; + public const UNIT_TYPE_DAY_PER_CALENDAR_DAY = 'DayPerCalendarDay'; + public const LEAVE_CATEGORY_TYPE_STANDARD = 'Standard'; + public const LEAVE_CATEGORY_TYPE_LONG_SERVICE_LEAVE = 'LongServiceLeave'; + public const LEAVE_CATEGORY_TYPE_PERSONAL_CARERS_LEAVE = 'PersonalCarersLeave'; + public const LEAVE_UNIT_TYPE_HOURS = 'Hours'; + public const LEAVE_UNIT_TYPE_DAYS = 'Days'; + public const LEAVE_UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -316,7 +409,7 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_DAY_PER_CALENDAR_DAY, ]; } - + /** * Gets allowable values of the enum * @@ -330,7 +423,7 @@ public function getLeaveCategoryTypeAllowableValues() self::LEAVE_CATEGORY_TYPE_PERSONAL_CARERS_LEAVE, ]; } - + /** * Gets allowable values of the enum * @@ -344,7 +437,6 @@ public function getLeaveUnitTypeAllowableValues() self::LEAVE_UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -361,32 +453,50 @@ public function getLeaveUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['contingent_period'] = isset($data['contingent_period']) ? $data['contingent_period'] : null; - $this->container['entitlement_period'] = isset($data['entitlement_period']) ? $data['entitlement_period'] : null; - $this->container['leave_loading'] = isset($data['leave_loading']) ? $data['leave_loading'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['leave_category_type'] = isset($data['leave_category_type']) ? $data['leave_category_type'] : null; - $this->container['leave_accrual_rule'] = isset($data['leave_accrual_rule']) ? $data['leave_accrual_rule'] : null; - $this->container['transfer_on_termination_to_pay_category_id'] = isset($data['transfer_on_termination_to_pay_category_id']) ? $data['transfer_on_termination_to_pay_category_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['automatically_accrues'] = isset($data['automatically_accrues']) ? $data['automatically_accrues'] : null; - $this->container['is_private'] = isset($data['is_private']) ? $data['is_private'] : null; - $this->container['exclude_from_termination_payout'] = isset($data['exclude_from_termination_payout']) ? $data['exclude_from_termination_payout'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['is_balance_untracked'] = isset($data['is_balance_untracked']) ? $data['is_balance_untracked'] : null; - $this->container['deduct_from_primary_pay_category'] = isset($data['deduct_from_primary_pay_category']) ? $data['deduct_from_primary_pay_category'] : null; - $this->container['deduct_from_pay_category_id'] = isset($data['deduct_from_pay_category_id']) ? $data['deduct_from_pay_category_id'] : null; - $this->container['transfer_to_pay_category_id'] = isset($data['transfer_to_pay_category_id']) ? $data['transfer_to_pay_category_id'] : null; - $this->container['hide_accruals_on_payslip'] = isset($data['hide_accruals_on_payslip']) ? $data['hide_accruals_on_payslip'] : null; - $this->container['use_deduct_from_pay_category_rate'] = isset($data['use_deduct_from_pay_category_rate']) ? $data['use_deduct_from_pay_category_rate'] : null; - $this->container['is_name_private'] = isset($data['is_name_private']) ? $data['is_name_private'] : null; - $this->container['leave_unit_type'] = isset($data['leave_unit_type']) ? $data['leave_unit_type'] : null; - $this->container['payout_as_etp'] = isset($data['payout_as_etp']) ? $data['payout_as_etp'] : null; - $this->container['accrues_first_pay_run_per_period_only'] = isset($data['accrues_first_pay_run_per_period_only']) ? $data['accrues_first_pay_run_per_period_only'] : null; - $this->container['prevent_negative_balance_unpaid_leave_category_id'] = isset($data['prevent_negative_balance_unpaid_leave_category_id']) ? $data['prevent_negative_balance_unpaid_leave_category_id'] : null; + $this->setIfExists('contingent_period', $data ?? [], null); + $this->setIfExists('entitlement_period', $data ?? [], null); + $this->setIfExists('leave_loading', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('leave_category_type', $data ?? [], null); + $this->setIfExists('leave_accrual_rule', $data ?? [], null); + $this->setIfExists('transfer_on_termination_to_pay_category_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('automatically_accrues', $data ?? [], null); + $this->setIfExists('is_private', $data ?? [], null); + $this->setIfExists('exclude_from_termination_payout', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('is_balance_untracked', $data ?? [], null); + $this->setIfExists('deduct_from_primary_pay_category', $data ?? [], null); + $this->setIfExists('deduct_from_pay_category_id', $data ?? [], null); + $this->setIfExists('transfer_to_pay_category_id', $data ?? [], null); + $this->setIfExists('hide_accruals_on_payslip', $data ?? [], null); + $this->setIfExists('use_deduct_from_pay_category_rate', $data ?? [], null); + $this->setIfExists('is_name_private', $data ?? [], null); + $this->setIfExists('leave_unit_type', $data ?? [], null); + $this->setIfExists('payout_as_etp', $data ?? [], null); + $this->setIfExists('accrues_first_pay_run_per_period_only', $data ?? [], null); + $this->setIfExists('prevent_negative_balance_unpaid_leave_category_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; } /** @@ -401,7 +511,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -409,7 +520,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveCategoryTypeAllowableValues(); if (!is_null($this->container['leave_category_type']) && !in_array($this->container['leave_category_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_category_type', must be one of '%s'", + "invalid value '%s' for 'leave_category_type', must be one of '%s'", + $this->container['leave_category_type'], implode("', '", $allowedValues) ); } @@ -417,7 +529,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveUnitTypeAllowableValues(); if (!is_null($this->container['leave_unit_type']) && !in_array($this->container['leave_unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_unit_type', must be one of '%s'", + "invalid value '%s' for 'leave_unit_type', must be one of '%s'", + $this->container['leave_unit_type'], implode("', '", $allowedValues) ); } @@ -440,7 +553,7 @@ public function valid() /** * Gets contingent_period * - * @return double + * @return float|null */ public function getContingentPeriod() { @@ -450,12 +563,15 @@ public function getContingentPeriod() /** * Sets contingent_period * - * @param double $contingent_period + * @param float|null $contingent_period * - * @return $this + * @return self */ public function setContingentPeriod($contingent_period) { + if (is_null($contingent_period)) { + throw new \InvalidArgumentException('non-nullable contingent_period cannot be null'); + } $this->container['contingent_period'] = $contingent_period; return $this; @@ -464,7 +580,7 @@ public function setContingentPeriod($contingent_period) /** * Gets entitlement_period * - * @return double + * @return float|null */ public function getEntitlementPeriod() { @@ -474,12 +590,15 @@ public function getEntitlementPeriod() /** * Sets entitlement_period * - * @param double $entitlement_period + * @param float|null $entitlement_period * - * @return $this + * @return self */ public function setEntitlementPeriod($entitlement_period) { + if (is_null($entitlement_period)) { + throw new \InvalidArgumentException('non-nullable entitlement_period cannot be null'); + } $this->container['entitlement_period'] = $entitlement_period; return $this; @@ -488,7 +607,7 @@ public function setEntitlementPeriod($entitlement_period) /** * Gets leave_loading * - * @return double + * @return float|null */ public function getLeaveLoading() { @@ -498,12 +617,15 @@ public function getLeaveLoading() /** * Sets leave_loading * - * @param double $leave_loading + * @param float|null $leave_loading * - * @return $this + * @return self */ public function setLeaveLoading($leave_loading) { + if (is_null($leave_loading)) { + throw new \InvalidArgumentException('non-nullable leave_loading cannot be null'); + } $this->container['leave_loading'] = $leave_loading; return $this; @@ -512,7 +634,7 @@ public function setLeaveLoading($leave_loading) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -522,17 +644,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -545,7 +671,7 @@ public function setUnitType($unit_type) /** * Gets leave_category_type * - * @return string + * @return string|null */ public function getLeaveCategoryType() { @@ -555,17 +681,21 @@ public function getLeaveCategoryType() /** * Sets leave_category_type * - * @param string $leave_category_type + * @param string|null $leave_category_type * - * @return $this + * @return self */ public function setLeaveCategoryType($leave_category_type) { + if (is_null($leave_category_type)) { + throw new \InvalidArgumentException('non-nullable leave_category_type cannot be null'); + } $allowedValues = $this->getLeaveCategoryTypeAllowableValues(); - if (!is_null($leave_category_type) && !in_array($leave_category_type, $allowedValues, true)) { + if (!in_array($leave_category_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_category_type', must be one of '%s'", + "Invalid value '%s' for 'leave_category_type', must be one of '%s'", + $leave_category_type, implode("', '", $allowedValues) ) ); @@ -578,7 +708,7 @@ public function setLeaveCategoryType($leave_category_type) /** * Gets leave_accrual_rule * - * @return \Swagger\Client\Model\AuLeaveAccrualRuleModel + * @return \OpenAPI\Client\Model\AuLeaveAccrualRuleModel|null */ public function getLeaveAccrualRule() { @@ -588,12 +718,15 @@ public function getLeaveAccrualRule() /** * Sets leave_accrual_rule * - * @param \Swagger\Client\Model\AuLeaveAccrualRuleModel $leave_accrual_rule + * @param \OpenAPI\Client\Model\AuLeaveAccrualRuleModel|null $leave_accrual_rule leave_accrual_rule * - * @return $this + * @return self */ public function setLeaveAccrualRule($leave_accrual_rule) { + if (is_null($leave_accrual_rule)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule cannot be null'); + } $this->container['leave_accrual_rule'] = $leave_accrual_rule; return $this; @@ -602,7 +735,7 @@ public function setLeaveAccrualRule($leave_accrual_rule) /** * Gets transfer_on_termination_to_pay_category_id * - * @return int + * @return int|null */ public function getTransferOnTerminationToPayCategoryId() { @@ -612,12 +745,15 @@ public function getTransferOnTerminationToPayCategoryId() /** * Sets transfer_on_termination_to_pay_category_id * - * @param int $transfer_on_termination_to_pay_category_id + * @param int|null $transfer_on_termination_to_pay_category_id * - * @return $this + * @return self */ public function setTransferOnTerminationToPayCategoryId($transfer_on_termination_to_pay_category_id) { + if (is_null($transfer_on_termination_to_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable transfer_on_termination_to_pay_category_id cannot be null'); + } $this->container['transfer_on_termination_to_pay_category_id'] = $transfer_on_termination_to_pay_category_id; return $this; @@ -626,7 +762,7 @@ public function setTransferOnTerminationToPayCategoryId($transfer_on_termination /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -636,12 +772,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -650,7 +789,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -660,12 +799,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -674,7 +816,7 @@ public function setName($name) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -684,12 +826,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -698,7 +843,7 @@ public function setUnits($units) /** * Gets automatically_accrues * - * @return bool + * @return bool|null */ public function getAutomaticallyAccrues() { @@ -708,12 +853,15 @@ public function getAutomaticallyAccrues() /** * Sets automatically_accrues * - * @param bool $automatically_accrues + * @param bool|null $automatically_accrues * - * @return $this + * @return self */ public function setAutomaticallyAccrues($automatically_accrues) { + if (is_null($automatically_accrues)) { + throw new \InvalidArgumentException('non-nullable automatically_accrues cannot be null'); + } $this->container['automatically_accrues'] = $automatically_accrues; return $this; @@ -722,7 +870,7 @@ public function setAutomaticallyAccrues($automatically_accrues) /** * Gets is_private * - * @return bool + * @return bool|null */ public function getIsPrivate() { @@ -732,12 +880,15 @@ public function getIsPrivate() /** * Sets is_private * - * @param bool $is_private + * @param bool|null $is_private * - * @return $this + * @return self */ public function setIsPrivate($is_private) { + if (is_null($is_private)) { + throw new \InvalidArgumentException('non-nullable is_private cannot be null'); + } $this->container['is_private'] = $is_private; return $this; @@ -746,7 +897,7 @@ public function setIsPrivate($is_private) /** * Gets exclude_from_termination_payout * - * @return bool + * @return bool|null */ public function getExcludeFromTerminationPayout() { @@ -756,12 +907,15 @@ public function getExcludeFromTerminationPayout() /** * Sets exclude_from_termination_payout * - * @param bool $exclude_from_termination_payout + * @param bool|null $exclude_from_termination_payout * - * @return $this + * @return self */ public function setExcludeFromTerminationPayout($exclude_from_termination_payout) { + if (is_null($exclude_from_termination_payout)) { + throw new \InvalidArgumentException('non-nullable exclude_from_termination_payout cannot be null'); + } $this->container['exclude_from_termination_payout'] = $exclude_from_termination_payout; return $this; @@ -770,7 +924,7 @@ public function setExcludeFromTerminationPayout($exclude_from_termination_payout /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -780,12 +934,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -794,7 +951,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -804,12 +961,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -818,7 +978,7 @@ public function setSource($source) /** * Gets is_balance_untracked * - * @return bool + * @return bool|null */ public function getIsBalanceUntracked() { @@ -828,12 +988,15 @@ public function getIsBalanceUntracked() /** * Sets is_balance_untracked * - * @param bool $is_balance_untracked + * @param bool|null $is_balance_untracked * - * @return $this + * @return self */ public function setIsBalanceUntracked($is_balance_untracked) { + if (is_null($is_balance_untracked)) { + throw new \InvalidArgumentException('non-nullable is_balance_untracked cannot be null'); + } $this->container['is_balance_untracked'] = $is_balance_untracked; return $this; @@ -842,7 +1005,7 @@ public function setIsBalanceUntracked($is_balance_untracked) /** * Gets deduct_from_primary_pay_category * - * @return bool + * @return bool|null */ public function getDeductFromPrimaryPayCategory() { @@ -852,12 +1015,15 @@ public function getDeductFromPrimaryPayCategory() /** * Sets deduct_from_primary_pay_category * - * @param bool $deduct_from_primary_pay_category + * @param bool|null $deduct_from_primary_pay_category * - * @return $this + * @return self */ public function setDeductFromPrimaryPayCategory($deduct_from_primary_pay_category) { + if (is_null($deduct_from_primary_pay_category)) { + throw new \InvalidArgumentException('non-nullable deduct_from_primary_pay_category cannot be null'); + } $this->container['deduct_from_primary_pay_category'] = $deduct_from_primary_pay_category; return $this; @@ -866,7 +1032,7 @@ public function setDeductFromPrimaryPayCategory($deduct_from_primary_pay_categor /** * Gets deduct_from_pay_category_id * - * @return int + * @return int|null */ public function getDeductFromPayCategoryId() { @@ -876,12 +1042,15 @@ public function getDeductFromPayCategoryId() /** * Sets deduct_from_pay_category_id * - * @param int $deduct_from_pay_category_id + * @param int|null $deduct_from_pay_category_id * - * @return $this + * @return self */ public function setDeductFromPayCategoryId($deduct_from_pay_category_id) { + if (is_null($deduct_from_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable deduct_from_pay_category_id cannot be null'); + } $this->container['deduct_from_pay_category_id'] = $deduct_from_pay_category_id; return $this; @@ -890,7 +1059,7 @@ public function setDeductFromPayCategoryId($deduct_from_pay_category_id) /** * Gets transfer_to_pay_category_id * - * @return int + * @return int|null */ public function getTransferToPayCategoryId() { @@ -900,12 +1069,15 @@ public function getTransferToPayCategoryId() /** * Sets transfer_to_pay_category_id * - * @param int $transfer_to_pay_category_id + * @param int|null $transfer_to_pay_category_id * - * @return $this + * @return self */ public function setTransferToPayCategoryId($transfer_to_pay_category_id) { + if (is_null($transfer_to_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable transfer_to_pay_category_id cannot be null'); + } $this->container['transfer_to_pay_category_id'] = $transfer_to_pay_category_id; return $this; @@ -914,7 +1086,7 @@ public function setTransferToPayCategoryId($transfer_to_pay_category_id) /** * Gets hide_accruals_on_payslip * - * @return bool + * @return bool|null */ public function getHideAccrualsOnPayslip() { @@ -924,12 +1096,15 @@ public function getHideAccrualsOnPayslip() /** * Sets hide_accruals_on_payslip * - * @param bool $hide_accruals_on_payslip + * @param bool|null $hide_accruals_on_payslip * - * @return $this + * @return self */ public function setHideAccrualsOnPayslip($hide_accruals_on_payslip) { + if (is_null($hide_accruals_on_payslip)) { + throw new \InvalidArgumentException('non-nullable hide_accruals_on_payslip cannot be null'); + } $this->container['hide_accruals_on_payslip'] = $hide_accruals_on_payslip; return $this; @@ -938,7 +1113,7 @@ public function setHideAccrualsOnPayslip($hide_accruals_on_payslip) /** * Gets use_deduct_from_pay_category_rate * - * @return bool + * @return bool|null */ public function getUseDeductFromPayCategoryRate() { @@ -948,12 +1123,15 @@ public function getUseDeductFromPayCategoryRate() /** * Sets use_deduct_from_pay_category_rate * - * @param bool $use_deduct_from_pay_category_rate + * @param bool|null $use_deduct_from_pay_category_rate * - * @return $this + * @return self */ public function setUseDeductFromPayCategoryRate($use_deduct_from_pay_category_rate) { + if (is_null($use_deduct_from_pay_category_rate)) { + throw new \InvalidArgumentException('non-nullable use_deduct_from_pay_category_rate cannot be null'); + } $this->container['use_deduct_from_pay_category_rate'] = $use_deduct_from_pay_category_rate; return $this; @@ -962,7 +1140,7 @@ public function setUseDeductFromPayCategoryRate($use_deduct_from_pay_category_ra /** * Gets is_name_private * - * @return bool + * @return bool|null */ public function getIsNamePrivate() { @@ -972,12 +1150,15 @@ public function getIsNamePrivate() /** * Sets is_name_private * - * @param bool $is_name_private + * @param bool|null $is_name_private * - * @return $this + * @return self */ public function setIsNamePrivate($is_name_private) { + if (is_null($is_name_private)) { + throw new \InvalidArgumentException('non-nullable is_name_private cannot be null'); + } $this->container['is_name_private'] = $is_name_private; return $this; @@ -986,7 +1167,7 @@ public function setIsNamePrivate($is_name_private) /** * Gets leave_unit_type * - * @return string + * @return string|null */ public function getLeaveUnitType() { @@ -996,17 +1177,21 @@ public function getLeaveUnitType() /** * Sets leave_unit_type * - * @param string $leave_unit_type + * @param string|null $leave_unit_type * - * @return $this + * @return self */ public function setLeaveUnitType($leave_unit_type) { + if (is_null($leave_unit_type)) { + throw new \InvalidArgumentException('non-nullable leave_unit_type cannot be null'); + } $allowedValues = $this->getLeaveUnitTypeAllowableValues(); - if (!is_null($leave_unit_type) && !in_array($leave_unit_type, $allowedValues, true)) { + if (!in_array($leave_unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_unit_type', must be one of '%s'", + "Invalid value '%s' for 'leave_unit_type', must be one of '%s'", + $leave_unit_type, implode("', '", $allowedValues) ) ); @@ -1019,7 +1204,7 @@ public function setLeaveUnitType($leave_unit_type) /** * Gets payout_as_etp * - * @return bool + * @return bool|null */ public function getPayoutAsEtp() { @@ -1029,12 +1214,15 @@ public function getPayoutAsEtp() /** * Sets payout_as_etp * - * @param bool $payout_as_etp + * @param bool|null $payout_as_etp * - * @return $this + * @return self */ public function setPayoutAsEtp($payout_as_etp) { + if (is_null($payout_as_etp)) { + throw new \InvalidArgumentException('non-nullable payout_as_etp cannot be null'); + } $this->container['payout_as_etp'] = $payout_as_etp; return $this; @@ -1043,7 +1231,7 @@ public function setPayoutAsEtp($payout_as_etp) /** * Gets accrues_first_pay_run_per_period_only * - * @return bool + * @return bool|null */ public function getAccruesFirstPayRunPerPeriodOnly() { @@ -1053,12 +1241,15 @@ public function getAccruesFirstPayRunPerPeriodOnly() /** * Sets accrues_first_pay_run_per_period_only * - * @param bool $accrues_first_pay_run_per_period_only + * @param bool|null $accrues_first_pay_run_per_period_only * - * @return $this + * @return self */ public function setAccruesFirstPayRunPerPeriodOnly($accrues_first_pay_run_per_period_only) { + if (is_null($accrues_first_pay_run_per_period_only)) { + throw new \InvalidArgumentException('non-nullable accrues_first_pay_run_per_period_only cannot be null'); + } $this->container['accrues_first_pay_run_per_period_only'] = $accrues_first_pay_run_per_period_only; return $this; @@ -1067,7 +1258,7 @@ public function setAccruesFirstPayRunPerPeriodOnly($accrues_first_pay_run_per_pe /** * Gets prevent_negative_balance_unpaid_leave_category_id * - * @return int + * @return int|null */ public function getPreventNegativeBalanceUnpaidLeaveCategoryId() { @@ -1077,12 +1268,15 @@ public function getPreventNegativeBalanceUnpaidLeaveCategoryId() /** * Sets prevent_negative_balance_unpaid_leave_category_id * - * @param int $prevent_negative_balance_unpaid_leave_category_id + * @param int|null $prevent_negative_balance_unpaid_leave_category_id * - * @return $this + * @return self */ public function setPreventNegativeBalanceUnpaidLeaveCategoryId($prevent_negative_balance_unpaid_leave_category_id) { + if (is_null($prevent_negative_balance_unpaid_leave_category_id)) { + throw new \InvalidArgumentException('non-nullable prevent_negative_balance_unpaid_leave_category_id cannot be null'); + } $this->container['prevent_negative_balance_unpaid_leave_category_id'] = $prevent_negative_balance_unpaid_leave_category_id; return $this; @@ -1094,7 +1288,7 @@ public function setPreventNegativeBalanceUnpaidLeaveCategoryId($prevent_negative * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1104,22 +1298,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1135,11 +1330,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1147,13 +1355,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLeaveLiabilityExportModel.php b/src/lib/Model/AuLeaveLiabilityExportModel.php index 5317042..db18009 100644 --- a/src/lib/Model/AuLeaveLiabilityExportModel.php +++ b/src/lib/Model/AuLeaveLiabilityExportModel.php @@ -2,62 +2,62 @@ /** * AuLeaveLiabilityExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLeaveLiabilityExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLeaveLiabilityExportModel implements ModelInterface, ArrayAccess +class AuLeaveLiabilityExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLeaveLiabilityExportModel'; + protected static $openAPIModelName = 'AuLeaveLiabilityExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'leave_loading_dollar_value' => 'double', + protected static $openAPITypes = [ + 'leave_loading_dollar_value' => 'float', 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', @@ -65,23 +65,25 @@ class AuLeaveLiabilityExportModel implements ModelInterface, ArrayAccess 'start_date' => '\DateTime', 'last_paid_date' => '\DateTime', 'last_pay_period_ending' => '\DateTime', - 'calculated_weeks' => 'double', + 'calculated_weeks' => 'float', 'location' => 'string', 'leave_category_name' => 'string', - 'approved_leave_amount' => 'double', - 'accrued_amount' => 'double', - 'leave_value' => 'double', - 'approved_leave_amount_in_hours' => 'double', + 'approved_leave_amount' => 'float', + 'accrued_amount' => 'float', + 'leave_value' => 'float', + 'approved_leave_amount_in_hours' => 'float', 'unit_type' => 'string', - 'accrued_amount_in_hours' => 'double' + 'accrued_amount_in_hours' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_loading_dollar_value' => 'double', 'employee_id' => 'int32', 'first_name' => null, @@ -101,14 +103,46 @@ class AuLeaveLiabilityExportModel implements ModelInterface, ArrayAccess 'accrued_amount_in_hours' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_loading_dollar_value' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'start_date' => false, + 'last_paid_date' => false, + 'last_pay_period_ending' => false, + 'calculated_weeks' => false, + 'location' => false, + 'leave_category_name' => false, + 'approved_leave_amount' => false, + 'accrued_amount' => false, + 'leave_value' => false, + 'approved_leave_amount_in_hours' => false, + 'unit_type' => false, + 'accrued_amount_in_hours' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -235,15 +321,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -257,7 +341,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -274,23 +357,41 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_loading_dollar_value'] = isset($data['leave_loading_dollar_value']) ? $data['leave_loading_dollar_value'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['last_paid_date'] = isset($data['last_paid_date']) ? $data['last_paid_date'] : null; - $this->container['last_pay_period_ending'] = isset($data['last_pay_period_ending']) ? $data['last_pay_period_ending'] : null; - $this->container['calculated_weeks'] = isset($data['calculated_weeks']) ? $data['calculated_weeks'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['approved_leave_amount'] = isset($data['approved_leave_amount']) ? $data['approved_leave_amount'] : null; - $this->container['accrued_amount'] = isset($data['accrued_amount']) ? $data['accrued_amount'] : null; - $this->container['leave_value'] = isset($data['leave_value']) ? $data['leave_value'] : null; - $this->container['approved_leave_amount_in_hours'] = isset($data['approved_leave_amount_in_hours']) ? $data['approved_leave_amount_in_hours'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['accrued_amount_in_hours'] = isset($data['accrued_amount_in_hours']) ? $data['accrued_amount_in_hours'] : null; + $this->setIfExists('leave_loading_dollar_value', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('last_paid_date', $data ?? [], null); + $this->setIfExists('last_pay_period_ending', $data ?? [], null); + $this->setIfExists('calculated_weeks', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('approved_leave_amount', $data ?? [], null); + $this->setIfExists('accrued_amount', $data ?? [], null); + $this->setIfExists('leave_value', $data ?? [], null); + $this->setIfExists('approved_leave_amount_in_hours', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('accrued_amount_in_hours', $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; } /** @@ -305,7 +406,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -328,7 +430,7 @@ public function valid() /** * Gets leave_loading_dollar_value * - * @return double + * @return float|null */ public function getLeaveLoadingDollarValue() { @@ -338,12 +440,15 @@ public function getLeaveLoadingDollarValue() /** * Sets leave_loading_dollar_value * - * @param double $leave_loading_dollar_value + * @param float|null $leave_loading_dollar_value * - * @return $this + * @return self */ public function setLeaveLoadingDollarValue($leave_loading_dollar_value) { + if (is_null($leave_loading_dollar_value)) { + throw new \InvalidArgumentException('non-nullable leave_loading_dollar_value cannot be null'); + } $this->container['leave_loading_dollar_value'] = $leave_loading_dollar_value; return $this; @@ -352,7 +457,7 @@ public function setLeaveLoadingDollarValue($leave_loading_dollar_value) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -362,12 +467,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -376,7 +484,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -386,12 +494,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -400,7 +511,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -410,12 +521,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -424,7 +538,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -434,12 +548,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -448,7 +565,7 @@ public function setExternalId($external_id) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -458,12 +575,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -472,7 +592,7 @@ public function setStartDate($start_date) /** * Gets last_paid_date * - * @return \DateTime + * @return \DateTime|null */ public function getLastPaidDate() { @@ -482,12 +602,15 @@ public function getLastPaidDate() /** * Sets last_paid_date * - * @param \DateTime $last_paid_date + * @param \DateTime|null $last_paid_date * - * @return $this + * @return self */ public function setLastPaidDate($last_paid_date) { + if (is_null($last_paid_date)) { + throw new \InvalidArgumentException('non-nullable last_paid_date cannot be null'); + } $this->container['last_paid_date'] = $last_paid_date; return $this; @@ -496,7 +619,7 @@ public function setLastPaidDate($last_paid_date) /** * Gets last_pay_period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getLastPayPeriodEnding() { @@ -506,12 +629,15 @@ public function getLastPayPeriodEnding() /** * Sets last_pay_period_ending * - * @param \DateTime $last_pay_period_ending + * @param \DateTime|null $last_pay_period_ending * - * @return $this + * @return self */ public function setLastPayPeriodEnding($last_pay_period_ending) { + if (is_null($last_pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable last_pay_period_ending cannot be null'); + } $this->container['last_pay_period_ending'] = $last_pay_period_ending; return $this; @@ -520,7 +646,7 @@ public function setLastPayPeriodEnding($last_pay_period_ending) /** * Gets calculated_weeks * - * @return double + * @return float|null */ public function getCalculatedWeeks() { @@ -530,12 +656,15 @@ public function getCalculatedWeeks() /** * Sets calculated_weeks * - * @param double $calculated_weeks + * @param float|null $calculated_weeks * - * @return $this + * @return self */ public function setCalculatedWeeks($calculated_weeks) { + if (is_null($calculated_weeks)) { + throw new \InvalidArgumentException('non-nullable calculated_weeks cannot be null'); + } $this->container['calculated_weeks'] = $calculated_weeks; return $this; @@ -544,7 +673,7 @@ public function setCalculatedWeeks($calculated_weeks) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -554,12 +683,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -568,7 +700,7 @@ public function setLocation($location) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -578,12 +710,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -592,7 +727,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets approved_leave_amount * - * @return double + * @return float|null */ public function getApprovedLeaveAmount() { @@ -602,12 +737,15 @@ public function getApprovedLeaveAmount() /** * Sets approved_leave_amount * - * @param double $approved_leave_amount + * @param float|null $approved_leave_amount * - * @return $this + * @return self */ public function setApprovedLeaveAmount($approved_leave_amount) { + if (is_null($approved_leave_amount)) { + throw new \InvalidArgumentException('non-nullable approved_leave_amount cannot be null'); + } $this->container['approved_leave_amount'] = $approved_leave_amount; return $this; @@ -616,7 +754,7 @@ public function setApprovedLeaveAmount($approved_leave_amount) /** * Gets accrued_amount * - * @return double + * @return float|null */ public function getAccruedAmount() { @@ -626,12 +764,15 @@ public function getAccruedAmount() /** * Sets accrued_amount * - * @param double $accrued_amount + * @param float|null $accrued_amount * - * @return $this + * @return self */ public function setAccruedAmount($accrued_amount) { + if (is_null($accrued_amount)) { + throw new \InvalidArgumentException('non-nullable accrued_amount cannot be null'); + } $this->container['accrued_amount'] = $accrued_amount; return $this; @@ -640,7 +781,7 @@ public function setAccruedAmount($accrued_amount) /** * Gets leave_value * - * @return double + * @return float|null */ public function getLeaveValue() { @@ -650,12 +791,15 @@ public function getLeaveValue() /** * Sets leave_value * - * @param double $leave_value + * @param float|null $leave_value * - * @return $this + * @return self */ public function setLeaveValue($leave_value) { + if (is_null($leave_value)) { + throw new \InvalidArgumentException('non-nullable leave_value cannot be null'); + } $this->container['leave_value'] = $leave_value; return $this; @@ -664,7 +808,7 @@ public function setLeaveValue($leave_value) /** * Gets approved_leave_amount_in_hours * - * @return double + * @return float|null */ public function getApprovedLeaveAmountInHours() { @@ -674,12 +818,15 @@ public function getApprovedLeaveAmountInHours() /** * Sets approved_leave_amount_in_hours * - * @param double $approved_leave_amount_in_hours + * @param float|null $approved_leave_amount_in_hours * - * @return $this + * @return self */ public function setApprovedLeaveAmountInHours($approved_leave_amount_in_hours) { + if (is_null($approved_leave_amount_in_hours)) { + throw new \InvalidArgumentException('non-nullable approved_leave_amount_in_hours cannot be null'); + } $this->container['approved_leave_amount_in_hours'] = $approved_leave_amount_in_hours; return $this; @@ -688,7 +835,7 @@ public function setApprovedLeaveAmountInHours($approved_leave_amount_in_hours) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -698,17 +845,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -721,7 +872,7 @@ public function setUnitType($unit_type) /** * Gets accrued_amount_in_hours * - * @return double + * @return float|null */ public function getAccruedAmountInHours() { @@ -731,12 +882,15 @@ public function getAccruedAmountInHours() /** * Sets accrued_amount_in_hours * - * @param double $accrued_amount_in_hours + * @param float|null $accrued_amount_in_hours * - * @return $this + * @return self */ public function setAccruedAmountInHours($accrued_amount_in_hours) { + if (is_null($accrued_amount_in_hours)) { + throw new \InvalidArgumentException('non-nullable accrued_amount_in_hours cannot be null'); + } $this->container['accrued_amount_in_hours'] = $accrued_amount_in_hours; return $this; @@ -748,7 +902,7 @@ public function setAccruedAmountInHours($accrued_amount_in_hours) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -758,22 +912,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -789,11 +944,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -801,13 +969,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuLocationModel.php b/src/lib/Model/AuLocationModel.php index 4b31b84..4890530 100644 --- a/src/lib/Model/AuLocationModel.php +++ b/src/lib/Model/AuLocationModel.php @@ -2,61 +2,61 @@ /** * AuLocationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuLocationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuLocationModel implements ModelInterface, ArrayAccess +class AuLocationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuLocationModel'; + protected static $openAPIModelName = 'AuLocationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'country' => 'string', 'id' => 'int', 'parent_id' => 'int', @@ -76,8 +76,10 @@ class AuLocationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'country' => null, 'id' => 'int32', 'parent_id' => 'int32', @@ -93,14 +95,42 @@ class AuLocationModel implements ModelInterface, ArrayAccess 'state' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'country' => false, + 'id' => false, + 'parent_id' => false, + 'name' => false, + 'external_id' => false, + 'external_accounting_location_id' => false, + 'source' => false, + 'fully_qualified_name' => false, + 'is_global' => false, + 'is_rollup_reporting_location' => false, + 'general_ledger_mapping_code' => false, + 'default_shift_condition_ids' => false, + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -215,12 +297,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -237,19 +316,37 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['country'] = isset($data['country']) ? $data['country'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['external_accounting_location_id'] = isset($data['external_accounting_location_id']) ? $data['external_accounting_location_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['fully_qualified_name'] = isset($data['fully_qualified_name']) ? $data['fully_qualified_name'] : null; - $this->container['is_global'] = isset($data['is_global']) ? $data['is_global'] : null; - $this->container['is_rollup_reporting_location'] = isset($data['is_rollup_reporting_location']) ? $data['is_rollup_reporting_location'] : null; - $this->container['general_ledger_mapping_code'] = isset($data['general_ledger_mapping_code']) ? $data['general_ledger_mapping_code'] : null; - $this->container['default_shift_condition_ids'] = isset($data['default_shift_condition_ids']) ? $data['default_shift_condition_ids'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('external_accounting_location_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('fully_qualified_name', $data ?? [], null); + $this->setIfExists('is_global', $data ?? [], null); + $this->setIfExists('is_rollup_reporting_location', $data ?? [], null); + $this->setIfExists('general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('default_shift_condition_ids', $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; } /** @@ -279,7 +376,7 @@ public function valid() /** * Gets country * - * @return string + * @return string|null */ public function getCountry() { @@ -289,12 +386,15 @@ public function getCountry() /** * Sets country * - * @param string $country + * @param string|null $country * - * @return $this + * @return self */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -303,7 +403,7 @@ public function setCountry($country) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -313,12 +413,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -327,7 +430,7 @@ public function setId($id) /** * Gets parent_id * - * @return int + * @return int|null */ public function getParentId() { @@ -337,12 +440,15 @@ public function getParentId() /** * Sets parent_id * - * @param int $parent_id + * @param int|null $parent_id * - * @return $this + * @return self */ public function setParentId($parent_id) { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } $this->container['parent_id'] = $parent_id; return $this; @@ -351,7 +457,7 @@ public function setParentId($parent_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -361,12 +467,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -375,7 +484,7 @@ public function setName($name) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -385,12 +494,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -399,7 +511,7 @@ public function setExternalId($external_id) /** * Gets external_accounting_location_id * - * @return string + * @return string|null */ public function getExternalAccountingLocationId() { @@ -409,12 +521,15 @@ public function getExternalAccountingLocationId() /** * Sets external_accounting_location_id * - * @param string $external_accounting_location_id + * @param string|null $external_accounting_location_id * - * @return $this + * @return self */ public function setExternalAccountingLocationId($external_accounting_location_id) { + if (is_null($external_accounting_location_id)) { + throw new \InvalidArgumentException('non-nullable external_accounting_location_id cannot be null'); + } $this->container['external_accounting_location_id'] = $external_accounting_location_id; return $this; @@ -423,7 +538,7 @@ public function setExternalAccountingLocationId($external_accounting_location_id /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -433,12 +548,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -447,7 +565,7 @@ public function setSource($source) /** * Gets fully_qualified_name * - * @return string + * @return string|null */ public function getFullyQualifiedName() { @@ -457,12 +575,15 @@ public function getFullyQualifiedName() /** * Sets fully_qualified_name * - * @param string $fully_qualified_name + * @param string|null $fully_qualified_name * - * @return $this + * @return self */ public function setFullyQualifiedName($fully_qualified_name) { + if (is_null($fully_qualified_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_name cannot be null'); + } $this->container['fully_qualified_name'] = $fully_qualified_name; return $this; @@ -471,7 +592,7 @@ public function setFullyQualifiedName($fully_qualified_name) /** * Gets is_global * - * @return bool + * @return bool|null */ public function getIsGlobal() { @@ -481,12 +602,15 @@ public function getIsGlobal() /** * Sets is_global * - * @param bool $is_global + * @param bool|null $is_global * - * @return $this + * @return self */ public function setIsGlobal($is_global) { + if (is_null($is_global)) { + throw new \InvalidArgumentException('non-nullable is_global cannot be null'); + } $this->container['is_global'] = $is_global; return $this; @@ -495,7 +619,7 @@ public function setIsGlobal($is_global) /** * Gets is_rollup_reporting_location * - * @return bool + * @return bool|null */ public function getIsRollupReportingLocation() { @@ -505,12 +629,15 @@ public function getIsRollupReportingLocation() /** * Sets is_rollup_reporting_location * - * @param bool $is_rollup_reporting_location + * @param bool|null $is_rollup_reporting_location * - * @return $this + * @return self */ public function setIsRollupReportingLocation($is_rollup_reporting_location) { + if (is_null($is_rollup_reporting_location)) { + throw new \InvalidArgumentException('non-nullable is_rollup_reporting_location cannot be null'); + } $this->container['is_rollup_reporting_location'] = $is_rollup_reporting_location; return $this; @@ -519,7 +646,7 @@ public function setIsRollupReportingLocation($is_rollup_reporting_location) /** * Gets general_ledger_mapping_code * - * @return string + * @return string|null */ public function getGeneralLedgerMappingCode() { @@ -529,12 +656,15 @@ public function getGeneralLedgerMappingCode() /** * Sets general_ledger_mapping_code * - * @param string $general_ledger_mapping_code + * @param string|null $general_ledger_mapping_code * - * @return $this + * @return self */ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) { + if (is_null($general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable general_ledger_mapping_code cannot be null'); + } $this->container['general_ledger_mapping_code'] = $general_ledger_mapping_code; return $this; @@ -543,7 +673,7 @@ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) /** * Gets default_shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getDefaultShiftConditionIds() { @@ -553,12 +683,15 @@ public function getDefaultShiftConditionIds() /** * Sets default_shift_condition_ids * - * @param int[] $default_shift_condition_ids + * @param int[]|null $default_shift_condition_ids * - * @return $this + * @return self */ public function setDefaultShiftConditionIds($default_shift_condition_ids) { + if (is_null($default_shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable default_shift_condition_ids cannot be null'); + } $this->container['default_shift_condition_ids'] = $default_shift_condition_ids; return $this; @@ -567,7 +700,7 @@ public function setDefaultShiftConditionIds($default_shift_condition_ids) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -577,12 +710,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -594,7 +730,7 @@ public function setState($state) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -604,22 +740,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -635,11 +772,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -647,13 +797,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuManagerRosterDataModel.php b/src/lib/Model/AuManagerRosterDataModel.php index 8057e09..4d39df6 100644 --- a/src/lib/Model/AuManagerRosterDataModel.php +++ b/src/lib/Model/AuManagerRosterDataModel.php @@ -2,74 +2,76 @@ /** * AuManagerRosterDataModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuManagerRosterDataModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuManagerRosterDataModel implements ModelInterface, ArrayAccess +class AuManagerRosterDataModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuManagerRosterDataModel'; + protected static $openAPIModelName = 'AuManagerRosterDataModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'rostered_shifts' => '\Swagger\Client\Model\AuManagerRosterShiftModel[]', - 'unassigned_shifts' => '\Swagger\Client\Model\AuManagerRosterShiftModel[]', - 'biddable_shifts' => '\Swagger\Client\Model\ManagerBiddableRosterShiftModel[]', - 'unavailability' => '\Swagger\Client\Model\ManagerUnavailabilityModel[]', - 'leave_requests' => '\Swagger\Client\Model\ILeaveBasedRosterShift[]' + protected static $openAPITypes = [ + 'rostered_shifts' => '\OpenAPI\Client\Model\AuManagerRosterShiftModel[]', + 'unassigned_shifts' => '\OpenAPI\Client\Model\AuManagerRosterShiftModel[]', + 'biddable_shifts' => '\OpenAPI\Client\Model\ManagerBiddableRosterShiftModel[]', + 'unavailability' => '\OpenAPI\Client\Model\ManagerUnavailabilityModel[]', + 'leave_requests' => '\OpenAPI\Client\Model\ILeaveBasedRosterShift[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'rostered_shifts' => null, 'unassigned_shifts' => null, 'biddable_shifts' => null, @@ -77,14 +79,34 @@ class AuManagerRosterDataModel implements ModelInterface, ArrayAccess 'leave_requests' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rostered_shifts' => false, + 'unassigned_shifts' => false, + 'biddable_shifts' => false, + 'unavailability' => false, + 'leave_requests' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['rostered_shifts'] = isset($data['rostered_shifts']) ? $data['rostered_shifts'] : null; - $this->container['unassigned_shifts'] = isset($data['unassigned_shifts']) ? $data['unassigned_shifts'] : null; - $this->container['biddable_shifts'] = isset($data['biddable_shifts']) ? $data['biddable_shifts'] : null; - $this->container['unavailability'] = isset($data['unavailability']) ? $data['unavailability'] : null; - $this->container['leave_requests'] = isset($data['leave_requests']) ? $data['leave_requests'] : null; + $this->setIfExists('rostered_shifts', $data ?? [], null); + $this->setIfExists('unassigned_shifts', $data ?? [], null); + $this->setIfExists('biddable_shifts', $data ?? [], null); + $this->setIfExists('unavailability', $data ?? [], null); + $this->setIfExists('leave_requests', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets rostered_shifts * - * @return \Swagger\Client\Model\AuManagerRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuManagerRosterShiftModel[]|null */ public function getRosteredShifts() { @@ -241,12 +330,15 @@ public function getRosteredShifts() /** * Sets rostered_shifts * - * @param \Swagger\Client\Model\AuManagerRosterShiftModel[] $rostered_shifts + * @param \OpenAPI\Client\Model\AuManagerRosterShiftModel[]|null $rostered_shifts * - * @return $this + * @return self */ public function setRosteredShifts($rostered_shifts) { + if (is_null($rostered_shifts)) { + throw new \InvalidArgumentException('non-nullable rostered_shifts cannot be null'); + } $this->container['rostered_shifts'] = $rostered_shifts; return $this; @@ -255,7 +347,7 @@ public function setRosteredShifts($rostered_shifts) /** * Gets unassigned_shifts * - * @return \Swagger\Client\Model\AuManagerRosterShiftModel[] + * @return \OpenAPI\Client\Model\AuManagerRosterShiftModel[]|null */ public function getUnassignedShifts() { @@ -265,12 +357,15 @@ public function getUnassignedShifts() /** * Sets unassigned_shifts * - * @param \Swagger\Client\Model\AuManagerRosterShiftModel[] $unassigned_shifts + * @param \OpenAPI\Client\Model\AuManagerRosterShiftModel[]|null $unassigned_shifts * - * @return $this + * @return self */ public function setUnassignedShifts($unassigned_shifts) { + if (is_null($unassigned_shifts)) { + throw new \InvalidArgumentException('non-nullable unassigned_shifts cannot be null'); + } $this->container['unassigned_shifts'] = $unassigned_shifts; return $this; @@ -279,7 +374,7 @@ public function setUnassignedShifts($unassigned_shifts) /** * Gets biddable_shifts * - * @return \Swagger\Client\Model\ManagerBiddableRosterShiftModel[] + * @return \OpenAPI\Client\Model\ManagerBiddableRosterShiftModel[]|null */ public function getBiddableShifts() { @@ -289,12 +384,15 @@ public function getBiddableShifts() /** * Sets biddable_shifts * - * @param \Swagger\Client\Model\ManagerBiddableRosterShiftModel[] $biddable_shifts + * @param \OpenAPI\Client\Model\ManagerBiddableRosterShiftModel[]|null $biddable_shifts * - * @return $this + * @return self */ public function setBiddableShifts($biddable_shifts) { + if (is_null($biddable_shifts)) { + throw new \InvalidArgumentException('non-nullable biddable_shifts cannot be null'); + } $this->container['biddable_shifts'] = $biddable_shifts; return $this; @@ -303,7 +401,7 @@ public function setBiddableShifts($biddable_shifts) /** * Gets unavailability * - * @return \Swagger\Client\Model\ManagerUnavailabilityModel[] + * @return \OpenAPI\Client\Model\ManagerUnavailabilityModel[]|null */ public function getUnavailability() { @@ -313,12 +411,15 @@ public function getUnavailability() /** * Sets unavailability * - * @param \Swagger\Client\Model\ManagerUnavailabilityModel[] $unavailability + * @param \OpenAPI\Client\Model\ManagerUnavailabilityModel[]|null $unavailability * - * @return $this + * @return self */ public function setUnavailability($unavailability) { + if (is_null($unavailability)) { + throw new \InvalidArgumentException('non-nullable unavailability cannot be null'); + } $this->container['unavailability'] = $unavailability; return $this; @@ -327,7 +428,7 @@ public function setUnavailability($unavailability) /** * Gets leave_requests * - * @return \Swagger\Client\Model\ILeaveBasedRosterShift[] + * @return \OpenAPI\Client\Model\ILeaveBasedRosterShift[]|null */ public function getLeaveRequests() { @@ -337,12 +438,15 @@ public function getLeaveRequests() /** * Sets leave_requests * - * @param \Swagger\Client\Model\ILeaveBasedRosterShift[] $leave_requests + * @param \OpenAPI\Client\Model\ILeaveBasedRosterShift[]|null $leave_requests * - * @return $this + * @return self */ public function setLeaveRequests($leave_requests) { + if (is_null($leave_requests)) { + throw new \InvalidArgumentException('non-nullable leave_requests cannot be null'); + } $this->container['leave_requests'] = $leave_requests; return $this; @@ -354,7 +458,7 @@ public function setLeaveRequests($leave_requests) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuManagerRosterShiftModel.php b/src/lib/Model/AuManagerRosterShiftModel.php index 617df9f..ab4c54c 100644 --- a/src/lib/Model/AuManagerRosterShiftModel.php +++ b/src/lib/Model/AuManagerRosterShiftModel.php @@ -2,86 +2,86 @@ /** * AuManagerRosterShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuManagerRosterShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuManagerRosterShiftModel implements ModelInterface, ArrayAccess +class AuManagerRosterShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuManagerRosterShiftModel'; + protected static $openAPIModelName = 'AuManagerRosterShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'int', 'classification_name' => 'string', 'employee_phone_number' => 'string', - 'cost' => 'double', + 'cost' => 'float', 'cost_formatted' => 'string', 'warnings' => 'string[]', 'is_leave_based_roster_shift' => 'bool', - 'current_shift' => '\Swagger\Client\Model\ManagerCurrentRosterShift', + 'current_shift' => '\OpenAPI\Client\Model\ManagerCurrentRosterShift', 'id' => 'int', 'token' => 'string', - 'qualifications' => '\Swagger\Client\Model\QualificationModel[]', - 'breaks' => '\Swagger\Client\Model\RosterShiftBreakApiModel[]', + 'qualifications' => '\OpenAPI\Client\Model\QualificationModel[]', + 'breaks' => '\OpenAPI\Client\Model\RosterShiftBreakApiModel[]', 'employee_id' => 'int', 'employee_name' => 'string', 'location_id' => 'int', 'location_name' => 'string', 'work_type_id' => 'int', 'work_type_name' => 'string', - 'role' => '\Swagger\Client\Model\RosterShiftRole', + 'role' => '\OpenAPI\Client\Model\RosterShiftRole', 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'notes' => 'string', 'published' => 'bool', 'accepted' => 'bool', - 'pending_swap' => '\Swagger\Client\Model\RosterShiftSwapModel', + 'pending_swap' => '\OpenAPI\Client\Model\RosterShiftSwapModel', 'date_published' => '\DateTime', 'biddable' => 'bool', 'shift_swap_cutoff_time' => '\DateTime', @@ -92,8 +92,10 @@ class AuManagerRosterShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => 'int32', 'classification_name' => null, 'employee_phone_number' => null, @@ -125,14 +127,58 @@ class AuManagerRosterShiftModel implements ModelInterface, ArrayAccess 'shift_assignment_status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification_name' => false, + 'employee_phone_number' => false, + 'cost' => false, + 'cost_formatted' => false, + 'warnings' => false, + 'is_leave_based_roster_shift' => false, + 'current_shift' => false, + 'id' => false, + 'token' => false, + 'qualifications' => false, + 'breaks' => false, + 'employee_id' => false, + 'employee_name' => false, + 'location_id' => false, + 'location_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'role' => false, + 'start_time' => false, + 'end_time' => false, + 'notes' => false, + 'published' => false, + 'accepted' => false, + 'pending_swap' => false, + 'date_published' => false, + 'biddable' => false, + 'shift_swap_cutoff_time' => false, + 'shift_assignment_status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -140,9 +186,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -295,19 +393,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; - const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; - const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - + public const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; + public const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; + public const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - /** * Gets allowable values of the enum * @@ -325,7 +421,6 @@ public function getShiftAssignmentStatusAllowableValues() self::SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL, ]; } - /** * Associative array for storing property values @@ -342,35 +437,53 @@ public function getShiftAssignmentStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification_name'] = isset($data['classification_name']) ? $data['classification_name'] : null; - $this->container['employee_phone_number'] = isset($data['employee_phone_number']) ? $data['employee_phone_number'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['cost_formatted'] = isset($data['cost_formatted']) ? $data['cost_formatted'] : null; - $this->container['warnings'] = isset($data['warnings']) ? $data['warnings'] : null; - $this->container['is_leave_based_roster_shift'] = isset($data['is_leave_based_roster_shift']) ? $data['is_leave_based_roster_shift'] : null; - $this->container['current_shift'] = isset($data['current_shift']) ? $data['current_shift'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['qualifications'] = isset($data['qualifications']) ? $data['qualifications'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['published'] = isset($data['published']) ? $data['published'] : null; - $this->container['accepted'] = isset($data['accepted']) ? $data['accepted'] : null; - $this->container['pending_swap'] = isset($data['pending_swap']) ? $data['pending_swap'] : null; - $this->container['date_published'] = isset($data['date_published']) ? $data['date_published'] : null; - $this->container['biddable'] = isset($data['biddable']) ? $data['biddable'] : null; - $this->container['shift_swap_cutoff_time'] = isset($data['shift_swap_cutoff_time']) ? $data['shift_swap_cutoff_time'] : null; - $this->container['shift_assignment_status'] = isset($data['shift_assignment_status']) ? $data['shift_assignment_status'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification_name', $data ?? [], null); + $this->setIfExists('employee_phone_number', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('cost_formatted', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); + $this->setIfExists('is_leave_based_roster_shift', $data ?? [], null); + $this->setIfExists('current_shift', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('qualifications', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('published', $data ?? [], null); + $this->setIfExists('accepted', $data ?? [], null); + $this->setIfExists('pending_swap', $data ?? [], null); + $this->setIfExists('date_published', $data ?? [], null); + $this->setIfExists('biddable', $data ?? [], null); + $this->setIfExists('shift_swap_cutoff_time', $data ?? [], null); + $this->setIfExists('shift_assignment_status', $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; } /** @@ -385,7 +498,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); if (!is_null($this->container['shift_assignment_status']) && !in_array($this->container['shift_assignment_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_assignment_status', must be one of '%s'", + "invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $this->container['shift_assignment_status'], implode("', '", $allowedValues) ); } @@ -408,7 +522,7 @@ public function valid() /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -418,12 +532,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -432,7 +549,7 @@ public function setClassificationId($classification_id) /** * Gets classification_name * - * @return string + * @return string|null */ public function getClassificationName() { @@ -442,12 +559,15 @@ public function getClassificationName() /** * Sets classification_name * - * @param string $classification_name + * @param string|null $classification_name * - * @return $this + * @return self */ public function setClassificationName($classification_name) { + if (is_null($classification_name)) { + throw new \InvalidArgumentException('non-nullable classification_name cannot be null'); + } $this->container['classification_name'] = $classification_name; return $this; @@ -456,7 +576,7 @@ public function setClassificationName($classification_name) /** * Gets employee_phone_number * - * @return string + * @return string|null */ public function getEmployeePhoneNumber() { @@ -466,12 +586,15 @@ public function getEmployeePhoneNumber() /** * Sets employee_phone_number * - * @param string $employee_phone_number + * @param string|null $employee_phone_number * - * @return $this + * @return self */ public function setEmployeePhoneNumber($employee_phone_number) { + if (is_null($employee_phone_number)) { + throw new \InvalidArgumentException('non-nullable employee_phone_number cannot be null'); + } $this->container['employee_phone_number'] = $employee_phone_number; return $this; @@ -480,7 +603,7 @@ public function setEmployeePhoneNumber($employee_phone_number) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -490,12 +613,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -504,7 +630,7 @@ public function setCost($cost) /** * Gets cost_formatted * - * @return string + * @return string|null */ public function getCostFormatted() { @@ -514,12 +640,15 @@ public function getCostFormatted() /** * Sets cost_formatted * - * @param string $cost_formatted + * @param string|null $cost_formatted * - * @return $this + * @return self */ public function setCostFormatted($cost_formatted) { + if (is_null($cost_formatted)) { + throw new \InvalidArgumentException('non-nullable cost_formatted cannot be null'); + } $this->container['cost_formatted'] = $cost_formatted; return $this; @@ -528,7 +657,7 @@ public function setCostFormatted($cost_formatted) /** * Gets warnings * - * @return string[] + * @return string[]|null */ public function getWarnings() { @@ -538,12 +667,15 @@ public function getWarnings() /** * Sets warnings * - * @param string[] $warnings + * @param string[]|null $warnings * - * @return $this + * @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; @@ -552,7 +684,7 @@ public function setWarnings($warnings) /** * Gets is_leave_based_roster_shift * - * @return bool + * @return bool|null */ public function getIsLeaveBasedRosterShift() { @@ -562,12 +694,15 @@ public function getIsLeaveBasedRosterShift() /** * Sets is_leave_based_roster_shift * - * @param bool $is_leave_based_roster_shift + * @param bool|null $is_leave_based_roster_shift * - * @return $this + * @return self */ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) { + if (is_null($is_leave_based_roster_shift)) { + throw new \InvalidArgumentException('non-nullable is_leave_based_roster_shift cannot be null'); + } $this->container['is_leave_based_roster_shift'] = $is_leave_based_roster_shift; return $this; @@ -576,7 +711,7 @@ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) /** * Gets current_shift * - * @return \Swagger\Client\Model\ManagerCurrentRosterShift + * @return \OpenAPI\Client\Model\ManagerCurrentRosterShift|null */ public function getCurrentShift() { @@ -586,12 +721,15 @@ public function getCurrentShift() /** * Sets current_shift * - * @param \Swagger\Client\Model\ManagerCurrentRosterShift $current_shift + * @param \OpenAPI\Client\Model\ManagerCurrentRosterShift|null $current_shift current_shift * - * @return $this + * @return self */ public function setCurrentShift($current_shift) { + if (is_null($current_shift)) { + throw new \InvalidArgumentException('non-nullable current_shift cannot be null'); + } $this->container['current_shift'] = $current_shift; return $this; @@ -600,7 +738,7 @@ public function setCurrentShift($current_shift) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -610,12 +748,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -624,7 +765,7 @@ public function setId($id) /** * Gets token * - * @return string + * @return string|null */ public function getToken() { @@ -634,12 +775,15 @@ public function getToken() /** * Sets token * - * @param string $token + * @param string|null $token * - * @return $this + * @return self */ public function setToken($token) { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -648,7 +792,7 @@ public function setToken($token) /** * Gets qualifications * - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[]|null */ public function getQualifications() { @@ -658,12 +802,15 @@ public function getQualifications() /** * Sets qualifications * - * @param \Swagger\Client\Model\QualificationModel[] $qualifications + * @param \OpenAPI\Client\Model\QualificationModel[]|null $qualifications * - * @return $this + * @return self */ public function setQualifications($qualifications) { + if (is_null($qualifications)) { + throw new \InvalidArgumentException('non-nullable qualifications cannot be null'); + } $this->container['qualifications'] = $qualifications; return $this; @@ -672,7 +819,7 @@ public function setQualifications($qualifications) /** * Gets breaks * - * @return \Swagger\Client\Model\RosterShiftBreakApiModel[] + * @return \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null */ public function getBreaks() { @@ -682,12 +829,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\RosterShiftBreakApiModel[] $breaks + * @param \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -696,7 +846,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -706,12 +856,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -720,7 +873,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -730,12 +883,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -744,7 +900,7 @@ public function setEmployeeName($employee_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -754,12 +910,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -768,7 +927,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -778,12 +937,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -792,7 +954,7 @@ public function setLocationName($location_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -802,12 +964,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -816,7 +981,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -826,12 +991,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -840,7 +1008,7 @@ public function setWorkTypeName($work_type_name) /** * Gets role * - * @return \Swagger\Client\Model\RosterShiftRole + * @return \OpenAPI\Client\Model\RosterShiftRole|null */ public function getRole() { @@ -850,12 +1018,15 @@ public function getRole() /** * Sets role * - * @param \Swagger\Client\Model\RosterShiftRole $role + * @param \OpenAPI\Client\Model\RosterShiftRole|null $role role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -864,7 +1035,7 @@ public function setRole($role) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -874,12 +1045,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -888,7 +1062,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -898,12 +1072,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -912,7 +1089,7 @@ public function setEndTime($end_time) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -922,12 +1099,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -936,7 +1116,7 @@ public function setNotes($notes) /** * Gets published * - * @return bool + * @return bool|null */ public function getPublished() { @@ -946,12 +1126,15 @@ public function getPublished() /** * Sets published * - * @param bool $published + * @param bool|null $published * - * @return $this + * @return self */ public function setPublished($published) { + if (is_null($published)) { + throw new \InvalidArgumentException('non-nullable published cannot be null'); + } $this->container['published'] = $published; return $this; @@ -960,7 +1143,7 @@ public function setPublished($published) /** * Gets accepted * - * @return bool + * @return bool|null */ public function getAccepted() { @@ -970,12 +1153,15 @@ public function getAccepted() /** * Sets accepted * - * @param bool $accepted + * @param bool|null $accepted * - * @return $this + * @return self */ public function setAccepted($accepted) { + if (is_null($accepted)) { + throw new \InvalidArgumentException('non-nullable accepted cannot be null'); + } $this->container['accepted'] = $accepted; return $this; @@ -984,7 +1170,7 @@ public function setAccepted($accepted) /** * Gets pending_swap * - * @return \Swagger\Client\Model\RosterShiftSwapModel + * @return \OpenAPI\Client\Model\RosterShiftSwapModel|null */ public function getPendingSwap() { @@ -994,12 +1180,15 @@ public function getPendingSwap() /** * Sets pending_swap * - * @param \Swagger\Client\Model\RosterShiftSwapModel $pending_swap + * @param \OpenAPI\Client\Model\RosterShiftSwapModel|null $pending_swap pending_swap * - * @return $this + * @return self */ public function setPendingSwap($pending_swap) { + if (is_null($pending_swap)) { + throw new \InvalidArgumentException('non-nullable pending_swap cannot be null'); + } $this->container['pending_swap'] = $pending_swap; return $this; @@ -1008,7 +1197,7 @@ public function setPendingSwap($pending_swap) /** * Gets date_published * - * @return \DateTime + * @return \DateTime|null */ public function getDatePublished() { @@ -1018,12 +1207,15 @@ public function getDatePublished() /** * Sets date_published * - * @param \DateTime $date_published + * @param \DateTime|null $date_published * - * @return $this + * @return self */ public function setDatePublished($date_published) { + if (is_null($date_published)) { + throw new \InvalidArgumentException('non-nullable date_published cannot be null'); + } $this->container['date_published'] = $date_published; return $this; @@ -1032,7 +1224,7 @@ public function setDatePublished($date_published) /** * Gets biddable * - * @return bool + * @return bool|null */ public function getBiddable() { @@ -1042,12 +1234,15 @@ public function getBiddable() /** * Sets biddable * - * @param bool $biddable + * @param bool|null $biddable * - * @return $this + * @return self */ public function setBiddable($biddable) { + if (is_null($biddable)) { + throw new \InvalidArgumentException('non-nullable biddable cannot be null'); + } $this->container['biddable'] = $biddable; return $this; @@ -1056,7 +1251,7 @@ public function setBiddable($biddable) /** * Gets shift_swap_cutoff_time * - * @return \DateTime + * @return \DateTime|null */ public function getShiftSwapCutoffTime() { @@ -1066,12 +1261,15 @@ public function getShiftSwapCutoffTime() /** * Sets shift_swap_cutoff_time * - * @param \DateTime $shift_swap_cutoff_time + * @param \DateTime|null $shift_swap_cutoff_time * - * @return $this + * @return self */ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) { + if (is_null($shift_swap_cutoff_time)) { + throw new \InvalidArgumentException('non-nullable shift_swap_cutoff_time cannot be null'); + } $this->container['shift_swap_cutoff_time'] = $shift_swap_cutoff_time; return $this; @@ -1080,7 +1278,7 @@ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) /** * Gets shift_assignment_status * - * @return string + * @return string|null */ public function getShiftAssignmentStatus() { @@ -1090,17 +1288,21 @@ public function getShiftAssignmentStatus() /** * Sets shift_assignment_status * - * @param string $shift_assignment_status + * @param string|null $shift_assignment_status * - * @return $this + * @return self */ public function setShiftAssignmentStatus($shift_assignment_status) { + if (is_null($shift_assignment_status)) { + throw new \InvalidArgumentException('non-nullable shift_assignment_status cannot be null'); + } $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); - if (!is_null($shift_assignment_status) && !in_array($shift_assignment_status, $allowedValues, true)) { + if (!in_array($shift_assignment_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_assignment_status', must be one of '%s'", + "Invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $shift_assignment_status, implode("', '", $allowedValues) ) ); @@ -1116,7 +1318,7 @@ public function setShiftAssignmentStatus($shift_assignment_status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1126,22 +1328,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1157,11 +1360,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1169,13 +1385,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuOpeningBalancesModel.php b/src/lib/Model/AuOpeningBalancesModel.php index c7d542c..6b2e487 100644 --- a/src/lib/Model/AuOpeningBalancesModel.php +++ b/src/lib/Model/AuOpeningBalancesModel.php @@ -2,76 +2,76 @@ /** * AuOpeningBalancesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuOpeningBalancesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuOpeningBalancesModel implements ModelInterface, ArrayAccess +class AuOpeningBalancesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuOpeningBalancesModel'; + protected static $openAPIModelName = 'AuOpeningBalancesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'deductions' => '\Swagger\Client\Model\AuInitialDeductionModel[]', - 'payg_withholding_amount' => 'double', - 'method_b2_payg_withholding_amount' => 'double', - 'sfss_amount' => 'double', - 'help_amount' => 'double', - 'super_contribution' => 'double', - 'employer_contribution' => 'double', - 'non_resc_employer_contribution' => 'double', - 'earnings_lines' => '\Swagger\Client\Model\AuInitialEarningsModel[]', - 'etps' => '\Swagger\Client\Model\OpeningBalancesEtpModel[]', + protected static $openAPITypes = [ + 'deductions' => '\OpenAPI\Client\Model\AuInitialDeductionModel[]', + 'payg_withholding_amount' => 'float', + 'method_b2_payg_withholding_amount' => 'float', + 'sfss_amount' => 'float', + 'help_amount' => 'float', + 'super_contribution' => 'float', + 'employer_contribution' => 'float', + 'non_resc_employer_contribution' => 'float', + 'earnings_lines' => '\OpenAPI\Client\Model\AuInitialEarningsModel[]', + 'etps' => '\OpenAPI\Client\Model\OpeningBalancesEtpModel[]', 'employee_id' => 'int', - 'total_hours' => 'double', - 'gross_earnings' => 'double', - 'leave_balances' => '\Swagger\Client\Model\InitialLeaveBalanceModel[]', - 'employer_liabilities' => '\Swagger\Client\Model\InitialEmployerLiabilityModel[]', + 'total_hours' => 'float', + 'gross_earnings' => 'float', + 'leave_balances' => '\OpenAPI\Client\Model\InitialLeaveBalanceModel[]', + 'employer_liabilities' => '\OpenAPI\Client\Model\InitialEmployerLiabilityModel[]', 'financial_year_starting_year' => 'int', 'location_name' => 'string' ]; @@ -80,8 +80,10 @@ class AuOpeningBalancesModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deductions' => null, 'payg_withholding_amount' => 'double', 'method_b2_payg_withholding_amount' => 'double', @@ -101,14 +103,46 @@ class AuOpeningBalancesModel implements ModelInterface, ArrayAccess 'location_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deductions' => false, + 'payg_withholding_amount' => false, + 'method_b2_payg_withholding_amount' => false, + 'sfss_amount' => false, + 'help_amount' => false, + 'super_contribution' => false, + 'employer_contribution' => false, + 'non_resc_employer_contribution' => false, + 'earnings_lines' => false, + 'etps' => false, + 'employee_id' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'leave_balances' => false, + 'employer_liabilities' => false, + 'financial_year_starting_year' => false, + 'location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -235,12 +321,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -257,23 +340,41 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['deductions'] = isset($data['deductions']) ? $data['deductions'] : null; - $this->container['payg_withholding_amount'] = isset($data['payg_withholding_amount']) ? $data['payg_withholding_amount'] : null; - $this->container['method_b2_payg_withholding_amount'] = isset($data['method_b2_payg_withholding_amount']) ? $data['method_b2_payg_withholding_amount'] : null; - $this->container['sfss_amount'] = isset($data['sfss_amount']) ? $data['sfss_amount'] : null; - $this->container['help_amount'] = isset($data['help_amount']) ? $data['help_amount'] : null; - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['employer_contribution'] = isset($data['employer_contribution']) ? $data['employer_contribution'] : null; - $this->container['non_resc_employer_contribution'] = isset($data['non_resc_employer_contribution']) ? $data['non_resc_employer_contribution'] : null; - $this->container['earnings_lines'] = isset($data['earnings_lines']) ? $data['earnings_lines'] : null; - $this->container['etps'] = isset($data['etps']) ? $data['etps'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['leave_balances'] = isset($data['leave_balances']) ? $data['leave_balances'] : null; - $this->container['employer_liabilities'] = isset($data['employer_liabilities']) ? $data['employer_liabilities'] : null; - $this->container['financial_year_starting_year'] = isset($data['financial_year_starting_year']) ? $data['financial_year_starting_year'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; + $this->setIfExists('deductions', $data ?? [], null); + $this->setIfExists('payg_withholding_amount', $data ?? [], null); + $this->setIfExists('method_b2_payg_withholding_amount', $data ?? [], null); + $this->setIfExists('sfss_amount', $data ?? [], null); + $this->setIfExists('help_amount', $data ?? [], null); + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('employer_contribution', $data ?? [], null); + $this->setIfExists('non_resc_employer_contribution', $data ?? [], null); + $this->setIfExists('earnings_lines', $data ?? [], null); + $this->setIfExists('etps', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('leave_balances', $data ?? [], null); + $this->setIfExists('employer_liabilities', $data ?? [], null); + $this->setIfExists('financial_year_starting_year', $data ?? [], null); + $this->setIfExists('location_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; } /** @@ -303,7 +404,7 @@ public function valid() /** * Gets deductions * - * @return \Swagger\Client\Model\AuInitialDeductionModel[] + * @return \OpenAPI\Client\Model\AuInitialDeductionModel[]|null */ public function getDeductions() { @@ -313,12 +414,15 @@ public function getDeductions() /** * Sets deductions * - * @param \Swagger\Client\Model\AuInitialDeductionModel[] $deductions + * @param \OpenAPI\Client\Model\AuInitialDeductionModel[]|null $deductions * - * @return $this + * @return self */ public function setDeductions($deductions) { + if (is_null($deductions)) { + throw new \InvalidArgumentException('non-nullable deductions cannot be null'); + } $this->container['deductions'] = $deductions; return $this; @@ -327,7 +431,7 @@ public function setDeductions($deductions) /** * Gets payg_withholding_amount * - * @return double + * @return float|null */ public function getPaygWithholdingAmount() { @@ -337,12 +441,15 @@ public function getPaygWithholdingAmount() /** * Sets payg_withholding_amount * - * @param double $payg_withholding_amount + * @param float|null $payg_withholding_amount * - * @return $this + * @return self */ public function setPaygWithholdingAmount($payg_withholding_amount) { + if (is_null($payg_withholding_amount)) { + throw new \InvalidArgumentException('non-nullable payg_withholding_amount cannot be null'); + } $this->container['payg_withholding_amount'] = $payg_withholding_amount; return $this; @@ -351,7 +458,7 @@ public function setPaygWithholdingAmount($payg_withholding_amount) /** * Gets method_b2_payg_withholding_amount * - * @return double + * @return float|null */ public function getMethodB2PaygWithholdingAmount() { @@ -361,12 +468,15 @@ public function getMethodB2PaygWithholdingAmount() /** * Sets method_b2_payg_withholding_amount * - * @param double $method_b2_payg_withholding_amount + * @param float|null $method_b2_payg_withholding_amount * - * @return $this + * @return self */ public function setMethodB2PaygWithholdingAmount($method_b2_payg_withholding_amount) { + if (is_null($method_b2_payg_withholding_amount)) { + throw new \InvalidArgumentException('non-nullable method_b2_payg_withholding_amount cannot be null'); + } $this->container['method_b2_payg_withholding_amount'] = $method_b2_payg_withholding_amount; return $this; @@ -375,7 +485,7 @@ public function setMethodB2PaygWithholdingAmount($method_b2_payg_withholding_amo /** * Gets sfss_amount * - * @return double + * @return float|null */ public function getSfssAmount() { @@ -385,12 +495,15 @@ public function getSfssAmount() /** * Sets sfss_amount * - * @param double $sfss_amount + * @param float|null $sfss_amount * - * @return $this + * @return self */ public function setSfssAmount($sfss_amount) { + if (is_null($sfss_amount)) { + throw new \InvalidArgumentException('non-nullable sfss_amount cannot be null'); + } $this->container['sfss_amount'] = $sfss_amount; return $this; @@ -399,7 +512,7 @@ public function setSfssAmount($sfss_amount) /** * Gets help_amount * - * @return double + * @return float|null */ public function getHelpAmount() { @@ -409,12 +522,15 @@ public function getHelpAmount() /** * Sets help_amount * - * @param double $help_amount + * @param float|null $help_amount * - * @return $this + * @return self */ public function setHelpAmount($help_amount) { + if (is_null($help_amount)) { + throw new \InvalidArgumentException('non-nullable help_amount cannot be null'); + } $this->container['help_amount'] = $help_amount; return $this; @@ -423,7 +539,7 @@ public function setHelpAmount($help_amount) /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -433,12 +549,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -447,7 +566,7 @@ public function setSuperContribution($super_contribution) /** * Gets employer_contribution * - * @return double + * @return float|null */ public function getEmployerContribution() { @@ -457,12 +576,15 @@ public function getEmployerContribution() /** * Sets employer_contribution * - * @param double $employer_contribution + * @param float|null $employer_contribution * - * @return $this + * @return self */ public function setEmployerContribution($employer_contribution) { + if (is_null($employer_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_contribution cannot be null'); + } $this->container['employer_contribution'] = $employer_contribution; return $this; @@ -471,7 +593,7 @@ public function setEmployerContribution($employer_contribution) /** * Gets non_resc_employer_contribution * - * @return double + * @return float|null */ public function getNonRescEmployerContribution() { @@ -481,12 +603,15 @@ public function getNonRescEmployerContribution() /** * Sets non_resc_employer_contribution * - * @param double $non_resc_employer_contribution + * @param float|null $non_resc_employer_contribution * - * @return $this + * @return self */ public function setNonRescEmployerContribution($non_resc_employer_contribution) { + if (is_null($non_resc_employer_contribution)) { + throw new \InvalidArgumentException('non-nullable non_resc_employer_contribution cannot be null'); + } $this->container['non_resc_employer_contribution'] = $non_resc_employer_contribution; return $this; @@ -495,7 +620,7 @@ public function setNonRescEmployerContribution($non_resc_employer_contribution) /** * Gets earnings_lines * - * @return \Swagger\Client\Model\AuInitialEarningsModel[] + * @return \OpenAPI\Client\Model\AuInitialEarningsModel[]|null */ public function getEarningsLines() { @@ -505,12 +630,15 @@ public function getEarningsLines() /** * Sets earnings_lines * - * @param \Swagger\Client\Model\AuInitialEarningsModel[] $earnings_lines + * @param \OpenAPI\Client\Model\AuInitialEarningsModel[]|null $earnings_lines * - * @return $this + * @return self */ public function setEarningsLines($earnings_lines) { + if (is_null($earnings_lines)) { + throw new \InvalidArgumentException('non-nullable earnings_lines cannot be null'); + } $this->container['earnings_lines'] = $earnings_lines; return $this; @@ -519,7 +647,7 @@ public function setEarningsLines($earnings_lines) /** * Gets etps * - * @return \Swagger\Client\Model\OpeningBalancesEtpModel[] + * @return \OpenAPI\Client\Model\OpeningBalancesEtpModel[]|null */ public function getEtps() { @@ -529,12 +657,15 @@ public function getEtps() /** * Sets etps * - * @param \Swagger\Client\Model\OpeningBalancesEtpModel[] $etps + * @param \OpenAPI\Client\Model\OpeningBalancesEtpModel[]|null $etps * - * @return $this + * @return self */ public function setEtps($etps) { + if (is_null($etps)) { + throw new \InvalidArgumentException('non-nullable etps cannot be null'); + } $this->container['etps'] = $etps; return $this; @@ -543,7 +674,7 @@ public function setEtps($etps) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -553,12 +684,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -567,7 +701,7 @@ public function setEmployeeId($employee_id) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -577,12 +711,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -591,7 +728,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -601,12 +738,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -615,7 +755,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets leave_balances * - * @return \Swagger\Client\Model\InitialLeaveBalanceModel[] + * @return \OpenAPI\Client\Model\InitialLeaveBalanceModel[]|null */ public function getLeaveBalances() { @@ -625,12 +765,15 @@ public function getLeaveBalances() /** * Sets leave_balances * - * @param \Swagger\Client\Model\InitialLeaveBalanceModel[] $leave_balances + * @param \OpenAPI\Client\Model\InitialLeaveBalanceModel[]|null $leave_balances * - * @return $this + * @return self */ public function setLeaveBalances($leave_balances) { + if (is_null($leave_balances)) { + throw new \InvalidArgumentException('non-nullable leave_balances cannot be null'); + } $this->container['leave_balances'] = $leave_balances; return $this; @@ -639,7 +782,7 @@ public function setLeaveBalances($leave_balances) /** * Gets employer_liabilities * - * @return \Swagger\Client\Model\InitialEmployerLiabilityModel[] + * @return \OpenAPI\Client\Model\InitialEmployerLiabilityModel[]|null */ public function getEmployerLiabilities() { @@ -649,12 +792,15 @@ public function getEmployerLiabilities() /** * Sets employer_liabilities * - * @param \Swagger\Client\Model\InitialEmployerLiabilityModel[] $employer_liabilities + * @param \OpenAPI\Client\Model\InitialEmployerLiabilityModel[]|null $employer_liabilities * - * @return $this + * @return self */ public function setEmployerLiabilities($employer_liabilities) { + if (is_null($employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities cannot be null'); + } $this->container['employer_liabilities'] = $employer_liabilities; return $this; @@ -663,7 +809,7 @@ public function setEmployerLiabilities($employer_liabilities) /** * Gets financial_year_starting_year * - * @return int + * @return int|null */ public function getFinancialYearStartingYear() { @@ -673,12 +819,15 @@ public function getFinancialYearStartingYear() /** * Sets financial_year_starting_year * - * @param int $financial_year_starting_year + * @param int|null $financial_year_starting_year * - * @return $this + * @return self */ public function setFinancialYearStartingYear($financial_year_starting_year) { + if (is_null($financial_year_starting_year)) { + throw new \InvalidArgumentException('non-nullable financial_year_starting_year cannot be null'); + } $this->container['financial_year_starting_year'] = $financial_year_starting_year; return $this; @@ -687,7 +836,7 @@ public function setFinancialYearStartingYear($financial_year_starting_year) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -697,12 +846,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -714,7 +866,7 @@ public function setLocationName($location_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -724,22 +876,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -755,11 +908,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -767,13 +933,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuOrdinaryTimeEarningsApiModel.php b/src/lib/Model/AuOrdinaryTimeEarningsApiModel.php index b166ef5..b174829 100644 --- a/src/lib/Model/AuOrdinaryTimeEarningsApiModel.php +++ b/src/lib/Model/AuOrdinaryTimeEarningsApiModel.php @@ -2,63 +2,63 @@ /** * AuOrdinaryTimeEarningsApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuOrdinaryTimeEarningsApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuOrdinaryTimeEarningsApiModel implements ModelInterface, ArrayAccess +class AuOrdinaryTimeEarningsApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuOrdinaryTimeEarningsApiModel'; + protected static $openAPIModelName = 'AuOrdinaryTimeEarningsApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super' => 'double', - 'super_percentage_of_earnings' => 'double', + protected static $openAPITypes = [ + 'super' => 'float', + 'super_percentage_of_earnings' => 'float', 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', @@ -67,15 +67,17 @@ class AuOrdinaryTimeEarningsApiModel implements ModelInterface, ArrayAccess 'pay_category' => 'string', 'pay_period_starting' => '\DateTime', 'pay_period_ending' => '\DateTime', - 'earnings' => 'double' + 'earnings' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super' => 'double', 'super_percentage_of_earnings' => 'double', 'employee_id' => 'int32', @@ -89,14 +91,40 @@ class AuOrdinaryTimeEarningsApiModel implements ModelInterface, ArrayAccess 'earnings' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super' => false, + 'super_percentage_of_earnings' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'pay_run' => false, + 'pay_category' => false, + 'pay_period_starting' => false, + 'pay_period_ending' => false, + 'earnings' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super'] = isset($data['super']) ? $data['super'] : null; - $this->container['super_percentage_of_earnings'] = isset($data['super_percentage_of_earnings']) ? $data['super_percentage_of_earnings'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['pay_run'] = isset($data['pay_run']) ? $data['pay_run'] : null; - $this->container['pay_category'] = isset($data['pay_category']) ? $data['pay_category'] : null; - $this->container['pay_period_starting'] = isset($data['pay_period_starting']) ? $data['pay_period_starting'] : null; - $this->container['pay_period_ending'] = isset($data['pay_period_ending']) ? $data['pay_period_ending'] : null; - $this->container['earnings'] = isset($data['earnings']) ? $data['earnings'] : null; + $this->setIfExists('super', $data ?? [], null); + $this->setIfExists('super_percentage_of_earnings', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('pay_run', $data ?? [], null); + $this->setIfExists('pay_category', $data ?? [], null); + $this->setIfExists('pay_period_starting', $data ?? [], null); + $this->setIfExists('pay_period_ending', $data ?? [], null); + $this->setIfExists('earnings', $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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets super * - * @return double + * @return float|null */ public function getSuper() { @@ -277,12 +372,15 @@ public function getSuper() /** * Sets super * - * @param double $super + * @param float|null $super * - * @return $this + * @return self */ public function setSuper($super) { + if (is_null($super)) { + throw new \InvalidArgumentException('non-nullable super cannot be null'); + } $this->container['super'] = $super; return $this; @@ -291,7 +389,7 @@ public function setSuper($super) /** * Gets super_percentage_of_earnings * - * @return double + * @return float|null */ public function getSuperPercentageOfEarnings() { @@ -301,12 +399,15 @@ public function getSuperPercentageOfEarnings() /** * Sets super_percentage_of_earnings * - * @param double $super_percentage_of_earnings + * @param float|null $super_percentage_of_earnings * - * @return $this + * @return self */ public function setSuperPercentageOfEarnings($super_percentage_of_earnings) { + if (is_null($super_percentage_of_earnings)) { + throw new \InvalidArgumentException('non-nullable super_percentage_of_earnings cannot be null'); + } $this->container['super_percentage_of_earnings'] = $super_percentage_of_earnings; return $this; @@ -315,7 +416,7 @@ public function setSuperPercentageOfEarnings($super_percentage_of_earnings) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -325,12 +426,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -339,7 +443,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -349,12 +453,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -363,7 +470,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -373,12 +480,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -387,7 +497,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -397,12 +507,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -411,7 +524,7 @@ public function setExternalId($external_id) /** * Gets pay_run * - * @return string + * @return string|null */ public function getPayRun() { @@ -421,12 +534,15 @@ public function getPayRun() /** * Sets pay_run * - * @param string $pay_run + * @param string|null $pay_run * - * @return $this + * @return self */ public function setPayRun($pay_run) { + if (is_null($pay_run)) { + throw new \InvalidArgumentException('non-nullable pay_run cannot be null'); + } $this->container['pay_run'] = $pay_run; return $this; @@ -435,7 +551,7 @@ public function setPayRun($pay_run) /** * Gets pay_category * - * @return string + * @return string|null */ public function getPayCategory() { @@ -445,12 +561,15 @@ public function getPayCategory() /** * Sets pay_category * - * @param string $pay_category + * @param string|null $pay_category * - * @return $this + * @return self */ public function setPayCategory($pay_category) { + if (is_null($pay_category)) { + throw new \InvalidArgumentException('non-nullable pay_category cannot be null'); + } $this->container['pay_category'] = $pay_category; return $this; @@ -459,7 +578,7 @@ public function setPayCategory($pay_category) /** * Gets pay_period_starting * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodStarting() { @@ -469,12 +588,15 @@ public function getPayPeriodStarting() /** * Sets pay_period_starting * - * @param \DateTime $pay_period_starting + * @param \DateTime|null $pay_period_starting * - * @return $this + * @return self */ public function setPayPeriodStarting($pay_period_starting) { + if (is_null($pay_period_starting)) { + throw new \InvalidArgumentException('non-nullable pay_period_starting cannot be null'); + } $this->container['pay_period_starting'] = $pay_period_starting; return $this; @@ -483,7 +605,7 @@ public function setPayPeriodStarting($pay_period_starting) /** * Gets pay_period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodEnding() { @@ -493,12 +615,15 @@ public function getPayPeriodEnding() /** * Sets pay_period_ending * - * @param \DateTime $pay_period_ending + * @param \DateTime|null $pay_period_ending * - * @return $this + * @return self */ public function setPayPeriodEnding($pay_period_ending) { + if (is_null($pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable pay_period_ending cannot be null'); + } $this->container['pay_period_ending'] = $pay_period_ending; return $this; @@ -507,7 +632,7 @@ public function setPayPeriodEnding($pay_period_ending) /** * Gets earnings * - * @return double + * @return float|null */ public function getEarnings() { @@ -517,12 +642,15 @@ public function getEarnings() /** * Sets earnings * - * @param double $earnings + * @param float|null $earnings * - * @return $this + * @return self */ public function setEarnings($earnings) { + if (is_null($earnings)) { + throw new \InvalidArgumentException('non-nullable earnings cannot be null'); + } $this->container['earnings'] = $earnings; return $this; @@ -534,7 +662,7 @@ public function setEarnings($earnings) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayCategoriesModel.php b/src/lib/Model/AuPayCategoriesModel.php index f114c10..0677dc5 100644 --- a/src/lib/Model/AuPayCategoriesModel.php +++ b/src/lib/Model/AuPayCategoriesModel.php @@ -2,62 +2,62 @@ /** * AuPayCategoriesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayCategoriesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayCategoriesModel implements ModelInterface, ArrayAccess +class AuPayCategoriesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayCategoriesModel'; + protected static $openAPIModelName = 'AuPayCategoriesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super_amount' => 'double', + protected static $openAPITypes = [ + 'super_amount' => 'float', 'pay_category' => 'string', 'pay_run' => 'string', 'date_paid' => '\DateTime', @@ -66,17 +66,19 @@ class AuPayCategoriesModel implements ModelInterface, ArrayAccess 'surname' => 'string', 'external_id' => 'string', 'location' => 'string', - 'units' => 'double', - 'rate' => 'double', - 'amount' => 'double' + 'units' => 'float', + 'rate' => 'float', + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_amount' => 'double', 'pay_category' => null, 'pay_run' => null, @@ -91,14 +93,41 @@ class AuPayCategoriesModel implements ModelInterface, ArrayAccess 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_amount' => false, + 'pay_category' => false, + 'pay_run' => false, + 'date_paid' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'location' => false, + 'units' => false, + 'rate' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super_amount'] = isset($data['super_amount']) ? $data['super_amount'] : null; - $this->container['pay_category'] = isset($data['pay_category']) ? $data['pay_category'] : null; - $this->container['pay_run'] = isset($data['pay_run']) ? $data['pay_run'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('super_amount', $data ?? [], null); + $this->setIfExists('pay_category', $data ?? [], null); + $this->setIfExists('pay_run', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets super_amount * - * @return double + * @return float|null */ public function getSuperAmount() { @@ -283,12 +379,15 @@ public function getSuperAmount() /** * Sets super_amount * - * @param double $super_amount + * @param float|null $super_amount * - * @return $this + * @return self */ public function setSuperAmount($super_amount) { + if (is_null($super_amount)) { + throw new \InvalidArgumentException('non-nullable super_amount cannot be null'); + } $this->container['super_amount'] = $super_amount; return $this; @@ -297,7 +396,7 @@ public function setSuperAmount($super_amount) /** * Gets pay_category * - * @return string + * @return string|null */ public function getPayCategory() { @@ -307,12 +406,15 @@ public function getPayCategory() /** * Sets pay_category * - * @param string $pay_category + * @param string|null $pay_category * - * @return $this + * @return self */ public function setPayCategory($pay_category) { + if (is_null($pay_category)) { + throw new \InvalidArgumentException('non-nullable pay_category cannot be null'); + } $this->container['pay_category'] = $pay_category; return $this; @@ -321,7 +423,7 @@ public function setPayCategory($pay_category) /** * Gets pay_run * - * @return string + * @return string|null */ public function getPayRun() { @@ -331,12 +433,15 @@ public function getPayRun() /** * Sets pay_run * - * @param string $pay_run + * @param string|null $pay_run * - * @return $this + * @return self */ public function setPayRun($pay_run) { + if (is_null($pay_run)) { + throw new \InvalidArgumentException('non-nullable pay_run cannot be null'); + } $this->container['pay_run'] = $pay_run; return $this; @@ -345,7 +450,7 @@ public function setPayRun($pay_run) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -355,12 +460,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -369,7 +477,7 @@ public function setDatePaid($date_paid) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -379,12 +487,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -393,7 +504,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -403,12 +514,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -417,7 +531,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -427,12 +541,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -441,7 +558,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -451,12 +568,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -465,7 +585,7 @@ public function setExternalId($external_id) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -475,12 +595,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -489,7 +612,7 @@ public function setLocation($location) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -499,12 +622,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -513,7 +639,7 @@ public function setUnits($units) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -523,12 +649,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -537,7 +666,7 @@ public function setRate($rate) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -547,12 +676,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -564,7 +696,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayCategoryModel.php b/src/lib/Model/AuPayCategoryModel.php index 395dd7f..2c40961 100644 --- a/src/lib/Model/AuPayCategoryModel.php +++ b/src/lib/Model/AuPayCategoryModel.php @@ -2,64 +2,64 @@ /** * AuPayCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayCategoryModel implements ModelInterface, ArrayAccess +class AuPayCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayCategoryModel'; + protected static $openAPIModelName = 'AuPayCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'payment_summary_classification' => 'string', 'allowance_description' => 'string', - 'default_super_rate' => 'double', + 'default_super_rate' => 'float', 'super_expense_mapping_code' => 'string', 'super_liability_mapping_code' => 'string', 'is_payroll_tax_exempt' => 'bool', @@ -71,8 +71,8 @@ class AuPayCategoryModel implements ModelInterface, ArrayAccess 'name' => 'string', 'rate_unit' => 'string', 'accrues_leave' => 'bool', - 'rate_loading_percent' => 'double', - 'penalty_loading_percent' => 'double', + 'rate_loading_percent' => 'float', + 'penalty_loading_percent' => 'float', 'is_tax_exempt' => 'bool', 'external_id' => 'string', 'source' => 'string', @@ -88,8 +88,10 @@ class AuPayCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payment_summary_classification' => null, 'allowance_description' => null, 'default_super_rate' => 'double', @@ -117,14 +119,54 @@ class AuPayCategoryModel implements ModelInterface, ArrayAccess 'is_primary' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payment_summary_classification' => false, + 'allowance_description' => false, + 'default_super_rate' => false, + 'super_expense_mapping_code' => false, + 'super_liability_mapping_code' => false, + 'is_payroll_tax_exempt' => false, + 'award_name' => false, + 'award_id' => false, + 'pay_category_type' => false, + 'id' => false, + 'parent_id' => false, + 'name' => false, + 'rate_unit' => false, + 'accrues_leave' => false, + 'rate_loading_percent' => false, + 'penalty_loading_percent' => false, + 'is_tax_exempt' => false, + 'external_id' => false, + 'source' => false, + 'general_ledger_mapping_code' => false, + 'is_system_pay_category' => false, + 'number_of_decimal_places' => false, + 'rounding_method' => false, + 'hide_units_on_pay_slip' => false, + 'is_primary' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -132,9 +174,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -275,110 +369,108 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const PAYMENT_SUMMARY_CLASSIFICATION__DEFAULT = 'Default'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE = 'Allowance'; - const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_A_TYPE_R = 'LumpSumATypeR'; - const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_A_TYPE_T = 'LumpSumATypeT'; - const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_B = 'LumpSumB'; - const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_D = 'LumpSumD'; - const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_E = 'LumpSumE'; - const PAYMENT_SUMMARY_CLASSIFICATION_EXCLUDE = 'Exclude'; - const PAYMENT_SUMMARY_CLASSIFICATION_CDEP = 'Cdep'; - const PAYMENT_SUMMARY_CLASSIFICATION_EXEMPT_FOREIGN_EMPLOYMENT_INCOME = 'ExemptForeignEmploymentIncome'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_CAR = 'AllowanceCar'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TRANSPORT = 'AllowanceTransport'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_LAUNDRY = 'AllowanceLaundry'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_MEALS = 'AllowanceMeals'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TRAVEL = 'AllowanceTravel'; - const PAYMENT_SUMMARY_CLASSIFICATION_GROSS_SALARY = 'GrossSalary'; - const PAYMENT_SUMMARY_CLASSIFICATION_BONUS = 'Bonus'; - const PAYMENT_SUMMARY_CLASSIFICATION_DIRECTORS_FEES = 'DirectorsFees'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_ENTERTAINMENT = 'AllowanceEntertainment'; - const PAYMENT_SUMMARY_CLASSIFICATION_GROSS_COMMISSION = 'GrossCommission'; - const PAYMENT_SUMMARY_CLASSIFICATION_PENSION = 'Pension'; - const PAYMENT_SUMMARY_CLASSIFICATION_NOT_REPORTABLE = 'NotReportable'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_GROSS_SALARY = 'MyGrossSalary'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_FEES = 'MyFees'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_GROSS_TIPS = 'MyGrossTips'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_ESOS_BENEFIT = 'MyEsosBenefit'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_GRATUITY = 'MyGratuity'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_BENEFITS_IN_KIND = 'MyBenefitsInKind'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_VALUE_OF_LIVING_ACCOMMODATIONS = 'MyValueOfLivingAccommodations'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_REFUND_PROVIDENT_PENSION_FUND = 'MyRefundProvidentPensionFund'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_COMPENSATION_FOR_LOSS_OF_EMPLOYMENT = 'MyCompensationForLossOfEmployment'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_PENSION = 'MyPension'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_ANNUITIES = 'MyAnnuities'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_CP38_DEDUCTION = 'MyCp38Deduction'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_ZAKAT_PAID_VIA_SALARY_DEDUCTION = 'MyZakatPaidViaSalaryDeduction'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_RELIEF_CLAIM_TP1 = 'MyReliefClaimTp1'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_ZAKAT_RELIEF_CLAIM_TP1 = 'MyZakatReliefClaimTp1'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_TAX_EXEMPT_ALLOWANCES = 'MyTaxExemptAllowances'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_ARREARS_INCOME_A = 'MyArrearsIncomeA'; - const PAYMENT_SUMMARY_CLASSIFICATION_MY_ARREARS_INCOME_B = 'MyArrearsIncomeB'; - const PAYMENT_SUMMARY_CLASSIFICATION_NONE = 'None'; - const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_CASH_OUT_OF_LEAVE_IN_SERVICE = 'LeaveCashOutOfLeaveInService'; - const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_UNUSED_LEAVE_ON_TERMINATION = 'LeaveUnusedLeaveOnTermination'; - const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_PAID_PARENTAL_LEAVE = 'LeavePaidParentalLeave'; - const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_WORKERS_COMPENSATION = 'LeaveWorkersCompensation'; - const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_ANCILLARY_AND_DEFENCE_LEAVE = 'LeaveAncillaryAndDefenceLeave'; - const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_OTHER_PAID_LEAVE = 'LeaveOtherPaidLeave'; - const PAYMENT_SUMMARY_CLASSIFICATION_OVERTIME = 'Overtime'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TOOL = 'AllowanceTool'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TASKS = 'AllowanceTasks'; - const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_QUALIFICATIONS_CERTIFICATES = 'AllowanceQualificationsCertificates'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_LIFE_BENEFIT_CODE_R = 'EtpLifeBenefitCodeR'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_LIFE_BENEFIT_CODE_O = 'EtpLifeBenefitCodeO'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_MULTIPLE_PAYMENTS_CODE_S = 'EtpMultiplePaymentsCodeS'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_MULTIPLE_PAYMENTS_CODE_P = 'EtpMultiplePaymentsCodeP'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_D = 'EtpDeathBenefitCodeD'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_N = 'EtpDeathBenefitCodeN'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_B = 'EtpDeathBenefitCodeB'; - const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_T = 'EtpDeathBenefitCodeT'; - const PAYMENT_SUMMARY_CLASSIFICATION_RETURN_TO_WORK_PAYMENT = 'ReturnToWorkPayment'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_GRATUITY = 'SgGratuity'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_NOTICE_PAY = 'SgNoticePay'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_EX_GRATIA_PAYMENT = 'SgExGratiaPayment'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_OTHER_LUMP_SUM_PAYMENTS = 'SgOtherLumpSumPayments'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_COMPENSATION_LOSS_OF_OFFICE = 'SgCompensationLossOfOffice'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_RETIREMENT_BENEFITS_PRE1993 = 'SgRetirementBenefitsPre1993'; - const PAYMENT_SUMMARY_CLASSIFICATION_SG_RETIREMENT_BENEFITS_FROM1993 = 'SgRetirementBenefitsFrom1993'; - const PAY_CATEGORY_TYPE_STANDARD = 'Standard'; - const PAY_CATEGORY_TYPE_LEAVE_LOADING = 'LeaveLoading'; - const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_PAYMENT = 'GenuineRedundancyLeavePayment'; - const PAY_CATEGORY_TYPE_OPENING_BALANCE_ALLOWANCES = 'OpeningBalanceAllowances'; - const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAXABLE = 'EtpTypeRTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAX_FREE = 'EtpTypeRTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAXABLE = 'EtpTypeOTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAX_FREE = 'EtpTypeOTaxFree'; - const PAY_CATEGORY_TYPE_ETP_LUMP_SUM_D = 'EtpLumpSumD'; - const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_LOADING = 'GenuineRedundancyLeaveLoading'; - const PAY_CATEGORY_TYPE_METHOD_B2_ADDITIONAL_PAYMENTS_OPENING_BALANCE = 'MethodB2AdditionalPaymentsOpeningBalance'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAXABLE = 'EtpSuperableTypeOTaxable'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAX_FREE = 'EtpSuperableTypeOTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_O_UNUSED_LEAVE_PAYMENT = 'EtpTypeOUnusedLeavePayment'; - const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAXABLE = 'EtpTypeSTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAX_FREE = 'EtpTypeSTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAXABLE = 'EtpTypePTaxable'; - const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAX_FREE = 'EtpTypePTaxFree'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAXABLE = 'EtpSuperableTypePTaxable'; - const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAX_FREE = 'EtpSuperableTypePTaxFree'; - const PAY_CATEGORY_TYPE_ETP_TYPE_P_UNUSED_LEAVE_PAYMENT = 'EtpTypePUnusedLeavePayment'; - const PAY_CATEGORY_TYPE_NORMAL_TERMINATION_LEAVE_LOADING = 'NormalTerminationLeaveLoading'; - const PAY_CATEGORY_TYPE_UNUSED_LEAVE_PAYMENT_NORMAL_TERMINATION = 'UnusedLeavePaymentNormalTermination'; - const PAY_CATEGORY_TYPE_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'PaidFamilyAndDomesticViolenceLeave'; - const RATE_UNIT_HOURLY = 'Hourly'; - const RATE_UNIT_ANNUALLY = 'Annually'; - const RATE_UNIT_FIXED = 'Fixed'; - const RATE_UNIT_DAILY = 'Daily'; - const RATE_UNIT_MONTHLY = 'Monthly'; - const ROUNDING_METHOD_TO_EVEN = 'ToEven'; - const ROUNDING_METHOD_AWAY_FROM_ZERO = 'AwayFromZero'; - - - + return self::$openAPIModelName; + } + + public const PAYMENT_SUMMARY_CLASSIFICATION__DEFAULT = 'Default'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE = 'Allowance'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_A_TYPE_R = 'LumpSumATypeR'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_A_TYPE_T = 'LumpSumATypeT'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_B = 'LumpSumB'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_D = 'LumpSumD'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LUMP_SUM_E = 'LumpSumE'; + public const PAYMENT_SUMMARY_CLASSIFICATION_EXCLUDE = 'Exclude'; + public const PAYMENT_SUMMARY_CLASSIFICATION_CDEP = 'Cdep'; + public const PAYMENT_SUMMARY_CLASSIFICATION_EXEMPT_FOREIGN_EMPLOYMENT_INCOME = 'ExemptForeignEmploymentIncome'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_CAR = 'AllowanceCar'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TRANSPORT = 'AllowanceTransport'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_LAUNDRY = 'AllowanceLaundry'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_MEALS = 'AllowanceMeals'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TRAVEL = 'AllowanceTravel'; + public const PAYMENT_SUMMARY_CLASSIFICATION_GROSS_SALARY = 'GrossSalary'; + public const PAYMENT_SUMMARY_CLASSIFICATION_BONUS = 'Bonus'; + public const PAYMENT_SUMMARY_CLASSIFICATION_DIRECTORS_FEES = 'DirectorsFees'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_ENTERTAINMENT = 'AllowanceEntertainment'; + public const PAYMENT_SUMMARY_CLASSIFICATION_GROSS_COMMISSION = 'GrossCommission'; + public const PAYMENT_SUMMARY_CLASSIFICATION_PENSION = 'Pension'; + public const PAYMENT_SUMMARY_CLASSIFICATION_NOT_REPORTABLE = 'NotReportable'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_GROSS_SALARY = 'MyGrossSalary'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_FEES = 'MyFees'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_GROSS_TIPS = 'MyGrossTips'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_ESOS_BENEFIT = 'MyEsosBenefit'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_GRATUITY = 'MyGratuity'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_BENEFITS_IN_KIND = 'MyBenefitsInKind'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_VALUE_OF_LIVING_ACCOMMODATIONS = 'MyValueOfLivingAccommodations'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_REFUND_PROVIDENT_PENSION_FUND = 'MyRefundProvidentPensionFund'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_COMPENSATION_FOR_LOSS_OF_EMPLOYMENT = 'MyCompensationForLossOfEmployment'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_PENSION = 'MyPension'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_ANNUITIES = 'MyAnnuities'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_CP38_DEDUCTION = 'MyCp38Deduction'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_ZAKAT_PAID_VIA_SALARY_DEDUCTION = 'MyZakatPaidViaSalaryDeduction'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_RELIEF_CLAIM_TP1 = 'MyReliefClaimTp1'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_ZAKAT_RELIEF_CLAIM_TP1 = 'MyZakatReliefClaimTp1'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_TAX_EXEMPT_ALLOWANCES = 'MyTaxExemptAllowances'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_ARREARS_INCOME_A = 'MyArrearsIncomeA'; + public const PAYMENT_SUMMARY_CLASSIFICATION_MY_ARREARS_INCOME_B = 'MyArrearsIncomeB'; + public const PAYMENT_SUMMARY_CLASSIFICATION_NONE = 'None'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_CASH_OUT_OF_LEAVE_IN_SERVICE = 'LeaveCashOutOfLeaveInService'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_UNUSED_LEAVE_ON_TERMINATION = 'LeaveUnusedLeaveOnTermination'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_PAID_PARENTAL_LEAVE = 'LeavePaidParentalLeave'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_WORKERS_COMPENSATION = 'LeaveWorkersCompensation'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_ANCILLARY_AND_DEFENCE_LEAVE = 'LeaveAncillaryAndDefenceLeave'; + public const PAYMENT_SUMMARY_CLASSIFICATION_LEAVE_OTHER_PAID_LEAVE = 'LeaveOtherPaidLeave'; + public const PAYMENT_SUMMARY_CLASSIFICATION_OVERTIME = 'Overtime'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TOOL = 'AllowanceTool'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_TASKS = 'AllowanceTasks'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ALLOWANCE_QUALIFICATIONS_CERTIFICATES = 'AllowanceQualificationsCertificates'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_LIFE_BENEFIT_CODE_R = 'EtpLifeBenefitCodeR'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_LIFE_BENEFIT_CODE_O = 'EtpLifeBenefitCodeO'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_MULTIPLE_PAYMENTS_CODE_S = 'EtpMultiplePaymentsCodeS'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_MULTIPLE_PAYMENTS_CODE_P = 'EtpMultiplePaymentsCodeP'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_D = 'EtpDeathBenefitCodeD'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_N = 'EtpDeathBenefitCodeN'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_B = 'EtpDeathBenefitCodeB'; + public const PAYMENT_SUMMARY_CLASSIFICATION_ETP_DEATH_BENEFIT_CODE_T = 'EtpDeathBenefitCodeT'; + public const PAYMENT_SUMMARY_CLASSIFICATION_RETURN_TO_WORK_PAYMENT = 'ReturnToWorkPayment'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_GRATUITY = 'SgGratuity'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_NOTICE_PAY = 'SgNoticePay'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_EX_GRATIA_PAYMENT = 'SgExGratiaPayment'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_OTHER_LUMP_SUM_PAYMENTS = 'SgOtherLumpSumPayments'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_COMPENSATION_LOSS_OF_OFFICE = 'SgCompensationLossOfOffice'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_RETIREMENT_BENEFITS_PRE1993 = 'SgRetirementBenefitsPre1993'; + public const PAYMENT_SUMMARY_CLASSIFICATION_SG_RETIREMENT_BENEFITS_FROM1993 = 'SgRetirementBenefitsFrom1993'; + public const PAY_CATEGORY_TYPE_STANDARD = 'Standard'; + public const PAY_CATEGORY_TYPE_LEAVE_LOADING = 'LeaveLoading'; + public const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_PAYMENT = 'GenuineRedundancyLeavePayment'; + public const PAY_CATEGORY_TYPE_OPENING_BALANCE_ALLOWANCES = 'OpeningBalanceAllowances'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAXABLE = 'EtpTypeRTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_R_TAX_FREE = 'EtpTypeRTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAXABLE = 'EtpTypeOTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_O_TAX_FREE = 'EtpTypeOTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_LUMP_SUM_D = 'EtpLumpSumD'; + public const PAY_CATEGORY_TYPE_GENUINE_REDUNDANCY_LEAVE_LOADING = 'GenuineRedundancyLeaveLoading'; + public const PAY_CATEGORY_TYPE_METHOD_B2_ADDITIONAL_PAYMENTS_OPENING_BALANCE = 'MethodB2AdditionalPaymentsOpeningBalance'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAXABLE = 'EtpSuperableTypeOTaxable'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_O_TAX_FREE = 'EtpSuperableTypeOTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_O_UNUSED_LEAVE_PAYMENT = 'EtpTypeOUnusedLeavePayment'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAXABLE = 'EtpTypeSTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_S_TAX_FREE = 'EtpTypeSTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAXABLE = 'EtpTypePTaxable'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_P_TAX_FREE = 'EtpTypePTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAXABLE = 'EtpSuperableTypePTaxable'; + public const PAY_CATEGORY_TYPE_ETP_SUPERABLE_TYPE_P_TAX_FREE = 'EtpSuperableTypePTaxFree'; + public const PAY_CATEGORY_TYPE_ETP_TYPE_P_UNUSED_LEAVE_PAYMENT = 'EtpTypePUnusedLeavePayment'; + public const PAY_CATEGORY_TYPE_NORMAL_TERMINATION_LEAVE_LOADING = 'NormalTerminationLeaveLoading'; + public const PAY_CATEGORY_TYPE_UNUSED_LEAVE_PAYMENT_NORMAL_TERMINATION = 'UnusedLeavePaymentNormalTermination'; + public const PAY_CATEGORY_TYPE_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'PaidFamilyAndDomesticViolenceLeave'; + public const RATE_UNIT_HOURLY = 'Hourly'; + public const RATE_UNIT_ANNUALLY = 'Annually'; + public const RATE_UNIT_FIXED = 'Fixed'; + public const RATE_UNIT_DAILY = 'Daily'; + public const RATE_UNIT_MONTHLY = 'Monthly'; + public const ROUNDING_METHOD_TO_EVEN = 'ToEven'; + public const ROUNDING_METHOD_AWAY_FROM_ZERO = 'AwayFromZero'; + /** * Gets allowable values of the enum * @@ -456,7 +548,7 @@ public function getPaymentSummaryClassificationAllowableValues() self::PAYMENT_SUMMARY_CLASSIFICATION_SG_RETIREMENT_BENEFITS_FROM1993, ]; } - + /** * Gets allowable values of the enum * @@ -491,7 +583,7 @@ public function getPayCategoryTypeAllowableValues() self::PAY_CATEGORY_TYPE_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE, ]; } - + /** * Gets allowable values of the enum * @@ -507,7 +599,7 @@ public function getRateUnitAllowableValues() self::RATE_UNIT_MONTHLY, ]; } - + /** * Gets allowable values of the enum * @@ -520,7 +612,6 @@ public function getRoundingMethodAllowableValues() self::ROUNDING_METHOD_AWAY_FROM_ZERO, ]; } - /** * Associative array for storing property values @@ -537,31 +628,49 @@ public function getRoundingMethodAllowableValues() */ public function __construct(array $data = null) { - $this->container['payment_summary_classification'] = isset($data['payment_summary_classification']) ? $data['payment_summary_classification'] : null; - $this->container['allowance_description'] = isset($data['allowance_description']) ? $data['allowance_description'] : null; - $this->container['default_super_rate'] = isset($data['default_super_rate']) ? $data['default_super_rate'] : null; - $this->container['super_expense_mapping_code'] = isset($data['super_expense_mapping_code']) ? $data['super_expense_mapping_code'] : null; - $this->container['super_liability_mapping_code'] = isset($data['super_liability_mapping_code']) ? $data['super_liability_mapping_code'] : null; - $this->container['is_payroll_tax_exempt'] = isset($data['is_payroll_tax_exempt']) ? $data['is_payroll_tax_exempt'] : null; - $this->container['award_name'] = isset($data['award_name']) ? $data['award_name'] : null; - $this->container['award_id'] = isset($data['award_id']) ? $data['award_id'] : null; - $this->container['pay_category_type'] = isset($data['pay_category_type']) ? $data['pay_category_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['rate_unit'] = isset($data['rate_unit']) ? $data['rate_unit'] : null; - $this->container['accrues_leave'] = isset($data['accrues_leave']) ? $data['accrues_leave'] : null; - $this->container['rate_loading_percent'] = isset($data['rate_loading_percent']) ? $data['rate_loading_percent'] : null; - $this->container['penalty_loading_percent'] = isset($data['penalty_loading_percent']) ? $data['penalty_loading_percent'] : null; - $this->container['is_tax_exempt'] = isset($data['is_tax_exempt']) ? $data['is_tax_exempt'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['general_ledger_mapping_code'] = isset($data['general_ledger_mapping_code']) ? $data['general_ledger_mapping_code'] : null; - $this->container['is_system_pay_category'] = isset($data['is_system_pay_category']) ? $data['is_system_pay_category'] : null; - $this->container['number_of_decimal_places'] = isset($data['number_of_decimal_places']) ? $data['number_of_decimal_places'] : null; - $this->container['rounding_method'] = isset($data['rounding_method']) ? $data['rounding_method'] : null; - $this->container['hide_units_on_pay_slip'] = isset($data['hide_units_on_pay_slip']) ? $data['hide_units_on_pay_slip'] : null; - $this->container['is_primary'] = isset($data['is_primary']) ? $data['is_primary'] : null; + $this->setIfExists('payment_summary_classification', $data ?? [], null); + $this->setIfExists('allowance_description', $data ?? [], null); + $this->setIfExists('default_super_rate', $data ?? [], null); + $this->setIfExists('super_expense_mapping_code', $data ?? [], null); + $this->setIfExists('super_liability_mapping_code', $data ?? [], null); + $this->setIfExists('is_payroll_tax_exempt', $data ?? [], null); + $this->setIfExists('award_name', $data ?? [], null); + $this->setIfExists('award_id', $data ?? [], null); + $this->setIfExists('pay_category_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('rate_unit', $data ?? [], null); + $this->setIfExists('accrues_leave', $data ?? [], null); + $this->setIfExists('rate_loading_percent', $data ?? [], null); + $this->setIfExists('penalty_loading_percent', $data ?? [], null); + $this->setIfExists('is_tax_exempt', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('is_system_pay_category', $data ?? [], null); + $this->setIfExists('number_of_decimal_places', $data ?? [], null); + $this->setIfExists('rounding_method', $data ?? [], null); + $this->setIfExists('hide_units_on_pay_slip', $data ?? [], null); + $this->setIfExists('is_primary', $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; } /** @@ -576,7 +685,8 @@ public function listInvalidProperties() $allowedValues = $this->getPaymentSummaryClassificationAllowableValues(); if (!is_null($this->container['payment_summary_classification']) && !in_array($this->container['payment_summary_classification'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'payment_summary_classification', must be one of '%s'", + "invalid value '%s' for 'payment_summary_classification', must be one of '%s'", + $this->container['payment_summary_classification'], implode("', '", $allowedValues) ); } @@ -584,7 +694,8 @@ public function listInvalidProperties() $allowedValues = $this->getPayCategoryTypeAllowableValues(); if (!is_null($this->container['pay_category_type']) && !in_array($this->container['pay_category_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'pay_category_type', must be one of '%s'", + "invalid value '%s' for 'pay_category_type', must be one of '%s'", + $this->container['pay_category_type'], implode("', '", $allowedValues) ); } @@ -592,7 +703,8 @@ public function listInvalidProperties() $allowedValues = $this->getRateUnitAllowableValues(); if (!is_null($this->container['rate_unit']) && !in_array($this->container['rate_unit'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'rate_unit', must be one of '%s'", + "invalid value '%s' for 'rate_unit', must be one of '%s'", + $this->container['rate_unit'], implode("', '", $allowedValues) ); } @@ -600,7 +712,8 @@ public function listInvalidProperties() $allowedValues = $this->getRoundingMethodAllowableValues(); if (!is_null($this->container['rounding_method']) && !in_array($this->container['rounding_method'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'rounding_method', must be one of '%s'", + "invalid value '%s' for 'rounding_method', must be one of '%s'", + $this->container['rounding_method'], implode("', '", $allowedValues) ); } @@ -623,7 +736,7 @@ public function valid() /** * Gets payment_summary_classification * - * @return string + * @return string|null */ public function getPaymentSummaryClassification() { @@ -633,17 +746,21 @@ public function getPaymentSummaryClassification() /** * Sets payment_summary_classification * - * @param string $payment_summary_classification + * @param string|null $payment_summary_classification * - * @return $this + * @return self */ public function setPaymentSummaryClassification($payment_summary_classification) { + if (is_null($payment_summary_classification)) { + throw new \InvalidArgumentException('non-nullable payment_summary_classification cannot be null'); + } $allowedValues = $this->getPaymentSummaryClassificationAllowableValues(); - if (!is_null($payment_summary_classification) && !in_array($payment_summary_classification, $allowedValues, true)) { + if (!in_array($payment_summary_classification, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'payment_summary_classification', must be one of '%s'", + "Invalid value '%s' for 'payment_summary_classification', must be one of '%s'", + $payment_summary_classification, implode("', '", $allowedValues) ) ); @@ -656,7 +773,7 @@ public function setPaymentSummaryClassification($payment_summary_classification) /** * Gets allowance_description * - * @return string + * @return string|null */ public function getAllowanceDescription() { @@ -666,12 +783,15 @@ public function getAllowanceDescription() /** * Sets allowance_description * - * @param string $allowance_description + * @param string|null $allowance_description * - * @return $this + * @return self */ public function setAllowanceDescription($allowance_description) { + if (is_null($allowance_description)) { + throw new \InvalidArgumentException('non-nullable allowance_description cannot be null'); + } $this->container['allowance_description'] = $allowance_description; return $this; @@ -680,7 +800,7 @@ public function setAllowanceDescription($allowance_description) /** * Gets default_super_rate * - * @return double + * @return float|null */ public function getDefaultSuperRate() { @@ -690,12 +810,15 @@ public function getDefaultSuperRate() /** * Sets default_super_rate * - * @param double $default_super_rate + * @param float|null $default_super_rate * - * @return $this + * @return self */ public function setDefaultSuperRate($default_super_rate) { + if (is_null($default_super_rate)) { + throw new \InvalidArgumentException('non-nullable default_super_rate cannot be null'); + } $this->container['default_super_rate'] = $default_super_rate; return $this; @@ -704,7 +827,7 @@ public function setDefaultSuperRate($default_super_rate) /** * Gets super_expense_mapping_code * - * @return string + * @return string|null */ public function getSuperExpenseMappingCode() { @@ -714,12 +837,15 @@ public function getSuperExpenseMappingCode() /** * Sets super_expense_mapping_code * - * @param string $super_expense_mapping_code + * @param string|null $super_expense_mapping_code * - * @return $this + * @return self */ public function setSuperExpenseMappingCode($super_expense_mapping_code) { + if (is_null($super_expense_mapping_code)) { + throw new \InvalidArgumentException('non-nullable super_expense_mapping_code cannot be null'); + } $this->container['super_expense_mapping_code'] = $super_expense_mapping_code; return $this; @@ -728,7 +854,7 @@ public function setSuperExpenseMappingCode($super_expense_mapping_code) /** * Gets super_liability_mapping_code * - * @return string + * @return string|null */ public function getSuperLiabilityMappingCode() { @@ -738,12 +864,15 @@ public function getSuperLiabilityMappingCode() /** * Sets super_liability_mapping_code * - * @param string $super_liability_mapping_code + * @param string|null $super_liability_mapping_code * - * @return $this + * @return self */ public function setSuperLiabilityMappingCode($super_liability_mapping_code) { + if (is_null($super_liability_mapping_code)) { + throw new \InvalidArgumentException('non-nullable super_liability_mapping_code cannot be null'); + } $this->container['super_liability_mapping_code'] = $super_liability_mapping_code; return $this; @@ -752,7 +881,7 @@ public function setSuperLiabilityMappingCode($super_liability_mapping_code) /** * Gets is_payroll_tax_exempt * - * @return bool + * @return bool|null */ public function getIsPayrollTaxExempt() { @@ -762,12 +891,15 @@ public function getIsPayrollTaxExempt() /** * Sets is_payroll_tax_exempt * - * @param bool $is_payroll_tax_exempt + * @param bool|null $is_payroll_tax_exempt * - * @return $this + * @return self */ public function setIsPayrollTaxExempt($is_payroll_tax_exempt) { + if (is_null($is_payroll_tax_exempt)) { + throw new \InvalidArgumentException('non-nullable is_payroll_tax_exempt cannot be null'); + } $this->container['is_payroll_tax_exempt'] = $is_payroll_tax_exempt; return $this; @@ -776,7 +908,7 @@ public function setIsPayrollTaxExempt($is_payroll_tax_exempt) /** * Gets award_name * - * @return string + * @return string|null */ public function getAwardName() { @@ -786,12 +918,15 @@ public function getAwardName() /** * Sets award_name * - * @param string $award_name + * @param string|null $award_name * - * @return $this + * @return self */ public function setAwardName($award_name) { + if (is_null($award_name)) { + throw new \InvalidArgumentException('non-nullable award_name cannot be null'); + } $this->container['award_name'] = $award_name; return $this; @@ -800,7 +935,7 @@ public function setAwardName($award_name) /** * Gets award_id * - * @return int + * @return int|null */ public function getAwardId() { @@ -810,12 +945,15 @@ public function getAwardId() /** * Sets award_id * - * @param int $award_id + * @param int|null $award_id * - * @return $this + * @return self */ public function setAwardId($award_id) { + if (is_null($award_id)) { + throw new \InvalidArgumentException('non-nullable award_id cannot be null'); + } $this->container['award_id'] = $award_id; return $this; @@ -824,7 +962,7 @@ public function setAwardId($award_id) /** * Gets pay_category_type * - * @return string + * @return string|null */ public function getPayCategoryType() { @@ -834,17 +972,21 @@ public function getPayCategoryType() /** * Sets pay_category_type * - * @param string $pay_category_type + * @param string|null $pay_category_type * - * @return $this + * @return self */ public function setPayCategoryType($pay_category_type) { + if (is_null($pay_category_type)) { + throw new \InvalidArgumentException('non-nullable pay_category_type cannot be null'); + } $allowedValues = $this->getPayCategoryTypeAllowableValues(); - if (!is_null($pay_category_type) && !in_array($pay_category_type, $allowedValues, true)) { + if (!in_array($pay_category_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'pay_category_type', must be one of '%s'", + "Invalid value '%s' for 'pay_category_type', must be one of '%s'", + $pay_category_type, implode("', '", $allowedValues) ) ); @@ -857,7 +999,7 @@ public function setPayCategoryType($pay_category_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -867,12 +1009,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -881,7 +1026,7 @@ public function setId($id) /** * Gets parent_id * - * @return int + * @return int|null */ public function getParentId() { @@ -891,12 +1036,15 @@ public function getParentId() /** * Sets parent_id * - * @param int $parent_id + * @param int|null $parent_id * - * @return $this + * @return self */ public function setParentId($parent_id) { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } $this->container['parent_id'] = $parent_id; return $this; @@ -905,7 +1053,7 @@ public function setParentId($parent_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -915,12 +1063,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -929,7 +1080,7 @@ public function setName($name) /** * Gets rate_unit * - * @return string + * @return string|null */ public function getRateUnit() { @@ -939,17 +1090,21 @@ public function getRateUnit() /** * Sets rate_unit * - * @param string $rate_unit + * @param string|null $rate_unit * - * @return $this + * @return self */ public function setRateUnit($rate_unit) { + if (is_null($rate_unit)) { + throw new \InvalidArgumentException('non-nullable rate_unit cannot be null'); + } $allowedValues = $this->getRateUnitAllowableValues(); - if (!is_null($rate_unit) && !in_array($rate_unit, $allowedValues, true)) { + if (!in_array($rate_unit, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'rate_unit', must be one of '%s'", + "Invalid value '%s' for 'rate_unit', must be one of '%s'", + $rate_unit, implode("', '", $allowedValues) ) ); @@ -962,7 +1117,7 @@ public function setRateUnit($rate_unit) /** * Gets accrues_leave * - * @return bool + * @return bool|null */ public function getAccruesLeave() { @@ -972,12 +1127,15 @@ public function getAccruesLeave() /** * Sets accrues_leave * - * @param bool $accrues_leave + * @param bool|null $accrues_leave * - * @return $this + * @return self */ public function setAccruesLeave($accrues_leave) { + if (is_null($accrues_leave)) { + throw new \InvalidArgumentException('non-nullable accrues_leave cannot be null'); + } $this->container['accrues_leave'] = $accrues_leave; return $this; @@ -986,7 +1144,7 @@ public function setAccruesLeave($accrues_leave) /** * Gets rate_loading_percent * - * @return double + * @return float|null */ public function getRateLoadingPercent() { @@ -996,12 +1154,15 @@ public function getRateLoadingPercent() /** * Sets rate_loading_percent * - * @param double $rate_loading_percent + * @param float|null $rate_loading_percent * - * @return $this + * @return self */ public function setRateLoadingPercent($rate_loading_percent) { + if (is_null($rate_loading_percent)) { + throw new \InvalidArgumentException('non-nullable rate_loading_percent cannot be null'); + } $this->container['rate_loading_percent'] = $rate_loading_percent; return $this; @@ -1010,7 +1171,7 @@ public function setRateLoadingPercent($rate_loading_percent) /** * Gets penalty_loading_percent * - * @return double + * @return float|null */ public function getPenaltyLoadingPercent() { @@ -1020,12 +1181,15 @@ public function getPenaltyLoadingPercent() /** * Sets penalty_loading_percent * - * @param double $penalty_loading_percent + * @param float|null $penalty_loading_percent * - * @return $this + * @return self */ public function setPenaltyLoadingPercent($penalty_loading_percent) { + if (is_null($penalty_loading_percent)) { + throw new \InvalidArgumentException('non-nullable penalty_loading_percent cannot be null'); + } $this->container['penalty_loading_percent'] = $penalty_loading_percent; return $this; @@ -1034,7 +1198,7 @@ public function setPenaltyLoadingPercent($penalty_loading_percent) /** * Gets is_tax_exempt * - * @return bool + * @return bool|null */ public function getIsTaxExempt() { @@ -1044,12 +1208,15 @@ public function getIsTaxExempt() /** * Sets is_tax_exempt * - * @param bool $is_tax_exempt + * @param bool|null $is_tax_exempt * - * @return $this + * @return self */ public function setIsTaxExempt($is_tax_exempt) { + if (is_null($is_tax_exempt)) { + throw new \InvalidArgumentException('non-nullable is_tax_exempt cannot be null'); + } $this->container['is_tax_exempt'] = $is_tax_exempt; return $this; @@ -1058,7 +1225,7 @@ public function setIsTaxExempt($is_tax_exempt) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -1068,12 +1235,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -1082,7 +1252,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -1092,12 +1262,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -1106,7 +1279,7 @@ public function setSource($source) /** * Gets general_ledger_mapping_code * - * @return string + * @return string|null */ public function getGeneralLedgerMappingCode() { @@ -1116,12 +1289,15 @@ public function getGeneralLedgerMappingCode() /** * Sets general_ledger_mapping_code * - * @param string $general_ledger_mapping_code + * @param string|null $general_ledger_mapping_code * - * @return $this + * @return self */ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) { + if (is_null($general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable general_ledger_mapping_code cannot be null'); + } $this->container['general_ledger_mapping_code'] = $general_ledger_mapping_code; return $this; @@ -1130,7 +1306,7 @@ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) /** * Gets is_system_pay_category * - * @return bool + * @return bool|null */ public function getIsSystemPayCategory() { @@ -1140,12 +1316,15 @@ public function getIsSystemPayCategory() /** * Sets is_system_pay_category * - * @param bool $is_system_pay_category + * @param bool|null $is_system_pay_category * - * @return $this + * @return self */ public function setIsSystemPayCategory($is_system_pay_category) { + if (is_null($is_system_pay_category)) { + throw new \InvalidArgumentException('non-nullable is_system_pay_category cannot be null'); + } $this->container['is_system_pay_category'] = $is_system_pay_category; return $this; @@ -1154,7 +1333,7 @@ public function setIsSystemPayCategory($is_system_pay_category) /** * Gets number_of_decimal_places * - * @return int + * @return int|null */ public function getNumberOfDecimalPlaces() { @@ -1164,12 +1343,15 @@ public function getNumberOfDecimalPlaces() /** * Sets number_of_decimal_places * - * @param int $number_of_decimal_places + * @param int|null $number_of_decimal_places * - * @return $this + * @return self */ public function setNumberOfDecimalPlaces($number_of_decimal_places) { + if (is_null($number_of_decimal_places)) { + throw new \InvalidArgumentException('non-nullable number_of_decimal_places cannot be null'); + } $this->container['number_of_decimal_places'] = $number_of_decimal_places; return $this; @@ -1178,7 +1360,7 @@ public function setNumberOfDecimalPlaces($number_of_decimal_places) /** * Gets rounding_method * - * @return string + * @return string|null */ public function getRoundingMethod() { @@ -1188,17 +1370,21 @@ public function getRoundingMethod() /** * Sets rounding_method * - * @param string $rounding_method + * @param string|null $rounding_method * - * @return $this + * @return self */ public function setRoundingMethod($rounding_method) { + if (is_null($rounding_method)) { + throw new \InvalidArgumentException('non-nullable rounding_method cannot be null'); + } $allowedValues = $this->getRoundingMethodAllowableValues(); - if (!is_null($rounding_method) && !in_array($rounding_method, $allowedValues, true)) { + if (!in_array($rounding_method, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'rounding_method', must be one of '%s'", + "Invalid value '%s' for 'rounding_method', must be one of '%s'", + $rounding_method, implode("', '", $allowedValues) ) ); @@ -1211,7 +1397,7 @@ public function setRoundingMethod($rounding_method) /** * Gets hide_units_on_pay_slip * - * @return bool + * @return bool|null */ public function getHideUnitsOnPaySlip() { @@ -1221,12 +1407,15 @@ public function getHideUnitsOnPaySlip() /** * Sets hide_units_on_pay_slip * - * @param bool $hide_units_on_pay_slip + * @param bool|null $hide_units_on_pay_slip * - * @return $this + * @return self */ public function setHideUnitsOnPaySlip($hide_units_on_pay_slip) { + if (is_null($hide_units_on_pay_slip)) { + throw new \InvalidArgumentException('non-nullable hide_units_on_pay_slip cannot be null'); + } $this->container['hide_units_on_pay_slip'] = $hide_units_on_pay_slip; return $this; @@ -1235,7 +1424,7 @@ public function setHideUnitsOnPaySlip($hide_units_on_pay_slip) /** * Gets is_primary * - * @return bool + * @return bool|null */ public function getIsPrimary() { @@ -1245,12 +1434,15 @@ public function getIsPrimary() /** * Sets is_primary * - * @param bool $is_primary + * @param bool|null $is_primary * - * @return $this + * @return self */ public function setIsPrimary($is_primary) { + if (is_null($is_primary)) { + throw new \InvalidArgumentException('non-nullable is_primary cannot be null'); + } $this->container['is_primary'] = $is_primary; return $this; @@ -1262,7 +1454,7 @@ public function setIsPrimary($is_primary) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1272,22 +1464,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1303,11 +1496,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1315,13 +1521,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRateTemplateModel.php b/src/lib/Model/AuPayRateTemplateModel.php index ee8c45a..1828acb 100644 --- a/src/lib/Model/AuPayRateTemplateModel.php +++ b/src/lib/Model/AuPayRateTemplateModel.php @@ -2,67 +2,67 @@ /** * AuPayRateTemplateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRateTemplateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRateTemplateModel implements ModelInterface, ArrayAccess +class AuPayRateTemplateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRateTemplateModel'; + protected static $openAPIModelName = 'AuPayRateTemplateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super_threshold_amount' => 'double', - 'maximum_quarterly_super_contributions_base' => 'double', + protected static $openAPITypes = [ + 'super_threshold_amount' => 'float', + 'maximum_quarterly_super_contributions_base' => 'float', 'id' => 'int', 'name' => 'string', 'primary_pay_category_id' => 'int', - 'pay_categories' => '\Swagger\Client\Model\PayRateTemplatePayCategoryExportModel[]', + 'pay_categories' => '\OpenAPI\Client\Model\PayRateTemplatePayCategoryExportModel[]', 'external_id' => 'string', 'source' => 'string', 'reapply_to_linked_employees' => 'bool' @@ -72,8 +72,10 @@ class AuPayRateTemplateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_threshold_amount' => 'double', 'maximum_quarterly_super_contributions_base' => 'double', 'id' => 'int32', @@ -85,14 +87,38 @@ class AuPayRateTemplateModel implements ModelInterface, ArrayAccess 'reapply_to_linked_employees' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_threshold_amount' => false, + 'maximum_quarterly_super_contributions_base' => false, + 'id' => false, + 'name' => false, + 'primary_pay_category_id' => false, + 'pay_categories' => false, + 'external_id' => false, + 'source' => false, + 'reapply_to_linked_employees' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super_threshold_amount'] = isset($data['super_threshold_amount']) ? $data['super_threshold_amount'] : null; - $this->container['maximum_quarterly_super_contributions_base'] = isset($data['maximum_quarterly_super_contributions_base']) ? $data['maximum_quarterly_super_contributions_base'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['primary_pay_category_id'] = isset($data['primary_pay_category_id']) ? $data['primary_pay_category_id'] : null; - $this->container['pay_categories'] = isset($data['pay_categories']) ? $data['pay_categories'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['reapply_to_linked_employees'] = isset($data['reapply_to_linked_employees']) ? $data['reapply_to_linked_employees'] : null; + $this->setIfExists('super_threshold_amount', $data ?? [], null); + $this->setIfExists('maximum_quarterly_super_contributions_base', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('primary_pay_category_id', $data ?? [], null); + $this->setIfExists('pay_categories', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('reapply_to_linked_employees', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets super_threshold_amount * - * @return double + * @return float|null */ public function getSuperThresholdAmount() { @@ -265,12 +358,15 @@ public function getSuperThresholdAmount() /** * Sets super_threshold_amount * - * @param double $super_threshold_amount + * @param float|null $super_threshold_amount * - * @return $this + * @return self */ public function setSuperThresholdAmount($super_threshold_amount) { + if (is_null($super_threshold_amount)) { + throw new \InvalidArgumentException('non-nullable super_threshold_amount cannot be null'); + } $this->container['super_threshold_amount'] = $super_threshold_amount; return $this; @@ -279,7 +375,7 @@ public function setSuperThresholdAmount($super_threshold_amount) /** * Gets maximum_quarterly_super_contributions_base * - * @return double + * @return float|null */ public function getMaximumQuarterlySuperContributionsBase() { @@ -289,12 +385,15 @@ public function getMaximumQuarterlySuperContributionsBase() /** * Sets maximum_quarterly_super_contributions_base * - * @param double $maximum_quarterly_super_contributions_base + * @param float|null $maximum_quarterly_super_contributions_base * - * @return $this + * @return self */ public function setMaximumQuarterlySuperContributionsBase($maximum_quarterly_super_contributions_base) { + if (is_null($maximum_quarterly_super_contributions_base)) { + throw new \InvalidArgumentException('non-nullable maximum_quarterly_super_contributions_base cannot be null'); + } $this->container['maximum_quarterly_super_contributions_base'] = $maximum_quarterly_super_contributions_base; return $this; @@ -303,7 +402,7 @@ public function setMaximumQuarterlySuperContributionsBase($maximum_quarterly_sup /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -313,12 +412,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -327,7 +429,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -337,12 +439,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -351,7 +456,7 @@ public function setName($name) /** * Gets primary_pay_category_id * - * @return int + * @return int|null */ public function getPrimaryPayCategoryId() { @@ -361,12 +466,15 @@ public function getPrimaryPayCategoryId() /** * Sets primary_pay_category_id * - * @param int $primary_pay_category_id + * @param int|null $primary_pay_category_id * - * @return $this + * @return self */ public function setPrimaryPayCategoryId($primary_pay_category_id) { + if (is_null($primary_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable primary_pay_category_id cannot be null'); + } $this->container['primary_pay_category_id'] = $primary_pay_category_id; return $this; @@ -375,7 +483,7 @@ public function setPrimaryPayCategoryId($primary_pay_category_id) /** * Gets pay_categories * - * @return \Swagger\Client\Model\PayRateTemplatePayCategoryExportModel[] + * @return \OpenAPI\Client\Model\PayRateTemplatePayCategoryExportModel[]|null */ public function getPayCategories() { @@ -385,12 +493,15 @@ public function getPayCategories() /** * Sets pay_categories * - * @param \Swagger\Client\Model\PayRateTemplatePayCategoryExportModel[] $pay_categories + * @param \OpenAPI\Client\Model\PayRateTemplatePayCategoryExportModel[]|null $pay_categories * - * @return $this + * @return self */ public function setPayCategories($pay_categories) { + if (is_null($pay_categories)) { + throw new \InvalidArgumentException('non-nullable pay_categories cannot be null'); + } $this->container['pay_categories'] = $pay_categories; return $this; @@ -399,7 +510,7 @@ public function setPayCategories($pay_categories) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -409,12 +520,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -423,7 +537,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -433,12 +547,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -447,7 +564,7 @@ public function setSource($source) /** * Gets reapply_to_linked_employees * - * @return bool + * @return bool|null */ public function getReapplyToLinkedEmployees() { @@ -457,12 +574,15 @@ public function getReapplyToLinkedEmployees() /** * Sets reapply_to_linked_employees * - * @param bool $reapply_to_linked_employees + * @param bool|null $reapply_to_linked_employees * - * @return $this + * @return self */ public function setReapplyToLinkedEmployees($reapply_to_linked_employees) { + if (is_null($reapply_to_linked_employees)) { + throw new \InvalidArgumentException('non-nullable reapply_to_linked_employees cannot be null'); + } $this->container['reapply_to_linked_employees'] = $reapply_to_linked_employees; return $this; @@ -474,7 +594,7 @@ public function setReapplyToLinkedEmployees($reapply_to_linked_employees) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunDeductionResponse.php b/src/lib/Model/AuPayRunDeductionResponse.php index c544188..edac35e 100644 --- a/src/lib/Model/AuPayRunDeductionResponse.php +++ b/src/lib/Model/AuPayRunDeductionResponse.php @@ -2,62 +2,62 @@ /** * AuPayRunDeductionResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunDeductionResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunDeductionResponse implements ModelInterface, ArrayAccess +class AuPayRunDeductionResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunDeductionResponse'; + protected static $openAPIModelName = 'AuPayRunDeductionResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'deductions' => 'map[string,\Swagger\Client\Model\AuDeductionModel[]]', + protected static $openAPITypes = [ + 'deductions' => 'array', 'pay_run_id' => 'int' ]; @@ -65,20 +65,39 @@ class AuPayRunDeductionResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deductions' => null, 'pay_run_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deductions' => false, + 'pay_run_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['deductions'] = isset($data['deductions']) ? $data['deductions'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; + $this->setIfExists('deductions', $data ?? [], null); + $this->setIfExists('pay_run_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets deductions * - * @return map[string,\Swagger\Client\Model\AuDeductionModel[]] + * @return array|null */ public function getDeductions() { @@ -223,12 +309,15 @@ public function getDeductions() /** * Sets deductions * - * @param map[string,\Swagger\Client\Model\AuDeductionModel[]] $deductions + * @param array|null $deductions * - * @return $this + * @return self */ public function setDeductions($deductions) { + if (is_null($deductions)) { + throw new \InvalidArgumentException('non-nullable deductions cannot be null'); + } $this->container['deductions'] = $deductions; return $this; @@ -237,7 +326,7 @@ public function setDeductions($deductions) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -247,12 +336,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -264,7 +356,7 @@ public function setPayRunId($pay_run_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunDetailsModel.php b/src/lib/Model/AuPayRunDetailsModel.php index 2a42525..851c7cc 100644 --- a/src/lib/Model/AuPayRunDetailsModel.php +++ b/src/lib/Model/AuPayRunDetailsModel.php @@ -2,85 +2,105 @@ /** * AuPayRunDetailsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunDetailsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunDetailsModel implements ModelInterface, ArrayAccess +class AuPayRunDetailsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunDetailsModel'; + protected static $openAPIModelName = 'AuPayRunDetailsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'pay_run_totals' => '\Swagger\Client\Model\AuPayRunTotalDetailModel[]', - 'grand_total' => '\Swagger\Client\Model\AuPayRunGrandTotalModel', - 'pay_run' => '\Swagger\Client\Model\PayRunModel' + protected static $openAPITypes = [ + 'pay_run_totals' => '\OpenAPI\Client\Model\AuPayRunTotalDetailModel[]', + 'grand_total' => '\OpenAPI\Client\Model\AuPayRunGrandTotalModel', + 'pay_run' => '\OpenAPI\Client\Model\PayRunModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_totals' => null, 'grand_total' => null, 'pay_run' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_totals' => false, + 'grand_total' => false, + 'pay_run' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_totals'] = isset($data['pay_run_totals']) ? $data['pay_run_totals'] : null; - $this->container['grand_total'] = isset($data['grand_total']) ? $data['grand_total'] : null; - $this->container['pay_run'] = isset($data['pay_run']) ? $data['pay_run'] : null; + $this->setIfExists('pay_run_totals', $data ?? [], null); + $this->setIfExists('grand_total', $data ?? [], null); + $this->setIfExists('pay_run', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets pay_run_totals * - * @return \Swagger\Client\Model\AuPayRunTotalDetailModel[] + * @return \OpenAPI\Client\Model\AuPayRunTotalDetailModel[]|null */ public function getPayRunTotals() { @@ -229,12 +316,15 @@ public function getPayRunTotals() /** * Sets pay_run_totals * - * @param \Swagger\Client\Model\AuPayRunTotalDetailModel[] $pay_run_totals + * @param \OpenAPI\Client\Model\AuPayRunTotalDetailModel[]|null $pay_run_totals * - * @return $this + * @return self */ public function setPayRunTotals($pay_run_totals) { + if (is_null($pay_run_totals)) { + throw new \InvalidArgumentException('non-nullable pay_run_totals cannot be null'); + } $this->container['pay_run_totals'] = $pay_run_totals; return $this; @@ -243,7 +333,7 @@ public function setPayRunTotals($pay_run_totals) /** * Gets grand_total * - * @return \Swagger\Client\Model\AuPayRunGrandTotalModel + * @return \OpenAPI\Client\Model\AuPayRunGrandTotalModel|null */ public function getGrandTotal() { @@ -253,12 +343,15 @@ public function getGrandTotal() /** * Sets grand_total * - * @param \Swagger\Client\Model\AuPayRunGrandTotalModel $grand_total + * @param \OpenAPI\Client\Model\AuPayRunGrandTotalModel|null $grand_total grand_total * - * @return $this + * @return self */ public function setGrandTotal($grand_total) { + if (is_null($grand_total)) { + throw new \InvalidArgumentException('non-nullable grand_total cannot be null'); + } $this->container['grand_total'] = $grand_total; return $this; @@ -267,7 +360,7 @@ public function setGrandTotal($grand_total) /** * Gets pay_run * - * @return \Swagger\Client\Model\PayRunModel + * @return \OpenAPI\Client\Model\PayRunModel|null */ public function getPayRun() { @@ -277,12 +370,15 @@ public function getPayRun() /** * Sets pay_run * - * @param \Swagger\Client\Model\PayRunModel $pay_run + * @param \OpenAPI\Client\Model\PayRunModel|null $pay_run pay_run * - * @return $this + * @return self */ public function setPayRun($pay_run) { + if (is_null($pay_run)) { + throw new \InvalidArgumentException('non-nullable pay_run cannot be null'); + } $this->container['pay_run'] = $pay_run; return $this; @@ -294,7 +390,7 @@ public function setPayRun($pay_run) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunEarningsLineResponseModel.php b/src/lib/Model/AuPayRunEarningsLineResponseModel.php index 045d7c7..19a96f1 100644 --- a/src/lib/Model/AuPayRunEarningsLineResponseModel.php +++ b/src/lib/Model/AuPayRunEarningsLineResponseModel.php @@ -2,62 +2,62 @@ /** * AuPayRunEarningsLineResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunEarningsLineResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunEarningsLineResponseModel implements ModelInterface, ArrayAccess +class AuPayRunEarningsLineResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunEarningsLineResponseModel'; + protected static $openAPIModelName = 'AuPayRunEarningsLineResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'earnings_lines' => 'map[string,\Swagger\Client\Model\AuEarningsLineModel[]]', + protected static $openAPITypes = [ + 'earnings_lines' => 'array', 'pay_run_id' => 'int' ]; @@ -65,20 +65,39 @@ class AuPayRunEarningsLineResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'earnings_lines' => null, 'pay_run_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'earnings_lines' => false, + 'pay_run_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['earnings_lines'] = isset($data['earnings_lines']) ? $data['earnings_lines'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; + $this->setIfExists('earnings_lines', $data ?? [], null); + $this->setIfExists('pay_run_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets earnings_lines * - * @return map[string,\Swagger\Client\Model\AuEarningsLineModel[]] + * @return array|null */ public function getEarningsLines() { @@ -223,12 +309,15 @@ public function getEarningsLines() /** * Sets earnings_lines * - * @param map[string,\Swagger\Client\Model\AuEarningsLineModel[]] $earnings_lines + * @param array|null $earnings_lines * - * @return $this + * @return self */ public function setEarningsLines($earnings_lines) { + if (is_null($earnings_lines)) { + throw new \InvalidArgumentException('non-nullable earnings_lines cannot be null'); + } $this->container['earnings_lines'] = $earnings_lines; return $this; @@ -237,7 +326,7 @@ public function setEarningsLines($earnings_lines) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -247,12 +336,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -264,7 +356,7 @@ public function setPayRunId($pay_run_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunGrandTotalModel.php b/src/lib/Model/AuPayRunGrandTotalModel.php index bc60164..536922c 100644 --- a/src/lib/Model/AuPayRunGrandTotalModel.php +++ b/src/lib/Model/AuPayRunGrandTotalModel.php @@ -2,83 +2,85 @@ /** * AuPayRunGrandTotalModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunGrandTotalModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunGrandTotalModel implements ModelInterface, ArrayAccess +class AuPayRunGrandTotalModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunGrandTotalModel'; + protected static $openAPIModelName = 'AuPayRunGrandTotalModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'sfss_amount' => 'double', - 'help_amount' => 'double', - 'super_contribution' => 'double', - 'payg_withholding_amount' => 'double', + protected static $openAPITypes = [ + 'sfss_amount' => 'float', + 'help_amount' => 'float', + 'super_contribution' => 'float', + 'payg_withholding_amount' => 'float', 'number_of_employees' => 'int', - 'total_hours' => 'double', - 'taxable_earnings' => 'double', - 'gross_earnings' => 'double', - 'net_earnings' => 'double', - 'pre_tax_deduction_amount' => 'double', - 'post_tax_deduction_amount' => 'double', - 'employer_contribution' => 'double', - 'employee_expenses_total' => 'double', - 'employer_liabilities_total' => 'double' + 'total_hours' => 'float', + 'taxable_earnings' => 'float', + 'gross_earnings' => 'float', + 'net_earnings' => 'float', + 'pre_tax_deduction_amount' => 'float', + 'post_tax_deduction_amount' => 'float', + 'employer_contribution' => 'float', + 'employee_expenses_total' => 'float', + 'employer_liabilities_total' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'sfss_amount' => 'double', 'help_amount' => 'double', 'super_contribution' => 'double', @@ -95,14 +97,43 @@ class AuPayRunGrandTotalModel implements ModelInterface, ArrayAccess 'employer_liabilities_total' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sfss_amount' => false, + 'help_amount' => false, + 'super_contribution' => false, + 'payg_withholding_amount' => false, + 'number_of_employees' => false, + 'total_hours' => false, + 'taxable_earnings' => false, + 'gross_earnings' => false, + 'net_earnings' => false, + 'pre_tax_deduction_amount' => false, + 'post_tax_deduction_amount' => false, + 'employer_contribution' => false, + 'employee_expenses_total' => false, + 'employer_liabilities_total' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,12 +303,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -242,20 +322,38 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sfss_amount'] = isset($data['sfss_amount']) ? $data['sfss_amount'] : null; - $this->container['help_amount'] = isset($data['help_amount']) ? $data['help_amount'] : null; - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['payg_withholding_amount'] = isset($data['payg_withholding_amount']) ? $data['payg_withholding_amount'] : null; - $this->container['number_of_employees'] = isset($data['number_of_employees']) ? $data['number_of_employees'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['pre_tax_deduction_amount'] = isset($data['pre_tax_deduction_amount']) ? $data['pre_tax_deduction_amount'] : null; - $this->container['post_tax_deduction_amount'] = isset($data['post_tax_deduction_amount']) ? $data['post_tax_deduction_amount'] : null; - $this->container['employer_contribution'] = isset($data['employer_contribution']) ? $data['employer_contribution'] : null; - $this->container['employee_expenses_total'] = isset($data['employee_expenses_total']) ? $data['employee_expenses_total'] : null; - $this->container['employer_liabilities_total'] = isset($data['employer_liabilities_total']) ? $data['employer_liabilities_total'] : null; + $this->setIfExists('sfss_amount', $data ?? [], null); + $this->setIfExists('help_amount', $data ?? [], null); + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('payg_withholding_amount', $data ?? [], null); + $this->setIfExists('number_of_employees', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('pre_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('post_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('employer_contribution', $data ?? [], null); + $this->setIfExists('employee_expenses_total', $data ?? [], null); + $this->setIfExists('employer_liabilities_total', $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; } /** @@ -285,7 +383,7 @@ public function valid() /** * Gets sfss_amount * - * @return double + * @return float|null */ public function getSfssAmount() { @@ -295,12 +393,15 @@ public function getSfssAmount() /** * Sets sfss_amount * - * @param double $sfss_amount + * @param float|null $sfss_amount * - * @return $this + * @return self */ public function setSfssAmount($sfss_amount) { + if (is_null($sfss_amount)) { + throw new \InvalidArgumentException('non-nullable sfss_amount cannot be null'); + } $this->container['sfss_amount'] = $sfss_amount; return $this; @@ -309,7 +410,7 @@ public function setSfssAmount($sfss_amount) /** * Gets help_amount * - * @return double + * @return float|null */ public function getHelpAmount() { @@ -319,12 +420,15 @@ public function getHelpAmount() /** * Sets help_amount * - * @param double $help_amount + * @param float|null $help_amount * - * @return $this + * @return self */ public function setHelpAmount($help_amount) { + if (is_null($help_amount)) { + throw new \InvalidArgumentException('non-nullable help_amount cannot be null'); + } $this->container['help_amount'] = $help_amount; return $this; @@ -333,7 +437,7 @@ public function setHelpAmount($help_amount) /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -343,12 +447,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -357,7 +464,7 @@ public function setSuperContribution($super_contribution) /** * Gets payg_withholding_amount * - * @return double + * @return float|null */ public function getPaygWithholdingAmount() { @@ -367,12 +474,15 @@ public function getPaygWithholdingAmount() /** * Sets payg_withholding_amount * - * @param double $payg_withholding_amount + * @param float|null $payg_withholding_amount * - * @return $this + * @return self */ public function setPaygWithholdingAmount($payg_withholding_amount) { + if (is_null($payg_withholding_amount)) { + throw new \InvalidArgumentException('non-nullable payg_withholding_amount cannot be null'); + } $this->container['payg_withholding_amount'] = $payg_withholding_amount; return $this; @@ -381,7 +491,7 @@ public function setPaygWithholdingAmount($payg_withholding_amount) /** * Gets number_of_employees * - * @return int + * @return int|null */ public function getNumberOfEmployees() { @@ -391,12 +501,15 @@ public function getNumberOfEmployees() /** * Sets number_of_employees * - * @param int $number_of_employees + * @param int|null $number_of_employees * - * @return $this + * @return self */ public function setNumberOfEmployees($number_of_employees) { + if (is_null($number_of_employees)) { + throw new \InvalidArgumentException('non-nullable number_of_employees cannot be null'); + } $this->container['number_of_employees'] = $number_of_employees; return $this; @@ -405,7 +518,7 @@ public function setNumberOfEmployees($number_of_employees) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -415,12 +528,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -429,7 +545,7 @@ public function setTotalHours($total_hours) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -439,12 +555,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -453,7 +572,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -463,12 +582,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -477,7 +599,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -487,12 +609,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -501,7 +626,7 @@ public function setNetEarnings($net_earnings) /** * Gets pre_tax_deduction_amount * - * @return double + * @return float|null */ public function getPreTaxDeductionAmount() { @@ -511,12 +636,15 @@ public function getPreTaxDeductionAmount() /** * Sets pre_tax_deduction_amount * - * @param double $pre_tax_deduction_amount + * @param float|null $pre_tax_deduction_amount * - * @return $this + * @return self */ public function setPreTaxDeductionAmount($pre_tax_deduction_amount) { + if (is_null($pre_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deduction_amount cannot be null'); + } $this->container['pre_tax_deduction_amount'] = $pre_tax_deduction_amount; return $this; @@ -525,7 +653,7 @@ public function setPreTaxDeductionAmount($pre_tax_deduction_amount) /** * Gets post_tax_deduction_amount * - * @return double + * @return float|null */ public function getPostTaxDeductionAmount() { @@ -535,12 +663,15 @@ public function getPostTaxDeductionAmount() /** * Sets post_tax_deduction_amount * - * @param double $post_tax_deduction_amount + * @param float|null $post_tax_deduction_amount * - * @return $this + * @return self */ public function setPostTaxDeductionAmount($post_tax_deduction_amount) { + if (is_null($post_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable post_tax_deduction_amount cannot be null'); + } $this->container['post_tax_deduction_amount'] = $post_tax_deduction_amount; return $this; @@ -549,7 +680,7 @@ public function setPostTaxDeductionAmount($post_tax_deduction_amount) /** * Gets employer_contribution * - * @return double + * @return float|null */ public function getEmployerContribution() { @@ -559,12 +690,15 @@ public function getEmployerContribution() /** * Sets employer_contribution * - * @param double $employer_contribution + * @param float|null $employer_contribution * - * @return $this + * @return self */ public function setEmployerContribution($employer_contribution) { + if (is_null($employer_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_contribution cannot be null'); + } $this->container['employer_contribution'] = $employer_contribution; return $this; @@ -573,7 +707,7 @@ public function setEmployerContribution($employer_contribution) /** * Gets employee_expenses_total * - * @return double + * @return float|null */ public function getEmployeeExpensesTotal() { @@ -583,12 +717,15 @@ public function getEmployeeExpensesTotal() /** * Sets employee_expenses_total * - * @param double $employee_expenses_total + * @param float|null $employee_expenses_total * - * @return $this + * @return self */ public function setEmployeeExpensesTotal($employee_expenses_total) { + if (is_null($employee_expenses_total)) { + throw new \InvalidArgumentException('non-nullable employee_expenses_total cannot be null'); + } $this->container['employee_expenses_total'] = $employee_expenses_total; return $this; @@ -597,7 +734,7 @@ public function setEmployeeExpensesTotal($employee_expenses_total) /** * Gets employer_liabilities_total * - * @return double + * @return float|null */ public function getEmployerLiabilitiesTotal() { @@ -607,12 +744,15 @@ public function getEmployerLiabilitiesTotal() /** * Sets employer_liabilities_total * - * @param double $employer_liabilities_total + * @param float|null $employer_liabilities_total * - * @return $this + * @return self */ public function setEmployerLiabilitiesTotal($employer_liabilities_total) { + if (is_null($employer_liabilities_total)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities_total cannot be null'); + } $this->container['employer_liabilities_total'] = $employer_liabilities_total; return $this; @@ -624,7 +764,7 @@ public function setEmployerLiabilitiesTotal($employer_liabilities_total) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -634,22 +774,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -665,11 +806,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -677,13 +831,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunInclusionExportModel.php b/src/lib/Model/AuPayRunInclusionExportModel.php index 7a84f85..3a0684a 100644 --- a/src/lib/Model/AuPayRunInclusionExportModel.php +++ b/src/lib/Model/AuPayRunInclusionExportModel.php @@ -2,61 +2,61 @@ /** * AuPayRunInclusionExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunInclusionExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunInclusionExportModel implements ModelInterface, ArrayAccess +class AuPayRunInclusionExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunInclusionExportModel'; + protected static $openAPIModelName = 'AuPayRunInclusionExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'super_contribution_type' => 'string', 'super_rate' => 'string', 'tax_code' => 'string', @@ -74,11 +74,11 @@ class AuPayRunInclusionExportModel implements ModelInterface, ArrayAccess 'tax_adjustment_type' => 'string', 'start_date' => 'string', 'expiry' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'amount_type' => 'string', 'paid' => 'string', 'preserved_earnings' => 'string', - 'units' => 'double', + 'units' => 'float', 'rate' => 'string', 'total' => 'string', 'notes' => 'string' @@ -88,8 +88,10 @@ class AuPayRunInclusionExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_contribution_type' => null, 'super_rate' => null, 'tax_code' => null, @@ -117,14 +119,54 @@ class AuPayRunInclusionExportModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_contribution_type' => false, + 'super_rate' => false, + 'tax_code' => false, + 'tax_rate' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'primary_location' => false, + 'location' => false, + 'deduction_category' => false, + 'expense_category' => false, + 'employer_liability_category' => false, + 'pay_category' => false, + 'tax_adjustment_type' => false, + 'start_date' => false, + 'expiry' => false, + 'amount' => false, + 'amount_type' => false, + 'paid' => false, + 'preserved_earnings' => false, + 'units' => false, + 'rate' => false, + 'total' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -132,9 +174,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -275,12 +369,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -297,31 +388,49 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super_contribution_type'] = isset($data['super_contribution_type']) ? $data['super_contribution_type'] : null; - $this->container['super_rate'] = isset($data['super_rate']) ? $data['super_rate'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['primary_location'] = isset($data['primary_location']) ? $data['primary_location'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['deduction_category'] = isset($data['deduction_category']) ? $data['deduction_category'] : null; - $this->container['expense_category'] = isset($data['expense_category']) ? $data['expense_category'] : null; - $this->container['employer_liability_category'] = isset($data['employer_liability_category']) ? $data['employer_liability_category'] : null; - $this->container['pay_category'] = isset($data['pay_category']) ? $data['pay_category'] : null; - $this->container['tax_adjustment_type'] = isset($data['tax_adjustment_type']) ? $data['tax_adjustment_type'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['expiry'] = isset($data['expiry']) ? $data['expiry'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['amount_type'] = isset($data['amount_type']) ? $data['amount_type'] : null; - $this->container['paid'] = isset($data['paid']) ? $data['paid'] : null; - $this->container['preserved_earnings'] = isset($data['preserved_earnings']) ? $data['preserved_earnings'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['total'] = isset($data['total']) ? $data['total'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('super_contribution_type', $data ?? [], null); + $this->setIfExists('super_rate', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_rate', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('primary_location', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('deduction_category', $data ?? [], null); + $this->setIfExists('expense_category', $data ?? [], null); + $this->setIfExists('employer_liability_category', $data ?? [], null); + $this->setIfExists('pay_category', $data ?? [], null); + $this->setIfExists('tax_adjustment_type', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('expiry', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('amount_type', $data ?? [], null); + $this->setIfExists('paid', $data ?? [], null); + $this->setIfExists('preserved_earnings', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -351,7 +460,7 @@ public function valid() /** * Gets super_contribution_type * - * @return string + * @return string|null */ public function getSuperContributionType() { @@ -361,12 +470,15 @@ public function getSuperContributionType() /** * Sets super_contribution_type * - * @param string $super_contribution_type + * @param string|null $super_contribution_type * - * @return $this + * @return self */ public function setSuperContributionType($super_contribution_type) { + if (is_null($super_contribution_type)) { + throw new \InvalidArgumentException('non-nullable super_contribution_type cannot be null'); + } $this->container['super_contribution_type'] = $super_contribution_type; return $this; @@ -375,7 +487,7 @@ public function setSuperContributionType($super_contribution_type) /** * Gets super_rate * - * @return string + * @return string|null */ public function getSuperRate() { @@ -385,12 +497,15 @@ public function getSuperRate() /** * Sets super_rate * - * @param string $super_rate + * @param string|null $super_rate * - * @return $this + * @return self */ public function setSuperRate($super_rate) { + if (is_null($super_rate)) { + throw new \InvalidArgumentException('non-nullable super_rate cannot be null'); + } $this->container['super_rate'] = $super_rate; return $this; @@ -399,7 +514,7 @@ public function setSuperRate($super_rate) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -409,12 +524,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -423,7 +541,7 @@ public function setTaxCode($tax_code) /** * Gets tax_rate * - * @return string + * @return string|null */ public function getTaxRate() { @@ -433,12 +551,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param string $tax_rate + * @param string|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -447,7 +568,7 @@ public function setTaxRate($tax_rate) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -457,12 +578,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -471,7 +595,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -481,12 +605,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -495,7 +622,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -505,12 +632,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -519,7 +649,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -529,12 +659,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -543,7 +676,7 @@ public function setExternalId($external_id) /** * Gets primary_location * - * @return string + * @return string|null */ public function getPrimaryLocation() { @@ -553,12 +686,15 @@ public function getPrimaryLocation() /** * Sets primary_location * - * @param string $primary_location + * @param string|null $primary_location * - * @return $this + * @return self */ public function setPrimaryLocation($primary_location) { + if (is_null($primary_location)) { + throw new \InvalidArgumentException('non-nullable primary_location cannot be null'); + } $this->container['primary_location'] = $primary_location; return $this; @@ -567,7 +703,7 @@ public function setPrimaryLocation($primary_location) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -577,12 +713,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -591,7 +730,7 @@ public function setLocation($location) /** * Gets deduction_category * - * @return string + * @return string|null */ public function getDeductionCategory() { @@ -601,12 +740,15 @@ public function getDeductionCategory() /** * Sets deduction_category * - * @param string $deduction_category + * @param string|null $deduction_category * - * @return $this + * @return self */ public function setDeductionCategory($deduction_category) { + if (is_null($deduction_category)) { + throw new \InvalidArgumentException('non-nullable deduction_category cannot be null'); + } $this->container['deduction_category'] = $deduction_category; return $this; @@ -615,7 +757,7 @@ public function setDeductionCategory($deduction_category) /** * Gets expense_category * - * @return string + * @return string|null */ public function getExpenseCategory() { @@ -625,12 +767,15 @@ public function getExpenseCategory() /** * Sets expense_category * - * @param string $expense_category + * @param string|null $expense_category * - * @return $this + * @return self */ public function setExpenseCategory($expense_category) { + if (is_null($expense_category)) { + throw new \InvalidArgumentException('non-nullable expense_category cannot be null'); + } $this->container['expense_category'] = $expense_category; return $this; @@ -639,7 +784,7 @@ public function setExpenseCategory($expense_category) /** * Gets employer_liability_category * - * @return string + * @return string|null */ public function getEmployerLiabilityCategory() { @@ -649,12 +794,15 @@ public function getEmployerLiabilityCategory() /** * Sets employer_liability_category * - * @param string $employer_liability_category + * @param string|null $employer_liability_category * - * @return $this + * @return self */ public function setEmployerLiabilityCategory($employer_liability_category) { + if (is_null($employer_liability_category)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category cannot be null'); + } $this->container['employer_liability_category'] = $employer_liability_category; return $this; @@ -663,7 +811,7 @@ public function setEmployerLiabilityCategory($employer_liability_category) /** * Gets pay_category * - * @return string + * @return string|null */ public function getPayCategory() { @@ -673,12 +821,15 @@ public function getPayCategory() /** * Sets pay_category * - * @param string $pay_category + * @param string|null $pay_category * - * @return $this + * @return self */ public function setPayCategory($pay_category) { + if (is_null($pay_category)) { + throw new \InvalidArgumentException('non-nullable pay_category cannot be null'); + } $this->container['pay_category'] = $pay_category; return $this; @@ -687,7 +838,7 @@ public function setPayCategory($pay_category) /** * Gets tax_adjustment_type * - * @return string + * @return string|null */ public function getTaxAdjustmentType() { @@ -697,12 +848,15 @@ public function getTaxAdjustmentType() /** * Sets tax_adjustment_type * - * @param string $tax_adjustment_type + * @param string|null $tax_adjustment_type * - * @return $this + * @return self */ public function setTaxAdjustmentType($tax_adjustment_type) { + if (is_null($tax_adjustment_type)) { + throw new \InvalidArgumentException('non-nullable tax_adjustment_type cannot be null'); + } $this->container['tax_adjustment_type'] = $tax_adjustment_type; return $this; @@ -711,7 +865,7 @@ public function setTaxAdjustmentType($tax_adjustment_type) /** * Gets start_date * - * @return string + * @return string|null */ public function getStartDate() { @@ -721,12 +875,15 @@ public function getStartDate() /** * Sets start_date * - * @param string $start_date + * @param string|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -735,7 +892,7 @@ public function setStartDate($start_date) /** * Gets expiry * - * @return string + * @return string|null */ public function getExpiry() { @@ -745,12 +902,15 @@ public function getExpiry() /** * Sets expiry * - * @param string $expiry + * @param string|null $expiry * - * @return $this + * @return self */ public function setExpiry($expiry) { + if (is_null($expiry)) { + throw new \InvalidArgumentException('non-nullable expiry cannot be null'); + } $this->container['expiry'] = $expiry; return $this; @@ -759,7 +919,7 @@ public function setExpiry($expiry) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -769,12 +929,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -783,7 +946,7 @@ public function setAmount($amount) /** * Gets amount_type * - * @return string + * @return string|null */ public function getAmountType() { @@ -793,12 +956,15 @@ public function getAmountType() /** * Sets amount_type * - * @param string $amount_type + * @param string|null $amount_type * - * @return $this + * @return self */ public function setAmountType($amount_type) { + if (is_null($amount_type)) { + throw new \InvalidArgumentException('non-nullable amount_type cannot be null'); + } $this->container['amount_type'] = $amount_type; return $this; @@ -807,7 +973,7 @@ public function setAmountType($amount_type) /** * Gets paid * - * @return string + * @return string|null */ public function getPaid() { @@ -817,12 +983,15 @@ public function getPaid() /** * Sets paid * - * @param string $paid + * @param string|null $paid * - * @return $this + * @return self */ public function setPaid($paid) { + if (is_null($paid)) { + throw new \InvalidArgumentException('non-nullable paid cannot be null'); + } $this->container['paid'] = $paid; return $this; @@ -831,7 +1000,7 @@ public function setPaid($paid) /** * Gets preserved_earnings * - * @return string + * @return string|null */ public function getPreservedEarnings() { @@ -841,12 +1010,15 @@ public function getPreservedEarnings() /** * Sets preserved_earnings * - * @param string $preserved_earnings + * @param string|null $preserved_earnings * - * @return $this + * @return self */ public function setPreservedEarnings($preserved_earnings) { + if (is_null($preserved_earnings)) { + throw new \InvalidArgumentException('non-nullable preserved_earnings cannot be null'); + } $this->container['preserved_earnings'] = $preserved_earnings; return $this; @@ -855,7 +1027,7 @@ public function setPreservedEarnings($preserved_earnings) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -865,12 +1037,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -879,7 +1054,7 @@ public function setUnits($units) /** * Gets rate * - * @return string + * @return string|null */ public function getRate() { @@ -889,12 +1064,15 @@ public function getRate() /** * Sets rate * - * @param string $rate + * @param string|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -903,7 +1081,7 @@ public function setRate($rate) /** * Gets total * - * @return string + * @return string|null */ public function getTotal() { @@ -913,12 +1091,15 @@ public function getTotal() /** * Sets total * - * @param string $total + * @param string|null $total * - * @return $this + * @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; @@ -927,7 +1108,7 @@ public function setTotal($total) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -937,12 +1118,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -954,7 +1138,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -964,22 +1148,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -995,11 +1180,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1007,13 +1205,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunTotalDetailModel.php b/src/lib/Model/AuPayRunTotalDetailModel.php index 839c867..674b342 100644 --- a/src/lib/Model/AuPayRunTotalDetailModel.php +++ b/src/lib/Model/AuPayRunTotalDetailModel.php @@ -2,88 +2,88 @@ /** * AuPayRunTotalDetailModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunTotalDetailModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunTotalDetailModel implements ModelInterface, ArrayAccess +class AuPayRunTotalDetailModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunTotalDetailModel'; + protected static $openAPIModelName = 'AuPayRunTotalDetailModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg_withholding_amount' => 'double', - 'payg_withholding_percent' => 'double', - 'sfss_amount' => 'double', - 'help_amount' => 'double', - 'super_contribution' => 'double', - 'employer_contribution' => 'double', - 'super_contribution_minus_super_adjustments' => 'double', - 'all_super_contributions_total' => 'double', - 'gross_plus_super' => 'double', - 'super_adjustments_amount' => 'double', - 'salary_sacrifice_super_amount' => 'double', - 'member_voluntary_super_amount' => 'double', - 'non_super_deduction_total' => 'double', - 'super_payments_total' => 'double', + protected static $openAPITypes = [ + 'payg_withholding_amount' => 'float', + 'payg_withholding_percent' => 'float', + 'sfss_amount' => 'float', + 'help_amount' => 'float', + 'super_contribution' => 'float', + 'employer_contribution' => 'float', + 'super_contribution_minus_super_adjustments' => 'float', + 'all_super_contributions_total' => 'float', + 'gross_plus_super' => 'float', + 'super_adjustments_amount' => 'float', + 'salary_sacrifice_super_amount' => 'float', + 'member_voluntary_super_amount' => 'float', + 'non_super_deduction_total' => 'float', + 'super_payments_total' => 'float', 'is_employee_under18' => 'bool', - 'employer_contribution_adjustments_amount' => 'double', - 'payg_adjustments_amount' => 'double', + 'employer_contribution_adjustments_amount' => 'float', + 'payg_adjustments_amount' => 'float', 'super_contributions_cap_applied' => 'bool', - 'payg_payment_total' => 'double', + 'payg_payment_total' => 'float', 'id' => 'int', 'employee_name' => 'string', - 'total_hours' => 'double', - 'gross_earnings' => 'double', - 'net_earnings' => 'double', - 'taxable_earnings' => 'double', - 'post_tax_deduction_amount' => 'double', - 'pre_tax_deduction_amount' => 'double', + 'total_hours' => 'float', + 'gross_earnings' => 'float', + 'net_earnings' => 'float', + 'taxable_earnings' => 'float', + 'post_tax_deduction_amount' => 'float', + 'pre_tax_deduction_amount' => 'float', 'pay_condition_rule_set_name' => 'string', 'employee_id' => 'int', 'is_termination' => 'bool', @@ -92,12 +92,12 @@ class AuPayRunTotalDetailModel implements ModelInterface, ArrayAccess 'employee_external_reference_id' => 'string', 'is_excluded' => 'bool', 'employee_external_id' => 'string', - 'bank_payments_total' => 'double', + 'bank_payments_total' => 'float', 'termination_date' => '\DateTime', 'earliest_termination_date' => '\DateTime', 'previous_termination_date' => '\DateTime', - 'employee_expenses_total' => 'double', - 'employer_liabilities_total' => 'double', + 'employee_expenses_total' => 'float', + 'employer_liabilities_total' => 'float', 'is_complete' => 'bool' ]; @@ -105,8 +105,10 @@ class AuPayRunTotalDetailModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg_withholding_amount' => 'double', 'payg_withholding_percent' => 'double', 'sfss_amount' => 'double', @@ -151,14 +153,71 @@ class AuPayRunTotalDetailModel implements ModelInterface, ArrayAccess 'is_complete' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg_withholding_amount' => false, + 'payg_withholding_percent' => false, + 'sfss_amount' => false, + 'help_amount' => false, + 'super_contribution' => false, + 'employer_contribution' => false, + 'super_contribution_minus_super_adjustments' => false, + 'all_super_contributions_total' => false, + 'gross_plus_super' => false, + 'super_adjustments_amount' => false, + 'salary_sacrifice_super_amount' => false, + 'member_voluntary_super_amount' => false, + 'non_super_deduction_total' => false, + 'super_payments_total' => false, + 'is_employee_under18' => false, + 'employer_contribution_adjustments_amount' => false, + 'payg_adjustments_amount' => false, + 'super_contributions_cap_applied' => false, + 'payg_payment_total' => false, + 'id' => false, + 'employee_name' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'net_earnings' => false, + 'taxable_earnings' => false, + 'post_tax_deduction_amount' => false, + 'pre_tax_deduction_amount' => false, + 'pay_condition_rule_set_name' => false, + 'employee_id' => false, + 'is_termination' => false, + 'notation' => false, + 'employee_start_date' => false, + 'employee_external_reference_id' => false, + 'is_excluded' => false, + 'employee_external_id' => false, + 'bank_payments_total' => false, + 'termination_date' => false, + 'earliest_termination_date' => false, + 'previous_termination_date' => false, + 'employee_expenses_total' => false, + 'employer_liabilities_total' => false, + 'is_complete' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -166,9 +225,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -360,12 +471,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -382,48 +490,66 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payg_withholding_amount'] = isset($data['payg_withholding_amount']) ? $data['payg_withholding_amount'] : null; - $this->container['payg_withholding_percent'] = isset($data['payg_withholding_percent']) ? $data['payg_withholding_percent'] : null; - $this->container['sfss_amount'] = isset($data['sfss_amount']) ? $data['sfss_amount'] : null; - $this->container['help_amount'] = isset($data['help_amount']) ? $data['help_amount'] : null; - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['employer_contribution'] = isset($data['employer_contribution']) ? $data['employer_contribution'] : null; - $this->container['super_contribution_minus_super_adjustments'] = isset($data['super_contribution_minus_super_adjustments']) ? $data['super_contribution_minus_super_adjustments'] : null; - $this->container['all_super_contributions_total'] = isset($data['all_super_contributions_total']) ? $data['all_super_contributions_total'] : null; - $this->container['gross_plus_super'] = isset($data['gross_plus_super']) ? $data['gross_plus_super'] : null; - $this->container['super_adjustments_amount'] = isset($data['super_adjustments_amount']) ? $data['super_adjustments_amount'] : null; - $this->container['salary_sacrifice_super_amount'] = isset($data['salary_sacrifice_super_amount']) ? $data['salary_sacrifice_super_amount'] : null; - $this->container['member_voluntary_super_amount'] = isset($data['member_voluntary_super_amount']) ? $data['member_voluntary_super_amount'] : null; - $this->container['non_super_deduction_total'] = isset($data['non_super_deduction_total']) ? $data['non_super_deduction_total'] : null; - $this->container['super_payments_total'] = isset($data['super_payments_total']) ? $data['super_payments_total'] : null; - $this->container['is_employee_under18'] = isset($data['is_employee_under18']) ? $data['is_employee_under18'] : null; - $this->container['employer_contribution_adjustments_amount'] = isset($data['employer_contribution_adjustments_amount']) ? $data['employer_contribution_adjustments_amount'] : null; - $this->container['payg_adjustments_amount'] = isset($data['payg_adjustments_amount']) ? $data['payg_adjustments_amount'] : null; - $this->container['super_contributions_cap_applied'] = isset($data['super_contributions_cap_applied']) ? $data['super_contributions_cap_applied'] : null; - $this->container['payg_payment_total'] = isset($data['payg_payment_total']) ? $data['payg_payment_total'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['post_tax_deduction_amount'] = isset($data['post_tax_deduction_amount']) ? $data['post_tax_deduction_amount'] : null; - $this->container['pre_tax_deduction_amount'] = isset($data['pre_tax_deduction_amount']) ? $data['pre_tax_deduction_amount'] : null; - $this->container['pay_condition_rule_set_name'] = isset($data['pay_condition_rule_set_name']) ? $data['pay_condition_rule_set_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['is_termination'] = isset($data['is_termination']) ? $data['is_termination'] : null; - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; - $this->container['employee_start_date'] = isset($data['employee_start_date']) ? $data['employee_start_date'] : null; - $this->container['employee_external_reference_id'] = isset($data['employee_external_reference_id']) ? $data['employee_external_reference_id'] : null; - $this->container['is_excluded'] = isset($data['is_excluded']) ? $data['is_excluded'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['bank_payments_total'] = isset($data['bank_payments_total']) ? $data['bank_payments_total'] : null; - $this->container['termination_date'] = isset($data['termination_date']) ? $data['termination_date'] : null; - $this->container['earliest_termination_date'] = isset($data['earliest_termination_date']) ? $data['earliest_termination_date'] : null; - $this->container['previous_termination_date'] = isset($data['previous_termination_date']) ? $data['previous_termination_date'] : null; - $this->container['employee_expenses_total'] = isset($data['employee_expenses_total']) ? $data['employee_expenses_total'] : null; - $this->container['employer_liabilities_total'] = isset($data['employer_liabilities_total']) ? $data['employer_liabilities_total'] : null; - $this->container['is_complete'] = isset($data['is_complete']) ? $data['is_complete'] : null; + $this->setIfExists('payg_withholding_amount', $data ?? [], null); + $this->setIfExists('payg_withholding_percent', $data ?? [], null); + $this->setIfExists('sfss_amount', $data ?? [], null); + $this->setIfExists('help_amount', $data ?? [], null); + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('employer_contribution', $data ?? [], null); + $this->setIfExists('super_contribution_minus_super_adjustments', $data ?? [], null); + $this->setIfExists('all_super_contributions_total', $data ?? [], null); + $this->setIfExists('gross_plus_super', $data ?? [], null); + $this->setIfExists('super_adjustments_amount', $data ?? [], null); + $this->setIfExists('salary_sacrifice_super_amount', $data ?? [], null); + $this->setIfExists('member_voluntary_super_amount', $data ?? [], null); + $this->setIfExists('non_super_deduction_total', $data ?? [], null); + $this->setIfExists('super_payments_total', $data ?? [], null); + $this->setIfExists('is_employee_under18', $data ?? [], null); + $this->setIfExists('employer_contribution_adjustments_amount', $data ?? [], null); + $this->setIfExists('payg_adjustments_amount', $data ?? [], null); + $this->setIfExists('super_contributions_cap_applied', $data ?? [], null); + $this->setIfExists('payg_payment_total', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('post_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('pre_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('pay_condition_rule_set_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('is_termination', $data ?? [], null); + $this->setIfExists('notation', $data ?? [], null); + $this->setIfExists('employee_start_date', $data ?? [], null); + $this->setIfExists('employee_external_reference_id', $data ?? [], null); + $this->setIfExists('is_excluded', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('bank_payments_total', $data ?? [], null); + $this->setIfExists('termination_date', $data ?? [], null); + $this->setIfExists('earliest_termination_date', $data ?? [], null); + $this->setIfExists('previous_termination_date', $data ?? [], null); + $this->setIfExists('employee_expenses_total', $data ?? [], null); + $this->setIfExists('employer_liabilities_total', $data ?? [], null); + $this->setIfExists('is_complete', $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; } /** @@ -453,7 +579,7 @@ public function valid() /** * Gets payg_withholding_amount * - * @return double + * @return float|null */ public function getPaygWithholdingAmount() { @@ -463,12 +589,15 @@ public function getPaygWithholdingAmount() /** * Sets payg_withholding_amount * - * @param double $payg_withholding_amount + * @param float|null $payg_withholding_amount * - * @return $this + * @return self */ public function setPaygWithholdingAmount($payg_withholding_amount) { + if (is_null($payg_withholding_amount)) { + throw new \InvalidArgumentException('non-nullable payg_withholding_amount cannot be null'); + } $this->container['payg_withholding_amount'] = $payg_withholding_amount; return $this; @@ -477,7 +606,7 @@ public function setPaygWithholdingAmount($payg_withholding_amount) /** * Gets payg_withholding_percent * - * @return double + * @return float|null */ public function getPaygWithholdingPercent() { @@ -487,12 +616,15 @@ public function getPaygWithholdingPercent() /** * Sets payg_withholding_percent * - * @param double $payg_withholding_percent + * @param float|null $payg_withholding_percent * - * @return $this + * @return self */ public function setPaygWithholdingPercent($payg_withholding_percent) { + if (is_null($payg_withholding_percent)) { + throw new \InvalidArgumentException('non-nullable payg_withholding_percent cannot be null'); + } $this->container['payg_withholding_percent'] = $payg_withholding_percent; return $this; @@ -501,7 +633,7 @@ public function setPaygWithholdingPercent($payg_withholding_percent) /** * Gets sfss_amount * - * @return double + * @return float|null */ public function getSfssAmount() { @@ -511,12 +643,15 @@ public function getSfssAmount() /** * Sets sfss_amount * - * @param double $sfss_amount + * @param float|null $sfss_amount * - * @return $this + * @return self */ public function setSfssAmount($sfss_amount) { + if (is_null($sfss_amount)) { + throw new \InvalidArgumentException('non-nullable sfss_amount cannot be null'); + } $this->container['sfss_amount'] = $sfss_amount; return $this; @@ -525,7 +660,7 @@ public function setSfssAmount($sfss_amount) /** * Gets help_amount * - * @return double + * @return float|null */ public function getHelpAmount() { @@ -535,12 +670,15 @@ public function getHelpAmount() /** * Sets help_amount * - * @param double $help_amount + * @param float|null $help_amount * - * @return $this + * @return self */ public function setHelpAmount($help_amount) { + if (is_null($help_amount)) { + throw new \InvalidArgumentException('non-nullable help_amount cannot be null'); + } $this->container['help_amount'] = $help_amount; return $this; @@ -549,7 +687,7 @@ public function setHelpAmount($help_amount) /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -559,12 +697,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -573,7 +714,7 @@ public function setSuperContribution($super_contribution) /** * Gets employer_contribution * - * @return double + * @return float|null */ public function getEmployerContribution() { @@ -583,12 +724,15 @@ public function getEmployerContribution() /** * Sets employer_contribution * - * @param double $employer_contribution + * @param float|null $employer_contribution * - * @return $this + * @return self */ public function setEmployerContribution($employer_contribution) { + if (is_null($employer_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_contribution cannot be null'); + } $this->container['employer_contribution'] = $employer_contribution; return $this; @@ -597,7 +741,7 @@ public function setEmployerContribution($employer_contribution) /** * Gets super_contribution_minus_super_adjustments * - * @return double + * @return float|null */ public function getSuperContributionMinusSuperAdjustments() { @@ -607,12 +751,15 @@ public function getSuperContributionMinusSuperAdjustments() /** * Sets super_contribution_minus_super_adjustments * - * @param double $super_contribution_minus_super_adjustments + * @param float|null $super_contribution_minus_super_adjustments * - * @return $this + * @return self */ public function setSuperContributionMinusSuperAdjustments($super_contribution_minus_super_adjustments) { + if (is_null($super_contribution_minus_super_adjustments)) { + throw new \InvalidArgumentException('non-nullable super_contribution_minus_super_adjustments cannot be null'); + } $this->container['super_contribution_minus_super_adjustments'] = $super_contribution_minus_super_adjustments; return $this; @@ -621,7 +768,7 @@ public function setSuperContributionMinusSuperAdjustments($super_contribution_mi /** * Gets all_super_contributions_total * - * @return double + * @return float|null */ public function getAllSuperContributionsTotal() { @@ -631,12 +778,15 @@ public function getAllSuperContributionsTotal() /** * Sets all_super_contributions_total * - * @param double $all_super_contributions_total + * @param float|null $all_super_contributions_total * - * @return $this + * @return self */ public function setAllSuperContributionsTotal($all_super_contributions_total) { + if (is_null($all_super_contributions_total)) { + throw new \InvalidArgumentException('non-nullable all_super_contributions_total cannot be null'); + } $this->container['all_super_contributions_total'] = $all_super_contributions_total; return $this; @@ -645,7 +795,7 @@ public function setAllSuperContributionsTotal($all_super_contributions_total) /** * Gets gross_plus_super * - * @return double + * @return float|null */ public function getGrossPlusSuper() { @@ -655,12 +805,15 @@ public function getGrossPlusSuper() /** * Sets gross_plus_super * - * @param double $gross_plus_super + * @param float|null $gross_plus_super * - * @return $this + * @return self */ public function setGrossPlusSuper($gross_plus_super) { + if (is_null($gross_plus_super)) { + throw new \InvalidArgumentException('non-nullable gross_plus_super cannot be null'); + } $this->container['gross_plus_super'] = $gross_plus_super; return $this; @@ -669,7 +822,7 @@ public function setGrossPlusSuper($gross_plus_super) /** * Gets super_adjustments_amount * - * @return double + * @return float|null */ public function getSuperAdjustmentsAmount() { @@ -679,12 +832,15 @@ public function getSuperAdjustmentsAmount() /** * Sets super_adjustments_amount * - * @param double $super_adjustments_amount + * @param float|null $super_adjustments_amount * - * @return $this + * @return self */ public function setSuperAdjustmentsAmount($super_adjustments_amount) { + if (is_null($super_adjustments_amount)) { + throw new \InvalidArgumentException('non-nullable super_adjustments_amount cannot be null'); + } $this->container['super_adjustments_amount'] = $super_adjustments_amount; return $this; @@ -693,7 +849,7 @@ public function setSuperAdjustmentsAmount($super_adjustments_amount) /** * Gets salary_sacrifice_super_amount * - * @return double + * @return float|null */ public function getSalarySacrificeSuperAmount() { @@ -703,12 +859,15 @@ public function getSalarySacrificeSuperAmount() /** * Sets salary_sacrifice_super_amount * - * @param double $salary_sacrifice_super_amount + * @param float|null $salary_sacrifice_super_amount * - * @return $this + * @return self */ public function setSalarySacrificeSuperAmount($salary_sacrifice_super_amount) { + if (is_null($salary_sacrifice_super_amount)) { + throw new \InvalidArgumentException('non-nullable salary_sacrifice_super_amount cannot be null'); + } $this->container['salary_sacrifice_super_amount'] = $salary_sacrifice_super_amount; return $this; @@ -717,7 +876,7 @@ public function setSalarySacrificeSuperAmount($salary_sacrifice_super_amount) /** * Gets member_voluntary_super_amount * - * @return double + * @return float|null */ public function getMemberVoluntarySuperAmount() { @@ -727,12 +886,15 @@ public function getMemberVoluntarySuperAmount() /** * Sets member_voluntary_super_amount * - * @param double $member_voluntary_super_amount + * @param float|null $member_voluntary_super_amount * - * @return $this + * @return self */ public function setMemberVoluntarySuperAmount($member_voluntary_super_amount) { + if (is_null($member_voluntary_super_amount)) { + throw new \InvalidArgumentException('non-nullable member_voluntary_super_amount cannot be null'); + } $this->container['member_voluntary_super_amount'] = $member_voluntary_super_amount; return $this; @@ -741,7 +903,7 @@ public function setMemberVoluntarySuperAmount($member_voluntary_super_amount) /** * Gets non_super_deduction_total * - * @return double + * @return float|null */ public function getNonSuperDeductionTotal() { @@ -751,12 +913,15 @@ public function getNonSuperDeductionTotal() /** * Sets non_super_deduction_total * - * @param double $non_super_deduction_total + * @param float|null $non_super_deduction_total * - * @return $this + * @return self */ public function setNonSuperDeductionTotal($non_super_deduction_total) { + if (is_null($non_super_deduction_total)) { + throw new \InvalidArgumentException('non-nullable non_super_deduction_total cannot be null'); + } $this->container['non_super_deduction_total'] = $non_super_deduction_total; return $this; @@ -765,7 +930,7 @@ public function setNonSuperDeductionTotal($non_super_deduction_total) /** * Gets super_payments_total * - * @return double + * @return float|null */ public function getSuperPaymentsTotal() { @@ -775,12 +940,15 @@ public function getSuperPaymentsTotal() /** * Sets super_payments_total * - * @param double $super_payments_total + * @param float|null $super_payments_total * - * @return $this + * @return self */ public function setSuperPaymentsTotal($super_payments_total) { + if (is_null($super_payments_total)) { + throw new \InvalidArgumentException('non-nullable super_payments_total cannot be null'); + } $this->container['super_payments_total'] = $super_payments_total; return $this; @@ -789,7 +957,7 @@ public function setSuperPaymentsTotal($super_payments_total) /** * Gets is_employee_under18 * - * @return bool + * @return bool|null */ public function getIsEmployeeUnder18() { @@ -799,12 +967,15 @@ public function getIsEmployeeUnder18() /** * Sets is_employee_under18 * - * @param bool $is_employee_under18 + * @param bool|null $is_employee_under18 * - * @return $this + * @return self */ public function setIsEmployeeUnder18($is_employee_under18) { + if (is_null($is_employee_under18)) { + throw new \InvalidArgumentException('non-nullable is_employee_under18 cannot be null'); + } $this->container['is_employee_under18'] = $is_employee_under18; return $this; @@ -813,7 +984,7 @@ public function setIsEmployeeUnder18($is_employee_under18) /** * Gets employer_contribution_adjustments_amount * - * @return double + * @return float|null */ public function getEmployerContributionAdjustmentsAmount() { @@ -823,12 +994,15 @@ public function getEmployerContributionAdjustmentsAmount() /** * Sets employer_contribution_adjustments_amount * - * @param double $employer_contribution_adjustments_amount + * @param float|null $employer_contribution_adjustments_amount * - * @return $this + * @return self */ public function setEmployerContributionAdjustmentsAmount($employer_contribution_adjustments_amount) { + if (is_null($employer_contribution_adjustments_amount)) { + throw new \InvalidArgumentException('non-nullable employer_contribution_adjustments_amount cannot be null'); + } $this->container['employer_contribution_adjustments_amount'] = $employer_contribution_adjustments_amount; return $this; @@ -837,7 +1011,7 @@ public function setEmployerContributionAdjustmentsAmount($employer_contribution_ /** * Gets payg_adjustments_amount * - * @return double + * @return float|null */ public function getPaygAdjustmentsAmount() { @@ -847,12 +1021,15 @@ public function getPaygAdjustmentsAmount() /** * Sets payg_adjustments_amount * - * @param double $payg_adjustments_amount + * @param float|null $payg_adjustments_amount * - * @return $this + * @return self */ public function setPaygAdjustmentsAmount($payg_adjustments_amount) { + if (is_null($payg_adjustments_amount)) { + throw new \InvalidArgumentException('non-nullable payg_adjustments_amount cannot be null'); + } $this->container['payg_adjustments_amount'] = $payg_adjustments_amount; return $this; @@ -861,7 +1038,7 @@ public function setPaygAdjustmentsAmount($payg_adjustments_amount) /** * Gets super_contributions_cap_applied * - * @return bool + * @return bool|null */ public function getSuperContributionsCapApplied() { @@ -871,12 +1048,15 @@ public function getSuperContributionsCapApplied() /** * Sets super_contributions_cap_applied * - * @param bool $super_contributions_cap_applied + * @param bool|null $super_contributions_cap_applied * - * @return $this + * @return self */ public function setSuperContributionsCapApplied($super_contributions_cap_applied) { + if (is_null($super_contributions_cap_applied)) { + throw new \InvalidArgumentException('non-nullable super_contributions_cap_applied cannot be null'); + } $this->container['super_contributions_cap_applied'] = $super_contributions_cap_applied; return $this; @@ -885,7 +1065,7 @@ public function setSuperContributionsCapApplied($super_contributions_cap_applied /** * Gets payg_payment_total * - * @return double + * @return float|null */ public function getPaygPaymentTotal() { @@ -895,12 +1075,15 @@ public function getPaygPaymentTotal() /** * Sets payg_payment_total * - * @param double $payg_payment_total + * @param float|null $payg_payment_total * - * @return $this + * @return self */ public function setPaygPaymentTotal($payg_payment_total) { + if (is_null($payg_payment_total)) { + throw new \InvalidArgumentException('non-nullable payg_payment_total cannot be null'); + } $this->container['payg_payment_total'] = $payg_payment_total; return $this; @@ -909,7 +1092,7 @@ public function setPaygPaymentTotal($payg_payment_total) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -919,12 +1102,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -933,7 +1119,7 @@ public function setId($id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -943,12 +1129,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -957,7 +1146,7 @@ public function setEmployeeName($employee_name) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -967,12 +1156,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -981,7 +1173,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -991,12 +1183,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -1005,7 +1200,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -1015,12 +1210,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -1029,7 +1227,7 @@ public function setNetEarnings($net_earnings) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -1039,12 +1237,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -1053,7 +1254,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets post_tax_deduction_amount * - * @return double + * @return float|null */ public function getPostTaxDeductionAmount() { @@ -1063,12 +1264,15 @@ public function getPostTaxDeductionAmount() /** * Sets post_tax_deduction_amount * - * @param double $post_tax_deduction_amount + * @param float|null $post_tax_deduction_amount * - * @return $this + * @return self */ public function setPostTaxDeductionAmount($post_tax_deduction_amount) { + if (is_null($post_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable post_tax_deduction_amount cannot be null'); + } $this->container['post_tax_deduction_amount'] = $post_tax_deduction_amount; return $this; @@ -1077,7 +1281,7 @@ public function setPostTaxDeductionAmount($post_tax_deduction_amount) /** * Gets pre_tax_deduction_amount * - * @return double + * @return float|null */ public function getPreTaxDeductionAmount() { @@ -1087,12 +1291,15 @@ public function getPreTaxDeductionAmount() /** * Sets pre_tax_deduction_amount * - * @param double $pre_tax_deduction_amount + * @param float|null $pre_tax_deduction_amount * - * @return $this + * @return self */ public function setPreTaxDeductionAmount($pre_tax_deduction_amount) { + if (is_null($pre_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deduction_amount cannot be null'); + } $this->container['pre_tax_deduction_amount'] = $pre_tax_deduction_amount; return $this; @@ -1101,7 +1308,7 @@ public function setPreTaxDeductionAmount($pre_tax_deduction_amount) /** * Gets pay_condition_rule_set_name * - * @return string + * @return string|null */ public function getPayConditionRuleSetName() { @@ -1111,12 +1318,15 @@ public function getPayConditionRuleSetName() /** * Sets pay_condition_rule_set_name * - * @param string $pay_condition_rule_set_name + * @param string|null $pay_condition_rule_set_name * - * @return $this + * @return self */ public function setPayConditionRuleSetName($pay_condition_rule_set_name) { + if (is_null($pay_condition_rule_set_name)) { + throw new \InvalidArgumentException('non-nullable pay_condition_rule_set_name cannot be null'); + } $this->container['pay_condition_rule_set_name'] = $pay_condition_rule_set_name; return $this; @@ -1125,7 +1335,7 @@ public function setPayConditionRuleSetName($pay_condition_rule_set_name) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -1135,12 +1345,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -1149,7 +1362,7 @@ public function setEmployeeId($employee_id) /** * Gets is_termination * - * @return bool + * @return bool|null */ public function getIsTermination() { @@ -1159,12 +1372,15 @@ public function getIsTermination() /** * Sets is_termination * - * @param bool $is_termination + * @param bool|null $is_termination * - * @return $this + * @return self */ public function setIsTermination($is_termination) { + if (is_null($is_termination)) { + throw new \InvalidArgumentException('non-nullable is_termination cannot be null'); + } $this->container['is_termination'] = $is_termination; return $this; @@ -1173,7 +1389,7 @@ public function setIsTermination($is_termination) /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -1183,12 +1399,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -1197,7 +1416,7 @@ public function setNotation($notation) /** * Gets employee_start_date * - * @return \DateTime + * @return \DateTime|null */ public function getEmployeeStartDate() { @@ -1207,12 +1426,15 @@ public function getEmployeeStartDate() /** * Sets employee_start_date * - * @param \DateTime $employee_start_date + * @param \DateTime|null $employee_start_date * - * @return $this + * @return self */ public function setEmployeeStartDate($employee_start_date) { + if (is_null($employee_start_date)) { + throw new \InvalidArgumentException('non-nullable employee_start_date cannot be null'); + } $this->container['employee_start_date'] = $employee_start_date; return $this; @@ -1221,7 +1443,7 @@ public function setEmployeeStartDate($employee_start_date) /** * Gets employee_external_reference_id * - * @return string + * @return string|null */ public function getEmployeeExternalReferenceId() { @@ -1231,12 +1453,15 @@ public function getEmployeeExternalReferenceId() /** * Sets employee_external_reference_id * - * @param string $employee_external_reference_id + * @param string|null $employee_external_reference_id * - * @return $this + * @return self */ public function setEmployeeExternalReferenceId($employee_external_reference_id) { + if (is_null($employee_external_reference_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_reference_id cannot be null'); + } $this->container['employee_external_reference_id'] = $employee_external_reference_id; return $this; @@ -1245,7 +1470,7 @@ public function setEmployeeExternalReferenceId($employee_external_reference_id) /** * Gets is_excluded * - * @return bool + * @return bool|null */ public function getIsExcluded() { @@ -1255,12 +1480,15 @@ public function getIsExcluded() /** * Sets is_excluded * - * @param bool $is_excluded + * @param bool|null $is_excluded * - * @return $this + * @return self */ public function setIsExcluded($is_excluded) { + if (is_null($is_excluded)) { + throw new \InvalidArgumentException('non-nullable is_excluded cannot be null'); + } $this->container['is_excluded'] = $is_excluded; return $this; @@ -1269,7 +1497,7 @@ public function setIsExcluded($is_excluded) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -1279,12 +1507,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -1293,7 +1524,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets bank_payments_total * - * @return double + * @return float|null */ public function getBankPaymentsTotal() { @@ -1303,12 +1534,15 @@ public function getBankPaymentsTotal() /** * Sets bank_payments_total * - * @param double $bank_payments_total + * @param float|null $bank_payments_total * - * @return $this + * @return self */ public function setBankPaymentsTotal($bank_payments_total) { + if (is_null($bank_payments_total)) { + throw new \InvalidArgumentException('non-nullable bank_payments_total cannot be null'); + } $this->container['bank_payments_total'] = $bank_payments_total; return $this; @@ -1317,7 +1551,7 @@ public function setBankPaymentsTotal($bank_payments_total) /** * Gets termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getTerminationDate() { @@ -1327,12 +1561,15 @@ public function getTerminationDate() /** * Sets termination_date * - * @param \DateTime $termination_date + * @param \DateTime|null $termination_date * - * @return $this + * @return self */ public function setTerminationDate($termination_date) { + if (is_null($termination_date)) { + throw new \InvalidArgumentException('non-nullable termination_date cannot be null'); + } $this->container['termination_date'] = $termination_date; return $this; @@ -1341,7 +1578,7 @@ public function setTerminationDate($termination_date) /** * Gets earliest_termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getEarliestTerminationDate() { @@ -1351,12 +1588,15 @@ public function getEarliestTerminationDate() /** * Sets earliest_termination_date * - * @param \DateTime $earliest_termination_date + * @param \DateTime|null $earliest_termination_date * - * @return $this + * @return self */ public function setEarliestTerminationDate($earliest_termination_date) { + if (is_null($earliest_termination_date)) { + throw new \InvalidArgumentException('non-nullable earliest_termination_date cannot be null'); + } $this->container['earliest_termination_date'] = $earliest_termination_date; return $this; @@ -1365,7 +1605,7 @@ public function setEarliestTerminationDate($earliest_termination_date) /** * Gets previous_termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getPreviousTerminationDate() { @@ -1375,12 +1615,15 @@ public function getPreviousTerminationDate() /** * Sets previous_termination_date * - * @param \DateTime $previous_termination_date + * @param \DateTime|null $previous_termination_date * - * @return $this + * @return self */ public function setPreviousTerminationDate($previous_termination_date) { + if (is_null($previous_termination_date)) { + throw new \InvalidArgumentException('non-nullable previous_termination_date cannot be null'); + } $this->container['previous_termination_date'] = $previous_termination_date; return $this; @@ -1389,7 +1632,7 @@ public function setPreviousTerminationDate($previous_termination_date) /** * Gets employee_expenses_total * - * @return double + * @return float|null */ public function getEmployeeExpensesTotal() { @@ -1399,12 +1642,15 @@ public function getEmployeeExpensesTotal() /** * Sets employee_expenses_total * - * @param double $employee_expenses_total + * @param float|null $employee_expenses_total * - * @return $this + * @return self */ public function setEmployeeExpensesTotal($employee_expenses_total) { + if (is_null($employee_expenses_total)) { + throw new \InvalidArgumentException('non-nullable employee_expenses_total cannot be null'); + } $this->container['employee_expenses_total'] = $employee_expenses_total; return $this; @@ -1413,7 +1659,7 @@ public function setEmployeeExpensesTotal($employee_expenses_total) /** * Gets employer_liabilities_total * - * @return double + * @return float|null */ public function getEmployerLiabilitiesTotal() { @@ -1423,12 +1669,15 @@ public function getEmployerLiabilitiesTotal() /** * Sets employer_liabilities_total * - * @param double $employer_liabilities_total + * @param float|null $employer_liabilities_total * - * @return $this + * @return self */ public function setEmployerLiabilitiesTotal($employer_liabilities_total) { + if (is_null($employer_liabilities_total)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities_total cannot be null'); + } $this->container['employer_liabilities_total'] = $employer_liabilities_total; return $this; @@ -1437,7 +1686,7 @@ public function setEmployerLiabilitiesTotal($employer_liabilities_total) /** * Gets is_complete * - * @return bool + * @return bool|null */ public function getIsComplete() { @@ -1447,12 +1696,15 @@ public function getIsComplete() /** * Sets is_complete * - * @param bool $is_complete + * @param bool|null $is_complete * - * @return $this + * @return self */ public function setIsComplete($is_complete) { + if (is_null($is_complete)) { + throw new \InvalidArgumentException('non-nullable is_complete cannot be null'); + } $this->container['is_complete'] = $is_complete; return $this; @@ -1464,7 +1716,7 @@ public function setIsComplete($is_complete) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1474,22 +1726,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1505,11 +1758,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1517,13 +1783,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunTotalModel.php b/src/lib/Model/AuPayRunTotalModel.php index e29a37c..ce13ff0 100644 --- a/src/lib/Model/AuPayRunTotalModel.php +++ b/src/lib/Model/AuPayRunTotalModel.php @@ -2,75 +2,75 @@ /** * AuPayRunTotalModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunTotalModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunTotalModel implements ModelInterface, ArrayAccess +class AuPayRunTotalModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunTotalModel'; + protected static $openAPIModelName = 'AuPayRunTotalModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg_withheld' => 'double', - 'sfss_withheld' => 'double', - 'help_withheld' => 'double', - 'super_contribution' => 'double', - 'employer_contribution' => 'double', + protected static $openAPITypes = [ + 'payg_withheld' => 'float', + 'sfss_withheld' => 'float', + 'help_withheld' => 'float', + 'super_contribution' => 'float', + 'employer_contribution' => 'float', 'id' => 'int', - 'total_hours' => 'double', - 'gross_earnings' => 'double', - 'pre_tax_deductions' => 'double', - 'taxable_earnings' => 'double', - 'post_tax_deductions' => 'double', - 'net_earnings' => 'double', - 'total_employee_expenses' => 'double', - 'total_employer_liabilities' => 'double', + 'total_hours' => 'float', + 'gross_earnings' => 'float', + 'pre_tax_deductions' => 'float', + 'taxable_earnings' => 'float', + 'post_tax_deductions' => 'float', + 'net_earnings' => 'float', + 'total_employee_expenses' => 'float', + 'total_employer_liabilities' => 'float', 'is_published' => 'bool', 'pay_run_id' => 'int', 'notation' => 'string' @@ -80,8 +80,10 @@ class AuPayRunTotalModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg_withheld' => 'double', 'sfss_withheld' => 'double', 'help_withheld' => 'double', @@ -101,14 +103,46 @@ class AuPayRunTotalModel implements ModelInterface, ArrayAccess 'notation' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg_withheld' => false, + 'sfss_withheld' => false, + 'help_withheld' => false, + 'super_contribution' => false, + 'employer_contribution' => false, + 'id' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'pre_tax_deductions' => false, + 'taxable_earnings' => false, + 'post_tax_deductions' => false, + 'net_earnings' => false, + 'total_employee_expenses' => false, + 'total_employer_liabilities' => false, + 'is_published' => false, + 'pay_run_id' => false, + 'notation' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -235,12 +321,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -257,23 +340,41 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payg_withheld'] = isset($data['payg_withheld']) ? $data['payg_withheld'] : null; - $this->container['sfss_withheld'] = isset($data['sfss_withheld']) ? $data['sfss_withheld'] : null; - $this->container['help_withheld'] = isset($data['help_withheld']) ? $data['help_withheld'] : null; - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['employer_contribution'] = isset($data['employer_contribution']) ? $data['employer_contribution'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['pre_tax_deductions'] = isset($data['pre_tax_deductions']) ? $data['pre_tax_deductions'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['post_tax_deductions'] = isset($data['post_tax_deductions']) ? $data['post_tax_deductions'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['total_employee_expenses'] = isset($data['total_employee_expenses']) ? $data['total_employee_expenses'] : null; - $this->container['total_employer_liabilities'] = isset($data['total_employer_liabilities']) ? $data['total_employer_liabilities'] : null; - $this->container['is_published'] = isset($data['is_published']) ? $data['is_published'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; + $this->setIfExists('payg_withheld', $data ?? [], null); + $this->setIfExists('sfss_withheld', $data ?? [], null); + $this->setIfExists('help_withheld', $data ?? [], null); + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('employer_contribution', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('pre_tax_deductions', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('post_tax_deductions', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('total_employee_expenses', $data ?? [], null); + $this->setIfExists('total_employer_liabilities', $data ?? [], null); + $this->setIfExists('is_published', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('notation', $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; } /** @@ -303,7 +404,7 @@ public function valid() /** * Gets payg_withheld * - * @return double + * @return float|null */ public function getPaygWithheld() { @@ -313,12 +414,15 @@ public function getPaygWithheld() /** * Sets payg_withheld * - * @param double $payg_withheld + * @param float|null $payg_withheld * - * @return $this + * @return self */ public function setPaygWithheld($payg_withheld) { + if (is_null($payg_withheld)) { + throw new \InvalidArgumentException('non-nullable payg_withheld cannot be null'); + } $this->container['payg_withheld'] = $payg_withheld; return $this; @@ -327,7 +431,7 @@ public function setPaygWithheld($payg_withheld) /** * Gets sfss_withheld * - * @return double + * @return float|null */ public function getSfssWithheld() { @@ -337,12 +441,15 @@ public function getSfssWithheld() /** * Sets sfss_withheld * - * @param double $sfss_withheld + * @param float|null $sfss_withheld * - * @return $this + * @return self */ public function setSfssWithheld($sfss_withheld) { + if (is_null($sfss_withheld)) { + throw new \InvalidArgumentException('non-nullable sfss_withheld cannot be null'); + } $this->container['sfss_withheld'] = $sfss_withheld; return $this; @@ -351,7 +458,7 @@ public function setSfssWithheld($sfss_withheld) /** * Gets help_withheld * - * @return double + * @return float|null */ public function getHelpWithheld() { @@ -361,12 +468,15 @@ public function getHelpWithheld() /** * Sets help_withheld * - * @param double $help_withheld + * @param float|null $help_withheld * - * @return $this + * @return self */ public function setHelpWithheld($help_withheld) { + if (is_null($help_withheld)) { + throw new \InvalidArgumentException('non-nullable help_withheld cannot be null'); + } $this->container['help_withheld'] = $help_withheld; return $this; @@ -375,7 +485,7 @@ public function setHelpWithheld($help_withheld) /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -385,12 +495,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -399,7 +512,7 @@ public function setSuperContribution($super_contribution) /** * Gets employer_contribution * - * @return double + * @return float|null */ public function getEmployerContribution() { @@ -409,12 +522,15 @@ public function getEmployerContribution() /** * Sets employer_contribution * - * @param double $employer_contribution + * @param float|null $employer_contribution * - * @return $this + * @return self */ public function setEmployerContribution($employer_contribution) { + if (is_null($employer_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_contribution cannot be null'); + } $this->container['employer_contribution'] = $employer_contribution; return $this; @@ -423,7 +539,7 @@ public function setEmployerContribution($employer_contribution) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -433,12 +549,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -447,7 +566,7 @@ public function setId($id) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -457,12 +576,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -471,7 +593,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -481,12 +603,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -495,7 +620,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets pre_tax_deductions * - * @return double + * @return float|null */ public function getPreTaxDeductions() { @@ -505,12 +630,15 @@ public function getPreTaxDeductions() /** * Sets pre_tax_deductions * - * @param double $pre_tax_deductions + * @param float|null $pre_tax_deductions * - * @return $this + * @return self */ public function setPreTaxDeductions($pre_tax_deductions) { + if (is_null($pre_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deductions cannot be null'); + } $this->container['pre_tax_deductions'] = $pre_tax_deductions; return $this; @@ -519,7 +647,7 @@ public function setPreTaxDeductions($pre_tax_deductions) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -529,12 +657,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -543,7 +674,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets post_tax_deductions * - * @return double + * @return float|null */ public function getPostTaxDeductions() { @@ -553,12 +684,15 @@ public function getPostTaxDeductions() /** * Sets post_tax_deductions * - * @param double $post_tax_deductions + * @param float|null $post_tax_deductions * - * @return $this + * @return self */ public function setPostTaxDeductions($post_tax_deductions) { + if (is_null($post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable post_tax_deductions cannot be null'); + } $this->container['post_tax_deductions'] = $post_tax_deductions; return $this; @@ -567,7 +701,7 @@ public function setPostTaxDeductions($post_tax_deductions) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -577,12 +711,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -591,7 +728,7 @@ public function setNetEarnings($net_earnings) /** * Gets total_employee_expenses * - * @return double + * @return float|null */ public function getTotalEmployeeExpenses() { @@ -601,12 +738,15 @@ public function getTotalEmployeeExpenses() /** * Sets total_employee_expenses * - * @param double $total_employee_expenses + * @param float|null $total_employee_expenses * - * @return $this + * @return self */ public function setTotalEmployeeExpenses($total_employee_expenses) { + if (is_null($total_employee_expenses)) { + throw new \InvalidArgumentException('non-nullable total_employee_expenses cannot be null'); + } $this->container['total_employee_expenses'] = $total_employee_expenses; return $this; @@ -615,7 +755,7 @@ public function setTotalEmployeeExpenses($total_employee_expenses) /** * Gets total_employer_liabilities * - * @return double + * @return float|null */ public function getTotalEmployerLiabilities() { @@ -625,12 +765,15 @@ public function getTotalEmployerLiabilities() /** * Sets total_employer_liabilities * - * @param double $total_employer_liabilities + * @param float|null $total_employer_liabilities * - * @return $this + * @return self */ public function setTotalEmployerLiabilities($total_employer_liabilities) { + if (is_null($total_employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable total_employer_liabilities cannot be null'); + } $this->container['total_employer_liabilities'] = $total_employer_liabilities; return $this; @@ -639,7 +782,7 @@ public function setTotalEmployerLiabilities($total_employer_liabilities) /** * Gets is_published * - * @return bool + * @return bool|null */ public function getIsPublished() { @@ -649,12 +792,15 @@ public function getIsPublished() /** * Sets is_published * - * @param bool $is_published + * @param bool|null $is_published * - * @return $this + * @return self */ public function setIsPublished($is_published) { + if (is_null($is_published)) { + throw new \InvalidArgumentException('non-nullable is_published cannot be null'); + } $this->container['is_published'] = $is_published; return $this; @@ -663,7 +809,7 @@ public function setIsPublished($is_published) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -673,12 +819,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -687,7 +836,7 @@ public function setPayRunId($pay_run_id) /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -697,12 +846,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -714,7 +866,7 @@ public function setNotation($notation) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -724,22 +876,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -755,11 +908,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -767,13 +933,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayRunTotalResponse.php b/src/lib/Model/AuPayRunTotalResponse.php index c73fad7..2c9c0b4 100644 --- a/src/lib/Model/AuPayRunTotalResponse.php +++ b/src/lib/Model/AuPayRunTotalResponse.php @@ -2,83 +2,102 @@ /** * AuPayRunTotalResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayRunTotalResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayRunTotalResponse implements ModelInterface, ArrayAccess +class AuPayRunTotalResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayRunTotalResponse'; + protected static $openAPIModelName = 'AuPayRunTotalResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_id' => 'int', - 'pay_run_totals' => 'map[string,\Swagger\Client\Model\AuPayRunTotalModel]' + 'pay_run_totals' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_id' => 'int32', 'pay_run_totals' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_id' => false, + 'pay_run_totals' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['pay_run_totals'] = isset($data['pay_run_totals']) ? $data['pay_run_totals'] : null; + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('pay_run_totals', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -223,12 +309,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -237,7 +326,7 @@ public function setPayRunId($pay_run_id) /** * Gets pay_run_totals * - * @return map[string,\Swagger\Client\Model\AuPayRunTotalModel] + * @return array|null */ public function getPayRunTotals() { @@ -247,12 +336,15 @@ public function getPayRunTotals() /** * Sets pay_run_totals * - * @param map[string,\Swagger\Client\Model\AuPayRunTotalModel] $pay_run_totals + * @param array|null $pay_run_totals * - * @return $this + * @return self */ public function setPayRunTotals($pay_run_totals) { + if (is_null($pay_run_totals)) { + throw new \InvalidArgumentException('non-nullable pay_run_totals cannot be null'); + } $this->container['pay_run_totals'] = $pay_run_totals; return $this; @@ -264,7 +356,7 @@ public function setPayRunTotals($pay_run_totals) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPayScheduleModel.php b/src/lib/Model/AuPayScheduleModel.php index 47669f9..90370b2 100644 --- a/src/lib/Model/AuPayScheduleModel.php +++ b/src/lib/Model/AuPayScheduleModel.php @@ -2,67 +2,67 @@ /** * AuPayScheduleModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPayScheduleModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPayScheduleModel implements ModelInterface, ArrayAccess +class AuPayScheduleModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPayScheduleModel'; + protected static $openAPIModelName = 'AuPayScheduleModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'aba_details_id' => 'int', 'payg_account_bsb' => 'string', 'payg_account_number' => 'string', 'payg_account_name' => 'string', 'payg_reference' => 'string', - 'auto_pay_configuration' => '\Swagger\Client\Model\AuAutoPayConfigurationModel', + 'auto_pay_configuration' => '\OpenAPI\Client\Model\AuAutoPayConfigurationModel', 'frequency' => 'string', 'id' => 'int', 'name' => 'string', @@ -74,16 +74,18 @@ class AuPayScheduleModel implements ModelInterface, ArrayAccess 'locations' => 'int[]', 'equal_monthly_payments' => 'bool', 'ignored_pay_run_warnings' => 'int[]', - 'default_finalise_settings' => '\Swagger\Client\Model\PayRunFinaliseDefaultSettingsModel', - 'pay_schedule_approval_settings' => '\Swagger\Client\Model\PayScheduleApprovalSettingsModel' + 'default_finalise_settings' => '\OpenAPI\Client\Model\PayRunFinaliseDefaultSettingsModel', + 'pay_schedule_approval_settings' => '\OpenAPI\Client\Model\PayScheduleApprovalSettingsModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'aba_details_id' => 'int32', 'payg_account_bsb' => null, 'payg_account_number' => null, @@ -105,14 +107,48 @@ class AuPayScheduleModel implements ModelInterface, ArrayAccess 'pay_schedule_approval_settings' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'aba_details_id' => false, + 'payg_account_bsb' => false, + 'payg_account_number' => false, + 'payg_account_name' => false, + 'payg_reference' => false, + 'auto_pay_configuration' => false, + 'frequency' => false, + 'id' => false, + 'name' => false, + 'employee_selection_strategy' => false, + 'last_date_paid' => false, + 'last_pay_run' => false, + 'external_id' => false, + 'source' => false, + 'locations' => false, + 'equal_monthly_payments' => false, + 'ignored_pay_run_warnings' => false, + 'default_finalise_settings' => false, + 'pay_schedule_approval_settings' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -120,9 +156,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -245,21 +333,19 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const FREQUENCY_WEEKLY = 'Weekly'; - const FREQUENCY_FORTNIGHTLY = 'Fortnightly'; - const FREQUENCY_MONTHLY = 'Monthly'; - const EMPLOYEE_SELECTION_STRATEGY_NONE = 'None'; - const EMPLOYEE_SELECTION_STRATEGY_PAY_RUN_DEFAULT = 'PayRunDefault'; - const EMPLOYEE_SELECTION_STRATEGY_TIMESHEET_LOCATIONS = 'TimesheetLocations'; - const EMPLOYEE_SELECTION_STRATEGY_PAY_RUN_DEFAULT_WITH_TIMESHEETS = 'PayRunDefaultWithTimesheets'; - const EMPLOYEE_SELECTION_STRATEGY_ACTIVE_SUBCONTRACTORS = 'ActiveSubcontractors'; - const EMPLOYEE_SELECTION_STRATEGY_EMPLOYING_ENTITY = 'EmployingEntity'; - + public const FREQUENCY_WEEKLY = 'Weekly'; + public const FREQUENCY_FORTNIGHTLY = 'Fortnightly'; + public const FREQUENCY_MONTHLY = 'Monthly'; + public const EMPLOYEE_SELECTION_STRATEGY_NONE = 'None'; + public const EMPLOYEE_SELECTION_STRATEGY_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const EMPLOYEE_SELECTION_STRATEGY_TIMESHEET_LOCATIONS = 'TimesheetLocations'; + public const EMPLOYEE_SELECTION_STRATEGY_PAY_RUN_DEFAULT_WITH_TIMESHEETS = 'PayRunDefaultWithTimesheets'; + public const EMPLOYEE_SELECTION_STRATEGY_ACTIVE_SUBCONTRACTORS = 'ActiveSubcontractors'; + public const EMPLOYEE_SELECTION_STRATEGY_EMPLOYING_ENTITY = 'EmployingEntity'; - /** * Gets allowable values of the enum * @@ -273,7 +359,7 @@ public function getFrequencyAllowableValues() self::FREQUENCY_MONTHLY, ]; } - + /** * Gets allowable values of the enum * @@ -290,7 +376,6 @@ public function getEmployeeSelectionStrategyAllowableValues() self::EMPLOYEE_SELECTION_STRATEGY_EMPLOYING_ENTITY, ]; } - /** * Associative array for storing property values @@ -307,25 +392,43 @@ public function getEmployeeSelectionStrategyAllowableValues() */ public function __construct(array $data = null) { - $this->container['aba_details_id'] = isset($data['aba_details_id']) ? $data['aba_details_id'] : null; - $this->container['payg_account_bsb'] = isset($data['payg_account_bsb']) ? $data['payg_account_bsb'] : null; - $this->container['payg_account_number'] = isset($data['payg_account_number']) ? $data['payg_account_number'] : null; - $this->container['payg_account_name'] = isset($data['payg_account_name']) ? $data['payg_account_name'] : null; - $this->container['payg_reference'] = isset($data['payg_reference']) ? $data['payg_reference'] : null; - $this->container['auto_pay_configuration'] = isset($data['auto_pay_configuration']) ? $data['auto_pay_configuration'] : null; - $this->container['frequency'] = isset($data['frequency']) ? $data['frequency'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['employee_selection_strategy'] = isset($data['employee_selection_strategy']) ? $data['employee_selection_strategy'] : null; - $this->container['last_date_paid'] = isset($data['last_date_paid']) ? $data['last_date_paid'] : null; - $this->container['last_pay_run'] = isset($data['last_pay_run']) ? $data['last_pay_run'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; - $this->container['equal_monthly_payments'] = isset($data['equal_monthly_payments']) ? $data['equal_monthly_payments'] : null; - $this->container['ignored_pay_run_warnings'] = isset($data['ignored_pay_run_warnings']) ? $data['ignored_pay_run_warnings'] : null; - $this->container['default_finalise_settings'] = isset($data['default_finalise_settings']) ? $data['default_finalise_settings'] : null; - $this->container['pay_schedule_approval_settings'] = isset($data['pay_schedule_approval_settings']) ? $data['pay_schedule_approval_settings'] : null; + $this->setIfExists('aba_details_id', $data ?? [], null); + $this->setIfExists('payg_account_bsb', $data ?? [], null); + $this->setIfExists('payg_account_number', $data ?? [], null); + $this->setIfExists('payg_account_name', $data ?? [], null); + $this->setIfExists('payg_reference', $data ?? [], null); + $this->setIfExists('auto_pay_configuration', $data ?? [], null); + $this->setIfExists('frequency', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('employee_selection_strategy', $data ?? [], null); + $this->setIfExists('last_date_paid', $data ?? [], null); + $this->setIfExists('last_pay_run', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('locations', $data ?? [], null); + $this->setIfExists('equal_monthly_payments', $data ?? [], null); + $this->setIfExists('ignored_pay_run_warnings', $data ?? [], null); + $this->setIfExists('default_finalise_settings', $data ?? [], null); + $this->setIfExists('pay_schedule_approval_settings', $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; } /** @@ -340,7 +443,8 @@ public function listInvalidProperties() $allowedValues = $this->getFrequencyAllowableValues(); if (!is_null($this->container['frequency']) && !in_array($this->container['frequency'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'frequency', must be one of '%s'", + "invalid value '%s' for 'frequency', must be one of '%s'", + $this->container['frequency'], implode("', '", $allowedValues) ); } @@ -348,7 +452,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeSelectionStrategyAllowableValues(); if (!is_null($this->container['employee_selection_strategy']) && !in_array($this->container['employee_selection_strategy'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_selection_strategy', must be one of '%s'", + "invalid value '%s' for 'employee_selection_strategy', must be one of '%s'", + $this->container['employee_selection_strategy'], implode("', '", $allowedValues) ); } @@ -371,7 +476,7 @@ public function valid() /** * Gets aba_details_id * - * @return int + * @return int|null */ public function getAbaDetailsId() { @@ -381,12 +486,15 @@ public function getAbaDetailsId() /** * Sets aba_details_id * - * @param int $aba_details_id + * @param int|null $aba_details_id * - * @return $this + * @return self */ public function setAbaDetailsId($aba_details_id) { + if (is_null($aba_details_id)) { + throw new \InvalidArgumentException('non-nullable aba_details_id cannot be null'); + } $this->container['aba_details_id'] = $aba_details_id; return $this; @@ -395,7 +503,7 @@ public function setAbaDetailsId($aba_details_id) /** * Gets payg_account_bsb * - * @return string + * @return string|null */ public function getPaygAccountBsb() { @@ -405,12 +513,15 @@ public function getPaygAccountBsb() /** * Sets payg_account_bsb * - * @param string $payg_account_bsb + * @param string|null $payg_account_bsb * - * @return $this + * @return self */ public function setPaygAccountBsb($payg_account_bsb) { + if (is_null($payg_account_bsb)) { + throw new \InvalidArgumentException('non-nullable payg_account_bsb cannot be null'); + } $this->container['payg_account_bsb'] = $payg_account_bsb; return $this; @@ -419,7 +530,7 @@ public function setPaygAccountBsb($payg_account_bsb) /** * Gets payg_account_number * - * @return string + * @return string|null */ public function getPaygAccountNumber() { @@ -429,12 +540,15 @@ public function getPaygAccountNumber() /** * Sets payg_account_number * - * @param string $payg_account_number + * @param string|null $payg_account_number * - * @return $this + * @return self */ public function setPaygAccountNumber($payg_account_number) { + if (is_null($payg_account_number)) { + throw new \InvalidArgumentException('non-nullable payg_account_number cannot be null'); + } $this->container['payg_account_number'] = $payg_account_number; return $this; @@ -443,7 +557,7 @@ public function setPaygAccountNumber($payg_account_number) /** * Gets payg_account_name * - * @return string + * @return string|null */ public function getPaygAccountName() { @@ -453,12 +567,15 @@ public function getPaygAccountName() /** * Sets payg_account_name * - * @param string $payg_account_name + * @param string|null $payg_account_name * - * @return $this + * @return self */ public function setPaygAccountName($payg_account_name) { + if (is_null($payg_account_name)) { + throw new \InvalidArgumentException('non-nullable payg_account_name cannot be null'); + } $this->container['payg_account_name'] = $payg_account_name; return $this; @@ -467,7 +584,7 @@ public function setPaygAccountName($payg_account_name) /** * Gets payg_reference * - * @return string + * @return string|null */ public function getPaygReference() { @@ -477,12 +594,15 @@ public function getPaygReference() /** * Sets payg_reference * - * @param string $payg_reference + * @param string|null $payg_reference * - * @return $this + * @return self */ public function setPaygReference($payg_reference) { + if (is_null($payg_reference)) { + throw new \InvalidArgumentException('non-nullable payg_reference cannot be null'); + } $this->container['payg_reference'] = $payg_reference; return $this; @@ -491,7 +611,7 @@ public function setPaygReference($payg_reference) /** * Gets auto_pay_configuration * - * @return \Swagger\Client\Model\AuAutoPayConfigurationModel + * @return \OpenAPI\Client\Model\AuAutoPayConfigurationModel|null */ public function getAutoPayConfiguration() { @@ -501,12 +621,15 @@ public function getAutoPayConfiguration() /** * Sets auto_pay_configuration * - * @param \Swagger\Client\Model\AuAutoPayConfigurationModel $auto_pay_configuration + * @param \OpenAPI\Client\Model\AuAutoPayConfigurationModel|null $auto_pay_configuration auto_pay_configuration * - * @return $this + * @return self */ public function setAutoPayConfiguration($auto_pay_configuration) { + if (is_null($auto_pay_configuration)) { + throw new \InvalidArgumentException('non-nullable auto_pay_configuration cannot be null'); + } $this->container['auto_pay_configuration'] = $auto_pay_configuration; return $this; @@ -515,7 +638,7 @@ public function setAutoPayConfiguration($auto_pay_configuration) /** * Gets frequency * - * @return string + * @return string|null */ public function getFrequency() { @@ -525,17 +648,21 @@ public function getFrequency() /** * Sets frequency * - * @param string $frequency + * @param string|null $frequency * - * @return $this + * @return self */ public function setFrequency($frequency) { + if (is_null($frequency)) { + throw new \InvalidArgumentException('non-nullable frequency cannot be null'); + } $allowedValues = $this->getFrequencyAllowableValues(); - if (!is_null($frequency) && !in_array($frequency, $allowedValues, true)) { + if (!in_array($frequency, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'frequency', must be one of '%s'", + "Invalid value '%s' for 'frequency', must be one of '%s'", + $frequency, implode("', '", $allowedValues) ) ); @@ -548,7 +675,7 @@ public function setFrequency($frequency) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -558,12 +685,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -572,7 +702,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -582,12 +712,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -596,7 +729,7 @@ public function setName($name) /** * Gets employee_selection_strategy * - * @return string + * @return string|null */ public function getEmployeeSelectionStrategy() { @@ -606,17 +739,21 @@ public function getEmployeeSelectionStrategy() /** * Sets employee_selection_strategy * - * @param string $employee_selection_strategy + * @param string|null $employee_selection_strategy * - * @return $this + * @return self */ public function setEmployeeSelectionStrategy($employee_selection_strategy) { + if (is_null($employee_selection_strategy)) { + throw new \InvalidArgumentException('non-nullable employee_selection_strategy cannot be null'); + } $allowedValues = $this->getEmployeeSelectionStrategyAllowableValues(); - if (!is_null($employee_selection_strategy) && !in_array($employee_selection_strategy, $allowedValues, true)) { + if (!in_array($employee_selection_strategy, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_selection_strategy', must be one of '%s'", + "Invalid value '%s' for 'employee_selection_strategy', must be one of '%s'", + $employee_selection_strategy, implode("', '", $allowedValues) ) ); @@ -629,7 +766,7 @@ public function setEmployeeSelectionStrategy($employee_selection_strategy) /** * Gets last_date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getLastDatePaid() { @@ -639,12 +776,15 @@ public function getLastDatePaid() /** * Sets last_date_paid * - * @param \DateTime $last_date_paid + * @param \DateTime|null $last_date_paid * - * @return $this + * @return self */ public function setLastDatePaid($last_date_paid) { + if (is_null($last_date_paid)) { + throw new \InvalidArgumentException('non-nullable last_date_paid cannot be null'); + } $this->container['last_date_paid'] = $last_date_paid; return $this; @@ -653,7 +793,7 @@ public function setLastDatePaid($last_date_paid) /** * Gets last_pay_run * - * @return \DateTime + * @return \DateTime|null */ public function getLastPayRun() { @@ -663,12 +803,15 @@ public function getLastPayRun() /** * Sets last_pay_run * - * @param \DateTime $last_pay_run + * @param \DateTime|null $last_pay_run * - * @return $this + * @return self */ public function setLastPayRun($last_pay_run) { + if (is_null($last_pay_run)) { + throw new \InvalidArgumentException('non-nullable last_pay_run cannot be null'); + } $this->container['last_pay_run'] = $last_pay_run; return $this; @@ -677,7 +820,7 @@ public function setLastPayRun($last_pay_run) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -687,12 +830,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -701,7 +847,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -711,12 +857,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -725,7 +874,7 @@ public function setSource($source) /** * Gets locations * - * @return int[] + * @return int[]|null */ public function getLocations() { @@ -735,12 +884,15 @@ public function getLocations() /** * Sets locations * - * @param int[] $locations + * @param int[]|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -749,7 +901,7 @@ public function setLocations($locations) /** * Gets equal_monthly_payments * - * @return bool + * @return bool|null */ public function getEqualMonthlyPayments() { @@ -759,12 +911,15 @@ public function getEqualMonthlyPayments() /** * Sets equal_monthly_payments * - * @param bool $equal_monthly_payments + * @param bool|null $equal_monthly_payments * - * @return $this + * @return self */ public function setEqualMonthlyPayments($equal_monthly_payments) { + if (is_null($equal_monthly_payments)) { + throw new \InvalidArgumentException('non-nullable equal_monthly_payments cannot be null'); + } $this->container['equal_monthly_payments'] = $equal_monthly_payments; return $this; @@ -773,7 +928,7 @@ public function setEqualMonthlyPayments($equal_monthly_payments) /** * Gets ignored_pay_run_warnings * - * @return int[] + * @return int[]|null */ public function getIgnoredPayRunWarnings() { @@ -783,12 +938,15 @@ public function getIgnoredPayRunWarnings() /** * Sets ignored_pay_run_warnings * - * @param int[] $ignored_pay_run_warnings + * @param int[]|null $ignored_pay_run_warnings * - * @return $this + * @return self */ public function setIgnoredPayRunWarnings($ignored_pay_run_warnings) { + if (is_null($ignored_pay_run_warnings)) { + throw new \InvalidArgumentException('non-nullable ignored_pay_run_warnings cannot be null'); + } $this->container['ignored_pay_run_warnings'] = $ignored_pay_run_warnings; return $this; @@ -797,7 +955,7 @@ public function setIgnoredPayRunWarnings($ignored_pay_run_warnings) /** * Gets default_finalise_settings * - * @return \Swagger\Client\Model\PayRunFinaliseDefaultSettingsModel + * @return \OpenAPI\Client\Model\PayRunFinaliseDefaultSettingsModel|null */ public function getDefaultFinaliseSettings() { @@ -807,12 +965,15 @@ public function getDefaultFinaliseSettings() /** * Sets default_finalise_settings * - * @param \Swagger\Client\Model\PayRunFinaliseDefaultSettingsModel $default_finalise_settings + * @param \OpenAPI\Client\Model\PayRunFinaliseDefaultSettingsModel|null $default_finalise_settings default_finalise_settings * - * @return $this + * @return self */ public function setDefaultFinaliseSettings($default_finalise_settings) { + if (is_null($default_finalise_settings)) { + throw new \InvalidArgumentException('non-nullable default_finalise_settings cannot be null'); + } $this->container['default_finalise_settings'] = $default_finalise_settings; return $this; @@ -821,7 +982,7 @@ public function setDefaultFinaliseSettings($default_finalise_settings) /** * Gets pay_schedule_approval_settings * - * @return \Swagger\Client\Model\PayScheduleApprovalSettingsModel + * @return \OpenAPI\Client\Model\PayScheduleApprovalSettingsModel|null */ public function getPayScheduleApprovalSettings() { @@ -831,12 +992,15 @@ public function getPayScheduleApprovalSettings() /** * Sets pay_schedule_approval_settings * - * @param \Swagger\Client\Model\PayScheduleApprovalSettingsModel $pay_schedule_approval_settings + * @param \OpenAPI\Client\Model\PayScheduleApprovalSettingsModel|null $pay_schedule_approval_settings pay_schedule_approval_settings * - * @return $this + * @return self */ public function setPayScheduleApprovalSettings($pay_schedule_approval_settings) { + if (is_null($pay_schedule_approval_settings)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_approval_settings cannot be null'); + } $this->container['pay_schedule_approval_settings'] = $pay_schedule_approval_settings; return $this; @@ -848,7 +1012,7 @@ public function setPayScheduleApprovalSettings($pay_schedule_approval_settings) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -858,22 +1022,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -889,11 +1054,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -901,13 +1079,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuPaymentHistoryModel.php b/src/lib/Model/AuPaymentHistoryModel.php index 8747657..e1531fd 100644 --- a/src/lib/Model/AuPaymentHistoryModel.php +++ b/src/lib/Model/AuPaymentHistoryModel.php @@ -2,61 +2,61 @@ /** * AuPaymentHistoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuPaymentHistoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuPaymentHistoryModel implements ModelInterface, ArrayAccess +class AuPaymentHistoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuPaymentHistoryModel'; + protected static $openAPIModelName = 'AuPaymentHistoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'bsb' => 'string', 'employee_id' => 'int', 'first_name' => 'string', @@ -67,19 +67,21 @@ class AuPaymentHistoryModel implements ModelInterface, ArrayAccess 'account_name' => 'string', 'account_number' => 'string', 'account_type' => 'string', - 'taxable_earnings' => 'double', - 'net_earnings' => 'double', - 'total_allowances' => 'double', - 'total_deductions' => 'double', - 'amount' => 'double' + 'taxable_earnings' => 'float', + 'net_earnings' => 'float', + 'total_allowances' => 'float', + 'total_deductions' => 'float', + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'bsb' => null, 'employee_id' => 'int32', 'first_name' => null, @@ -97,14 +99,44 @@ class AuPaymentHistoryModel implements ModelInterface, ArrayAccess 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bsb' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'date_paid' => false, + 'location_name' => false, + 'account_name' => false, + 'account_number' => false, + 'account_type' => false, + 'taxable_earnings' => false, + 'net_earnings' => false, + 'total_allowances' => false, + 'total_deductions' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -225,12 +309,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -247,21 +328,39 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['total_allowances'] = isset($data['total_allowances']) ? $data['total_allowances'] : null; - $this->container['total_deductions'] = isset($data['total_deductions']) ? $data['total_deductions'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('total_allowances', $data ?? [], null); + $this->setIfExists('total_deductions', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -291,7 +390,7 @@ public function valid() /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -301,12 +400,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -315,7 +417,7 @@ public function setBsb($bsb) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -325,12 +427,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -339,7 +444,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -349,12 +454,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -363,7 +471,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -373,12 +481,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -387,7 +498,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -397,12 +508,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -411,7 +525,7 @@ public function setExternalId($external_id) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -421,12 +535,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -435,7 +552,7 @@ public function setDatePaid($date_paid) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -445,12 +562,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -459,7 +579,7 @@ public function setLocationName($location_name) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -469,12 +589,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -483,7 +606,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -493,12 +616,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -507,7 +633,7 @@ public function setAccountNumber($account_number) /** * Gets account_type * - * @return string + * @return string|null */ public function getAccountType() { @@ -517,12 +643,15 @@ public function getAccountType() /** * Sets account_type * - * @param string $account_type + * @param string|null $account_type * - * @return $this + * @return self */ public function setAccountType($account_type) { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } $this->container['account_type'] = $account_type; return $this; @@ -531,7 +660,7 @@ public function setAccountType($account_type) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -541,12 +670,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -555,7 +687,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -565,12 +697,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -579,7 +714,7 @@ public function setNetEarnings($net_earnings) /** * Gets total_allowances * - * @return double + * @return float|null */ public function getTotalAllowances() { @@ -589,12 +724,15 @@ public function getTotalAllowances() /** * Sets total_allowances * - * @param double $total_allowances + * @param float|null $total_allowances * - * @return $this + * @return self */ public function setTotalAllowances($total_allowances) { + if (is_null($total_allowances)) { + throw new \InvalidArgumentException('non-nullable total_allowances cannot be null'); + } $this->container['total_allowances'] = $total_allowances; return $this; @@ -603,7 +741,7 @@ public function setTotalAllowances($total_allowances) /** * Gets total_deductions * - * @return double + * @return float|null */ public function getTotalDeductions() { @@ -613,12 +751,15 @@ public function getTotalDeductions() /** * Sets total_deductions * - * @param double $total_deductions + * @param float|null $total_deductions * - * @return $this + * @return self */ public function setTotalDeductions($total_deductions) { + if (is_null($total_deductions)) { + throw new \InvalidArgumentException('non-nullable total_deductions cannot be null'); + } $this->container['total_deductions'] = $total_deductions; return $this; @@ -627,7 +768,7 @@ public function setTotalDeductions($total_deductions) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -637,12 +778,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -654,7 +798,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -664,22 +808,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,11 +840,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -707,13 +865,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuRosterShiftEditModel.php b/src/lib/Model/AuRosterShiftEditModel.php index 4e9af4a..4743531 100644 --- a/src/lib/Model/AuRosterShiftEditModel.php +++ b/src/lib/Model/AuRosterShiftEditModel.php @@ -2,73 +2,73 @@ /** * AuRosterShiftEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuRosterShiftEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuRosterShiftEditModel implements ModelInterface, ArrayAccess +class AuRosterShiftEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuRosterShiftEditModel'; + protected static $openAPIModelName = 'AuRosterShiftEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'int', 'classification_name' => 'string', 'id' => 'int', - 'qualifications' => '\Swagger\Client\Model\QualificationModel[]', - 'breaks' => '\Swagger\Client\Model\RosterShiftBreakApiModel[]', + 'qualifications' => '\OpenAPI\Client\Model\QualificationModel[]', + 'breaks' => '\OpenAPI\Client\Model\RosterShiftBreakApiModel[]', 'employee_id' => 'int', 'employee_name' => 'string', 'location_id' => 'int', 'location_name' => 'string', 'work_type_id' => 'int', 'work_type_name' => 'string', - 'role' => '\Swagger\Client\Model\RosterShiftRole', + 'role' => '\OpenAPI\Client\Model\RosterShiftRole', 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'notes' => 'string' @@ -78,8 +78,10 @@ class AuRosterShiftEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => 'int32', 'classification_name' => null, 'id' => 'int32', @@ -97,14 +99,44 @@ class AuRosterShiftEditModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification_name' => false, + 'id' => false, + 'qualifications' => false, + 'breaks' => false, + 'employee_id' => false, + 'employee_name' => false, + 'location_id' => false, + 'location_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'role' => false, + 'start_time' => false, + 'end_time' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -225,12 +309,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -247,21 +328,39 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification_name'] = isset($data['classification_name']) ? $data['classification_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['qualifications'] = isset($data['qualifications']) ? $data['qualifications'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('qualifications', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -291,7 +390,7 @@ public function valid() /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -301,12 +400,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -315,7 +417,7 @@ public function setClassificationId($classification_id) /** * Gets classification_name * - * @return string + * @return string|null */ public function getClassificationName() { @@ -325,12 +427,15 @@ public function getClassificationName() /** * Sets classification_name * - * @param string $classification_name + * @param string|null $classification_name * - * @return $this + * @return self */ public function setClassificationName($classification_name) { + if (is_null($classification_name)) { + throw new \InvalidArgumentException('non-nullable classification_name cannot be null'); + } $this->container['classification_name'] = $classification_name; return $this; @@ -339,7 +444,7 @@ public function setClassificationName($classification_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -349,12 +454,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -363,7 +471,7 @@ public function setId($id) /** * Gets qualifications * - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[]|null */ public function getQualifications() { @@ -373,12 +481,15 @@ public function getQualifications() /** * Sets qualifications * - * @param \Swagger\Client\Model\QualificationModel[] $qualifications + * @param \OpenAPI\Client\Model\QualificationModel[]|null $qualifications * - * @return $this + * @return self */ public function setQualifications($qualifications) { + if (is_null($qualifications)) { + throw new \InvalidArgumentException('non-nullable qualifications cannot be null'); + } $this->container['qualifications'] = $qualifications; return $this; @@ -387,7 +498,7 @@ public function setQualifications($qualifications) /** * Gets breaks * - * @return \Swagger\Client\Model\RosterShiftBreakApiModel[] + * @return \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null */ public function getBreaks() { @@ -397,12 +508,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\RosterShiftBreakApiModel[] $breaks + * @param \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -411,7 +525,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -421,12 +535,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -435,7 +552,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -445,12 +562,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -459,7 +579,7 @@ public function setEmployeeName($employee_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -469,12 +589,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -483,7 +606,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -493,12 +616,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -507,7 +633,7 @@ public function setLocationName($location_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -517,12 +643,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -531,7 +660,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -541,12 +670,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -555,7 +687,7 @@ public function setWorkTypeName($work_type_name) /** * Gets role * - * @return \Swagger\Client\Model\RosterShiftRole + * @return \OpenAPI\Client\Model\RosterShiftRole|null */ public function getRole() { @@ -565,12 +697,15 @@ public function getRole() /** * Sets role * - * @param \Swagger\Client\Model\RosterShiftRole $role + * @param \OpenAPI\Client\Model\RosterShiftRole|null $role role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -579,7 +714,7 @@ public function setRole($role) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -589,12 +724,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -603,7 +741,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -613,12 +751,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -627,7 +768,7 @@ public function setEndTime($end_time) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -637,12 +778,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -654,7 +798,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -664,22 +808,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,11 +840,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -707,13 +865,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuRosterShiftGenerateTimesheetModel.php b/src/lib/Model/AuRosterShiftGenerateTimesheetModel.php index 2eeee85..5f00284 100644 --- a/src/lib/Model/AuRosterShiftGenerateTimesheetModel.php +++ b/src/lib/Model/AuRosterShiftGenerateTimesheetModel.php @@ -2,61 +2,61 @@ /** * AuRosterShiftGenerateTimesheetModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuRosterShiftGenerateTimesheetModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuRosterShiftGenerateTimesheetModel implements ModelInterface, ArrayAccess +class AuRosterShiftGenerateTimesheetModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuRosterShiftGenerateTimesheetModel'; + protected static $openAPIModelName = 'AuRosterShiftGenerateTimesheetModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'int', 'classification_name' => 'string', 'description' => 'string', @@ -65,21 +65,21 @@ class AuRosterShiftGenerateTimesheetModel implements ModelInterface, ArrayAccess 'warnings' => 'string[]', 'id' => 'int', 'token' => 'string', - 'qualifications' => '\Swagger\Client\Model\QualificationModel[]', - 'breaks' => '\Swagger\Client\Model\RosterShiftBreakApiModel[]', + 'qualifications' => '\OpenAPI\Client\Model\QualificationModel[]', + 'breaks' => '\OpenAPI\Client\Model\RosterShiftBreakApiModel[]', 'employee_id' => 'int', 'employee_name' => 'string', 'location_id' => 'int', 'location_name' => 'string', 'work_type_id' => 'int', 'work_type_name' => 'string', - 'role' => '\Swagger\Client\Model\RosterShiftRole', + 'role' => '\OpenAPI\Client\Model\RosterShiftRole', 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'notes' => 'string', 'published' => 'bool', 'accepted' => 'bool', - 'pending_swap' => '\Swagger\Client\Model\RosterShiftSwapModel', + 'pending_swap' => '\OpenAPI\Client\Model\RosterShiftSwapModel', 'date_published' => '\DateTime', 'biddable' => 'bool', 'shift_swap_cutoff_time' => '\DateTime', @@ -90,8 +90,10 @@ class AuRosterShiftGenerateTimesheetModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => 'int32', 'classification_name' => null, 'description' => null, @@ -121,14 +123,56 @@ class AuRosterShiftGenerateTimesheetModel implements ModelInterface, ArrayAccess 'shift_assignment_status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification_name' => false, + 'description' => false, + 'is_different' => false, + 'fully_qualified_location_name' => false, + 'warnings' => false, + 'id' => false, + 'token' => false, + 'qualifications' => false, + 'breaks' => false, + 'employee_id' => false, + 'employee_name' => false, + 'location_id' => false, + 'location_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'role' => false, + 'start_time' => false, + 'end_time' => false, + 'notes' => false, + 'published' => false, + 'accepted' => false, + 'pending_swap' => false, + 'date_published' => false, + 'biddable' => false, + 'shift_swap_cutoff_time' => false, + 'shift_assignment_status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -136,9 +180,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -285,19 +381,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; - const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; - const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - + public const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; + public const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; + public const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - /** * Gets allowable values of the enum * @@ -315,7 +409,6 @@ public function getShiftAssignmentStatusAllowableValues() self::SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL, ]; } - /** * Associative array for storing property values @@ -332,33 +425,51 @@ public function getShiftAssignmentStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification_name'] = isset($data['classification_name']) ? $data['classification_name'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['is_different'] = isset($data['is_different']) ? $data['is_different'] : null; - $this->container['fully_qualified_location_name'] = isset($data['fully_qualified_location_name']) ? $data['fully_qualified_location_name'] : null; - $this->container['warnings'] = isset($data['warnings']) ? $data['warnings'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['qualifications'] = isset($data['qualifications']) ? $data['qualifications'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['published'] = isset($data['published']) ? $data['published'] : null; - $this->container['accepted'] = isset($data['accepted']) ? $data['accepted'] : null; - $this->container['pending_swap'] = isset($data['pending_swap']) ? $data['pending_swap'] : null; - $this->container['date_published'] = isset($data['date_published']) ? $data['date_published'] : null; - $this->container['biddable'] = isset($data['biddable']) ? $data['biddable'] : null; - $this->container['shift_swap_cutoff_time'] = isset($data['shift_swap_cutoff_time']) ? $data['shift_swap_cutoff_time'] : null; - $this->container['shift_assignment_status'] = isset($data['shift_assignment_status']) ? $data['shift_assignment_status'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification_name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('is_different', $data ?? [], null); + $this->setIfExists('fully_qualified_location_name', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('qualifications', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('published', $data ?? [], null); + $this->setIfExists('accepted', $data ?? [], null); + $this->setIfExists('pending_swap', $data ?? [], null); + $this->setIfExists('date_published', $data ?? [], null); + $this->setIfExists('biddable', $data ?? [], null); + $this->setIfExists('shift_swap_cutoff_time', $data ?? [], null); + $this->setIfExists('shift_assignment_status', $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; } /** @@ -373,7 +484,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); if (!is_null($this->container['shift_assignment_status']) && !in_array($this->container['shift_assignment_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_assignment_status', must be one of '%s'", + "invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $this->container['shift_assignment_status'], implode("', '", $allowedValues) ); } @@ -396,7 +508,7 @@ public function valid() /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -406,12 +518,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -420,7 +535,7 @@ public function setClassificationId($classification_id) /** * Gets classification_name * - * @return string + * @return string|null */ public function getClassificationName() { @@ -430,12 +545,15 @@ public function getClassificationName() /** * Sets classification_name * - * @param string $classification_name + * @param string|null $classification_name * - * @return $this + * @return self */ public function setClassificationName($classification_name) { + if (is_null($classification_name)) { + throw new \InvalidArgumentException('non-nullable classification_name cannot be null'); + } $this->container['classification_name'] = $classification_name; return $this; @@ -444,7 +562,7 @@ public function setClassificationName($classification_name) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -454,12 +572,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -468,7 +589,7 @@ public function setDescription($description) /** * Gets is_different * - * @return bool + * @return bool|null */ public function getIsDifferent() { @@ -478,12 +599,15 @@ public function getIsDifferent() /** * Sets is_different * - * @param bool $is_different + * @param bool|null $is_different * - * @return $this + * @return self */ public function setIsDifferent($is_different) { + if (is_null($is_different)) { + throw new \InvalidArgumentException('non-nullable is_different cannot be null'); + } $this->container['is_different'] = $is_different; return $this; @@ -492,7 +616,7 @@ public function setIsDifferent($is_different) /** * Gets fully_qualified_location_name * - * @return string + * @return string|null */ public function getFullyQualifiedLocationName() { @@ -502,12 +626,15 @@ public function getFullyQualifiedLocationName() /** * Sets fully_qualified_location_name * - * @param string $fully_qualified_location_name + * @param string|null $fully_qualified_location_name * - * @return $this + * @return self */ public function setFullyQualifiedLocationName($fully_qualified_location_name) { + if (is_null($fully_qualified_location_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_location_name cannot be null'); + } $this->container['fully_qualified_location_name'] = $fully_qualified_location_name; return $this; @@ -516,7 +643,7 @@ public function setFullyQualifiedLocationName($fully_qualified_location_name) /** * Gets warnings * - * @return string[] + * @return string[]|null */ public function getWarnings() { @@ -526,12 +653,15 @@ public function getWarnings() /** * Sets warnings * - * @param string[] $warnings + * @param string[]|null $warnings * - * @return $this + * @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; @@ -540,7 +670,7 @@ public function setWarnings($warnings) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -550,12 +680,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -564,7 +697,7 @@ public function setId($id) /** * Gets token * - * @return string + * @return string|null */ public function getToken() { @@ -574,12 +707,15 @@ public function getToken() /** * Sets token * - * @param string $token + * @param string|null $token * - * @return $this + * @return self */ public function setToken($token) { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -588,7 +724,7 @@ public function setToken($token) /** * Gets qualifications * - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[]|null */ public function getQualifications() { @@ -598,12 +734,15 @@ public function getQualifications() /** * Sets qualifications * - * @param \Swagger\Client\Model\QualificationModel[] $qualifications + * @param \OpenAPI\Client\Model\QualificationModel[]|null $qualifications * - * @return $this + * @return self */ public function setQualifications($qualifications) { + if (is_null($qualifications)) { + throw new \InvalidArgumentException('non-nullable qualifications cannot be null'); + } $this->container['qualifications'] = $qualifications; return $this; @@ -612,7 +751,7 @@ public function setQualifications($qualifications) /** * Gets breaks * - * @return \Swagger\Client\Model\RosterShiftBreakApiModel[] + * @return \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null */ public function getBreaks() { @@ -622,12 +761,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\RosterShiftBreakApiModel[] $breaks + * @param \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -636,7 +778,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -646,12 +788,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -660,7 +805,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -670,12 +815,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -684,7 +832,7 @@ public function setEmployeeName($employee_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -694,12 +842,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -708,7 +859,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -718,12 +869,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -732,7 +886,7 @@ public function setLocationName($location_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -742,12 +896,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -756,7 +913,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -766,12 +923,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -780,7 +940,7 @@ public function setWorkTypeName($work_type_name) /** * Gets role * - * @return \Swagger\Client\Model\RosterShiftRole + * @return \OpenAPI\Client\Model\RosterShiftRole|null */ public function getRole() { @@ -790,12 +950,15 @@ public function getRole() /** * Sets role * - * @param \Swagger\Client\Model\RosterShiftRole $role + * @param \OpenAPI\Client\Model\RosterShiftRole|null $role role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -804,7 +967,7 @@ public function setRole($role) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -814,12 +977,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -828,7 +994,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -838,12 +1004,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -852,7 +1021,7 @@ public function setEndTime($end_time) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -862,12 +1031,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -876,7 +1048,7 @@ public function setNotes($notes) /** * Gets published * - * @return bool + * @return bool|null */ public function getPublished() { @@ -886,12 +1058,15 @@ public function getPublished() /** * Sets published * - * @param bool $published + * @param bool|null $published * - * @return $this + * @return self */ public function setPublished($published) { + if (is_null($published)) { + throw new \InvalidArgumentException('non-nullable published cannot be null'); + } $this->container['published'] = $published; return $this; @@ -900,7 +1075,7 @@ public function setPublished($published) /** * Gets accepted * - * @return bool + * @return bool|null */ public function getAccepted() { @@ -910,12 +1085,15 @@ public function getAccepted() /** * Sets accepted * - * @param bool $accepted + * @param bool|null $accepted * - * @return $this + * @return self */ public function setAccepted($accepted) { + if (is_null($accepted)) { + throw new \InvalidArgumentException('non-nullable accepted cannot be null'); + } $this->container['accepted'] = $accepted; return $this; @@ -924,7 +1102,7 @@ public function setAccepted($accepted) /** * Gets pending_swap * - * @return \Swagger\Client\Model\RosterShiftSwapModel + * @return \OpenAPI\Client\Model\RosterShiftSwapModel|null */ public function getPendingSwap() { @@ -934,12 +1112,15 @@ public function getPendingSwap() /** * Sets pending_swap * - * @param \Swagger\Client\Model\RosterShiftSwapModel $pending_swap + * @param \OpenAPI\Client\Model\RosterShiftSwapModel|null $pending_swap pending_swap * - * @return $this + * @return self */ public function setPendingSwap($pending_swap) { + if (is_null($pending_swap)) { + throw new \InvalidArgumentException('non-nullable pending_swap cannot be null'); + } $this->container['pending_swap'] = $pending_swap; return $this; @@ -948,7 +1129,7 @@ public function setPendingSwap($pending_swap) /** * Gets date_published * - * @return \DateTime + * @return \DateTime|null */ public function getDatePublished() { @@ -958,12 +1139,15 @@ public function getDatePublished() /** * Sets date_published * - * @param \DateTime $date_published + * @param \DateTime|null $date_published * - * @return $this + * @return self */ public function setDatePublished($date_published) { + if (is_null($date_published)) { + throw new \InvalidArgumentException('non-nullable date_published cannot be null'); + } $this->container['date_published'] = $date_published; return $this; @@ -972,7 +1156,7 @@ public function setDatePublished($date_published) /** * Gets biddable * - * @return bool + * @return bool|null */ public function getBiddable() { @@ -982,12 +1166,15 @@ public function getBiddable() /** * Sets biddable * - * @param bool $biddable + * @param bool|null $biddable * - * @return $this + * @return self */ public function setBiddable($biddable) { + if (is_null($biddable)) { + throw new \InvalidArgumentException('non-nullable biddable cannot be null'); + } $this->container['biddable'] = $biddable; return $this; @@ -996,7 +1183,7 @@ public function setBiddable($biddable) /** * Gets shift_swap_cutoff_time * - * @return \DateTime + * @return \DateTime|null */ public function getShiftSwapCutoffTime() { @@ -1006,12 +1193,15 @@ public function getShiftSwapCutoffTime() /** * Sets shift_swap_cutoff_time * - * @param \DateTime $shift_swap_cutoff_time + * @param \DateTime|null $shift_swap_cutoff_time * - * @return $this + * @return self */ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) { + if (is_null($shift_swap_cutoff_time)) { + throw new \InvalidArgumentException('non-nullable shift_swap_cutoff_time cannot be null'); + } $this->container['shift_swap_cutoff_time'] = $shift_swap_cutoff_time; return $this; @@ -1020,7 +1210,7 @@ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) /** * Gets shift_assignment_status * - * @return string + * @return string|null */ public function getShiftAssignmentStatus() { @@ -1030,17 +1220,21 @@ public function getShiftAssignmentStatus() /** * Sets shift_assignment_status * - * @param string $shift_assignment_status + * @param string|null $shift_assignment_status * - * @return $this + * @return self */ public function setShiftAssignmentStatus($shift_assignment_status) { + if (is_null($shift_assignment_status)) { + throw new \InvalidArgumentException('non-nullable shift_assignment_status cannot be null'); + } $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); - if (!is_null($shift_assignment_status) && !in_array($shift_assignment_status, $allowedValues, true)) { + if (!in_array($shift_assignment_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_assignment_status', must be one of '%s'", + "Invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $shift_assignment_status, implode("', '", $allowedValues) ) ); @@ -1056,7 +1250,7 @@ public function setShiftAssignmentStatus($shift_assignment_status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1066,22 +1260,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1097,11 +1292,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1109,13 +1317,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuRosterShiftMatchingResultModel.php b/src/lib/Model/AuRosterShiftMatchingResultModel.php index 8f11c94..1862937 100644 --- a/src/lib/Model/AuRosterShiftMatchingResultModel.php +++ b/src/lib/Model/AuRosterShiftMatchingResultModel.php @@ -2,81 +2,99 @@ /** * AuRosterShiftMatchingResultModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuRosterShiftMatchingResultModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuRosterShiftMatchingResultModel implements ModelInterface, ArrayAccess +class AuRosterShiftMatchingResultModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuRosterShiftMatchingResultModel'; + protected static $openAPIModelName = 'AuRosterShiftMatchingResultModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'shift' => '\Swagger\Client\Model\AuEssRosterShiftModel' + protected static $openAPITypes = [ + 'shift' => '\OpenAPI\Client\Model\AuEssRosterShiftModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shift' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shift' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shift'] = isset($data['shift']) ? $data['shift'] : null; + $this->setIfExists('shift', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets shift * - * @return \Swagger\Client\Model\AuEssRosterShiftModel + * @return \OpenAPI\Client\Model\AuEssRosterShiftModel|null */ public function getShift() { @@ -217,12 +302,15 @@ public function getShift() /** * Sets shift * - * @param \Swagger\Client\Model\AuEssRosterShiftModel $shift + * @param \OpenAPI\Client\Model\AuEssRosterShiftModel|null $shift shift * - * @return $this + * @return self */ public function setShift($shift) { + if (is_null($shift)) { + throw new \InvalidArgumentException('non-nullable shift cannot be null'); + } $this->container['shift'] = $shift; return $this; @@ -234,7 +322,7 @@ public function setShift($shift) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuRosterTimesheetComparisonReportExportModel.php b/src/lib/Model/AuRosterTimesheetComparisonReportExportModel.php index 599a209..be35c45 100644 --- a/src/lib/Model/AuRosterTimesheetComparisonReportExportModel.php +++ b/src/lib/Model/AuRosterTimesheetComparisonReportExportModel.php @@ -2,61 +2,61 @@ /** * AuRosterTimesheetComparisonReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuRosterTimesheetComparisonReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuRosterTimesheetComparisonReportExportModel implements ModelInterface, ArrayAccess +class AuRosterTimesheetComparisonReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuRosterTimesheetComparisonReportExportModel'; + protected static $openAPIModelName = 'AuRosterTimesheetComparisonReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employment_type' => 'string', 'employee_id' => 'int', 'employee_first_name' => 'string', @@ -74,7 +74,7 @@ class AuRosterTimesheetComparisonReportExportModel implements ModelInterface, Ar 'rostered_end_time' => 'string', 'rostered_duration' => 'string', 'rostered_breaks' => 'string', - 'rostered_cost' => 'double', + 'rostered_cost' => 'float', 'timesheet_id' => 'int', 'timesheet_status' => 'string', 'timesheet_location' => 'string', @@ -85,19 +85,21 @@ class AuRosterTimesheetComparisonReportExportModel implements ModelInterface, Ar 'timesheet_end_time' => 'string', 'timesheet_duration' => 'string', 'timesheet_breaks' => 'string', - 'timesheet_units' => 'double', + 'timesheet_units' => 'float', 'timesheet_unit_type' => 'string', - 'timesheet_cost' => 'double', + 'timesheet_cost' => 'float', 'time_variance' => 'string', - 'cost_variance' => 'double' + 'cost_variance' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employment_type' => null, 'employee_id' => 'int32', 'employee_first_name' => null, @@ -133,14 +135,62 @@ class AuRosterTimesheetComparisonReportExportModel implements ModelInterface, Ar 'cost_variance' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employment_type' => false, + 'employee_id' => false, + 'employee_first_name' => false, + 'employee_surname' => false, + 'employee_external_id' => false, + 'employee_default_location' => false, + 'pay_schedule_name' => false, + 'rostered_id' => false, + 'rostered_status' => false, + 'rostered_location' => false, + 'rostered_work_type' => false, + 'rostered_start' => false, + 'rostered_start_time' => false, + 'rostered_end' => false, + 'rostered_end_time' => false, + 'rostered_duration' => false, + 'rostered_breaks' => false, + 'rostered_cost' => false, + 'timesheet_id' => false, + 'timesheet_status' => false, + 'timesheet_location' => false, + 'timesheet_work_type' => false, + 'timesheet_start' => false, + 'timesheet_start_time' => false, + 'timesheet_end' => false, + 'timesheet_end_time' => false, + 'timesheet_duration' => false, + 'timesheet_breaks' => false, + 'timesheet_units' => false, + 'timesheet_unit_type' => false, + 'timesheet_cost' => false, + 'time_variance' => false, + 'cost_variance' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -148,9 +198,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -315,12 +417,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -337,39 +436,57 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employment_type'] = isset($data['employment_type']) ? $data['employment_type'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_first_name'] = isset($data['employee_first_name']) ? $data['employee_first_name'] : null; - $this->container['employee_surname'] = isset($data['employee_surname']) ? $data['employee_surname'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['employee_default_location'] = isset($data['employee_default_location']) ? $data['employee_default_location'] : null; - $this->container['pay_schedule_name'] = isset($data['pay_schedule_name']) ? $data['pay_schedule_name'] : null; - $this->container['rostered_id'] = isset($data['rostered_id']) ? $data['rostered_id'] : null; - $this->container['rostered_status'] = isset($data['rostered_status']) ? $data['rostered_status'] : null; - $this->container['rostered_location'] = isset($data['rostered_location']) ? $data['rostered_location'] : null; - $this->container['rostered_work_type'] = isset($data['rostered_work_type']) ? $data['rostered_work_type'] : null; - $this->container['rostered_start'] = isset($data['rostered_start']) ? $data['rostered_start'] : null; - $this->container['rostered_start_time'] = isset($data['rostered_start_time']) ? $data['rostered_start_time'] : null; - $this->container['rostered_end'] = isset($data['rostered_end']) ? $data['rostered_end'] : null; - $this->container['rostered_end_time'] = isset($data['rostered_end_time']) ? $data['rostered_end_time'] : null; - $this->container['rostered_duration'] = isset($data['rostered_duration']) ? $data['rostered_duration'] : null; - $this->container['rostered_breaks'] = isset($data['rostered_breaks']) ? $data['rostered_breaks'] : null; - $this->container['rostered_cost'] = isset($data['rostered_cost']) ? $data['rostered_cost'] : null; - $this->container['timesheet_id'] = isset($data['timesheet_id']) ? $data['timesheet_id'] : null; - $this->container['timesheet_status'] = isset($data['timesheet_status']) ? $data['timesheet_status'] : null; - $this->container['timesheet_location'] = isset($data['timesheet_location']) ? $data['timesheet_location'] : null; - $this->container['timesheet_work_type'] = isset($data['timesheet_work_type']) ? $data['timesheet_work_type'] : null; - $this->container['timesheet_start'] = isset($data['timesheet_start']) ? $data['timesheet_start'] : null; - $this->container['timesheet_start_time'] = isset($data['timesheet_start_time']) ? $data['timesheet_start_time'] : null; - $this->container['timesheet_end'] = isset($data['timesheet_end']) ? $data['timesheet_end'] : null; - $this->container['timesheet_end_time'] = isset($data['timesheet_end_time']) ? $data['timesheet_end_time'] : null; - $this->container['timesheet_duration'] = isset($data['timesheet_duration']) ? $data['timesheet_duration'] : null; - $this->container['timesheet_breaks'] = isset($data['timesheet_breaks']) ? $data['timesheet_breaks'] : null; - $this->container['timesheet_units'] = isset($data['timesheet_units']) ? $data['timesheet_units'] : null; - $this->container['timesheet_unit_type'] = isset($data['timesheet_unit_type']) ? $data['timesheet_unit_type'] : null; - $this->container['timesheet_cost'] = isset($data['timesheet_cost']) ? $data['timesheet_cost'] : null; - $this->container['time_variance'] = isset($data['time_variance']) ? $data['time_variance'] : null; - $this->container['cost_variance'] = isset($data['cost_variance']) ? $data['cost_variance'] : null; + $this->setIfExists('employment_type', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_first_name', $data ?? [], null); + $this->setIfExists('employee_surname', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('employee_default_location', $data ?? [], null); + $this->setIfExists('pay_schedule_name', $data ?? [], null); + $this->setIfExists('rostered_id', $data ?? [], null); + $this->setIfExists('rostered_status', $data ?? [], null); + $this->setIfExists('rostered_location', $data ?? [], null); + $this->setIfExists('rostered_work_type', $data ?? [], null); + $this->setIfExists('rostered_start', $data ?? [], null); + $this->setIfExists('rostered_start_time', $data ?? [], null); + $this->setIfExists('rostered_end', $data ?? [], null); + $this->setIfExists('rostered_end_time', $data ?? [], null); + $this->setIfExists('rostered_duration', $data ?? [], null); + $this->setIfExists('rostered_breaks', $data ?? [], null); + $this->setIfExists('rostered_cost', $data ?? [], null); + $this->setIfExists('timesheet_id', $data ?? [], null); + $this->setIfExists('timesheet_status', $data ?? [], null); + $this->setIfExists('timesheet_location', $data ?? [], null); + $this->setIfExists('timesheet_work_type', $data ?? [], null); + $this->setIfExists('timesheet_start', $data ?? [], null); + $this->setIfExists('timesheet_start_time', $data ?? [], null); + $this->setIfExists('timesheet_end', $data ?? [], null); + $this->setIfExists('timesheet_end_time', $data ?? [], null); + $this->setIfExists('timesheet_duration', $data ?? [], null); + $this->setIfExists('timesheet_breaks', $data ?? [], null); + $this->setIfExists('timesheet_units', $data ?? [], null); + $this->setIfExists('timesheet_unit_type', $data ?? [], null); + $this->setIfExists('timesheet_cost', $data ?? [], null); + $this->setIfExists('time_variance', $data ?? [], null); + $this->setIfExists('cost_variance', $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; } /** @@ -399,7 +516,7 @@ public function valid() /** * Gets employment_type * - * @return string + * @return string|null */ public function getEmploymentType() { @@ -409,12 +526,15 @@ public function getEmploymentType() /** * Sets employment_type * - * @param string $employment_type + * @param string|null $employment_type * - * @return $this + * @return self */ public function setEmploymentType($employment_type) { + if (is_null($employment_type)) { + throw new \InvalidArgumentException('non-nullable employment_type cannot be null'); + } $this->container['employment_type'] = $employment_type; return $this; @@ -423,7 +543,7 @@ public function setEmploymentType($employment_type) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -433,12 +553,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -447,7 +570,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_first_name * - * @return string + * @return string|null */ public function getEmployeeFirstName() { @@ -457,12 +580,15 @@ public function getEmployeeFirstName() /** * Sets employee_first_name * - * @param string $employee_first_name + * @param string|null $employee_first_name * - * @return $this + * @return self */ public function setEmployeeFirstName($employee_first_name) { + if (is_null($employee_first_name)) { + throw new \InvalidArgumentException('non-nullable employee_first_name cannot be null'); + } $this->container['employee_first_name'] = $employee_first_name; return $this; @@ -471,7 +597,7 @@ public function setEmployeeFirstName($employee_first_name) /** * Gets employee_surname * - * @return string + * @return string|null */ public function getEmployeeSurname() { @@ -481,12 +607,15 @@ public function getEmployeeSurname() /** * Sets employee_surname * - * @param string $employee_surname + * @param string|null $employee_surname * - * @return $this + * @return self */ public function setEmployeeSurname($employee_surname) { + if (is_null($employee_surname)) { + throw new \InvalidArgumentException('non-nullable employee_surname cannot be null'); + } $this->container['employee_surname'] = $employee_surname; return $this; @@ -495,7 +624,7 @@ public function setEmployeeSurname($employee_surname) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -505,12 +634,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -519,7 +651,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets employee_default_location * - * @return string + * @return string|null */ public function getEmployeeDefaultLocation() { @@ -529,12 +661,15 @@ public function getEmployeeDefaultLocation() /** * Sets employee_default_location * - * @param string $employee_default_location + * @param string|null $employee_default_location * - * @return $this + * @return self */ public function setEmployeeDefaultLocation($employee_default_location) { + if (is_null($employee_default_location)) { + throw new \InvalidArgumentException('non-nullable employee_default_location cannot be null'); + } $this->container['employee_default_location'] = $employee_default_location; return $this; @@ -543,7 +678,7 @@ public function setEmployeeDefaultLocation($employee_default_location) /** * Gets pay_schedule_name * - * @return string + * @return string|null */ public function getPayScheduleName() { @@ -553,12 +688,15 @@ public function getPayScheduleName() /** * Sets pay_schedule_name * - * @param string $pay_schedule_name + * @param string|null $pay_schedule_name * - * @return $this + * @return self */ public function setPayScheduleName($pay_schedule_name) { + if (is_null($pay_schedule_name)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_name cannot be null'); + } $this->container['pay_schedule_name'] = $pay_schedule_name; return $this; @@ -567,7 +705,7 @@ public function setPayScheduleName($pay_schedule_name) /** * Gets rostered_id * - * @return int + * @return int|null */ public function getRosteredId() { @@ -577,12 +715,15 @@ public function getRosteredId() /** * Sets rostered_id * - * @param int $rostered_id + * @param int|null $rostered_id * - * @return $this + * @return self */ public function setRosteredId($rostered_id) { + if (is_null($rostered_id)) { + throw new \InvalidArgumentException('non-nullable rostered_id cannot be null'); + } $this->container['rostered_id'] = $rostered_id; return $this; @@ -591,7 +732,7 @@ public function setRosteredId($rostered_id) /** * Gets rostered_status * - * @return string + * @return string|null */ public function getRosteredStatus() { @@ -601,12 +742,15 @@ public function getRosteredStatus() /** * Sets rostered_status * - * @param string $rostered_status + * @param string|null $rostered_status * - * @return $this + * @return self */ public function setRosteredStatus($rostered_status) { + if (is_null($rostered_status)) { + throw new \InvalidArgumentException('non-nullable rostered_status cannot be null'); + } $this->container['rostered_status'] = $rostered_status; return $this; @@ -615,7 +759,7 @@ public function setRosteredStatus($rostered_status) /** * Gets rostered_location * - * @return string + * @return string|null */ public function getRosteredLocation() { @@ -625,12 +769,15 @@ public function getRosteredLocation() /** * Sets rostered_location * - * @param string $rostered_location + * @param string|null $rostered_location * - * @return $this + * @return self */ public function setRosteredLocation($rostered_location) { + if (is_null($rostered_location)) { + throw new \InvalidArgumentException('non-nullable rostered_location cannot be null'); + } $this->container['rostered_location'] = $rostered_location; return $this; @@ -639,7 +786,7 @@ public function setRosteredLocation($rostered_location) /** * Gets rostered_work_type * - * @return string + * @return string|null */ public function getRosteredWorkType() { @@ -649,12 +796,15 @@ public function getRosteredWorkType() /** * Sets rostered_work_type * - * @param string $rostered_work_type + * @param string|null $rostered_work_type * - * @return $this + * @return self */ public function setRosteredWorkType($rostered_work_type) { + if (is_null($rostered_work_type)) { + throw new \InvalidArgumentException('non-nullable rostered_work_type cannot be null'); + } $this->container['rostered_work_type'] = $rostered_work_type; return $this; @@ -663,7 +813,7 @@ public function setRosteredWorkType($rostered_work_type) /** * Gets rostered_start * - * @return \DateTime + * @return \DateTime|null */ public function getRosteredStart() { @@ -673,12 +823,15 @@ public function getRosteredStart() /** * Sets rostered_start * - * @param \DateTime $rostered_start + * @param \DateTime|null $rostered_start * - * @return $this + * @return self */ public function setRosteredStart($rostered_start) { + if (is_null($rostered_start)) { + throw new \InvalidArgumentException('non-nullable rostered_start cannot be null'); + } $this->container['rostered_start'] = $rostered_start; return $this; @@ -687,7 +840,7 @@ public function setRosteredStart($rostered_start) /** * Gets rostered_start_time * - * @return string + * @return string|null */ public function getRosteredStartTime() { @@ -697,12 +850,15 @@ public function getRosteredStartTime() /** * Sets rostered_start_time * - * @param string $rostered_start_time + * @param string|null $rostered_start_time * - * @return $this + * @return self */ public function setRosteredStartTime($rostered_start_time) { + if (is_null($rostered_start_time)) { + throw new \InvalidArgumentException('non-nullable rostered_start_time cannot be null'); + } $this->container['rostered_start_time'] = $rostered_start_time; return $this; @@ -711,7 +867,7 @@ public function setRosteredStartTime($rostered_start_time) /** * Gets rostered_end * - * @return \DateTime + * @return \DateTime|null */ public function getRosteredEnd() { @@ -721,12 +877,15 @@ public function getRosteredEnd() /** * Sets rostered_end * - * @param \DateTime $rostered_end + * @param \DateTime|null $rostered_end * - * @return $this + * @return self */ public function setRosteredEnd($rostered_end) { + if (is_null($rostered_end)) { + throw new \InvalidArgumentException('non-nullable rostered_end cannot be null'); + } $this->container['rostered_end'] = $rostered_end; return $this; @@ -735,7 +894,7 @@ public function setRosteredEnd($rostered_end) /** * Gets rostered_end_time * - * @return string + * @return string|null */ public function getRosteredEndTime() { @@ -745,12 +904,15 @@ public function getRosteredEndTime() /** * Sets rostered_end_time * - * @param string $rostered_end_time + * @param string|null $rostered_end_time * - * @return $this + * @return self */ public function setRosteredEndTime($rostered_end_time) { + if (is_null($rostered_end_time)) { + throw new \InvalidArgumentException('non-nullable rostered_end_time cannot be null'); + } $this->container['rostered_end_time'] = $rostered_end_time; return $this; @@ -759,7 +921,7 @@ public function setRosteredEndTime($rostered_end_time) /** * Gets rostered_duration * - * @return string + * @return string|null */ public function getRosteredDuration() { @@ -769,12 +931,15 @@ public function getRosteredDuration() /** * Sets rostered_duration * - * @param string $rostered_duration + * @param string|null $rostered_duration * - * @return $this + * @return self */ public function setRosteredDuration($rostered_duration) { + if (is_null($rostered_duration)) { + throw new \InvalidArgumentException('non-nullable rostered_duration cannot be null'); + } $this->container['rostered_duration'] = $rostered_duration; return $this; @@ -783,7 +948,7 @@ public function setRosteredDuration($rostered_duration) /** * Gets rostered_breaks * - * @return string + * @return string|null */ public function getRosteredBreaks() { @@ -793,12 +958,15 @@ public function getRosteredBreaks() /** * Sets rostered_breaks * - * @param string $rostered_breaks + * @param string|null $rostered_breaks * - * @return $this + * @return self */ public function setRosteredBreaks($rostered_breaks) { + if (is_null($rostered_breaks)) { + throw new \InvalidArgumentException('non-nullable rostered_breaks cannot be null'); + } $this->container['rostered_breaks'] = $rostered_breaks; return $this; @@ -807,7 +975,7 @@ public function setRosteredBreaks($rostered_breaks) /** * Gets rostered_cost * - * @return double + * @return float|null */ public function getRosteredCost() { @@ -817,12 +985,15 @@ public function getRosteredCost() /** * Sets rostered_cost * - * @param double $rostered_cost + * @param float|null $rostered_cost * - * @return $this + * @return self */ public function setRosteredCost($rostered_cost) { + if (is_null($rostered_cost)) { + throw new \InvalidArgumentException('non-nullable rostered_cost cannot be null'); + } $this->container['rostered_cost'] = $rostered_cost; return $this; @@ -831,7 +1002,7 @@ public function setRosteredCost($rostered_cost) /** * Gets timesheet_id * - * @return int + * @return int|null */ public function getTimesheetId() { @@ -841,12 +1012,15 @@ public function getTimesheetId() /** * Sets timesheet_id * - * @param int $timesheet_id + * @param int|null $timesheet_id * - * @return $this + * @return self */ public function setTimesheetId($timesheet_id) { + if (is_null($timesheet_id)) { + throw new \InvalidArgumentException('non-nullable timesheet_id cannot be null'); + } $this->container['timesheet_id'] = $timesheet_id; return $this; @@ -855,7 +1029,7 @@ public function setTimesheetId($timesheet_id) /** * Gets timesheet_status * - * @return string + * @return string|null */ public function getTimesheetStatus() { @@ -865,12 +1039,15 @@ public function getTimesheetStatus() /** * Sets timesheet_status * - * @param string $timesheet_status + * @param string|null $timesheet_status * - * @return $this + * @return self */ public function setTimesheetStatus($timesheet_status) { + if (is_null($timesheet_status)) { + throw new \InvalidArgumentException('non-nullable timesheet_status cannot be null'); + } $this->container['timesheet_status'] = $timesheet_status; return $this; @@ -879,7 +1056,7 @@ public function setTimesheetStatus($timesheet_status) /** * Gets timesheet_location * - * @return string + * @return string|null */ public function getTimesheetLocation() { @@ -889,12 +1066,15 @@ public function getTimesheetLocation() /** * Sets timesheet_location * - * @param string $timesheet_location + * @param string|null $timesheet_location * - * @return $this + * @return self */ public function setTimesheetLocation($timesheet_location) { + if (is_null($timesheet_location)) { + throw new \InvalidArgumentException('non-nullable timesheet_location cannot be null'); + } $this->container['timesheet_location'] = $timesheet_location; return $this; @@ -903,7 +1083,7 @@ public function setTimesheetLocation($timesheet_location) /** * Gets timesheet_work_type * - * @return string + * @return string|null */ public function getTimesheetWorkType() { @@ -913,12 +1093,15 @@ public function getTimesheetWorkType() /** * Sets timesheet_work_type * - * @param string $timesheet_work_type + * @param string|null $timesheet_work_type * - * @return $this + * @return self */ public function setTimesheetWorkType($timesheet_work_type) { + if (is_null($timesheet_work_type)) { + throw new \InvalidArgumentException('non-nullable timesheet_work_type cannot be null'); + } $this->container['timesheet_work_type'] = $timesheet_work_type; return $this; @@ -927,7 +1110,7 @@ public function setTimesheetWorkType($timesheet_work_type) /** * Gets timesheet_start * - * @return \DateTime + * @return \DateTime|null */ public function getTimesheetStart() { @@ -937,12 +1120,15 @@ public function getTimesheetStart() /** * Sets timesheet_start * - * @param \DateTime $timesheet_start + * @param \DateTime|null $timesheet_start * - * @return $this + * @return self */ public function setTimesheetStart($timesheet_start) { + if (is_null($timesheet_start)) { + throw new \InvalidArgumentException('non-nullable timesheet_start cannot be null'); + } $this->container['timesheet_start'] = $timesheet_start; return $this; @@ -951,7 +1137,7 @@ public function setTimesheetStart($timesheet_start) /** * Gets timesheet_start_time * - * @return string + * @return string|null */ public function getTimesheetStartTime() { @@ -961,12 +1147,15 @@ public function getTimesheetStartTime() /** * Sets timesheet_start_time * - * @param string $timesheet_start_time + * @param string|null $timesheet_start_time * - * @return $this + * @return self */ public function setTimesheetStartTime($timesheet_start_time) { + if (is_null($timesheet_start_time)) { + throw new \InvalidArgumentException('non-nullable timesheet_start_time cannot be null'); + } $this->container['timesheet_start_time'] = $timesheet_start_time; return $this; @@ -975,7 +1164,7 @@ public function setTimesheetStartTime($timesheet_start_time) /** * Gets timesheet_end * - * @return \DateTime + * @return \DateTime|null */ public function getTimesheetEnd() { @@ -985,12 +1174,15 @@ public function getTimesheetEnd() /** * Sets timesheet_end * - * @param \DateTime $timesheet_end + * @param \DateTime|null $timesheet_end * - * @return $this + * @return self */ public function setTimesheetEnd($timesheet_end) { + if (is_null($timesheet_end)) { + throw new \InvalidArgumentException('non-nullable timesheet_end cannot be null'); + } $this->container['timesheet_end'] = $timesheet_end; return $this; @@ -999,7 +1191,7 @@ public function setTimesheetEnd($timesheet_end) /** * Gets timesheet_end_time * - * @return string + * @return string|null */ public function getTimesheetEndTime() { @@ -1009,12 +1201,15 @@ public function getTimesheetEndTime() /** * Sets timesheet_end_time * - * @param string $timesheet_end_time + * @param string|null $timesheet_end_time * - * @return $this + * @return self */ public function setTimesheetEndTime($timesheet_end_time) { + if (is_null($timesheet_end_time)) { + throw new \InvalidArgumentException('non-nullable timesheet_end_time cannot be null'); + } $this->container['timesheet_end_time'] = $timesheet_end_time; return $this; @@ -1023,7 +1218,7 @@ public function setTimesheetEndTime($timesheet_end_time) /** * Gets timesheet_duration * - * @return string + * @return string|null */ public function getTimesheetDuration() { @@ -1033,12 +1228,15 @@ public function getTimesheetDuration() /** * Sets timesheet_duration * - * @param string $timesheet_duration + * @param string|null $timesheet_duration * - * @return $this + * @return self */ public function setTimesheetDuration($timesheet_duration) { + if (is_null($timesheet_duration)) { + throw new \InvalidArgumentException('non-nullable timesheet_duration cannot be null'); + } $this->container['timesheet_duration'] = $timesheet_duration; return $this; @@ -1047,7 +1245,7 @@ public function setTimesheetDuration($timesheet_duration) /** * Gets timesheet_breaks * - * @return string + * @return string|null */ public function getTimesheetBreaks() { @@ -1057,12 +1255,15 @@ public function getTimesheetBreaks() /** * Sets timesheet_breaks * - * @param string $timesheet_breaks + * @param string|null $timesheet_breaks * - * @return $this + * @return self */ public function setTimesheetBreaks($timesheet_breaks) { + if (is_null($timesheet_breaks)) { + throw new \InvalidArgumentException('non-nullable timesheet_breaks cannot be null'); + } $this->container['timesheet_breaks'] = $timesheet_breaks; return $this; @@ -1071,7 +1272,7 @@ public function setTimesheetBreaks($timesheet_breaks) /** * Gets timesheet_units * - * @return double + * @return float|null */ public function getTimesheetUnits() { @@ -1081,12 +1282,15 @@ public function getTimesheetUnits() /** * Sets timesheet_units * - * @param double $timesheet_units + * @param float|null $timesheet_units * - * @return $this + * @return self */ public function setTimesheetUnits($timesheet_units) { + if (is_null($timesheet_units)) { + throw new \InvalidArgumentException('non-nullable timesheet_units cannot be null'); + } $this->container['timesheet_units'] = $timesheet_units; return $this; @@ -1095,7 +1299,7 @@ public function setTimesheetUnits($timesheet_units) /** * Gets timesheet_unit_type * - * @return string + * @return string|null */ public function getTimesheetUnitType() { @@ -1105,12 +1309,15 @@ public function getTimesheetUnitType() /** * Sets timesheet_unit_type * - * @param string $timesheet_unit_type + * @param string|null $timesheet_unit_type * - * @return $this + * @return self */ public function setTimesheetUnitType($timesheet_unit_type) { + if (is_null($timesheet_unit_type)) { + throw new \InvalidArgumentException('non-nullable timesheet_unit_type cannot be null'); + } $this->container['timesheet_unit_type'] = $timesheet_unit_type; return $this; @@ -1119,7 +1326,7 @@ public function setTimesheetUnitType($timesheet_unit_type) /** * Gets timesheet_cost * - * @return double + * @return float|null */ public function getTimesheetCost() { @@ -1129,12 +1336,15 @@ public function getTimesheetCost() /** * Sets timesheet_cost * - * @param double $timesheet_cost + * @param float|null $timesheet_cost * - * @return $this + * @return self */ public function setTimesheetCost($timesheet_cost) { + if (is_null($timesheet_cost)) { + throw new \InvalidArgumentException('non-nullable timesheet_cost cannot be null'); + } $this->container['timesheet_cost'] = $timesheet_cost; return $this; @@ -1143,7 +1353,7 @@ public function setTimesheetCost($timesheet_cost) /** * Gets time_variance * - * @return string + * @return string|null */ public function getTimeVariance() { @@ -1153,12 +1363,15 @@ public function getTimeVariance() /** * Sets time_variance * - * @param string $time_variance + * @param string|null $time_variance * - * @return $this + * @return self */ public function setTimeVariance($time_variance) { + if (is_null($time_variance)) { + throw new \InvalidArgumentException('non-nullable time_variance cannot be null'); + } $this->container['time_variance'] = $time_variance; return $this; @@ -1167,7 +1380,7 @@ public function setTimeVariance($time_variance) /** * Gets cost_variance * - * @return double + * @return float|null */ public function getCostVariance() { @@ -1177,12 +1390,15 @@ public function getCostVariance() /** * Sets cost_variance * - * @param double $cost_variance + * @param float|null $cost_variance * - * @return $this + * @return self */ public function setCostVariance($cost_variance) { + if (is_null($cost_variance)) { + throw new \InvalidArgumentException('non-nullable cost_variance cannot be null'); + } $this->container['cost_variance'] = $cost_variance; return $this; @@ -1194,7 +1410,7 @@ public function setCostVariance($cost_variance) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1204,22 +1420,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1235,11 +1452,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1247,13 +1477,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuRosterTimesheetComparisonReportRequestModel.php b/src/lib/Model/AuRosterTimesheetComparisonReportRequestModel.php index 2d01f99..e9fce8e 100644 --- a/src/lib/Model/AuRosterTimesheetComparisonReportRequestModel.php +++ b/src/lib/Model/AuRosterTimesheetComparisonReportRequestModel.php @@ -2,61 +2,61 @@ /** * AuRosterTimesheetComparisonReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuRosterTimesheetComparisonReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuRosterTimesheetComparisonReportRequestModel implements ModelInterface, ArrayAccess +class AuRosterTimesheetComparisonReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuRosterTimesheetComparisonReportRequestModel'; + protected static $openAPIModelName = 'AuRosterTimesheetComparisonReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employment_type_id' => 'int', 'employee_id' => 'int', 'include_costs' => 'bool', @@ -77,8 +77,10 @@ class AuRosterTimesheetComparisonReportRequestModel implements ModelInterface, A * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employment_type_id' => 'int32', 'employee_id' => 'int32', 'include_costs' => null, @@ -95,14 +97,43 @@ class AuRosterTimesheetComparisonReportRequestModel implements ModelInterface, A 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employment_type_id' => false, + 'employee_id' => false, + 'include_costs' => false, + 'timesheet_statuses' => false, + 'work_type_id' => false, + 'roster_location_id' => false, + 'timesheet_location_id' => false, + 'roster_statuses' => false, + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,21 +303,19 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TIMESHEET_STATUSES_MISSING = 'Missing'; - const TIMESHEET_STATUSES_SUBMITTED = 'Submitted'; - const TIMESHEET_STATUSES_APPROVED = 'Approved'; - const TIMESHEET_STATUSES_REJECTED = 'Rejected'; - const TIMESHEET_STATUSES_PROCESSED = 'Processed'; - const ROSTER_STATUSES_ALL = 'All'; - const ROSTER_STATUSES_PUBLISHED = 'Published'; - const ROSTER_STATUSES_UNPUBLISHED = 'Unpublished'; - const ROSTER_STATUSES_ACCEPTED = 'Accepted'; - + public const TIMESHEET_STATUSES_MISSING = 'Missing'; + public const TIMESHEET_STATUSES_SUBMITTED = 'Submitted'; + public const TIMESHEET_STATUSES_APPROVED = 'Approved'; + public const TIMESHEET_STATUSES_REJECTED = 'Rejected'; + public const TIMESHEET_STATUSES_PROCESSED = 'Processed'; + public const ROSTER_STATUSES_ALL = 'All'; + public const ROSTER_STATUSES_PUBLISHED = 'Published'; + public const ROSTER_STATUSES_UNPUBLISHED = 'Unpublished'; + public const ROSTER_STATUSES_ACCEPTED = 'Accepted'; - /** * Gets allowable values of the enum * @@ -250,7 +331,7 @@ public function getTimesheetStatusesAllowableValues() self::TIMESHEET_STATUSES_PROCESSED, ]; } - + /** * Gets allowable values of the enum * @@ -265,7 +346,6 @@ public function getRosterStatusesAllowableValues() self::ROSTER_STATUSES_ACCEPTED, ]; } - /** * Associative array for storing property values @@ -282,20 +362,38 @@ public function getRosterStatusesAllowableValues() */ public function __construct(array $data = null) { - $this->container['employment_type_id'] = isset($data['employment_type_id']) ? $data['employment_type_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['include_costs'] = isset($data['include_costs']) ? $data['include_costs'] : null; - $this->container['timesheet_statuses'] = isset($data['timesheet_statuses']) ? $data['timesheet_statuses'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['roster_location_id'] = isset($data['roster_location_id']) ? $data['roster_location_id'] : null; - $this->container['timesheet_location_id'] = isset($data['timesheet_location_id']) ? $data['timesheet_location_id'] : null; - $this->container['roster_statuses'] = isset($data['roster_statuses']) ? $data['roster_statuses'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employment_type_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('include_costs', $data ?? [], null); + $this->setIfExists('timesheet_statuses', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('roster_location_id', $data ?? [], null); + $this->setIfExists('timesheet_location_id', $data ?? [], null); + $this->setIfExists('roster_statuses', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -325,7 +423,7 @@ public function valid() /** * Gets employment_type_id * - * @return int + * @return int|null */ public function getEmploymentTypeId() { @@ -335,12 +433,15 @@ public function getEmploymentTypeId() /** * Sets employment_type_id * - * @param int $employment_type_id + * @param int|null $employment_type_id * - * @return $this + * @return self */ public function setEmploymentTypeId($employment_type_id) { + if (is_null($employment_type_id)) { + throw new \InvalidArgumentException('non-nullable employment_type_id cannot be null'); + } $this->container['employment_type_id'] = $employment_type_id; return $this; @@ -349,7 +450,7 @@ public function setEmploymentTypeId($employment_type_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -359,12 +460,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -373,7 +477,7 @@ public function setEmployeeId($employee_id) /** * Gets include_costs * - * @return bool + * @return bool|null */ public function getIncludeCosts() { @@ -383,12 +487,15 @@ public function getIncludeCosts() /** * Sets include_costs * - * @param bool $include_costs + * @param bool|null $include_costs * - * @return $this + * @return self */ public function setIncludeCosts($include_costs) { + if (is_null($include_costs)) { + throw new \InvalidArgumentException('non-nullable include_costs cannot be null'); + } $this->container['include_costs'] = $include_costs; return $this; @@ -397,7 +504,7 @@ public function setIncludeCosts($include_costs) /** * Gets timesheet_statuses * - * @return string[] + * @return string[]|null */ public function getTimesheetStatuses() { @@ -407,14 +514,17 @@ public function getTimesheetStatuses() /** * Sets timesheet_statuses * - * @param string[] $timesheet_statuses + * @param string[]|null $timesheet_statuses * - * @return $this + * @return self */ public function setTimesheetStatuses($timesheet_statuses) { + if (is_null($timesheet_statuses)) { + throw new \InvalidArgumentException('non-nullable timesheet_statuses cannot be null'); + } $allowedValues = $this->getTimesheetStatusesAllowableValues(); - if (!is_null($timesheet_statuses) && array_diff($timesheet_statuses, $allowedValues)) { + if (array_diff($timesheet_statuses, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'timesheet_statuses', must be one of '%s'", @@ -430,7 +540,7 @@ public function setTimesheetStatuses($timesheet_statuses) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -440,12 +550,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -454,7 +567,7 @@ public function setWorkTypeId($work_type_id) /** * Gets roster_location_id * - * @return int + * @return int|null */ public function getRosterLocationId() { @@ -464,12 +577,15 @@ public function getRosterLocationId() /** * Sets roster_location_id * - * @param int $roster_location_id + * @param int|null $roster_location_id * - * @return $this + * @return self */ public function setRosterLocationId($roster_location_id) { + if (is_null($roster_location_id)) { + throw new \InvalidArgumentException('non-nullable roster_location_id cannot be null'); + } $this->container['roster_location_id'] = $roster_location_id; return $this; @@ -478,7 +594,7 @@ public function setRosterLocationId($roster_location_id) /** * Gets timesheet_location_id * - * @return int + * @return int|null */ public function getTimesheetLocationId() { @@ -488,12 +604,15 @@ public function getTimesheetLocationId() /** * Sets timesheet_location_id * - * @param int $timesheet_location_id + * @param int|null $timesheet_location_id * - * @return $this + * @return self */ public function setTimesheetLocationId($timesheet_location_id) { + if (is_null($timesheet_location_id)) { + throw new \InvalidArgumentException('non-nullable timesheet_location_id cannot be null'); + } $this->container['timesheet_location_id'] = $timesheet_location_id; return $this; @@ -502,7 +621,7 @@ public function setTimesheetLocationId($timesheet_location_id) /** * Gets roster_statuses * - * @return string[] + * @return string[]|null */ public function getRosterStatuses() { @@ -512,14 +631,17 @@ public function getRosterStatuses() /** * Sets roster_statuses * - * @param string[] $roster_statuses + * @param string[]|null $roster_statuses * - * @return $this + * @return self */ public function setRosterStatuses($roster_statuses) { + if (is_null($roster_statuses)) { + throw new \InvalidArgumentException('non-nullable roster_statuses cannot be null'); + } $allowedValues = $this->getRosterStatusesAllowableValues(); - if (!is_null($roster_statuses) && array_diff($roster_statuses, $allowedValues)) { + if (array_diff($roster_statuses, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'roster_statuses', must be one of '%s'", @@ -535,7 +657,7 @@ public function setRosterStatuses($roster_statuses) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -545,12 +667,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -559,7 +684,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -569,12 +694,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -583,7 +711,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -593,12 +721,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -607,7 +738,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -617,12 +748,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -631,7 +765,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -641,12 +775,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -655,7 +792,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -665,12 +802,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -682,7 +822,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -692,22 +832,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -723,11 +864,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -735,13 +889,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuSaveBankAccountResponseModel.php b/src/lib/Model/AuSaveBankAccountResponseModel.php index 9cd674b..adaa929 100644 --- a/src/lib/Model/AuSaveBankAccountResponseModel.php +++ b/src/lib/Model/AuSaveBankAccountResponseModel.php @@ -2,83 +2,102 @@ /** * AuSaveBankAccountResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuSaveBankAccountResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuSaveBankAccountResponseModel implements ModelInterface, ArrayAccess +class AuSaveBankAccountResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuSaveBankAccountResponseModel'; + protected static $openAPIModelName = 'AuSaveBankAccountResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'validation_warning' => 'string', - 'result' => '\Swagger\Client\Model\AuBankAccountModel' + 'result' => '\OpenAPI\Client\Model\AuBankAccountModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'validation_warning' => null, 'result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'validation_warning' => false, + 'result' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['validation_warning'] = isset($data['validation_warning']) ? $data['validation_warning'] : null; - $this->container['result'] = isset($data['result']) ? $data['result'] : null; + $this->setIfExists('validation_warning', $data ?? [], null); + $this->setIfExists('result', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets validation_warning * - * @return string + * @return string|null */ public function getValidationWarning() { @@ -223,12 +309,15 @@ public function getValidationWarning() /** * Sets validation_warning * - * @param string $validation_warning + * @param string|null $validation_warning * - * @return $this + * @return self */ public function setValidationWarning($validation_warning) { + if (is_null($validation_warning)) { + throw new \InvalidArgumentException('non-nullable validation_warning cannot be null'); + } $this->container['validation_warning'] = $validation_warning; return $this; @@ -237,7 +326,7 @@ public function setValidationWarning($validation_warning) /** * Gets result * - * @return \Swagger\Client\Model\AuBankAccountModel + * @return \OpenAPI\Client\Model\AuBankAccountModel|null */ public function getResult() { @@ -247,12 +336,15 @@ public function getResult() /** * Sets result * - * @param \Swagger\Client\Model\AuBankAccountModel $result + * @param \OpenAPI\Client\Model\AuBankAccountModel|null $result result * - * @return $this + * @return self */ public function setResult($result) { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } $this->container['result'] = $result; return $this; @@ -264,7 +356,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuSingleLocationModel.php b/src/lib/Model/AuSingleLocationModel.php index b11e120..2609a21 100644 --- a/src/lib/Model/AuSingleLocationModel.php +++ b/src/lib/Model/AuSingleLocationModel.php @@ -2,62 +2,62 @@ /** * AuSingleLocationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuSingleLocationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuSingleLocationModel implements ModelInterface, ArrayAccess +class AuSingleLocationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuSingleLocationModel'; + protected static $openAPIModelName = 'AuSingleLocationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'nested_locations' => '\Swagger\Client\Model\AuLocationModel[]', + protected static $openAPITypes = [ + 'nested_locations' => '\OpenAPI\Client\Model\AuLocationModel[]', 'country' => 'string', 'id' => 'int', 'parent_id' => 'int', @@ -77,8 +77,10 @@ class AuSingleLocationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'nested_locations' => null, 'country' => null, 'id' => 'int32', @@ -95,14 +97,43 @@ class AuSingleLocationModel implements ModelInterface, ArrayAccess 'state' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'nested_locations' => false, + 'country' => false, + 'id' => false, + 'parent_id' => false, + 'name' => false, + 'external_id' => false, + 'external_accounting_location_id' => false, + 'source' => false, + 'fully_qualified_name' => false, + 'is_global' => false, + 'is_rollup_reporting_location' => false, + 'general_ledger_mapping_code' => false, + 'default_shift_condition_ids' => false, + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,12 +303,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -242,20 +322,38 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['nested_locations'] = isset($data['nested_locations']) ? $data['nested_locations'] : null; - $this->container['country'] = isset($data['country']) ? $data['country'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['external_accounting_location_id'] = isset($data['external_accounting_location_id']) ? $data['external_accounting_location_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['fully_qualified_name'] = isset($data['fully_qualified_name']) ? $data['fully_qualified_name'] : null; - $this->container['is_global'] = isset($data['is_global']) ? $data['is_global'] : null; - $this->container['is_rollup_reporting_location'] = isset($data['is_rollup_reporting_location']) ? $data['is_rollup_reporting_location'] : null; - $this->container['general_ledger_mapping_code'] = isset($data['general_ledger_mapping_code']) ? $data['general_ledger_mapping_code'] : null; - $this->container['default_shift_condition_ids'] = isset($data['default_shift_condition_ids']) ? $data['default_shift_condition_ids'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->setIfExists('nested_locations', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('external_accounting_location_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('fully_qualified_name', $data ?? [], null); + $this->setIfExists('is_global', $data ?? [], null); + $this->setIfExists('is_rollup_reporting_location', $data ?? [], null); + $this->setIfExists('general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('default_shift_condition_ids', $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; } /** @@ -285,7 +383,7 @@ public function valid() /** * Gets nested_locations * - * @return \Swagger\Client\Model\AuLocationModel[] + * @return \OpenAPI\Client\Model\AuLocationModel[]|null */ public function getNestedLocations() { @@ -295,12 +393,15 @@ public function getNestedLocations() /** * Sets nested_locations * - * @param \Swagger\Client\Model\AuLocationModel[] $nested_locations + * @param \OpenAPI\Client\Model\AuLocationModel[]|null $nested_locations * - * @return $this + * @return self */ public function setNestedLocations($nested_locations) { + if (is_null($nested_locations)) { + throw new \InvalidArgumentException('non-nullable nested_locations cannot be null'); + } $this->container['nested_locations'] = $nested_locations; return $this; @@ -309,7 +410,7 @@ public function setNestedLocations($nested_locations) /** * Gets country * - * @return string + * @return string|null */ public function getCountry() { @@ -319,12 +420,15 @@ public function getCountry() /** * Sets country * - * @param string $country + * @param string|null $country * - * @return $this + * @return self */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -333,7 +437,7 @@ public function setCountry($country) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +447,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +464,7 @@ public function setId($id) /** * Gets parent_id * - * @return int + * @return int|null */ public function getParentId() { @@ -367,12 +474,15 @@ public function getParentId() /** * Sets parent_id * - * @param int $parent_id + * @param int|null $parent_id * - * @return $this + * @return self */ public function setParentId($parent_id) { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } $this->container['parent_id'] = $parent_id; return $this; @@ -381,7 +491,7 @@ public function setParentId($parent_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -391,12 +501,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -405,7 +518,7 @@ public function setName($name) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -415,12 +528,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -429,7 +545,7 @@ public function setExternalId($external_id) /** * Gets external_accounting_location_id * - * @return string + * @return string|null */ public function getExternalAccountingLocationId() { @@ -439,12 +555,15 @@ public function getExternalAccountingLocationId() /** * Sets external_accounting_location_id * - * @param string $external_accounting_location_id + * @param string|null $external_accounting_location_id * - * @return $this + * @return self */ public function setExternalAccountingLocationId($external_accounting_location_id) { + if (is_null($external_accounting_location_id)) { + throw new \InvalidArgumentException('non-nullable external_accounting_location_id cannot be null'); + } $this->container['external_accounting_location_id'] = $external_accounting_location_id; return $this; @@ -453,7 +572,7 @@ public function setExternalAccountingLocationId($external_accounting_location_id /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -463,12 +582,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -477,7 +599,7 @@ public function setSource($source) /** * Gets fully_qualified_name * - * @return string + * @return string|null */ public function getFullyQualifiedName() { @@ -487,12 +609,15 @@ public function getFullyQualifiedName() /** * Sets fully_qualified_name * - * @param string $fully_qualified_name + * @param string|null $fully_qualified_name * - * @return $this + * @return self */ public function setFullyQualifiedName($fully_qualified_name) { + if (is_null($fully_qualified_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_name cannot be null'); + } $this->container['fully_qualified_name'] = $fully_qualified_name; return $this; @@ -501,7 +626,7 @@ public function setFullyQualifiedName($fully_qualified_name) /** * Gets is_global * - * @return bool + * @return bool|null */ public function getIsGlobal() { @@ -511,12 +636,15 @@ public function getIsGlobal() /** * Sets is_global * - * @param bool $is_global + * @param bool|null $is_global * - * @return $this + * @return self */ public function setIsGlobal($is_global) { + if (is_null($is_global)) { + throw new \InvalidArgumentException('non-nullable is_global cannot be null'); + } $this->container['is_global'] = $is_global; return $this; @@ -525,7 +653,7 @@ public function setIsGlobal($is_global) /** * Gets is_rollup_reporting_location * - * @return bool + * @return bool|null */ public function getIsRollupReportingLocation() { @@ -535,12 +663,15 @@ public function getIsRollupReportingLocation() /** * Sets is_rollup_reporting_location * - * @param bool $is_rollup_reporting_location + * @param bool|null $is_rollup_reporting_location * - * @return $this + * @return self */ public function setIsRollupReportingLocation($is_rollup_reporting_location) { + if (is_null($is_rollup_reporting_location)) { + throw new \InvalidArgumentException('non-nullable is_rollup_reporting_location cannot be null'); + } $this->container['is_rollup_reporting_location'] = $is_rollup_reporting_location; return $this; @@ -549,7 +680,7 @@ public function setIsRollupReportingLocation($is_rollup_reporting_location) /** * Gets general_ledger_mapping_code * - * @return string + * @return string|null */ public function getGeneralLedgerMappingCode() { @@ -559,12 +690,15 @@ public function getGeneralLedgerMappingCode() /** * Sets general_ledger_mapping_code * - * @param string $general_ledger_mapping_code + * @param string|null $general_ledger_mapping_code * - * @return $this + * @return self */ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) { + if (is_null($general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable general_ledger_mapping_code cannot be null'); + } $this->container['general_ledger_mapping_code'] = $general_ledger_mapping_code; return $this; @@ -573,7 +707,7 @@ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) /** * Gets default_shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getDefaultShiftConditionIds() { @@ -583,12 +717,15 @@ public function getDefaultShiftConditionIds() /** * Sets default_shift_condition_ids * - * @param int[] $default_shift_condition_ids + * @param int[]|null $default_shift_condition_ids * - * @return $this + * @return self */ public function setDefaultShiftConditionIds($default_shift_condition_ids) { + if (is_null($default_shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable default_shift_condition_ids cannot be null'); + } $this->container['default_shift_condition_ids'] = $default_shift_condition_ids; return $this; @@ -597,7 +734,7 @@ public function setDefaultShiftConditionIds($default_shift_condition_ids) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -607,12 +744,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -624,7 +764,7 @@ public function setState($state) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -634,22 +774,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -665,11 +806,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -677,13 +831,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuSmsfElectronicServiceAddressModel.php b/src/lib/Model/AuSmsfElectronicServiceAddressModel.php index e54a4b5..e636304 100644 --- a/src/lib/Model/AuSmsfElectronicServiceAddressModel.php +++ b/src/lib/Model/AuSmsfElectronicServiceAddressModel.php @@ -2,61 +2,61 @@ /** * AuSmsfElectronicServiceAddressModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuSmsfElectronicServiceAddressModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuSmsfElectronicServiceAddressModel implements ModelInterface, ArrayAccess +class AuSmsfElectronicServiceAddressModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuSmsfElectronicServiceAddressModel'; + protected static $openAPIModelName = 'AuSmsfElectronicServiceAddressModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string' ]; @@ -64,19 +64,37 @@ class AuSmsfElectronicServiceAddressModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : 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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -217,12 +302,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -234,7 +322,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuStpRegistrationModel.php b/src/lib/Model/AuStpRegistrationModel.php index 769e088..4c68a74 100644 --- a/src/lib/Model/AuStpRegistrationModel.php +++ b/src/lib/Model/AuStpRegistrationModel.php @@ -2,61 +2,61 @@ /** * AuStpRegistrationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuStpRegistrationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuStpRegistrationModel implements ModelInterface, ArrayAccess +class AuStpRegistrationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuStpRegistrationModel'; + protected static $openAPIModelName = 'AuStpRegistrationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', 'branch' => 'string', 'abn' => 'string', @@ -85,8 +85,10 @@ class AuStpRegistrationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'branch' => null, 'abn' => null, @@ -111,14 +113,51 @@ class AuStpRegistrationModel implements ModelInterface, ArrayAccess 'single_touch_payroll_enabled' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'branch' => false, + 'abn' => false, + 'contact_name' => false, + 'contact_phone_number' => false, + 'contact_email_address' => false, + 'address_line1' => false, + 'address_line2' => false, + 'suburb_id' => false, + 'suburb' => false, + 'post_code' => false, + 'state' => false, + 'lodgement_role' => false, + 'tax_agent_number' => false, + 'intermediary_abn' => false, + 'intermediary_contact_name' => false, + 'intermediary_contact_email' => false, + 'intermediary_contact_phone' => false, + 'ato_integration_option' => false, + 'sbr_software_id' => false, + 'sbr_enabled' => false, + 'single_touch_payroll_enabled' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -126,9 +165,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -260,17 +351,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const LODGEMENT_ROLE_EMPLOYER = 'Employer'; - const LODGEMENT_ROLE_REGISTERED_TAX_AGENT = 'RegisteredTaxAgent'; - const LODGEMENT_ROLE_INTERMEDIARY = 'Intermediary'; - const ATO_INTEGRATION_OPTION_PHONE = 'Phone'; - const ATO_INTEGRATION_OPTION_ACCESS_MANAGER = 'AccessManager'; - + public const LODGEMENT_ROLE_EMPLOYER = 'Employer'; + public const LODGEMENT_ROLE_REGISTERED_TAX_AGENT = 'RegisteredTaxAgent'; + public const LODGEMENT_ROLE_INTERMEDIARY = 'Intermediary'; + public const ATO_INTEGRATION_OPTION_PHONE = 'Phone'; + public const ATO_INTEGRATION_OPTION_ACCESS_MANAGER = 'AccessManager'; - /** * Gets allowable values of the enum * @@ -284,7 +373,7 @@ public function getLodgementRoleAllowableValues() self::LODGEMENT_ROLE_INTERMEDIARY, ]; } - + /** * Gets allowable values of the enum * @@ -297,7 +386,6 @@ public function getAtoIntegrationOptionAllowableValues() self::ATO_INTEGRATION_OPTION_ACCESS_MANAGER, ]; } - /** * Associative array for storing property values @@ -314,28 +402,46 @@ public function getAtoIntegrationOptionAllowableValues() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['branch'] = isset($data['branch']) ? $data['branch'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['contact_name'] = isset($data['contact_name']) ? $data['contact_name'] : null; - $this->container['contact_phone_number'] = isset($data['contact_phone_number']) ? $data['contact_phone_number'] : null; - $this->container['contact_email_address'] = isset($data['contact_email_address']) ? $data['contact_email_address'] : null; - $this->container['address_line1'] = isset($data['address_line1']) ? $data['address_line1'] : null; - $this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null; - $this->container['suburb_id'] = isset($data['suburb_id']) ? $data['suburb_id'] : null; - $this->container['suburb'] = isset($data['suburb']) ? $data['suburb'] : null; - $this->container['post_code'] = isset($data['post_code']) ? $data['post_code'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['lodgement_role'] = isset($data['lodgement_role']) ? $data['lodgement_role'] : null; - $this->container['tax_agent_number'] = isset($data['tax_agent_number']) ? $data['tax_agent_number'] : null; - $this->container['intermediary_abn'] = isset($data['intermediary_abn']) ? $data['intermediary_abn'] : null; - $this->container['intermediary_contact_name'] = isset($data['intermediary_contact_name']) ? $data['intermediary_contact_name'] : null; - $this->container['intermediary_contact_email'] = isset($data['intermediary_contact_email']) ? $data['intermediary_contact_email'] : null; - $this->container['intermediary_contact_phone'] = isset($data['intermediary_contact_phone']) ? $data['intermediary_contact_phone'] : null; - $this->container['ato_integration_option'] = isset($data['ato_integration_option']) ? $data['ato_integration_option'] : null; - $this->container['sbr_software_id'] = isset($data['sbr_software_id']) ? $data['sbr_software_id'] : null; - $this->container['sbr_enabled'] = isset($data['sbr_enabled']) ? $data['sbr_enabled'] : null; - $this->container['single_touch_payroll_enabled'] = isset($data['single_touch_payroll_enabled']) ? $data['single_touch_payroll_enabled'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('branch', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('contact_name', $data ?? [], null); + $this->setIfExists('contact_phone_number', $data ?? [], null); + $this->setIfExists('contact_email_address', $data ?? [], null); + $this->setIfExists('address_line1', $data ?? [], null); + $this->setIfExists('address_line2', $data ?? [], null); + $this->setIfExists('suburb_id', $data ?? [], null); + $this->setIfExists('suburb', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('lodgement_role', $data ?? [], null); + $this->setIfExists('tax_agent_number', $data ?? [], null); + $this->setIfExists('intermediary_abn', $data ?? [], null); + $this->setIfExists('intermediary_contact_name', $data ?? [], null); + $this->setIfExists('intermediary_contact_email', $data ?? [], null); + $this->setIfExists('intermediary_contact_phone', $data ?? [], null); + $this->setIfExists('ato_integration_option', $data ?? [], null); + $this->setIfExists('sbr_software_id', $data ?? [], null); + $this->setIfExists('sbr_enabled', $data ?? [], null); + $this->setIfExists('single_touch_payroll_enabled', $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; } /** @@ -350,7 +456,8 @@ public function listInvalidProperties() $allowedValues = $this->getLodgementRoleAllowableValues(); if (!is_null($this->container['lodgement_role']) && !in_array($this->container['lodgement_role'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'lodgement_role', must be one of '%s'", + "invalid value '%s' for 'lodgement_role', must be one of '%s'", + $this->container['lodgement_role'], implode("', '", $allowedValues) ); } @@ -358,7 +465,8 @@ public function listInvalidProperties() $allowedValues = $this->getAtoIntegrationOptionAllowableValues(); if (!is_null($this->container['ato_integration_option']) && !in_array($this->container['ato_integration_option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'ato_integration_option', must be one of '%s'", + "invalid value '%s' for 'ato_integration_option', must be one of '%s'", + $this->container['ato_integration_option'], implode("', '", $allowedValues) ); } @@ -381,7 +489,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -391,12 +499,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -405,7 +516,7 @@ public function setName($name) /** * Gets branch * - * @return string + * @return string|null */ public function getBranch() { @@ -415,12 +526,15 @@ public function getBranch() /** * Sets branch * - * @param string $branch + * @param string|null $branch * - * @return $this + * @return self */ public function setBranch($branch) { + if (is_null($branch)) { + throw new \InvalidArgumentException('non-nullable branch cannot be null'); + } $this->container['branch'] = $branch; return $this; @@ -429,7 +543,7 @@ public function setBranch($branch) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -439,12 +553,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -453,7 +570,7 @@ public function setAbn($abn) /** * Gets contact_name * - * @return string + * @return string|null */ public function getContactName() { @@ -463,12 +580,15 @@ public function getContactName() /** * Sets contact_name * - * @param string $contact_name + * @param string|null $contact_name * - * @return $this + * @return self */ public function setContactName($contact_name) { + if (is_null($contact_name)) { + throw new \InvalidArgumentException('non-nullable contact_name cannot be null'); + } $this->container['contact_name'] = $contact_name; return $this; @@ -477,7 +597,7 @@ public function setContactName($contact_name) /** * Gets contact_phone_number * - * @return string + * @return string|null */ public function getContactPhoneNumber() { @@ -487,12 +607,15 @@ public function getContactPhoneNumber() /** * Sets contact_phone_number * - * @param string $contact_phone_number + * @param string|null $contact_phone_number * - * @return $this + * @return self */ public function setContactPhoneNumber($contact_phone_number) { + if (is_null($contact_phone_number)) { + throw new \InvalidArgumentException('non-nullable contact_phone_number cannot be null'); + } $this->container['contact_phone_number'] = $contact_phone_number; return $this; @@ -501,7 +624,7 @@ public function setContactPhoneNumber($contact_phone_number) /** * Gets contact_email_address * - * @return string + * @return string|null */ public function getContactEmailAddress() { @@ -511,12 +634,15 @@ public function getContactEmailAddress() /** * Sets contact_email_address * - * @param string $contact_email_address + * @param string|null $contact_email_address * - * @return $this + * @return self */ public function setContactEmailAddress($contact_email_address) { + if (is_null($contact_email_address)) { + throw new \InvalidArgumentException('non-nullable contact_email_address cannot be null'); + } $this->container['contact_email_address'] = $contact_email_address; return $this; @@ -525,7 +651,7 @@ public function setContactEmailAddress($contact_email_address) /** * Gets address_line1 * - * @return string + * @return string|null */ public function getAddressLine1() { @@ -535,12 +661,15 @@ public function getAddressLine1() /** * Sets address_line1 * - * @param string $address_line1 + * @param string|null $address_line1 * - * @return $this + * @return self */ public function setAddressLine1($address_line1) { + if (is_null($address_line1)) { + throw new \InvalidArgumentException('non-nullable address_line1 cannot be null'); + } $this->container['address_line1'] = $address_line1; return $this; @@ -549,7 +678,7 @@ public function setAddressLine1($address_line1) /** * Gets address_line2 * - * @return string + * @return string|null */ public function getAddressLine2() { @@ -559,12 +688,15 @@ public function getAddressLine2() /** * Sets address_line2 * - * @param string $address_line2 + * @param string|null $address_line2 * - * @return $this + * @return self */ public function setAddressLine2($address_line2) { + if (is_null($address_line2)) { + throw new \InvalidArgumentException('non-nullable address_line2 cannot be null'); + } $this->container['address_line2'] = $address_line2; return $this; @@ -573,7 +705,7 @@ public function setAddressLine2($address_line2) /** * Gets suburb_id * - * @return int + * @return int|null */ public function getSuburbId() { @@ -583,12 +715,15 @@ public function getSuburbId() /** * Sets suburb_id * - * @param int $suburb_id + * @param int|null $suburb_id * - * @return $this + * @return self */ public function setSuburbId($suburb_id) { + if (is_null($suburb_id)) { + throw new \InvalidArgumentException('non-nullable suburb_id cannot be null'); + } $this->container['suburb_id'] = $suburb_id; return $this; @@ -597,7 +732,7 @@ public function setSuburbId($suburb_id) /** * Gets suburb * - * @return string + * @return string|null */ public function getSuburb() { @@ -607,12 +742,15 @@ public function getSuburb() /** * Sets suburb * - * @param string $suburb + * @param string|null $suburb * - * @return $this + * @return self */ public function setSuburb($suburb) { + if (is_null($suburb)) { + throw new \InvalidArgumentException('non-nullable suburb cannot be null'); + } $this->container['suburb'] = $suburb; return $this; @@ -621,7 +759,7 @@ public function setSuburb($suburb) /** * Gets post_code * - * @return string + * @return string|null */ public function getPostCode() { @@ -631,12 +769,15 @@ public function getPostCode() /** * Sets post_code * - * @param string $post_code + * @param string|null $post_code * - * @return $this + * @return self */ public function setPostCode($post_code) { + if (is_null($post_code)) { + throw new \InvalidArgumentException('non-nullable post_code cannot be null'); + } $this->container['post_code'] = $post_code; return $this; @@ -645,7 +786,7 @@ public function setPostCode($post_code) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -655,12 +796,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -669,7 +813,7 @@ public function setState($state) /** * Gets lodgement_role * - * @return string + * @return string|null */ public function getLodgementRole() { @@ -679,17 +823,21 @@ public function getLodgementRole() /** * Sets lodgement_role * - * @param string $lodgement_role + * @param string|null $lodgement_role * - * @return $this + * @return self */ public function setLodgementRole($lodgement_role) { + if (is_null($lodgement_role)) { + throw new \InvalidArgumentException('non-nullable lodgement_role cannot be null'); + } $allowedValues = $this->getLodgementRoleAllowableValues(); - if (!is_null($lodgement_role) && !in_array($lodgement_role, $allowedValues, true)) { + if (!in_array($lodgement_role, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'lodgement_role', must be one of '%s'", + "Invalid value '%s' for 'lodgement_role', must be one of '%s'", + $lodgement_role, implode("', '", $allowedValues) ) ); @@ -702,7 +850,7 @@ public function setLodgementRole($lodgement_role) /** * Gets tax_agent_number * - * @return string + * @return string|null */ public function getTaxAgentNumber() { @@ -712,12 +860,15 @@ public function getTaxAgentNumber() /** * Sets tax_agent_number * - * @param string $tax_agent_number + * @param string|null $tax_agent_number * - * @return $this + * @return self */ public function setTaxAgentNumber($tax_agent_number) { + if (is_null($tax_agent_number)) { + throw new \InvalidArgumentException('non-nullable tax_agent_number cannot be null'); + } $this->container['tax_agent_number'] = $tax_agent_number; return $this; @@ -726,7 +877,7 @@ public function setTaxAgentNumber($tax_agent_number) /** * Gets intermediary_abn * - * @return string + * @return string|null */ public function getIntermediaryAbn() { @@ -736,12 +887,15 @@ public function getIntermediaryAbn() /** * Sets intermediary_abn * - * @param string $intermediary_abn + * @param string|null $intermediary_abn * - * @return $this + * @return self */ public function setIntermediaryAbn($intermediary_abn) { + if (is_null($intermediary_abn)) { + throw new \InvalidArgumentException('non-nullable intermediary_abn cannot be null'); + } $this->container['intermediary_abn'] = $intermediary_abn; return $this; @@ -750,7 +904,7 @@ public function setIntermediaryAbn($intermediary_abn) /** * Gets intermediary_contact_name * - * @return string + * @return string|null */ public function getIntermediaryContactName() { @@ -760,12 +914,15 @@ public function getIntermediaryContactName() /** * Sets intermediary_contact_name * - * @param string $intermediary_contact_name + * @param string|null $intermediary_contact_name * - * @return $this + * @return self */ public function setIntermediaryContactName($intermediary_contact_name) { + if (is_null($intermediary_contact_name)) { + throw new \InvalidArgumentException('non-nullable intermediary_contact_name cannot be null'); + } $this->container['intermediary_contact_name'] = $intermediary_contact_name; return $this; @@ -774,7 +931,7 @@ public function setIntermediaryContactName($intermediary_contact_name) /** * Gets intermediary_contact_email * - * @return string + * @return string|null */ public function getIntermediaryContactEmail() { @@ -784,12 +941,15 @@ public function getIntermediaryContactEmail() /** * Sets intermediary_contact_email * - * @param string $intermediary_contact_email + * @param string|null $intermediary_contact_email * - * @return $this + * @return self */ public function setIntermediaryContactEmail($intermediary_contact_email) { + if (is_null($intermediary_contact_email)) { + throw new \InvalidArgumentException('non-nullable intermediary_contact_email cannot be null'); + } $this->container['intermediary_contact_email'] = $intermediary_contact_email; return $this; @@ -798,7 +958,7 @@ public function setIntermediaryContactEmail($intermediary_contact_email) /** * Gets intermediary_contact_phone * - * @return string + * @return string|null */ public function getIntermediaryContactPhone() { @@ -808,12 +968,15 @@ public function getIntermediaryContactPhone() /** * Sets intermediary_contact_phone * - * @param string $intermediary_contact_phone + * @param string|null $intermediary_contact_phone * - * @return $this + * @return self */ public function setIntermediaryContactPhone($intermediary_contact_phone) { + if (is_null($intermediary_contact_phone)) { + throw new \InvalidArgumentException('non-nullable intermediary_contact_phone cannot be null'); + } $this->container['intermediary_contact_phone'] = $intermediary_contact_phone; return $this; @@ -822,7 +985,7 @@ public function setIntermediaryContactPhone($intermediary_contact_phone) /** * Gets ato_integration_option * - * @return string + * @return string|null */ public function getAtoIntegrationOption() { @@ -832,17 +995,21 @@ public function getAtoIntegrationOption() /** * Sets ato_integration_option * - * @param string $ato_integration_option + * @param string|null $ato_integration_option * - * @return $this + * @return self */ public function setAtoIntegrationOption($ato_integration_option) { + if (is_null($ato_integration_option)) { + throw new \InvalidArgumentException('non-nullable ato_integration_option cannot be null'); + } $allowedValues = $this->getAtoIntegrationOptionAllowableValues(); - if (!is_null($ato_integration_option) && !in_array($ato_integration_option, $allowedValues, true)) { + if (!in_array($ato_integration_option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'ato_integration_option', must be one of '%s'", + "Invalid value '%s' for 'ato_integration_option', must be one of '%s'", + $ato_integration_option, implode("', '", $allowedValues) ) ); @@ -855,7 +1022,7 @@ public function setAtoIntegrationOption($ato_integration_option) /** * Gets sbr_software_id * - * @return string + * @return string|null */ public function getSbrSoftwareId() { @@ -865,12 +1032,15 @@ public function getSbrSoftwareId() /** * Sets sbr_software_id * - * @param string $sbr_software_id + * @param string|null $sbr_software_id * - * @return $this + * @return self */ public function setSbrSoftwareId($sbr_software_id) { + if (is_null($sbr_software_id)) { + throw new \InvalidArgumentException('non-nullable sbr_software_id cannot be null'); + } $this->container['sbr_software_id'] = $sbr_software_id; return $this; @@ -879,7 +1049,7 @@ public function setSbrSoftwareId($sbr_software_id) /** * Gets sbr_enabled * - * @return bool + * @return bool|null */ public function getSbrEnabled() { @@ -889,12 +1059,15 @@ public function getSbrEnabled() /** * Sets sbr_enabled * - * @param bool $sbr_enabled + * @param bool|null $sbr_enabled * - * @return $this + * @return self */ public function setSbrEnabled($sbr_enabled) { + if (is_null($sbr_enabled)) { + throw new \InvalidArgumentException('non-nullable sbr_enabled cannot be null'); + } $this->container['sbr_enabled'] = $sbr_enabled; return $this; @@ -903,7 +1076,7 @@ public function setSbrEnabled($sbr_enabled) /** * Gets single_touch_payroll_enabled * - * @return bool + * @return bool|null */ public function getSingleTouchPayrollEnabled() { @@ -913,12 +1086,15 @@ public function getSingleTouchPayrollEnabled() /** * Sets single_touch_payroll_enabled * - * @param bool $single_touch_payroll_enabled + * @param bool|null $single_touch_payroll_enabled * - * @return $this + * @return self */ public function setSingleTouchPayrollEnabled($single_touch_payroll_enabled) { + if (is_null($single_touch_payroll_enabled)) { + throw new \InvalidArgumentException('non-nullable single_touch_payroll_enabled cannot be null'); + } $this->container['single_touch_payroll_enabled'] = $single_touch_payroll_enabled; return $this; @@ -930,7 +1106,7 @@ public function setSingleTouchPayrollEnabled($single_touch_payroll_enabled) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -940,22 +1116,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -971,11 +1148,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -983,13 +1173,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuSubmitPayRunEarningsLineRequest.php b/src/lib/Model/AuSubmitPayRunEarningsLineRequest.php index 4ebae52..7a73845 100644 --- a/src/lib/Model/AuSubmitPayRunEarningsLineRequest.php +++ b/src/lib/Model/AuSubmitPayRunEarningsLineRequest.php @@ -2,62 +2,62 @@ /** * AuSubmitPayRunEarningsLineRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuSubmitPayRunEarningsLineRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuSubmitPayRunEarningsLineRequest implements ModelInterface, ArrayAccess +class AuSubmitPayRunEarningsLineRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuSubmitPayRunEarningsLineRequest'; + protected static $openAPIModelName = 'AuSubmitPayRunEarningsLineRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'earnings_lines' => 'map[string,\Swagger\Client\Model\AuEarningsLineModel[]]', + protected static $openAPITypes = [ + 'earnings_lines' => 'array', 'location_id_type' => 'string', 'pay_category_id_type' => 'string', 'pay_run_id' => 'int', @@ -70,8 +70,10 @@ class AuSubmitPayRunEarningsLineRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'earnings_lines' => null, 'location_id_type' => null, 'pay_category_id_type' => null, @@ -81,14 +83,36 @@ class AuSubmitPayRunEarningsLineRequest implements ModelInterface, ArrayAccess 'suppress_calculations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'earnings_lines' => false, + 'location_id_type' => false, + 'pay_category_id_type' => false, + 'pay_run_id' => false, + 'employee_id_type' => false, + 'replace_existing' => false, + 'suppress_calculations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -185,18 +261,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const LOCATION_ID_TYPE_STANDARD = 'Standard'; - const LOCATION_ID_TYPE_EXTERNAL = 'External'; - const PAY_CATEGORY_ID_TYPE_STANDARD = 'Standard'; - const PAY_CATEGORY_ID_TYPE_EXTERNAL = 'External'; - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const LOCATION_ID_TYPE_STANDARD = 'Standard'; + public const LOCATION_ID_TYPE_EXTERNAL = 'External'; + public const PAY_CATEGORY_ID_TYPE_STANDARD = 'Standard'; + public const PAY_CATEGORY_ID_TYPE_EXTERNAL = 'External'; + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -209,7 +283,7 @@ public function getLocationIdTypeAllowableValues() self::LOCATION_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -222,7 +296,7 @@ public function getPayCategoryIdTypeAllowableValues() self::PAY_CATEGORY_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -235,7 +309,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -252,13 +325,31 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['earnings_lines'] = isset($data['earnings_lines']) ? $data['earnings_lines'] : null; - $this->container['location_id_type'] = isset($data['location_id_type']) ? $data['location_id_type'] : null; - $this->container['pay_category_id_type'] = isset($data['pay_category_id_type']) ? $data['pay_category_id_type'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; + $this->setIfExists('earnings_lines', $data ?? [], null); + $this->setIfExists('location_id_type', $data ?? [], null); + $this->setIfExists('pay_category_id_type', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('suppress_calculations', $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; } /** @@ -273,7 +364,8 @@ public function listInvalidProperties() $allowedValues = $this->getLocationIdTypeAllowableValues(); if (!is_null($this->container['location_id_type']) && !in_array($this->container['location_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'location_id_type', must be one of '%s'", + "invalid value '%s' for 'location_id_type', must be one of '%s'", + $this->container['location_id_type'], implode("', '", $allowedValues) ); } @@ -281,7 +373,8 @@ public function listInvalidProperties() $allowedValues = $this->getPayCategoryIdTypeAllowableValues(); if (!is_null($this->container['pay_category_id_type']) && !in_array($this->container['pay_category_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'pay_category_id_type', must be one of '%s'", + "invalid value '%s' for 'pay_category_id_type', must be one of '%s'", + $this->container['pay_category_id_type'], implode("', '", $allowedValues) ); } @@ -289,7 +382,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -312,7 +406,7 @@ public function valid() /** * Gets earnings_lines * - * @return map[string,\Swagger\Client\Model\AuEarningsLineModel[]] + * @return array|null */ public function getEarningsLines() { @@ -322,12 +416,15 @@ public function getEarningsLines() /** * Sets earnings_lines * - * @param map[string,\Swagger\Client\Model\AuEarningsLineModel[]] $earnings_lines + * @param array|null $earnings_lines * - * @return $this + * @return self */ public function setEarningsLines($earnings_lines) { + if (is_null($earnings_lines)) { + throw new \InvalidArgumentException('non-nullable earnings_lines cannot be null'); + } $this->container['earnings_lines'] = $earnings_lines; return $this; @@ -336,7 +433,7 @@ public function setEarningsLines($earnings_lines) /** * Gets location_id_type * - * @return string + * @return string|null */ public function getLocationIdType() { @@ -346,17 +443,21 @@ public function getLocationIdType() /** * Sets location_id_type * - * @param string $location_id_type + * @param string|null $location_id_type * - * @return $this + * @return self */ public function setLocationIdType($location_id_type) { + if (is_null($location_id_type)) { + throw new \InvalidArgumentException('non-nullable location_id_type cannot be null'); + } $allowedValues = $this->getLocationIdTypeAllowableValues(); - if (!is_null($location_id_type) && !in_array($location_id_type, $allowedValues, true)) { + if (!in_array($location_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'location_id_type', must be one of '%s'", + "Invalid value '%s' for 'location_id_type', must be one of '%s'", + $location_id_type, implode("', '", $allowedValues) ) ); @@ -369,7 +470,7 @@ public function setLocationIdType($location_id_type) /** * Gets pay_category_id_type * - * @return string + * @return string|null */ public function getPayCategoryIdType() { @@ -379,17 +480,21 @@ public function getPayCategoryIdType() /** * Sets pay_category_id_type * - * @param string $pay_category_id_type + * @param string|null $pay_category_id_type * - * @return $this + * @return self */ public function setPayCategoryIdType($pay_category_id_type) { + if (is_null($pay_category_id_type)) { + throw new \InvalidArgumentException('non-nullable pay_category_id_type cannot be null'); + } $allowedValues = $this->getPayCategoryIdTypeAllowableValues(); - if (!is_null($pay_category_id_type) && !in_array($pay_category_id_type, $allowedValues, true)) { + if (!in_array($pay_category_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'pay_category_id_type', must be one of '%s'", + "Invalid value '%s' for 'pay_category_id_type', must be one of '%s'", + $pay_category_id_type, implode("', '", $allowedValues) ) ); @@ -402,7 +507,7 @@ public function setPayCategoryIdType($pay_category_id_type) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -412,12 +517,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -426,7 +534,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -436,17 +544,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -459,7 +571,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -469,12 +581,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -483,7 +598,7 @@ public function setReplaceExisting($replace_existing) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -493,12 +608,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -510,7 +628,7 @@ public function setSuppressCalculations($suppress_calculations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -520,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -551,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -563,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuSubmitTimesheetsRequest.php b/src/lib/Model/AuSubmitTimesheetsRequest.php index 7553159..3fb91d1 100644 --- a/src/lib/Model/AuSubmitTimesheetsRequest.php +++ b/src/lib/Model/AuSubmitTimesheetsRequest.php @@ -2,61 +2,61 @@ /** * AuSubmitTimesheetsRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuSubmitTimesheetsRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuSubmitTimesheetsRequest implements ModelInterface, ArrayAccess +class AuSubmitTimesheetsRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuSubmitTimesheetsRequest'; + protected static $openAPIModelName = 'AuSubmitTimesheetsRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime', 'replace_existing' => 'bool', @@ -65,15 +65,17 @@ class AuSubmitTimesheetsRequest implements ModelInterface, ArrayAccess 'location_id_type' => 'string', 'work_type_id_type' => 'string', 'return_response' => 'bool', - 'timesheets' => 'map[string,\Swagger\Client\Model\AuTimesheetLineModel[]]' + 'timesheets' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time', 'replace_existing' => null, @@ -85,14 +87,38 @@ class AuSubmitTimesheetsRequest implements ModelInterface, ArrayAccess 'timesheets' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => false, + 'replace_existing' => false, + 'approved' => false, + 'employee_id_type' => false, + 'location_id_type' => false, + 'work_type_id_type' => false, + 'return_response' => false, + 'timesheets' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,18 +273,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - const LOCATION_ID_TYPE_STANDARD = 'Standard'; - const LOCATION_ID_TYPE_EXTERNAL = 'External'; - const WORK_TYPE_ID_TYPE_STANDARD = 'Standard'; - const WORK_TYPE_ID_TYPE_EXTERNAL = 'External'; - + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; + public const LOCATION_ID_TYPE_STANDARD = 'Standard'; + public const LOCATION_ID_TYPE_EXTERNAL = 'External'; + public const WORK_TYPE_ID_TYPE_STANDARD = 'Standard'; + public const WORK_TYPE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -219,7 +295,7 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -232,7 +308,7 @@ public function getLocationIdTypeAllowableValues() self::LOCATION_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -245,7 +321,6 @@ public function getWorkTypeIdTypeAllowableValues() self::WORK_TYPE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -262,15 +337,33 @@ public function getWorkTypeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['approved'] = isset($data['approved']) ? $data['approved'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['location_id_type'] = isset($data['location_id_type']) ? $data['location_id_type'] : null; - $this->container['work_type_id_type'] = isset($data['work_type_id_type']) ? $data['work_type_id_type'] : null; - $this->container['return_response'] = isset($data['return_response']) ? $data['return_response'] : null; - $this->container['timesheets'] = isset($data['timesheets']) ? $data['timesheets'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('approved', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('location_id_type', $data ?? [], null); + $this->setIfExists('work_type_id_type', $data ?? [], null); + $this->setIfExists('return_response', $data ?? [], null); + $this->setIfExists('timesheets', $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; } /** @@ -285,7 +378,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -293,7 +387,8 @@ public function listInvalidProperties() $allowedValues = $this->getLocationIdTypeAllowableValues(); if (!is_null($this->container['location_id_type']) && !in_array($this->container['location_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'location_id_type', must be one of '%s'", + "invalid value '%s' for 'location_id_type', must be one of '%s'", + $this->container['location_id_type'], implode("', '", $allowedValues) ); } @@ -301,7 +396,8 @@ public function listInvalidProperties() $allowedValues = $this->getWorkTypeIdTypeAllowableValues(); if (!is_null($this->container['work_type_id_type']) && !in_array($this->container['work_type_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'work_type_id_type', must be one of '%s'", + "invalid value '%s' for 'work_type_id_type', must be one of '%s'", + $this->container['work_type_id_type'], implode("', '", $allowedValues) ); } @@ -324,7 +420,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -334,12 +430,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -348,7 +447,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -358,12 +457,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -372,7 +474,7 @@ public function setToDate($to_date) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -382,12 +484,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -396,7 +501,7 @@ public function setReplaceExisting($replace_existing) /** * Gets approved * - * @return bool + * @return bool|null */ public function getApproved() { @@ -406,12 +511,15 @@ public function getApproved() /** * Sets approved * - * @param bool $approved + * @param bool|null $approved * - * @return $this + * @return self */ public function setApproved($approved) { + if (is_null($approved)) { + throw new \InvalidArgumentException('non-nullable approved cannot be null'); + } $this->container['approved'] = $approved; return $this; @@ -420,7 +528,7 @@ public function setApproved($approved) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -430,17 +538,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -453,7 +565,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets location_id_type * - * @return string + * @return string|null */ public function getLocationIdType() { @@ -463,17 +575,21 @@ public function getLocationIdType() /** * Sets location_id_type * - * @param string $location_id_type + * @param string|null $location_id_type * - * @return $this + * @return self */ public function setLocationIdType($location_id_type) { + if (is_null($location_id_type)) { + throw new \InvalidArgumentException('non-nullable location_id_type cannot be null'); + } $allowedValues = $this->getLocationIdTypeAllowableValues(); - if (!is_null($location_id_type) && !in_array($location_id_type, $allowedValues, true)) { + if (!in_array($location_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'location_id_type', must be one of '%s'", + "Invalid value '%s' for 'location_id_type', must be one of '%s'", + $location_id_type, implode("', '", $allowedValues) ) ); @@ -486,7 +602,7 @@ public function setLocationIdType($location_id_type) /** * Gets work_type_id_type * - * @return string + * @return string|null */ public function getWorkTypeIdType() { @@ -496,17 +612,21 @@ public function getWorkTypeIdType() /** * Sets work_type_id_type * - * @param string $work_type_id_type + * @param string|null $work_type_id_type * - * @return $this + * @return self */ public function setWorkTypeIdType($work_type_id_type) { + if (is_null($work_type_id_type)) { + throw new \InvalidArgumentException('non-nullable work_type_id_type cannot be null'); + } $allowedValues = $this->getWorkTypeIdTypeAllowableValues(); - if (!is_null($work_type_id_type) && !in_array($work_type_id_type, $allowedValues, true)) { + if (!in_array($work_type_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'work_type_id_type', must be one of '%s'", + "Invalid value '%s' for 'work_type_id_type', must be one of '%s'", + $work_type_id_type, implode("', '", $allowedValues) ) ); @@ -519,7 +639,7 @@ public function setWorkTypeIdType($work_type_id_type) /** * Gets return_response * - * @return bool + * @return bool|null */ public function getReturnResponse() { @@ -529,12 +649,15 @@ public function getReturnResponse() /** * Sets return_response * - * @param bool $return_response + * @param bool|null $return_response * - * @return $this + * @return self */ public function setReturnResponse($return_response) { + if (is_null($return_response)) { + throw new \InvalidArgumentException('non-nullable return_response cannot be null'); + } $this->container['return_response'] = $return_response; return $this; @@ -543,7 +666,7 @@ public function setReturnResponse($return_response) /** * Gets timesheets * - * @return map[string,\Swagger\Client\Model\AuTimesheetLineModel[]] + * @return array|null */ public function getTimesheets() { @@ -553,12 +676,15 @@ public function getTimesheets() /** * Sets timesheets * - * @param map[string,\Swagger\Client\Model\AuTimesheetLineModel[]] $timesheets + * @param array|null $timesheets * - * @return $this + * @return self */ public function setTimesheets($timesheets) { + if (is_null($timesheets)) { + throw new \InvalidArgumentException('non-nullable timesheets cannot be null'); + } $this->container['timesheets'] = $timesheets; return $this; @@ -570,7 +696,7 @@ public function setTimesheets($timesheets) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -580,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -611,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -623,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuSubmitTimesheetsResponse.php b/src/lib/Model/AuSubmitTimesheetsResponse.php index 8fe51b6..5fd37a0 100644 --- a/src/lib/Model/AuSubmitTimesheetsResponse.php +++ b/src/lib/Model/AuSubmitTimesheetsResponse.php @@ -2,81 +2,99 @@ /** * AuSubmitTimesheetsResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuSubmitTimesheetsResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuSubmitTimesheetsResponse implements ModelInterface, ArrayAccess +class AuSubmitTimesheetsResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuSubmitTimesheetsResponse'; + protected static $openAPIModelName = 'AuSubmitTimesheetsResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'timesheets' => 'map[string,\Swagger\Client\Model\AuIndividualTimesheetLineModel[]]' + protected static $openAPITypes = [ + 'timesheets' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'timesheets' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'timesheets' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['timesheets'] = isset($data['timesheets']) ? $data['timesheets'] : null; + $this->setIfExists('timesheets', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets timesheets * - * @return map[string,\Swagger\Client\Model\AuIndividualTimesheetLineModel[]] + * @return array|null */ public function getTimesheets() { @@ -217,12 +302,15 @@ public function getTimesheets() /** * Sets timesheets * - * @param map[string,\Swagger\Client\Model\AuIndividualTimesheetLineModel[]] $timesheets + * @param array|null $timesheets * - * @return $this + * @return self */ public function setTimesheets($timesheets) { + if (is_null($timesheets)) { + throw new \InvalidArgumentException('non-nullable timesheets cannot be null'); + } $this->container['timesheets'] = $timesheets; return $this; @@ -234,7 +322,7 @@ public function setTimesheets($timesheets) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuTimeAndAttendanceKioskModel.php b/src/lib/Model/AuTimeAndAttendanceKioskModel.php index f44fc92..ca44f8d 100644 --- a/src/lib/Model/AuTimeAndAttendanceKioskModel.php +++ b/src/lib/Model/AuTimeAndAttendanceKioskModel.php @@ -2,68 +2,68 @@ /** * AuTimeAndAttendanceKioskModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuTimeAndAttendanceKioskModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuTimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess +class AuTimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuTimeAndAttendanceKioskModel'; + protected static $openAPIModelName = 'AuTimeAndAttendanceKioskModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'allow_higher_classification_selection' => 'bool', 'id' => 'int', 'external_id' => 'string', 'location_id' => 'int', 'name' => 'string', 'time_zone' => 'string', - 'branding' => '\Swagger\Client\Model\WhiteLabelBrandingModel', + 'branding' => '\OpenAPI\Client\Model\WhiteLabelBrandingModel', 'is_location_required' => 'bool', 'is_work_type_required' => 'bool', 'restrict_locations_for_employees' => 'bool', @@ -80,8 +80,10 @@ class AuTimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'allow_higher_classification_selection' => null, 'id' => 'int32', 'external_id' => null, @@ -101,14 +103,46 @@ class AuTimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess 'available_to_all_restricted_users_with_kiosk_access' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'allow_higher_classification_selection' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'name' => false, + 'time_zone' => false, + 'branding' => false, + 'is_location_required' => false, + 'is_work_type_required' => false, + 'restrict_locations_for_employees' => false, + 'allow_employee_shift_selection' => false, + 'clock_on_window_minutes' => false, + 'clock_off_window_minutes' => false, + 'iana_time_zone' => false, + 'is_photo_required' => false, + 'can_add_employees' => false, + 'available_to_all_restricted_users_with_kiosk_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -235,12 +321,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -257,23 +340,41 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['allow_higher_classification_selection'] = isset($data['allow_higher_classification_selection']) ? $data['allow_higher_classification_selection'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['time_zone'] = isset($data['time_zone']) ? $data['time_zone'] : null; - $this->container['branding'] = isset($data['branding']) ? $data['branding'] : null; - $this->container['is_location_required'] = isset($data['is_location_required']) ? $data['is_location_required'] : null; - $this->container['is_work_type_required'] = isset($data['is_work_type_required']) ? $data['is_work_type_required'] : null; - $this->container['restrict_locations_for_employees'] = isset($data['restrict_locations_for_employees']) ? $data['restrict_locations_for_employees'] : null; - $this->container['allow_employee_shift_selection'] = isset($data['allow_employee_shift_selection']) ? $data['allow_employee_shift_selection'] : null; - $this->container['clock_on_window_minutes'] = isset($data['clock_on_window_minutes']) ? $data['clock_on_window_minutes'] : null; - $this->container['clock_off_window_minutes'] = isset($data['clock_off_window_minutes']) ? $data['clock_off_window_minutes'] : null; - $this->container['iana_time_zone'] = isset($data['iana_time_zone']) ? $data['iana_time_zone'] : null; - $this->container['is_photo_required'] = isset($data['is_photo_required']) ? $data['is_photo_required'] : null; - $this->container['can_add_employees'] = isset($data['can_add_employees']) ? $data['can_add_employees'] : null; - $this->container['available_to_all_restricted_users_with_kiosk_access'] = isset($data['available_to_all_restricted_users_with_kiosk_access']) ? $data['available_to_all_restricted_users_with_kiosk_access'] : null; + $this->setIfExists('allow_higher_classification_selection', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('time_zone', $data ?? [], null); + $this->setIfExists('branding', $data ?? [], null); + $this->setIfExists('is_location_required', $data ?? [], null); + $this->setIfExists('is_work_type_required', $data ?? [], null); + $this->setIfExists('restrict_locations_for_employees', $data ?? [], null); + $this->setIfExists('allow_employee_shift_selection', $data ?? [], null); + $this->setIfExists('clock_on_window_minutes', $data ?? [], null); + $this->setIfExists('clock_off_window_minutes', $data ?? [], null); + $this->setIfExists('iana_time_zone', $data ?? [], null); + $this->setIfExists('is_photo_required', $data ?? [], null); + $this->setIfExists('can_add_employees', $data ?? [], null); + $this->setIfExists('available_to_all_restricted_users_with_kiosk_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; } /** @@ -303,7 +404,7 @@ public function valid() /** * Gets allow_higher_classification_selection * - * @return bool + * @return bool|null */ public function getAllowHigherClassificationSelection() { @@ -313,12 +414,15 @@ public function getAllowHigherClassificationSelection() /** * Sets allow_higher_classification_selection * - * @param bool $allow_higher_classification_selection + * @param bool|null $allow_higher_classification_selection * - * @return $this + * @return self */ public function setAllowHigherClassificationSelection($allow_higher_classification_selection) { + if (is_null($allow_higher_classification_selection)) { + throw new \InvalidArgumentException('non-nullable allow_higher_classification_selection cannot be null'); + } $this->container['allow_higher_classification_selection'] = $allow_higher_classification_selection; return $this; @@ -327,7 +431,7 @@ public function setAllowHigherClassificationSelection($allow_higher_classificati /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -337,12 +441,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -351,7 +458,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -361,12 +468,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -375,7 +485,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -385,12 +495,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -399,7 +512,7 @@ public function setLocationId($location_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -409,12 +522,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -423,7 +539,7 @@ public function setName($name) /** * Gets time_zone * - * @return string + * @return string|null */ public function getTimeZone() { @@ -433,12 +549,15 @@ public function getTimeZone() /** * Sets time_zone * - * @param string $time_zone + * @param string|null $time_zone * - * @return $this + * @return self */ public function setTimeZone($time_zone) { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } $this->container['time_zone'] = $time_zone; return $this; @@ -447,7 +566,7 @@ public function setTimeZone($time_zone) /** * Gets branding * - * @return \Swagger\Client\Model\WhiteLabelBrandingModel + * @return \OpenAPI\Client\Model\WhiteLabelBrandingModel|null */ public function getBranding() { @@ -457,12 +576,15 @@ public function getBranding() /** * Sets branding * - * @param \Swagger\Client\Model\WhiteLabelBrandingModel $branding + * @param \OpenAPI\Client\Model\WhiteLabelBrandingModel|null $branding branding * - * @return $this + * @return self */ public function setBranding($branding) { + if (is_null($branding)) { + throw new \InvalidArgumentException('non-nullable branding cannot be null'); + } $this->container['branding'] = $branding; return $this; @@ -471,7 +593,7 @@ public function setBranding($branding) /** * Gets is_location_required * - * @return bool + * @return bool|null */ public function getIsLocationRequired() { @@ -481,12 +603,15 @@ public function getIsLocationRequired() /** * Sets is_location_required * - * @param bool $is_location_required + * @param bool|null $is_location_required * - * @return $this + * @return self */ public function setIsLocationRequired($is_location_required) { + if (is_null($is_location_required)) { + throw new \InvalidArgumentException('non-nullable is_location_required cannot be null'); + } $this->container['is_location_required'] = $is_location_required; return $this; @@ -495,7 +620,7 @@ public function setIsLocationRequired($is_location_required) /** * Gets is_work_type_required * - * @return bool + * @return bool|null */ public function getIsWorkTypeRequired() { @@ -505,12 +630,15 @@ public function getIsWorkTypeRequired() /** * Sets is_work_type_required * - * @param bool $is_work_type_required + * @param bool|null $is_work_type_required * - * @return $this + * @return self */ public function setIsWorkTypeRequired($is_work_type_required) { + if (is_null($is_work_type_required)) { + throw new \InvalidArgumentException('non-nullable is_work_type_required cannot be null'); + } $this->container['is_work_type_required'] = $is_work_type_required; return $this; @@ -519,7 +647,7 @@ public function setIsWorkTypeRequired($is_work_type_required) /** * Gets restrict_locations_for_employees * - * @return bool + * @return bool|null */ public function getRestrictLocationsForEmployees() { @@ -529,12 +657,15 @@ public function getRestrictLocationsForEmployees() /** * Sets restrict_locations_for_employees * - * @param bool $restrict_locations_for_employees + * @param bool|null $restrict_locations_for_employees * - * @return $this + * @return self */ public function setRestrictLocationsForEmployees($restrict_locations_for_employees) { + if (is_null($restrict_locations_for_employees)) { + throw new \InvalidArgumentException('non-nullable restrict_locations_for_employees cannot be null'); + } $this->container['restrict_locations_for_employees'] = $restrict_locations_for_employees; return $this; @@ -543,7 +674,7 @@ public function setRestrictLocationsForEmployees($restrict_locations_for_employe /** * Gets allow_employee_shift_selection * - * @return bool + * @return bool|null */ public function getAllowEmployeeShiftSelection() { @@ -553,12 +684,15 @@ public function getAllowEmployeeShiftSelection() /** * Sets allow_employee_shift_selection * - * @param bool $allow_employee_shift_selection + * @param bool|null $allow_employee_shift_selection * - * @return $this + * @return self */ public function setAllowEmployeeShiftSelection($allow_employee_shift_selection) { + if (is_null($allow_employee_shift_selection)) { + throw new \InvalidArgumentException('non-nullable allow_employee_shift_selection cannot be null'); + } $this->container['allow_employee_shift_selection'] = $allow_employee_shift_selection; return $this; @@ -567,7 +701,7 @@ public function setAllowEmployeeShiftSelection($allow_employee_shift_selection) /** * Gets clock_on_window_minutes * - * @return int + * @return int|null */ public function getClockOnWindowMinutes() { @@ -577,12 +711,15 @@ public function getClockOnWindowMinutes() /** * Sets clock_on_window_minutes * - * @param int $clock_on_window_minutes + * @param int|null $clock_on_window_minutes * - * @return $this + * @return self */ public function setClockOnWindowMinutes($clock_on_window_minutes) { + if (is_null($clock_on_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_on_window_minutes cannot be null'); + } $this->container['clock_on_window_minutes'] = $clock_on_window_minutes; return $this; @@ -591,7 +728,7 @@ public function setClockOnWindowMinutes($clock_on_window_minutes) /** * Gets clock_off_window_minutes * - * @return int + * @return int|null */ public function getClockOffWindowMinutes() { @@ -601,12 +738,15 @@ public function getClockOffWindowMinutes() /** * Sets clock_off_window_minutes * - * @param int $clock_off_window_minutes + * @param int|null $clock_off_window_minutes * - * @return $this + * @return self */ public function setClockOffWindowMinutes($clock_off_window_minutes) { + if (is_null($clock_off_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_off_window_minutes cannot be null'); + } $this->container['clock_off_window_minutes'] = $clock_off_window_minutes; return $this; @@ -615,7 +755,7 @@ public function setClockOffWindowMinutes($clock_off_window_minutes) /** * Gets iana_time_zone * - * @return string + * @return string|null */ public function getIanaTimeZone() { @@ -625,12 +765,15 @@ public function getIanaTimeZone() /** * Sets iana_time_zone * - * @param string $iana_time_zone + * @param string|null $iana_time_zone * - * @return $this + * @return self */ public function setIanaTimeZone($iana_time_zone) { + if (is_null($iana_time_zone)) { + throw new \InvalidArgumentException('non-nullable iana_time_zone cannot be null'); + } $this->container['iana_time_zone'] = $iana_time_zone; return $this; @@ -639,7 +782,7 @@ public function setIanaTimeZone($iana_time_zone) /** * Gets is_photo_required * - * @return bool + * @return bool|null */ public function getIsPhotoRequired() { @@ -649,12 +792,15 @@ public function getIsPhotoRequired() /** * Sets is_photo_required * - * @param bool $is_photo_required + * @param bool|null $is_photo_required * - * @return $this + * @return self */ public function setIsPhotoRequired($is_photo_required) { + if (is_null($is_photo_required)) { + throw new \InvalidArgumentException('non-nullable is_photo_required cannot be null'); + } $this->container['is_photo_required'] = $is_photo_required; return $this; @@ -663,7 +809,7 @@ public function setIsPhotoRequired($is_photo_required) /** * Gets can_add_employees * - * @return bool + * @return bool|null */ public function getCanAddEmployees() { @@ -673,12 +819,15 @@ public function getCanAddEmployees() /** * Sets can_add_employees * - * @param bool $can_add_employees + * @param bool|null $can_add_employees * - * @return $this + * @return self */ public function setCanAddEmployees($can_add_employees) { + if (is_null($can_add_employees)) { + throw new \InvalidArgumentException('non-nullable can_add_employees cannot be null'); + } $this->container['can_add_employees'] = $can_add_employees; return $this; @@ -687,7 +836,7 @@ public function setCanAddEmployees($can_add_employees) /** * Gets available_to_all_restricted_users_with_kiosk_access * - * @return bool + * @return bool|null */ public function getAvailableToAllRestrictedUsersWithKioskAccess() { @@ -697,12 +846,15 @@ public function getAvailableToAllRestrictedUsersWithKioskAccess() /** * Sets available_to_all_restricted_users_with_kiosk_access * - * @param bool $available_to_all_restricted_users_with_kiosk_access + * @param bool|null $available_to_all_restricted_users_with_kiosk_access * - * @return $this + * @return self */ public function setAvailableToAllRestrictedUsersWithKioskAccess($available_to_all_restricted_users_with_kiosk_access) { + if (is_null($available_to_all_restricted_users_with_kiosk_access)) { + throw new \InvalidArgumentException('non-nullable available_to_all_restricted_users_with_kiosk_access cannot be null'); + } $this->container['available_to_all_restricted_users_with_kiosk_access'] = $available_to_all_restricted_users_with_kiosk_access; return $this; @@ -714,7 +866,7 @@ public function setAvailableToAllRestrictedUsersWithKioskAccess($available_to_al * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -724,22 +876,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -755,11 +908,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -767,13 +933,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuTimeAndAttendanceLookupDataModel.php b/src/lib/Model/AuTimeAndAttendanceLookupDataModel.php index 03dde44..e967ce1 100644 --- a/src/lib/Model/AuTimeAndAttendanceLookupDataModel.php +++ b/src/lib/Model/AuTimeAndAttendanceLookupDataModel.php @@ -2,75 +2,77 @@ /** * AuTimeAndAttendanceLookupDataModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuTimeAndAttendanceLookupDataModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuTimeAndAttendanceLookupDataModel implements ModelInterface, ArrayAccess +class AuTimeAndAttendanceLookupDataModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuTimeAndAttendanceLookupDataModel'; + protected static $openAPIModelName = 'AuTimeAndAttendanceLookupDataModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'locations' => '\Swagger\Client\Model\LocationSelectModel[]', - 'work_types' => '\Swagger\Client\Model\WorkTypeSelectModel[]', - 'classifications' => '\Swagger\Client\Model\ClassificationLookupModel[]', - 'default_location' => '\Swagger\Client\Model\LocationSelectModel', - 'shift_conditions' => '\Swagger\Client\Model\ShiftConditionSelectModel[]', - 'location_shift_conditions' => '\Swagger\Client\Model\LocationShiftConditionsModel[]' + protected static $openAPITypes = [ + 'locations' => '\OpenAPI\Client\Model\LocationSelectModel[]', + 'work_types' => '\OpenAPI\Client\Model\WorkTypeSelectModel[]', + 'classifications' => '\OpenAPI\Client\Model\ClassificationLookupModel[]', + 'default_location' => '\OpenAPI\Client\Model\LocationSelectModel', + 'shift_conditions' => '\OpenAPI\Client\Model\ShiftConditionSelectModel[]', + 'location_shift_conditions' => '\OpenAPI\Client\Model\LocationShiftConditionsModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'locations' => null, 'work_types' => null, 'classifications' => null, @@ -79,14 +81,35 @@ class AuTimeAndAttendanceLookupDataModel implements ModelInterface, ArrayAccess 'location_shift_conditions' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'locations' => false, + 'work_types' => false, + 'classifications' => false, + 'default_location' => false, + 'shift_conditions' => false, + 'location_shift_conditions' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; - $this->container['work_types'] = isset($data['work_types']) ? $data['work_types'] : null; - $this->container['classifications'] = isset($data['classifications']) ? $data['classifications'] : null; - $this->container['default_location'] = isset($data['default_location']) ? $data['default_location'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['location_shift_conditions'] = isset($data['location_shift_conditions']) ? $data['location_shift_conditions'] : null; + $this->setIfExists('locations', $data ?? [], null); + $this->setIfExists('work_types', $data ?? [], null); + $this->setIfExists('classifications', $data ?? [], null); + $this->setIfExists('default_location', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('location_shift_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets locations * - * @return \Swagger\Client\Model\LocationSelectModel[] + * @return \OpenAPI\Client\Model\LocationSelectModel[]|null */ public function getLocations() { @@ -247,12 +337,15 @@ public function getLocations() /** * Sets locations * - * @param \Swagger\Client\Model\LocationSelectModel[] $locations + * @param \OpenAPI\Client\Model\LocationSelectModel[]|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -261,7 +354,7 @@ public function setLocations($locations) /** * Gets work_types * - * @return \Swagger\Client\Model\WorkTypeSelectModel[] + * @return \OpenAPI\Client\Model\WorkTypeSelectModel[]|null */ public function getWorkTypes() { @@ -271,12 +364,15 @@ public function getWorkTypes() /** * Sets work_types * - * @param \Swagger\Client\Model\WorkTypeSelectModel[] $work_types + * @param \OpenAPI\Client\Model\WorkTypeSelectModel[]|null $work_types * - * @return $this + * @return self */ public function setWorkTypes($work_types) { + if (is_null($work_types)) { + throw new \InvalidArgumentException('non-nullable work_types cannot be null'); + } $this->container['work_types'] = $work_types; return $this; @@ -285,7 +381,7 @@ public function setWorkTypes($work_types) /** * Gets classifications * - * @return \Swagger\Client\Model\ClassificationLookupModel[] + * @return \OpenAPI\Client\Model\ClassificationLookupModel[]|null */ public function getClassifications() { @@ -295,12 +391,15 @@ public function getClassifications() /** * Sets classifications * - * @param \Swagger\Client\Model\ClassificationLookupModel[] $classifications + * @param \OpenAPI\Client\Model\ClassificationLookupModel[]|null $classifications * - * @return $this + * @return self */ public function setClassifications($classifications) { + if (is_null($classifications)) { + throw new \InvalidArgumentException('non-nullable classifications cannot be null'); + } $this->container['classifications'] = $classifications; return $this; @@ -309,7 +408,7 @@ public function setClassifications($classifications) /** * Gets default_location * - * @return \Swagger\Client\Model\LocationSelectModel + * @return \OpenAPI\Client\Model\LocationSelectModel|null */ public function getDefaultLocation() { @@ -319,12 +418,15 @@ public function getDefaultLocation() /** * Sets default_location * - * @param \Swagger\Client\Model\LocationSelectModel $default_location + * @param \OpenAPI\Client\Model\LocationSelectModel|null $default_location default_location * - * @return $this + * @return self */ public function setDefaultLocation($default_location) { + if (is_null($default_location)) { + throw new \InvalidArgumentException('non-nullable default_location cannot be null'); + } $this->container['default_location'] = $default_location; return $this; @@ -333,7 +435,7 @@ public function setDefaultLocation($default_location) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\ShiftConditionSelectModel[] + * @return \OpenAPI\Client\Model\ShiftConditionSelectModel[]|null */ public function getShiftConditions() { @@ -343,12 +445,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\ShiftConditionSelectModel[] $shift_conditions + * @param \OpenAPI\Client\Model\ShiftConditionSelectModel[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -357,7 +462,7 @@ public function setShiftConditions($shift_conditions) /** * Gets location_shift_conditions * - * @return \Swagger\Client\Model\LocationShiftConditionsModel[] + * @return \OpenAPI\Client\Model\LocationShiftConditionsModel[]|null */ public function getLocationShiftConditions() { @@ -367,12 +472,15 @@ public function getLocationShiftConditions() /** * Sets location_shift_conditions * - * @param \Swagger\Client\Model\LocationShiftConditionsModel[] $location_shift_conditions + * @param \OpenAPI\Client\Model\LocationShiftConditionsModel[]|null $location_shift_conditions * - * @return $this + * @return self */ public function setLocationShiftConditions($location_shift_conditions) { + if (is_null($location_shift_conditions)) { + throw new \InvalidArgumentException('non-nullable location_shift_conditions cannot be null'); + } $this->container['location_shift_conditions'] = $location_shift_conditions; return $this; @@ -384,7 +492,7 @@ public function setLocationShiftConditions($location_shift_conditions) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuTimeAndAttendanceShiftModel.php b/src/lib/Model/AuTimeAndAttendanceShiftModel.php index 77d6aaf..f2e0138 100644 --- a/src/lib/Model/AuTimeAndAttendanceShiftModel.php +++ b/src/lib/Model/AuTimeAndAttendanceShiftModel.php @@ -2,61 +2,61 @@ /** * AuTimeAndAttendanceShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuTimeAndAttendanceShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuTimeAndAttendanceShiftModel implements ModelInterface, ArrayAccess +class AuTimeAndAttendanceShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuTimeAndAttendanceShiftModel'; + protected static $openAPIModelName = 'AuTimeAndAttendanceShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'int', 'classification_name' => 'string', 'id' => 'int', @@ -71,17 +71,19 @@ class AuTimeAndAttendanceShiftModel implements ModelInterface, ArrayAccess 'kiosk_id' => 'int', 'kiosk_name' => 'string', 'timesheet_line_id' => 'int', - 'employee' => '\Swagger\Client\Model\BasicKioskEmployeeModel', - 'breaks' => '\Swagger\Client\Model\TimeAndAttendanceBreakModel[]', - 'shift_conditions' => '\Swagger\Client\Model\ShiftConditionModel[]' + 'employee' => '\OpenAPI\Client\Model\BasicKioskEmployeeModel', + 'breaks' => '\OpenAPI\Client\Model\TimeAndAttendanceBreakModel[]', + 'shift_conditions' => '\OpenAPI\Client\Model\ShiftConditionModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => 'int32', 'classification_name' => null, 'id' => 'int32', @@ -101,14 +103,46 @@ class AuTimeAndAttendanceShiftModel implements ModelInterface, ArrayAccess 'shift_conditions' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification_name' => false, + 'id' => false, + 'start_time_local' => false, + 'start_time_utc' => false, + 'end_time_utc' => false, + 'end_time_local' => false, + 'location_id' => false, + 'location_fully_qualified_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'kiosk_id' => false, + 'kiosk_name' => false, + 'timesheet_line_id' => false, + 'employee' => false, + 'breaks' => false, + 'shift_conditions' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -235,12 +321,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -257,23 +340,41 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification_name'] = isset($data['classification_name']) ? $data['classification_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['start_time_local'] = isset($data['start_time_local']) ? $data['start_time_local'] : null; - $this->container['start_time_utc'] = isset($data['start_time_utc']) ? $data['start_time_utc'] : null; - $this->container['end_time_utc'] = isset($data['end_time_utc']) ? $data['end_time_utc'] : null; - $this->container['end_time_local'] = isset($data['end_time_local']) ? $data['end_time_local'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_fully_qualified_name'] = isset($data['location_fully_qualified_name']) ? $data['location_fully_qualified_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['kiosk_name'] = isset($data['kiosk_name']) ? $data['kiosk_name'] : null; - $this->container['timesheet_line_id'] = isset($data['timesheet_line_id']) ? $data['timesheet_line_id'] : null; - $this->container['employee'] = isset($data['employee']) ? $data['employee'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('start_time_local', $data ?? [], null); + $this->setIfExists('start_time_utc', $data ?? [], null); + $this->setIfExists('end_time_utc', $data ?? [], null); + $this->setIfExists('end_time_local', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_fully_qualified_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('kiosk_name', $data ?? [], null); + $this->setIfExists('timesheet_line_id', $data ?? [], null); + $this->setIfExists('employee', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('shift_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; } /** @@ -303,7 +404,7 @@ public function valid() /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -313,12 +414,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -327,7 +431,7 @@ public function setClassificationId($classification_id) /** * Gets classification_name * - * @return string + * @return string|null */ public function getClassificationName() { @@ -337,12 +441,15 @@ public function getClassificationName() /** * Sets classification_name * - * @param string $classification_name + * @param string|null $classification_name * - * @return $this + * @return self */ public function setClassificationName($classification_name) { + if (is_null($classification_name)) { + throw new \InvalidArgumentException('non-nullable classification_name cannot be null'); + } $this->container['classification_name'] = $classification_name; return $this; @@ -351,7 +458,7 @@ public function setClassificationName($classification_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -361,12 +468,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -375,7 +485,7 @@ public function setId($id) /** * Gets start_time_local * - * @return \DateTime + * @return \DateTime|null */ public function getStartTimeLocal() { @@ -385,12 +495,15 @@ public function getStartTimeLocal() /** * Sets start_time_local * - * @param \DateTime $start_time_local + * @param \DateTime|null $start_time_local * - * @return $this + * @return self */ public function setStartTimeLocal($start_time_local) { + if (is_null($start_time_local)) { + throw new \InvalidArgumentException('non-nullable start_time_local cannot be null'); + } $this->container['start_time_local'] = $start_time_local; return $this; @@ -399,7 +512,7 @@ public function setStartTimeLocal($start_time_local) /** * Gets start_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getStartTimeUtc() { @@ -409,12 +522,15 @@ public function getStartTimeUtc() /** * Sets start_time_utc * - * @param \DateTime $start_time_utc + * @param \DateTime|null $start_time_utc * - * @return $this + * @return self */ public function setStartTimeUtc($start_time_utc) { + if (is_null($start_time_utc)) { + throw new \InvalidArgumentException('non-nullable start_time_utc cannot be null'); + } $this->container['start_time_utc'] = $start_time_utc; return $this; @@ -423,7 +539,7 @@ public function setStartTimeUtc($start_time_utc) /** * Gets end_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getEndTimeUtc() { @@ -433,12 +549,15 @@ public function getEndTimeUtc() /** * Sets end_time_utc * - * @param \DateTime $end_time_utc + * @param \DateTime|null $end_time_utc * - * @return $this + * @return self */ public function setEndTimeUtc($end_time_utc) { + if (is_null($end_time_utc)) { + throw new \InvalidArgumentException('non-nullable end_time_utc cannot be null'); + } $this->container['end_time_utc'] = $end_time_utc; return $this; @@ -447,7 +566,7 @@ public function setEndTimeUtc($end_time_utc) /** * Gets end_time_local * - * @return \DateTime + * @return \DateTime|null */ public function getEndTimeLocal() { @@ -457,12 +576,15 @@ public function getEndTimeLocal() /** * Sets end_time_local * - * @param \DateTime $end_time_local + * @param \DateTime|null $end_time_local * - * @return $this + * @return self */ public function setEndTimeLocal($end_time_local) { + if (is_null($end_time_local)) { + throw new \InvalidArgumentException('non-nullable end_time_local cannot be null'); + } $this->container['end_time_local'] = $end_time_local; return $this; @@ -471,7 +593,7 @@ public function setEndTimeLocal($end_time_local) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -481,12 +603,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -495,7 +620,7 @@ public function setLocationId($location_id) /** * Gets location_fully_qualified_name * - * @return string + * @return string|null */ public function getLocationFullyQualifiedName() { @@ -505,12 +630,15 @@ public function getLocationFullyQualifiedName() /** * Sets location_fully_qualified_name * - * @param string $location_fully_qualified_name + * @param string|null $location_fully_qualified_name * - * @return $this + * @return self */ public function setLocationFullyQualifiedName($location_fully_qualified_name) { + if (is_null($location_fully_qualified_name)) { + throw new \InvalidArgumentException('non-nullable location_fully_qualified_name cannot be null'); + } $this->container['location_fully_qualified_name'] = $location_fully_qualified_name; return $this; @@ -519,7 +647,7 @@ public function setLocationFullyQualifiedName($location_fully_qualified_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -529,12 +657,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -543,7 +674,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -553,12 +684,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -567,7 +701,7 @@ public function setWorkTypeName($work_type_name) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -577,12 +711,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -591,7 +728,7 @@ public function setKioskId($kiosk_id) /** * Gets kiosk_name * - * @return string + * @return string|null */ public function getKioskName() { @@ -601,12 +738,15 @@ public function getKioskName() /** * Sets kiosk_name * - * @param string $kiosk_name + * @param string|null $kiosk_name * - * @return $this + * @return self */ public function setKioskName($kiosk_name) { + if (is_null($kiosk_name)) { + throw new \InvalidArgumentException('non-nullable kiosk_name cannot be null'); + } $this->container['kiosk_name'] = $kiosk_name; return $this; @@ -615,7 +755,7 @@ public function setKioskName($kiosk_name) /** * Gets timesheet_line_id * - * @return int + * @return int|null */ public function getTimesheetLineId() { @@ -625,12 +765,15 @@ public function getTimesheetLineId() /** * Sets timesheet_line_id * - * @param int $timesheet_line_id + * @param int|null $timesheet_line_id * - * @return $this + * @return self */ public function setTimesheetLineId($timesheet_line_id) { + if (is_null($timesheet_line_id)) { + throw new \InvalidArgumentException('non-nullable timesheet_line_id cannot be null'); + } $this->container['timesheet_line_id'] = $timesheet_line_id; return $this; @@ -639,7 +782,7 @@ public function setTimesheetLineId($timesheet_line_id) /** * Gets employee * - * @return \Swagger\Client\Model\BasicKioskEmployeeModel + * @return \OpenAPI\Client\Model\BasicKioskEmployeeModel|null */ public function getEmployee() { @@ -649,12 +792,15 @@ public function getEmployee() /** * Sets employee * - * @param \Swagger\Client\Model\BasicKioskEmployeeModel $employee + * @param \OpenAPI\Client\Model\BasicKioskEmployeeModel|null $employee employee * - * @return $this + * @return self */ public function setEmployee($employee) { + if (is_null($employee)) { + throw new \InvalidArgumentException('non-nullable employee cannot be null'); + } $this->container['employee'] = $employee; return $this; @@ -663,7 +809,7 @@ public function setEmployee($employee) /** * Gets breaks * - * @return \Swagger\Client\Model\TimeAndAttendanceBreakModel[] + * @return \OpenAPI\Client\Model\TimeAndAttendanceBreakModel[]|null */ public function getBreaks() { @@ -673,12 +819,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimeAndAttendanceBreakModel[] $breaks + * @param \OpenAPI\Client\Model\TimeAndAttendanceBreakModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -687,7 +836,7 @@ public function setBreaks($breaks) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\ShiftConditionModel[] + * @return \OpenAPI\Client\Model\ShiftConditionModel[]|null */ public function getShiftConditions() { @@ -697,12 +846,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\ShiftConditionModel[] $shift_conditions + * @param \OpenAPI\Client\Model\ShiftConditionModel[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -714,7 +866,7 @@ public function setShiftConditions($shift_conditions) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -724,22 +876,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -755,11 +908,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -767,13 +933,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuTimesheetExportModel.php b/src/lib/Model/AuTimesheetExportModel.php index 05e9475..e2f0828 100644 --- a/src/lib/Model/AuTimesheetExportModel.php +++ b/src/lib/Model/AuTimesheetExportModel.php @@ -2,63 +2,63 @@ /** * AuTimesheetExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuTimesheetExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuTimesheetExportModel implements ModelInterface, ArrayAccess +class AuTimesheetExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuTimesheetExportModel'; + protected static $openAPIModelName = 'AuTimesheetExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super' => 'double', - 'payg' => 'double', + protected static $openAPITypes = [ + 'super' => 'float', + 'payg' => 'float', 'classification' => 'string', 'employee_id' => 'int', 'first_name' => 'string', @@ -79,7 +79,7 @@ class AuTimesheetExportModel implements ModelInterface, ArrayAccess 'formatted_time_variance' => 'string', 'duration_excluding_breaks' => 'string', 'duration' => 'string', - 'units' => 'double', + 'units' => 'float', 'unit_type' => 'string', 'work_type' => 'string', 'shift_conditions' => 'string', @@ -88,23 +88,25 @@ class AuTimesheetExportModel implements ModelInterface, ArrayAccess 'comments' => 'string', 'consolidated_with_timesheet_line_id' => 'int', 'reviewed_by' => 'string', - 'gross' => 'double', - 'net_earnings' => 'double', - 'employer_liabilities' => 'double', - 'total_cost' => 'double', - 'total_cost_variance' => 'double', + 'gross' => 'float', + 'net_earnings' => 'float', + 'employer_liabilities' => 'float', + 'total_cost' => 'float', + 'total_cost_variance' => 'float', 'date_created' => '\DateTime', 'date_reviewed' => '\DateTime', 'shift_condition_short_codes' => 'string[]', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakModel[]' + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super' => 'double', 'payg' => 'double', 'classification' => null, @@ -147,14 +149,69 @@ class AuTimesheetExportModel implements ModelInterface, ArrayAccess 'breaks' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super' => false, + 'payg' => false, + 'classification' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'employee_external_id' => false, + 'id' => false, + 'status' => false, + 'location' => false, + 'start' => false, + 'start_time' => false, + 'end' => false, + 'end_time' => false, + 'actual_start' => false, + 'actual_start_time' => false, + 'actual_end' => false, + 'actual_end_time' => false, + 'time_variance' => false, + 'formatted_time_variance' => false, + 'duration_excluding_breaks' => false, + 'duration' => false, + 'units' => false, + 'unit_type' => false, + 'work_type' => false, + 'shift_conditions' => false, + 'number_of_breaks' => false, + 'break_duration' => false, + 'comments' => false, + 'consolidated_with_timesheet_line_id' => false, + 'reviewed_by' => false, + 'gross' => false, + 'net_earnings' => false, + 'employer_liabilities' => false, + 'total_cost' => false, + 'total_cost_variance' => false, + 'date_created' => false, + 'date_reviewed' => false, + 'shift_condition_short_codes' => false, + 'breaks' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -162,9 +219,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -350,12 +459,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -372,46 +478,64 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super'] = isset($data['super']) ? $data['super'] : null; - $this->container['payg'] = isset($data['payg']) ? $data['payg'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['actual_start'] = isset($data['actual_start']) ? $data['actual_start'] : null; - $this->container['actual_start_time'] = isset($data['actual_start_time']) ? $data['actual_start_time'] : null; - $this->container['actual_end'] = isset($data['actual_end']) ? $data['actual_end'] : null; - $this->container['actual_end_time'] = isset($data['actual_end_time']) ? $data['actual_end_time'] : null; - $this->container['time_variance'] = isset($data['time_variance']) ? $data['time_variance'] : null; - $this->container['formatted_time_variance'] = isset($data['formatted_time_variance']) ? $data['formatted_time_variance'] : null; - $this->container['duration_excluding_breaks'] = isset($data['duration_excluding_breaks']) ? $data['duration_excluding_breaks'] : null; - $this->container['duration'] = isset($data['duration']) ? $data['duration'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['number_of_breaks'] = isset($data['number_of_breaks']) ? $data['number_of_breaks'] : null; - $this->container['break_duration'] = isset($data['break_duration']) ? $data['break_duration'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['consolidated_with_timesheet_line_id'] = isset($data['consolidated_with_timesheet_line_id']) ? $data['consolidated_with_timesheet_line_id'] : null; - $this->container['reviewed_by'] = isset($data['reviewed_by']) ? $data['reviewed_by'] : null; - $this->container['gross'] = isset($data['gross']) ? $data['gross'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['employer_liabilities'] = isset($data['employer_liabilities']) ? $data['employer_liabilities'] : null; - $this->container['total_cost'] = isset($data['total_cost']) ? $data['total_cost'] : null; - $this->container['total_cost_variance'] = isset($data['total_cost_variance']) ? $data['total_cost_variance'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['date_reviewed'] = isset($data['date_reviewed']) ? $data['date_reviewed'] : null; - $this->container['shift_condition_short_codes'] = isset($data['shift_condition_short_codes']) ? $data['shift_condition_short_codes'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; + $this->setIfExists('super', $data ?? [], null); + $this->setIfExists('payg', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('actual_start', $data ?? [], null); + $this->setIfExists('actual_start_time', $data ?? [], null); + $this->setIfExists('actual_end', $data ?? [], null); + $this->setIfExists('actual_end_time', $data ?? [], null); + $this->setIfExists('time_variance', $data ?? [], null); + $this->setIfExists('formatted_time_variance', $data ?? [], null); + $this->setIfExists('duration_excluding_breaks', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('number_of_breaks', $data ?? [], null); + $this->setIfExists('break_duration', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('consolidated_with_timesheet_line_id', $data ?? [], null); + $this->setIfExists('reviewed_by', $data ?? [], null); + $this->setIfExists('gross', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('employer_liabilities', $data ?? [], null); + $this->setIfExists('total_cost', $data ?? [], null); + $this->setIfExists('total_cost_variance', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('date_reviewed', $data ?? [], null); + $this->setIfExists('shift_condition_short_codes', $data ?? [], null); + $this->setIfExists('breaks', $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; } /** @@ -441,7 +565,7 @@ public function valid() /** * Gets super * - * @return double + * @return float|null */ public function getSuper() { @@ -451,12 +575,15 @@ public function getSuper() /** * Sets super * - * @param double $super + * @param float|null $super * - * @return $this + * @return self */ public function setSuper($super) { + if (is_null($super)) { + throw new \InvalidArgumentException('non-nullable super cannot be null'); + } $this->container['super'] = $super; return $this; @@ -465,7 +592,7 @@ public function setSuper($super) /** * Gets payg * - * @return double + * @return float|null */ public function getPayg() { @@ -475,12 +602,15 @@ public function getPayg() /** * Sets payg * - * @param double $payg + * @param float|null $payg * - * @return $this + * @return self */ public function setPayg($payg) { + if (is_null($payg)) { + throw new \InvalidArgumentException('non-nullable payg cannot be null'); + } $this->container['payg'] = $payg; return $this; @@ -489,7 +619,7 @@ public function setPayg($payg) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -499,12 +629,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -513,7 +646,7 @@ public function setClassification($classification) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -523,12 +656,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -537,7 +673,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -547,12 +683,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -561,7 +700,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -571,12 +710,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -585,7 +727,7 @@ public function setSurname($surname) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -595,12 +737,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -609,7 +754,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -619,12 +764,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -633,7 +781,7 @@ public function setId($id) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -643,12 +791,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -657,7 +808,7 @@ public function setStatus($status) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -667,12 +818,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -681,7 +835,7 @@ public function setLocation($location) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -691,12 +845,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -705,7 +862,7 @@ public function setStart($start) /** * Gets start_time * - * @return string + * @return string|null */ public function getStartTime() { @@ -715,12 +872,15 @@ public function getStartTime() /** * Sets start_time * - * @param string $start_time + * @param string|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -729,7 +889,7 @@ public function setStartTime($start_time) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -739,12 +899,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -753,7 +916,7 @@ public function setEnd($end) /** * Gets end_time * - * @return string + * @return string|null */ public function getEndTime() { @@ -763,12 +926,15 @@ public function getEndTime() /** * Sets end_time * - * @param string $end_time + * @param string|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -777,7 +943,7 @@ public function setEndTime($end_time) /** * Gets actual_start * - * @return \DateTime + * @return \DateTime|null */ public function getActualStart() { @@ -787,12 +953,15 @@ public function getActualStart() /** * Sets actual_start * - * @param \DateTime $actual_start + * @param \DateTime|null $actual_start * - * @return $this + * @return self */ public function setActualStart($actual_start) { + if (is_null($actual_start)) { + throw new \InvalidArgumentException('non-nullable actual_start cannot be null'); + } $this->container['actual_start'] = $actual_start; return $this; @@ -801,7 +970,7 @@ public function setActualStart($actual_start) /** * Gets actual_start_time * - * @return string + * @return string|null */ public function getActualStartTime() { @@ -811,12 +980,15 @@ public function getActualStartTime() /** * Sets actual_start_time * - * @param string $actual_start_time + * @param string|null $actual_start_time * - * @return $this + * @return self */ public function setActualStartTime($actual_start_time) { + if (is_null($actual_start_time)) { + throw new \InvalidArgumentException('non-nullable actual_start_time cannot be null'); + } $this->container['actual_start_time'] = $actual_start_time; return $this; @@ -825,7 +997,7 @@ public function setActualStartTime($actual_start_time) /** * Gets actual_end * - * @return \DateTime + * @return \DateTime|null */ public function getActualEnd() { @@ -835,12 +1007,15 @@ public function getActualEnd() /** * Sets actual_end * - * @param \DateTime $actual_end + * @param \DateTime|null $actual_end * - * @return $this + * @return self */ public function setActualEnd($actual_end) { + if (is_null($actual_end)) { + throw new \InvalidArgumentException('non-nullable actual_end cannot be null'); + } $this->container['actual_end'] = $actual_end; return $this; @@ -849,7 +1024,7 @@ public function setActualEnd($actual_end) /** * Gets actual_end_time * - * @return string + * @return string|null */ public function getActualEndTime() { @@ -859,12 +1034,15 @@ public function getActualEndTime() /** * Sets actual_end_time * - * @param string $actual_end_time + * @param string|null $actual_end_time * - * @return $this + * @return self */ public function setActualEndTime($actual_end_time) { + if (is_null($actual_end_time)) { + throw new \InvalidArgumentException('non-nullable actual_end_time cannot be null'); + } $this->container['actual_end_time'] = $actual_end_time; return $this; @@ -873,7 +1051,7 @@ public function setActualEndTime($actual_end_time) /** * Gets time_variance * - * @return string + * @return string|null */ public function getTimeVariance() { @@ -883,12 +1061,15 @@ public function getTimeVariance() /** * Sets time_variance * - * @param string $time_variance + * @param string|null $time_variance * - * @return $this + * @return self */ public function setTimeVariance($time_variance) { + if (is_null($time_variance)) { + throw new \InvalidArgumentException('non-nullable time_variance cannot be null'); + } $this->container['time_variance'] = $time_variance; return $this; @@ -897,7 +1078,7 @@ public function setTimeVariance($time_variance) /** * Gets formatted_time_variance * - * @return string + * @return string|null */ public function getFormattedTimeVariance() { @@ -907,12 +1088,15 @@ public function getFormattedTimeVariance() /** * Sets formatted_time_variance * - * @param string $formatted_time_variance + * @param string|null $formatted_time_variance * - * @return $this + * @return self */ public function setFormattedTimeVariance($formatted_time_variance) { + if (is_null($formatted_time_variance)) { + throw new \InvalidArgumentException('non-nullable formatted_time_variance cannot be null'); + } $this->container['formatted_time_variance'] = $formatted_time_variance; return $this; @@ -921,7 +1105,7 @@ public function setFormattedTimeVariance($formatted_time_variance) /** * Gets duration_excluding_breaks * - * @return string + * @return string|null */ public function getDurationExcludingBreaks() { @@ -931,12 +1115,15 @@ public function getDurationExcludingBreaks() /** * Sets duration_excluding_breaks * - * @param string $duration_excluding_breaks + * @param string|null $duration_excluding_breaks * - * @return $this + * @return self */ public function setDurationExcludingBreaks($duration_excluding_breaks) { + if (is_null($duration_excluding_breaks)) { + throw new \InvalidArgumentException('non-nullable duration_excluding_breaks cannot be null'); + } $this->container['duration_excluding_breaks'] = $duration_excluding_breaks; return $this; @@ -945,7 +1132,7 @@ public function setDurationExcludingBreaks($duration_excluding_breaks) /** * Gets duration * - * @return string + * @return string|null */ public function getDuration() { @@ -955,12 +1142,15 @@ public function getDuration() /** * Sets duration * - * @param string $duration + * @param string|null $duration * - * @return $this + * @return self */ public function setDuration($duration) { + if (is_null($duration)) { + throw new \InvalidArgumentException('non-nullable duration cannot be null'); + } $this->container['duration'] = $duration; return $this; @@ -969,7 +1159,7 @@ public function setDuration($duration) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -979,12 +1169,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -993,7 +1186,7 @@ public function setUnits($units) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -1003,12 +1196,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -1017,7 +1213,7 @@ public function setUnitType($unit_type) /** * Gets work_type * - * @return string + * @return string|null */ public function getWorkType() { @@ -1027,12 +1223,15 @@ public function getWorkType() /** * Sets work_type * - * @param string $work_type + * @param string|null $work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -1041,7 +1240,7 @@ public function setWorkType($work_type) /** * Gets shift_conditions * - * @return string + * @return string|null */ public function getShiftConditions() { @@ -1051,12 +1250,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param string $shift_conditions + * @param string|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -1065,7 +1267,7 @@ public function setShiftConditions($shift_conditions) /** * Gets number_of_breaks * - * @return int + * @return int|null */ public function getNumberOfBreaks() { @@ -1075,12 +1277,15 @@ public function getNumberOfBreaks() /** * Sets number_of_breaks * - * @param int $number_of_breaks + * @param int|null $number_of_breaks * - * @return $this + * @return self */ public function setNumberOfBreaks($number_of_breaks) { + if (is_null($number_of_breaks)) { + throw new \InvalidArgumentException('non-nullable number_of_breaks cannot be null'); + } $this->container['number_of_breaks'] = $number_of_breaks; return $this; @@ -1089,7 +1294,7 @@ public function setNumberOfBreaks($number_of_breaks) /** * Gets break_duration * - * @return string + * @return string|null */ public function getBreakDuration() { @@ -1099,12 +1304,15 @@ public function getBreakDuration() /** * Sets break_duration * - * @param string $break_duration + * @param string|null $break_duration * - * @return $this + * @return self */ public function setBreakDuration($break_duration) { + if (is_null($break_duration)) { + throw new \InvalidArgumentException('non-nullable break_duration cannot be null'); + } $this->container['break_duration'] = $break_duration; return $this; @@ -1113,7 +1321,7 @@ public function setBreakDuration($break_duration) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -1123,12 +1331,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -1137,7 +1348,7 @@ public function setComments($comments) /** * Gets consolidated_with_timesheet_line_id * - * @return int + * @return int|null */ public function getConsolidatedWithTimesheetLineId() { @@ -1147,12 +1358,15 @@ public function getConsolidatedWithTimesheetLineId() /** * Sets consolidated_with_timesheet_line_id * - * @param int $consolidated_with_timesheet_line_id + * @param int|null $consolidated_with_timesheet_line_id * - * @return $this + * @return self */ public function setConsolidatedWithTimesheetLineId($consolidated_with_timesheet_line_id) { + if (is_null($consolidated_with_timesheet_line_id)) { + throw new \InvalidArgumentException('non-nullable consolidated_with_timesheet_line_id cannot be null'); + } $this->container['consolidated_with_timesheet_line_id'] = $consolidated_with_timesheet_line_id; return $this; @@ -1161,7 +1375,7 @@ public function setConsolidatedWithTimesheetLineId($consolidated_with_timesheet_ /** * Gets reviewed_by * - * @return string + * @return string|null */ public function getReviewedBy() { @@ -1171,12 +1385,15 @@ public function getReviewedBy() /** * Sets reviewed_by * - * @param string $reviewed_by + * @param string|null $reviewed_by * - * @return $this + * @return self */ public function setReviewedBy($reviewed_by) { + if (is_null($reviewed_by)) { + throw new \InvalidArgumentException('non-nullable reviewed_by cannot be null'); + } $this->container['reviewed_by'] = $reviewed_by; return $this; @@ -1185,7 +1402,7 @@ public function setReviewedBy($reviewed_by) /** * Gets gross * - * @return double + * @return float|null */ public function getGross() { @@ -1195,12 +1412,15 @@ public function getGross() /** * Sets gross * - * @param double $gross + * @param float|null $gross * - * @return $this + * @return self */ public function setGross($gross) { + if (is_null($gross)) { + throw new \InvalidArgumentException('non-nullable gross cannot be null'); + } $this->container['gross'] = $gross; return $this; @@ -1209,7 +1429,7 @@ public function setGross($gross) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -1219,12 +1439,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -1233,7 +1456,7 @@ public function setNetEarnings($net_earnings) /** * Gets employer_liabilities * - * @return double + * @return float|null */ public function getEmployerLiabilities() { @@ -1243,12 +1466,15 @@ public function getEmployerLiabilities() /** * Sets employer_liabilities * - * @param double $employer_liabilities + * @param float|null $employer_liabilities * - * @return $this + * @return self */ public function setEmployerLiabilities($employer_liabilities) { + if (is_null($employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities cannot be null'); + } $this->container['employer_liabilities'] = $employer_liabilities; return $this; @@ -1257,7 +1483,7 @@ public function setEmployerLiabilities($employer_liabilities) /** * Gets total_cost * - * @return double + * @return float|null */ public function getTotalCost() { @@ -1267,12 +1493,15 @@ public function getTotalCost() /** * Sets total_cost * - * @param double $total_cost + * @param float|null $total_cost * - * @return $this + * @return self */ public function setTotalCost($total_cost) { + if (is_null($total_cost)) { + throw new \InvalidArgumentException('non-nullable total_cost cannot be null'); + } $this->container['total_cost'] = $total_cost; return $this; @@ -1281,7 +1510,7 @@ public function setTotalCost($total_cost) /** * Gets total_cost_variance * - * @return double + * @return float|null */ public function getTotalCostVariance() { @@ -1291,12 +1520,15 @@ public function getTotalCostVariance() /** * Sets total_cost_variance * - * @param double $total_cost_variance + * @param float|null $total_cost_variance * - * @return $this + * @return self */ public function setTotalCostVariance($total_cost_variance) { + if (is_null($total_cost_variance)) { + throw new \InvalidArgumentException('non-nullable total_cost_variance cannot be null'); + } $this->container['total_cost_variance'] = $total_cost_variance; return $this; @@ -1305,7 +1537,7 @@ public function setTotalCostVariance($total_cost_variance) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -1315,12 +1547,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -1329,7 +1564,7 @@ public function setDateCreated($date_created) /** * Gets date_reviewed * - * @return \DateTime + * @return \DateTime|null */ public function getDateReviewed() { @@ -1339,12 +1574,15 @@ public function getDateReviewed() /** * Sets date_reviewed * - * @param \DateTime $date_reviewed + * @param \DateTime|null $date_reviewed * - * @return $this + * @return self */ public function setDateReviewed($date_reviewed) { + if (is_null($date_reviewed)) { + throw new \InvalidArgumentException('non-nullable date_reviewed cannot be null'); + } $this->container['date_reviewed'] = $date_reviewed; return $this; @@ -1353,7 +1591,7 @@ public function setDateReviewed($date_reviewed) /** * Gets shift_condition_short_codes * - * @return string[] + * @return string[]|null */ public function getShiftConditionShortCodes() { @@ -1363,12 +1601,15 @@ public function getShiftConditionShortCodes() /** * Sets shift_condition_short_codes * - * @param string[] $shift_condition_short_codes + * @param string[]|null $shift_condition_short_codes * - * @return $this + * @return self */ public function setShiftConditionShortCodes($shift_condition_short_codes) { + if (is_null($shift_condition_short_codes)) { + throw new \InvalidArgumentException('non-nullable shift_condition_short_codes cannot be null'); + } $this->container['shift_condition_short_codes'] = $shift_condition_short_codes; return $this; @@ -1377,7 +1618,7 @@ public function setShiftConditionShortCodes($shift_condition_short_codes) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakModel[] + * @return \OpenAPI\Client\Model\TimesheetBreakModel[]|null */ public function getBreaks() { @@ -1387,12 +1628,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakModel[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -1404,7 +1648,7 @@ public function setBreaks($breaks) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1414,22 +1658,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1445,11 +1690,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1457,13 +1715,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuTimesheetLineModel.php b/src/lib/Model/AuTimesheetLineModel.php index 9dda5a0..724ab2d 100644 --- a/src/lib/Model/AuTimesheetLineModel.php +++ b/src/lib/Model/AuTimesheetLineModel.php @@ -2,61 +2,61 @@ /** * AuTimesheetLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuTimesheetLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuTimesheetLineModel implements ModelInterface, ArrayAccess +class AuTimesheetLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuTimesheetLineModel'; + protected static $openAPIModelName = 'AuTimesheetLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'classification_id' => 'string', 'classification' => 'string', 'location_is_deleted' => 'bool', @@ -64,13 +64,13 @@ class AuTimesheetLineModel implements ModelInterface, ArrayAccess 'employee_id' => 'int', 'start_time' => '\DateTime', 'end_time' => '\DateTime', - 'units' => 'double', + 'units' => 'float', 'work_type_id' => 'string', 'location_id' => 'string', 'comments' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakModelv3[]', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakModelv3[]', 'status' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'leave_category_id' => 'string', 'pay_category_id' => 'string', 'external_id' => 'string', @@ -79,9 +79,9 @@ class AuTimesheetLineModel implements ModelInterface, ArrayAccess 'shift_condition_ids' => 'string[]', 'work_type' => 'string', 'fully_qualified_location_name' => 'string', - 'shift_conditions' => '\Swagger\Client\Model\TimesheetShiftConditionModelv3[]', + 'shift_conditions' => '\OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]', 'hidden_comments' => 'string', - 'attachment' => '\Swagger\Client\Model\Attachment', + 'attachment' => '\OpenAPI\Client\Model\Attachment', 'submitted_by_user' => 'string' ]; @@ -89,8 +89,10 @@ class AuTimesheetLineModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classification_id' => null, 'classification' => null, 'location_is_deleted' => null, @@ -119,14 +121,55 @@ class AuTimesheetLineModel implements ModelInterface, ArrayAccess 'submitted_by_user' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classification_id' => false, + 'classification' => false, + 'location_is_deleted' => false, + 'id' => false, + 'employee_id' => false, + 'start_time' => false, + 'end_time' => false, + 'units' => false, + 'work_type_id' => false, + 'location_id' => false, + 'comments' => false, + 'breaks' => false, + 'status' => false, + 'rate' => false, + 'leave_category_id' => false, + 'pay_category_id' => false, + 'external_id' => false, + 'source' => false, + 'attachment_id' => false, + 'shift_condition_ids' => false, + 'work_type' => false, + 'fully_qualified_location_name' => false, + 'shift_conditions' => false, + 'hidden_comments' => false, + 'attachment' => false, + 'submitted_by_user' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -134,9 +177,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -280,88 +375,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -448,7 +541,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -465,32 +557,50 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['location_is_deleted'] = isset($data['location_is_deleted']) ? $data['location_is_deleted'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['fully_qualified_location_name'] = isset($data['fully_qualified_location_name']) ? $data['fully_qualified_location_name'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['submitted_by_user'] = isset($data['submitted_by_user']) ? $data['submitted_by_user'] : null; + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('location_is_deleted', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('fully_qualified_location_name', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('submitted_by_user', $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; } /** @@ -505,7 +615,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -528,7 +639,7 @@ public function valid() /** * Gets classification_id * - * @return string + * @return string|null */ public function getClassificationId() { @@ -538,12 +649,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param string $classification_id + * @param string|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -552,7 +666,7 @@ public function setClassificationId($classification_id) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -562,12 +676,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -576,7 +693,7 @@ public function setClassification($classification) /** * Gets location_is_deleted * - * @return bool + * @return bool|null */ public function getLocationIsDeleted() { @@ -586,12 +703,15 @@ public function getLocationIsDeleted() /** * Sets location_is_deleted * - * @param bool $location_is_deleted + * @param bool|null $location_is_deleted * - * @return $this + * @return self */ public function setLocationIsDeleted($location_is_deleted) { + if (is_null($location_is_deleted)) { + throw new \InvalidArgumentException('non-nullable location_is_deleted cannot be null'); + } $this->container['location_is_deleted'] = $location_is_deleted; return $this; @@ -600,7 +720,7 @@ public function setLocationIsDeleted($location_is_deleted) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -610,12 +730,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -624,7 +747,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -634,12 +757,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -648,7 +774,7 @@ public function setEmployeeId($employee_id) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -658,12 +784,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -672,7 +801,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -682,12 +811,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -696,7 +828,7 @@ public function setEndTime($end_time) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -706,12 +838,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -720,7 +855,7 @@ public function setUnits($units) /** * Gets work_type_id * - * @return string + * @return string|null */ public function getWorkTypeId() { @@ -730,12 +865,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param string $work_type_id + * @param string|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -744,7 +882,7 @@ public function setWorkTypeId($work_type_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -754,12 +892,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -768,7 +909,7 @@ public function setLocationId($location_id) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -778,12 +919,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -792,7 +936,7 @@ public function setComments($comments) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakModelv3[] + * @return \OpenAPI\Client\Model\TimesheetBreakModelv3[]|null */ public function getBreaks() { @@ -802,12 +946,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakModelv3[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakModelv3[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -816,7 +963,7 @@ public function setBreaks($breaks) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -826,12 +973,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -840,7 +990,7 @@ public function setStatus($status) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -850,12 +1000,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -864,7 +1017,7 @@ public function setRate($rate) /** * Gets leave_category_id * - * @return string + * @return string|null */ public function getLeaveCategoryId() { @@ -874,12 +1027,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param string $leave_category_id + * @param string|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -888,7 +1044,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets pay_category_id * - * @return string + * @return string|null */ public function getPayCategoryId() { @@ -898,12 +1054,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param string $pay_category_id + * @param string|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -912,7 +1071,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -922,12 +1081,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -936,7 +1098,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -946,17 +1108,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -969,7 +1135,7 @@ public function setSource($source) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -979,12 +1145,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -993,7 +1162,7 @@ public function setAttachmentId($attachment_id) /** * Gets shift_condition_ids * - * @return string[] + * @return string[]|null */ public function getShiftConditionIds() { @@ -1003,12 +1172,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param string[] $shift_condition_ids + * @param string[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -1017,7 +1189,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets work_type * - * @return string + * @return string|null */ public function getWorkType() { @@ -1027,12 +1199,15 @@ public function getWorkType() /** * Sets work_type * - * @param string $work_type + * @param string|null $work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -1041,7 +1216,7 @@ public function setWorkType($work_type) /** * Gets fully_qualified_location_name * - * @return string + * @return string|null */ public function getFullyQualifiedLocationName() { @@ -1051,12 +1226,15 @@ public function getFullyQualifiedLocationName() /** * Sets fully_qualified_location_name * - * @param string $fully_qualified_location_name + * @param string|null $fully_qualified_location_name * - * @return $this + * @return self */ public function setFullyQualifiedLocationName($fully_qualified_location_name) { + if (is_null($fully_qualified_location_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_location_name cannot be null'); + } $this->container['fully_qualified_location_name'] = $fully_qualified_location_name; return $this; @@ -1065,7 +1243,7 @@ public function setFullyQualifiedLocationName($fully_qualified_location_name) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\TimesheetShiftConditionModelv3[] + * @return \OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]|null */ public function getShiftConditions() { @@ -1075,12 +1253,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\TimesheetShiftConditionModelv3[] $shift_conditions + * @param \OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -1089,7 +1270,7 @@ public function setShiftConditions($shift_conditions) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -1099,12 +1280,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -1113,7 +1297,7 @@ public function setHiddenComments($hidden_comments) /** * Gets attachment * - * @return \Swagger\Client\Model\Attachment + * @return \OpenAPI\Client\Model\Attachment|null */ public function getAttachment() { @@ -1123,12 +1307,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\Attachment $attachment + * @param \OpenAPI\Client\Model\Attachment|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -1137,7 +1324,7 @@ public function setAttachment($attachment) /** * Gets submitted_by_user * - * @return string + * @return string|null */ public function getSubmittedByUser() { @@ -1147,12 +1334,15 @@ public function getSubmittedByUser() /** * Sets submitted_by_user * - * @param string $submitted_by_user + * @param string|null $submitted_by_user * - * @return $this + * @return self */ public function setSubmittedByUser($submitted_by_user) { + if (is_null($submitted_by_user)) { + throw new \InvalidArgumentException('non-nullable submitted_by_user cannot be null'); + } $this->container['submitted_by_user'] = $submitted_by_user; return $this; @@ -1164,7 +1354,7 @@ public function setSubmittedByUser($submitted_by_user) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1174,22 +1364,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1205,11 +1396,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1217,13 +1421,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuTimesheetReferenceData.php b/src/lib/Model/AuTimesheetReferenceData.php index b2317b9..6382e7c 100644 --- a/src/lib/Model/AuTimesheetReferenceData.php +++ b/src/lib/Model/AuTimesheetReferenceData.php @@ -2,87 +2,108 @@ /** * AuTimesheetReferenceData * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuTimesheetReferenceData Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuTimesheetReferenceData implements ModelInterface, ArrayAccess +class AuTimesheetReferenceData implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuTimesheetReferenceData'; + protected static $openAPIModelName = 'AuTimesheetReferenceData'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'classifications' => '\Swagger\Client\Model\ClassificationSelectModel[]', - 'work_types' => '\Swagger\Client\Model\AuEssWorkTypeModel[]', - 'shift_conditions' => '\Swagger\Client\Model\AuEssWorkTypeModel[]', - 'locations' => '\Swagger\Client\Model\LocationModel[]' + protected static $openAPITypes = [ + 'classifications' => '\OpenAPI\Client\Model\ClassificationSelectModel[]', + 'work_types' => '\OpenAPI\Client\Model\AuEssWorkTypeModel[]', + 'shift_conditions' => '\OpenAPI\Client\Model\AuEssWorkTypeModel[]', + 'locations' => '\OpenAPI\Client\Model\LocationModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'classifications' => null, 'work_types' => null, 'shift_conditions' => null, 'locations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'classifications' => false, + 'work_types' => false, + 'shift_conditions' => false, + 'locations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['classifications'] = isset($data['classifications']) ? $data['classifications'] : null; - $this->container['work_types'] = isset($data['work_types']) ? $data['work_types'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; + $this->setIfExists('classifications', $data ?? [], null); + $this->setIfExists('work_types', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('locations', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets classifications * - * @return \Swagger\Client\Model\ClassificationSelectModel[] + * @return \OpenAPI\Client\Model\ClassificationSelectModel[]|null */ public function getClassifications() { @@ -235,12 +323,15 @@ public function getClassifications() /** * Sets classifications * - * @param \Swagger\Client\Model\ClassificationSelectModel[] $classifications + * @param \OpenAPI\Client\Model\ClassificationSelectModel[]|null $classifications * - * @return $this + * @return self */ public function setClassifications($classifications) { + if (is_null($classifications)) { + throw new \InvalidArgumentException('non-nullable classifications cannot be null'); + } $this->container['classifications'] = $classifications; return $this; @@ -249,7 +340,7 @@ public function setClassifications($classifications) /** * Gets work_types * - * @return \Swagger\Client\Model\AuEssWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuEssWorkTypeModel[]|null */ public function getWorkTypes() { @@ -259,12 +350,15 @@ public function getWorkTypes() /** * Sets work_types * - * @param \Swagger\Client\Model\AuEssWorkTypeModel[] $work_types + * @param \OpenAPI\Client\Model\AuEssWorkTypeModel[]|null $work_types * - * @return $this + * @return self */ public function setWorkTypes($work_types) { + if (is_null($work_types)) { + throw new \InvalidArgumentException('non-nullable work_types cannot be null'); + } $this->container['work_types'] = $work_types; return $this; @@ -273,7 +367,7 @@ public function setWorkTypes($work_types) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\AuEssWorkTypeModel[] + * @return \OpenAPI\Client\Model\AuEssWorkTypeModel[]|null */ public function getShiftConditions() { @@ -283,12 +377,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\AuEssWorkTypeModel[] $shift_conditions + * @param \OpenAPI\Client\Model\AuEssWorkTypeModel[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -297,7 +394,7 @@ public function setShiftConditions($shift_conditions) /** * Gets locations * - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[]|null */ public function getLocations() { @@ -307,12 +404,15 @@ public function getLocations() /** * Sets locations * - * @param \Swagger\Client\Model\LocationModel[] $locations + * @param \OpenAPI\Client\Model\LocationModel[]|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -324,7 +424,7 @@ public function setLocations($locations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuUnstructuredEmployeeModel.php b/src/lib/Model/AuUnstructuredEmployeeModel.php index 1bc9fa0..0983fa0 100644 --- a/src/lib/Model/AuUnstructuredEmployeeModel.php +++ b/src/lib/Model/AuUnstructuredEmployeeModel.php @@ -2,61 +2,61 @@ /** * AuUnstructuredEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuUnstructuredEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess +class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuUnstructuredEmployeeModel'; + protected static $openAPIModelName = 'AuUnstructuredEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'tax_file_number' => 'string', 'residential_suburb' => 'string', 'residential_state' => 'string', @@ -76,7 +76,7 @@ class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess 'working_holiday_visa_start_date' => '\DateTime', 'is_seasonal_worker' => 'bool', 'has_withholding_variation' => 'bool', - 'tax_variation' => 'double', + 'tax_variation' => 'float', 'date_tax_file_declaration_signed' => '\DateTime', 'date_tax_file_declaration_reported' => '\DateTime', 'business_award_package' => 'string', @@ -88,28 +88,28 @@ class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess 'super_fund1_product_code' => 'string', 'super_fund1_fund_name' => 'string', 'super_fund1_member_number' => 'string', - 'super_fund1_allocated_percentage' => 'double', - 'super_fund1_fixed_amount' => 'double', + 'super_fund1_allocated_percentage' => 'float', + 'super_fund1_fixed_amount' => 'float', 'super_fund1_employer_nominated_fund' => 'bool', 'super_fund2_product_code' => 'string', 'super_fund2_fund_name' => 'string', 'super_fund2_member_number' => 'string', - 'super_fund2_allocated_percentage' => 'double', - 'super_fund2_fixed_amount' => 'double', + 'super_fund2_allocated_percentage' => 'float', + 'super_fund2_fixed_amount' => 'float', 'super_fund2_employer_nominated_fund' => 'bool', 'super_fund3_product_code' => 'string', 'super_fund3_fund_name' => 'string', 'super_fund3_member_number' => 'string', - 'super_fund3_allocated_percentage' => 'double', - 'super_fund3_fixed_amount' => 'double', + 'super_fund3_allocated_percentage' => 'float', + 'super_fund3_fixed_amount' => 'float', 'super_fund3_employer_nominated_fund' => 'bool', - 'super_threshold_amount' => 'double', - 'maximum_quarterly_super_contributions_base' => 'double', + 'super_threshold_amount' => 'float', + 'maximum_quarterly_super_contributions_base' => 'float', 'medicare_levy_exemption' => 'string', 'closely_held_employee' => 'bool', 'closely_held_reporting' => 'string', 'single_touch_payroll' => 'string', - 'hours_per_day' => 'double', + 'hours_per_day' => 'float', 'postal_address_is_overseas' => 'bool', 'residential_address_is_overseas' => 'bool', 'employment_type' => 'string', @@ -151,10 +151,10 @@ class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess 'primary_pay_category' => 'string', 'primary_location' => 'string', 'pay_slip_notification_type' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'override_template_rate' => 'string', 'rate_unit' => 'string', - 'hours_per_week' => 'double', + 'hours_per_week' => 'float', 'automatically_pay_employee' => 'string', 'leave_template' => 'string', 'pay_rate_template' => 'string', @@ -174,16 +174,16 @@ class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess 'emergency_contact2_alternate_contact_number' => 'string', 'bank_account1_account_number' => 'string', 'bank_account1_account_name' => 'string', - 'bank_account1_allocated_percentage' => 'double', - 'bank_account1_fixed_amount' => 'double', + 'bank_account1_allocated_percentage' => 'float', + 'bank_account1_fixed_amount' => 'float', 'bank_account2_account_number' => 'string', 'bank_account2_account_name' => 'string', - 'bank_account2_allocated_percentage' => 'double', - 'bank_account2_fixed_amount' => 'double', + 'bank_account2_allocated_percentage' => 'float', + 'bank_account2_fixed_amount' => 'float', 'bank_account3_account_number' => 'string', 'bank_account3_account_name' => 'string', - 'bank_account3_allocated_percentage' => 'double', - 'bank_account3_fixed_amount' => 'double', + 'bank_account3_allocated_percentage' => 'float', + 'bank_account3_fixed_amount' => 'float', 'rostering_notification_choices' => 'string', 'leave_accrual_start_date_type' => 'string', 'leave_year_start' => '\DateTime', @@ -196,8 +196,10 @@ class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'tax_file_number' => null, 'residential_suburb' => null, 'residential_state' => null, @@ -333,14 +335,162 @@ class AuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess 'reporting_dimension_values' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tax_file_number' => false, + 'residential_suburb' => false, + 'residential_state' => false, + 'postal_suburb' => false, + 'postal_state' => false, + 'employing_entity_abn' => false, + 'employing_entity_id' => false, + 'previous_surname' => false, + 'australian_resident' => false, + 'claim_tax_free_threshold' => false, + 'seniors_tax_offset' => false, + 'other_tax_offset' => false, + 'stsl_debt' => false, + 'is_exempt_from_flood_levy' => false, + 'has_approved_working_holiday_visa' => false, + 'working_holiday_visa_country' => false, + 'working_holiday_visa_start_date' => false, + 'is_seasonal_worker' => false, + 'has_withholding_variation' => false, + 'tax_variation' => false, + 'date_tax_file_declaration_signed' => false, + 'date_tax_file_declaration_reported' => false, + 'business_award_package' => false, + 'employment_agreement' => false, + 'is_exempt_from_payroll_tax' => false, + 'bank_account1_bsb' => false, + 'bank_account2_bsb' => false, + 'bank_account3_bsb' => false, + 'super_fund1_product_code' => false, + 'super_fund1_fund_name' => false, + 'super_fund1_member_number' => false, + 'super_fund1_allocated_percentage' => false, + 'super_fund1_fixed_amount' => false, + 'super_fund1_employer_nominated_fund' => false, + 'super_fund2_product_code' => false, + 'super_fund2_fund_name' => false, + 'super_fund2_member_number' => false, + 'super_fund2_allocated_percentage' => false, + 'super_fund2_fixed_amount' => false, + 'super_fund2_employer_nominated_fund' => false, + 'super_fund3_product_code' => false, + 'super_fund3_fund_name' => false, + 'super_fund3_member_number' => false, + 'super_fund3_allocated_percentage' => false, + 'super_fund3_fixed_amount' => false, + 'super_fund3_employer_nominated_fund' => false, + 'super_threshold_amount' => false, + 'maximum_quarterly_super_contributions_base' => false, + 'medicare_levy_exemption' => false, + 'closely_held_employee' => false, + 'closely_held_reporting' => false, + 'single_touch_payroll' => false, + 'hours_per_day' => false, + 'postal_address_is_overseas' => false, + 'residential_address_is_overseas' => false, + 'employment_type' => false, + 'contractor_abn' => false, + 'termination_reason' => false, + 'tax_category' => false, + 'medicare_levy_surcharge_withholding_tier' => false, + 'claim_medicare_levy_reduction' => false, + 'medicare_levy_reduction_spouse' => false, + 'medicare_levy_reduction_dependent_count' => false, + 'dvl_pay_slip_description' => false, + 'id' => false, + 'title' => false, + 'preferred_name' => false, + 'first_name' => false, + 'middle_name' => false, + 'surname' => false, + 'date_of_birth' => false, + 'gender' => false, + 'external_id' => false, + 'residential_street_address' => false, + 'residential_address_line2' => false, + 'residential_post_code' => false, + 'residential_country' => false, + 'postal_street_address' => false, + 'postal_address_line2' => false, + 'postal_post_code' => false, + 'postal_country' => false, + 'email_address' => false, + 'home_phone' => false, + 'work_phone' => false, + 'mobile_phone' => false, + 'start_date' => false, + 'end_date' => false, + 'anniversary_date' => false, + 'tags' => false, + 'job_title' => false, + 'pay_schedule' => false, + 'primary_pay_category' => false, + 'primary_location' => false, + 'pay_slip_notification_type' => false, + 'rate' => false, + 'override_template_rate' => false, + 'rate_unit' => false, + 'hours_per_week' => false, + 'automatically_pay_employee' => false, + 'leave_template' => false, + 'pay_rate_template' => false, + 'pay_condition_rule_set' => false, + 'is_enabled_for_timesheets' => false, + 'locations' => false, + 'work_types' => false, + 'emergency_contact1_name' => false, + 'emergency_contact1_relationship' => false, + 'emergency_contact1_address' => false, + 'emergency_contact1_contact_number' => false, + 'emergency_contact1_alternate_contact_number' => false, + 'emergency_contact2_name' => false, + 'emergency_contact2_relationship' => false, + 'emergency_contact2_address' => false, + 'emergency_contact2_contact_number' => false, + 'emergency_contact2_alternate_contact_number' => false, + 'bank_account1_account_number' => false, + 'bank_account1_account_name' => false, + 'bank_account1_allocated_percentage' => false, + 'bank_account1_fixed_amount' => false, + 'bank_account2_account_number' => false, + 'bank_account2_account_name' => false, + 'bank_account2_allocated_percentage' => false, + 'bank_account2_fixed_amount' => false, + 'bank_account3_account_number' => false, + 'bank_account3_account_name' => false, + 'bank_account3_allocated_percentage' => false, + 'bank_account3_fixed_amount' => false, + 'rostering_notification_choices' => false, + 'leave_accrual_start_date_type' => false, + 'leave_year_start' => false, + 'status' => false, + 'date_created' => false, + 'reporting_dimension_values' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -348,9 +498,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -815,43 +1017,41 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const CLOSELY_HELD_REPORTING_PER_QUARTER = 'PerQuarter'; - const CLOSELY_HELD_REPORTING_PER_PAY_RUN = 'PerPayRun'; - const SINGLE_TOUCH_PAYROLL_CLOSELY_HELD = 'CloselyHeld'; - const SINGLE_TOUCH_PAYROLL_FOREIGN_EMPLOYMENT = 'ForeignEmployment'; - const SINGLE_TOUCH_PAYROLL_INBOUND_ASSIGNEE = 'InboundAssignee'; - const SINGLE_TOUCH_PAYROLL_LABOUR_HIRE = 'LabourHire'; - const SINGLE_TOUCH_PAYROLL_OTHER_SPECIFIED_PAYMENTS = 'OtherSpecifiedPayments'; - const TAX_CATEGORY_ACTOR_WITH_TAX_FREE_THRESHOLD = 'Actor_WithTaxFreeThreshold'; - const TAX_CATEGORY_ACTOR_NO_TAX_FREE_THRESHOLD = 'Actor_NoTaxFreeThreshold'; - const TAX_CATEGORY_ACTOR_LIMITED_PERFORMANCE_PER_WEEK = 'Actor_LimitedPerformancePerWeek'; - const TAX_CATEGORY_ACTOR_PROMOTIONAL = 'Actor_Promotional'; - const TAX_CATEGORY_HORTICULTURALIST_SHEARER_WITH_TAX_FREE_THRESHOLD = 'HorticulturalistShearer_WithTaxFreeThreshold'; - const TAX_CATEGORY_HORTICULTURALIST_SHEARER_FOREIGN_RESIDENT = 'HorticulturalistShearer_ForeignResident'; - const TAX_CATEGORY_SENIOR_PENSIONER_SINGLE = 'SeniorPensioner_Single'; - const TAX_CATEGORY_SENIOR_PENSIONER_MARRIED = 'SeniorPensioner_Married'; - const TAX_CATEGORY_SENIOR_PENSIONER_SEPARATED_COUPLE_ILLNESS = 'SeniorPensioner_SeparatedCoupleIllness'; - const TAX_CATEGORY_ATO_DEFINED_DEATH_BENEFICIARY = 'ATODefined_DeathBeneficiary'; - const TAX_CATEGORY_ATO_DEFINED_DOWNWARD_VARIATION = 'ATODefined_DownwardVariation'; - const TAX_CATEGORY_ATO_DEFINED_NON_EMPLOYEE = 'ATODefined_NonEmployee'; - const TAX_CATEGORY_DAILY_CASUAL = 'DailyCasual'; - const MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER1 = 'Tier1'; - const MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER2 = 'Tier2'; - const MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER3 = 'Tier3'; - const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; - const STATUS_ACTIVE = 'Active'; - const STATUS_TERMINATED = 'Terminated'; - const STATUS_INCOMPLETE = 'Incomplete'; - - - + return self::$openAPIModelName; + } + + public const CLOSELY_HELD_REPORTING_PER_QUARTER = 'PerQuarter'; + public const CLOSELY_HELD_REPORTING_PER_PAY_RUN = 'PerPayRun'; + public const SINGLE_TOUCH_PAYROLL_CLOSELY_HELD = 'CloselyHeld'; + public const SINGLE_TOUCH_PAYROLL_FOREIGN_EMPLOYMENT = 'ForeignEmployment'; + public const SINGLE_TOUCH_PAYROLL_INBOUND_ASSIGNEE = 'InboundAssignee'; + public const SINGLE_TOUCH_PAYROLL_LABOUR_HIRE = 'LabourHire'; + public const SINGLE_TOUCH_PAYROLL_OTHER_SPECIFIED_PAYMENTS = 'OtherSpecifiedPayments'; + public const TAX_CATEGORY_ACTOR_WITH_TAX_FREE_THRESHOLD = 'Actor_WithTaxFreeThreshold'; + public const TAX_CATEGORY_ACTOR_NO_TAX_FREE_THRESHOLD = 'Actor_NoTaxFreeThreshold'; + public const TAX_CATEGORY_ACTOR_LIMITED_PERFORMANCE_PER_WEEK = 'Actor_LimitedPerformancePerWeek'; + public const TAX_CATEGORY_ACTOR_PROMOTIONAL = 'Actor_Promotional'; + public const TAX_CATEGORY_HORTICULTURALIST_SHEARER_WITH_TAX_FREE_THRESHOLD = 'HorticulturalistShearer_WithTaxFreeThreshold'; + public const TAX_CATEGORY_HORTICULTURALIST_SHEARER_FOREIGN_RESIDENT = 'HorticulturalistShearer_ForeignResident'; + public const TAX_CATEGORY_SENIOR_PENSIONER_SINGLE = 'SeniorPensioner_Single'; + public const TAX_CATEGORY_SENIOR_PENSIONER_MARRIED = 'SeniorPensioner_Married'; + public const TAX_CATEGORY_SENIOR_PENSIONER_SEPARATED_COUPLE_ILLNESS = 'SeniorPensioner_SeparatedCoupleIllness'; + public const TAX_CATEGORY_ATO_DEFINED_DEATH_BENEFICIARY = 'ATODefined_DeathBeneficiary'; + public const TAX_CATEGORY_ATO_DEFINED_DOWNWARD_VARIATION = 'ATODefined_DownwardVariation'; + public const TAX_CATEGORY_ATO_DEFINED_NON_EMPLOYEE = 'ATODefined_NonEmployee'; + public const TAX_CATEGORY_DAILY_CASUAL = 'DailyCasual'; + public const MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER1 = 'Tier1'; + public const MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER2 = 'Tier2'; + public const MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER3 = 'Tier3'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; + public const STATUS_ACTIVE = 'Active'; + public const STATUS_TERMINATED = 'Terminated'; + public const STATUS_INCOMPLETE = 'Incomplete'; + /** * Gets allowable values of the enum * @@ -864,7 +1064,7 @@ public function getCloselyHeldReportingAllowableValues() self::CLOSELY_HELD_REPORTING_PER_PAY_RUN, ]; } - + /** * Gets allowable values of the enum * @@ -880,7 +1080,7 @@ public function getSingleTouchPayrollAllowableValues() self::SINGLE_TOUCH_PAYROLL_OTHER_SPECIFIED_PAYMENTS, ]; } - + /** * Gets allowable values of the enum * @@ -904,7 +1104,7 @@ public function getTaxCategoryAllowableValues() self::TAX_CATEGORY_DAILY_CASUAL, ]; } - + /** * Gets allowable values of the enum * @@ -918,7 +1118,7 @@ public function getMedicareLevySurchargeWithholdingTierAllowableValues() self::MEDICARE_LEVY_SURCHARGE_WITHHOLDING_TIER_TIER3, ]; } - + /** * Gets allowable values of the enum * @@ -934,7 +1134,7 @@ public function getLeaveAccrualStartDateTypeAllowableValues() self::LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH, ]; } - + /** * Gets allowable values of the enum * @@ -948,7 +1148,6 @@ public function getStatusAllowableValues() self::STATUS_INCOMPLETE, ]; } - /** * Associative array for storing property values @@ -965,139 +1164,157 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['tax_file_number'] = isset($data['tax_file_number']) ? $data['tax_file_number'] : null; - $this->container['residential_suburb'] = isset($data['residential_suburb']) ? $data['residential_suburb'] : null; - $this->container['residential_state'] = isset($data['residential_state']) ? $data['residential_state'] : null; - $this->container['postal_suburb'] = isset($data['postal_suburb']) ? $data['postal_suburb'] : null; - $this->container['postal_state'] = isset($data['postal_state']) ? $data['postal_state'] : null; - $this->container['employing_entity_abn'] = isset($data['employing_entity_abn']) ? $data['employing_entity_abn'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; - $this->container['previous_surname'] = isset($data['previous_surname']) ? $data['previous_surname'] : null; - $this->container['australian_resident'] = isset($data['australian_resident']) ? $data['australian_resident'] : null; - $this->container['claim_tax_free_threshold'] = isset($data['claim_tax_free_threshold']) ? $data['claim_tax_free_threshold'] : null; - $this->container['seniors_tax_offset'] = isset($data['seniors_tax_offset']) ? $data['seniors_tax_offset'] : null; - $this->container['other_tax_offset'] = isset($data['other_tax_offset']) ? $data['other_tax_offset'] : null; - $this->container['stsl_debt'] = isset($data['stsl_debt']) ? $data['stsl_debt'] : null; - $this->container['is_exempt_from_flood_levy'] = isset($data['is_exempt_from_flood_levy']) ? $data['is_exempt_from_flood_levy'] : null; - $this->container['has_approved_working_holiday_visa'] = isset($data['has_approved_working_holiday_visa']) ? $data['has_approved_working_holiday_visa'] : null; - $this->container['working_holiday_visa_country'] = isset($data['working_holiday_visa_country']) ? $data['working_holiday_visa_country'] : null; - $this->container['working_holiday_visa_start_date'] = isset($data['working_holiday_visa_start_date']) ? $data['working_holiday_visa_start_date'] : null; - $this->container['is_seasonal_worker'] = isset($data['is_seasonal_worker']) ? $data['is_seasonal_worker'] : null; - $this->container['has_withholding_variation'] = isset($data['has_withholding_variation']) ? $data['has_withholding_variation'] : null; - $this->container['tax_variation'] = isset($data['tax_variation']) ? $data['tax_variation'] : null; - $this->container['date_tax_file_declaration_signed'] = isset($data['date_tax_file_declaration_signed']) ? $data['date_tax_file_declaration_signed'] : null; - $this->container['date_tax_file_declaration_reported'] = isset($data['date_tax_file_declaration_reported']) ? $data['date_tax_file_declaration_reported'] : null; - $this->container['business_award_package'] = isset($data['business_award_package']) ? $data['business_award_package'] : null; - $this->container['employment_agreement'] = isset($data['employment_agreement']) ? $data['employment_agreement'] : null; - $this->container['is_exempt_from_payroll_tax'] = isset($data['is_exempt_from_payroll_tax']) ? $data['is_exempt_from_payroll_tax'] : null; - $this->container['bank_account1_bsb'] = isset($data['bank_account1_bsb']) ? $data['bank_account1_bsb'] : null; - $this->container['bank_account2_bsb'] = isset($data['bank_account2_bsb']) ? $data['bank_account2_bsb'] : null; - $this->container['bank_account3_bsb'] = isset($data['bank_account3_bsb']) ? $data['bank_account3_bsb'] : null; - $this->container['super_fund1_product_code'] = isset($data['super_fund1_product_code']) ? $data['super_fund1_product_code'] : null; - $this->container['super_fund1_fund_name'] = isset($data['super_fund1_fund_name']) ? $data['super_fund1_fund_name'] : null; - $this->container['super_fund1_member_number'] = isset($data['super_fund1_member_number']) ? $data['super_fund1_member_number'] : null; - $this->container['super_fund1_allocated_percentage'] = isset($data['super_fund1_allocated_percentage']) ? $data['super_fund1_allocated_percentage'] : null; - $this->container['super_fund1_fixed_amount'] = isset($data['super_fund1_fixed_amount']) ? $data['super_fund1_fixed_amount'] : null; - $this->container['super_fund1_employer_nominated_fund'] = isset($data['super_fund1_employer_nominated_fund']) ? $data['super_fund1_employer_nominated_fund'] : null; - $this->container['super_fund2_product_code'] = isset($data['super_fund2_product_code']) ? $data['super_fund2_product_code'] : null; - $this->container['super_fund2_fund_name'] = isset($data['super_fund2_fund_name']) ? $data['super_fund2_fund_name'] : null; - $this->container['super_fund2_member_number'] = isset($data['super_fund2_member_number']) ? $data['super_fund2_member_number'] : null; - $this->container['super_fund2_allocated_percentage'] = isset($data['super_fund2_allocated_percentage']) ? $data['super_fund2_allocated_percentage'] : null; - $this->container['super_fund2_fixed_amount'] = isset($data['super_fund2_fixed_amount']) ? $data['super_fund2_fixed_amount'] : null; - $this->container['super_fund2_employer_nominated_fund'] = isset($data['super_fund2_employer_nominated_fund']) ? $data['super_fund2_employer_nominated_fund'] : null; - $this->container['super_fund3_product_code'] = isset($data['super_fund3_product_code']) ? $data['super_fund3_product_code'] : null; - $this->container['super_fund3_fund_name'] = isset($data['super_fund3_fund_name']) ? $data['super_fund3_fund_name'] : null; - $this->container['super_fund3_member_number'] = isset($data['super_fund3_member_number']) ? $data['super_fund3_member_number'] : null; - $this->container['super_fund3_allocated_percentage'] = isset($data['super_fund3_allocated_percentage']) ? $data['super_fund3_allocated_percentage'] : null; - $this->container['super_fund3_fixed_amount'] = isset($data['super_fund3_fixed_amount']) ? $data['super_fund3_fixed_amount'] : null; - $this->container['super_fund3_employer_nominated_fund'] = isset($data['super_fund3_employer_nominated_fund']) ? $data['super_fund3_employer_nominated_fund'] : null; - $this->container['super_threshold_amount'] = isset($data['super_threshold_amount']) ? $data['super_threshold_amount'] : null; - $this->container['maximum_quarterly_super_contributions_base'] = isset($data['maximum_quarterly_super_contributions_base']) ? $data['maximum_quarterly_super_contributions_base'] : null; - $this->container['medicare_levy_exemption'] = isset($data['medicare_levy_exemption']) ? $data['medicare_levy_exemption'] : null; - $this->container['closely_held_employee'] = isset($data['closely_held_employee']) ? $data['closely_held_employee'] : null; - $this->container['closely_held_reporting'] = isset($data['closely_held_reporting']) ? $data['closely_held_reporting'] : null; - $this->container['single_touch_payroll'] = isset($data['single_touch_payroll']) ? $data['single_touch_payroll'] : null; - $this->container['hours_per_day'] = isset($data['hours_per_day']) ? $data['hours_per_day'] : null; - $this->container['postal_address_is_overseas'] = isset($data['postal_address_is_overseas']) ? $data['postal_address_is_overseas'] : null; - $this->container['residential_address_is_overseas'] = isset($data['residential_address_is_overseas']) ? $data['residential_address_is_overseas'] : null; - $this->container['employment_type'] = isset($data['employment_type']) ? $data['employment_type'] : null; - $this->container['contractor_abn'] = isset($data['contractor_abn']) ? $data['contractor_abn'] : null; - $this->container['termination_reason'] = isset($data['termination_reason']) ? $data['termination_reason'] : null; - $this->container['tax_category'] = isset($data['tax_category']) ? $data['tax_category'] : null; - $this->container['medicare_levy_surcharge_withholding_tier'] = isset($data['medicare_levy_surcharge_withholding_tier']) ? $data['medicare_levy_surcharge_withholding_tier'] : null; - $this->container['claim_medicare_levy_reduction'] = isset($data['claim_medicare_levy_reduction']) ? $data['claim_medicare_levy_reduction'] : null; - $this->container['medicare_levy_reduction_spouse'] = isset($data['medicare_levy_reduction_spouse']) ? $data['medicare_levy_reduction_spouse'] : null; - $this->container['medicare_levy_reduction_dependent_count'] = isset($data['medicare_levy_reduction_dependent_count']) ? $data['medicare_levy_reduction_dependent_count'] : null; - $this->container['dvl_pay_slip_description'] = isset($data['dvl_pay_slip_description']) ? $data['dvl_pay_slip_description'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['preferred_name'] = isset($data['preferred_name']) ? $data['preferred_name'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['middle_name'] = isset($data['middle_name']) ? $data['middle_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['residential_street_address'] = isset($data['residential_street_address']) ? $data['residential_street_address'] : null; - $this->container['residential_address_line2'] = isset($data['residential_address_line2']) ? $data['residential_address_line2'] : null; - $this->container['residential_post_code'] = isset($data['residential_post_code']) ? $data['residential_post_code'] : null; - $this->container['residential_country'] = isset($data['residential_country']) ? $data['residential_country'] : null; - $this->container['postal_street_address'] = isset($data['postal_street_address']) ? $data['postal_street_address'] : null; - $this->container['postal_address_line2'] = isset($data['postal_address_line2']) ? $data['postal_address_line2'] : null; - $this->container['postal_post_code'] = isset($data['postal_post_code']) ? $data['postal_post_code'] : null; - $this->container['postal_country'] = isset($data['postal_country']) ? $data['postal_country'] : null; - $this->container['email_address'] = isset($data['email_address']) ? $data['email_address'] : null; - $this->container['home_phone'] = isset($data['home_phone']) ? $data['home_phone'] : null; - $this->container['work_phone'] = isset($data['work_phone']) ? $data['work_phone'] : null; - $this->container['mobile_phone'] = isset($data['mobile_phone']) ? $data['mobile_phone'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['anniversary_date'] = isset($data['anniversary_date']) ? $data['anniversary_date'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; - $this->container['job_title'] = isset($data['job_title']) ? $data['job_title'] : null; - $this->container['pay_schedule'] = isset($data['pay_schedule']) ? $data['pay_schedule'] : null; - $this->container['primary_pay_category'] = isset($data['primary_pay_category']) ? $data['primary_pay_category'] : null; - $this->container['primary_location'] = isset($data['primary_location']) ? $data['primary_location'] : null; - $this->container['pay_slip_notification_type'] = isset($data['pay_slip_notification_type']) ? $data['pay_slip_notification_type'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['override_template_rate'] = isset($data['override_template_rate']) ? $data['override_template_rate'] : null; - $this->container['rate_unit'] = isset($data['rate_unit']) ? $data['rate_unit'] : null; - $this->container['hours_per_week'] = isset($data['hours_per_week']) ? $data['hours_per_week'] : null; - $this->container['automatically_pay_employee'] = isset($data['automatically_pay_employee']) ? $data['automatically_pay_employee'] : null; - $this->container['leave_template'] = isset($data['leave_template']) ? $data['leave_template'] : null; - $this->container['pay_rate_template'] = isset($data['pay_rate_template']) ? $data['pay_rate_template'] : null; - $this->container['pay_condition_rule_set'] = isset($data['pay_condition_rule_set']) ? $data['pay_condition_rule_set'] : null; - $this->container['is_enabled_for_timesheets'] = isset($data['is_enabled_for_timesheets']) ? $data['is_enabled_for_timesheets'] : null; - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; - $this->container['work_types'] = isset($data['work_types']) ? $data['work_types'] : null; - $this->container['emergency_contact1_name'] = isset($data['emergency_contact1_name']) ? $data['emergency_contact1_name'] : null; - $this->container['emergency_contact1_relationship'] = isset($data['emergency_contact1_relationship']) ? $data['emergency_contact1_relationship'] : null; - $this->container['emergency_contact1_address'] = isset($data['emergency_contact1_address']) ? $data['emergency_contact1_address'] : null; - $this->container['emergency_contact1_contact_number'] = isset($data['emergency_contact1_contact_number']) ? $data['emergency_contact1_contact_number'] : null; - $this->container['emergency_contact1_alternate_contact_number'] = isset($data['emergency_contact1_alternate_contact_number']) ? $data['emergency_contact1_alternate_contact_number'] : null; - $this->container['emergency_contact2_name'] = isset($data['emergency_contact2_name']) ? $data['emergency_contact2_name'] : null; - $this->container['emergency_contact2_relationship'] = isset($data['emergency_contact2_relationship']) ? $data['emergency_contact2_relationship'] : null; - $this->container['emergency_contact2_address'] = isset($data['emergency_contact2_address']) ? $data['emergency_contact2_address'] : null; - $this->container['emergency_contact2_contact_number'] = isset($data['emergency_contact2_contact_number']) ? $data['emergency_contact2_contact_number'] : null; - $this->container['emergency_contact2_alternate_contact_number'] = isset($data['emergency_contact2_alternate_contact_number']) ? $data['emergency_contact2_alternate_contact_number'] : null; - $this->container['bank_account1_account_number'] = isset($data['bank_account1_account_number']) ? $data['bank_account1_account_number'] : null; - $this->container['bank_account1_account_name'] = isset($data['bank_account1_account_name']) ? $data['bank_account1_account_name'] : null; - $this->container['bank_account1_allocated_percentage'] = isset($data['bank_account1_allocated_percentage']) ? $data['bank_account1_allocated_percentage'] : null; - $this->container['bank_account1_fixed_amount'] = isset($data['bank_account1_fixed_amount']) ? $data['bank_account1_fixed_amount'] : null; - $this->container['bank_account2_account_number'] = isset($data['bank_account2_account_number']) ? $data['bank_account2_account_number'] : null; - $this->container['bank_account2_account_name'] = isset($data['bank_account2_account_name']) ? $data['bank_account2_account_name'] : null; - $this->container['bank_account2_allocated_percentage'] = isset($data['bank_account2_allocated_percentage']) ? $data['bank_account2_allocated_percentage'] : null; - $this->container['bank_account2_fixed_amount'] = isset($data['bank_account2_fixed_amount']) ? $data['bank_account2_fixed_amount'] : null; - $this->container['bank_account3_account_number'] = isset($data['bank_account3_account_number']) ? $data['bank_account3_account_number'] : null; - $this->container['bank_account3_account_name'] = isset($data['bank_account3_account_name']) ? $data['bank_account3_account_name'] : null; - $this->container['bank_account3_allocated_percentage'] = isset($data['bank_account3_allocated_percentage']) ? $data['bank_account3_allocated_percentage'] : null; - $this->container['bank_account3_fixed_amount'] = isset($data['bank_account3_fixed_amount']) ? $data['bank_account3_fixed_amount'] : null; - $this->container['rostering_notification_choices'] = isset($data['rostering_notification_choices']) ? $data['rostering_notification_choices'] : null; - $this->container['leave_accrual_start_date_type'] = isset($data['leave_accrual_start_date_type']) ? $data['leave_accrual_start_date_type'] : null; - $this->container['leave_year_start'] = isset($data['leave_year_start']) ? $data['leave_year_start'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['reporting_dimension_values'] = isset($data['reporting_dimension_values']) ? $data['reporting_dimension_values'] : null; + $this->setIfExists('tax_file_number', $data ?? [], null); + $this->setIfExists('residential_suburb', $data ?? [], null); + $this->setIfExists('residential_state', $data ?? [], null); + $this->setIfExists('postal_suburb', $data ?? [], null); + $this->setIfExists('postal_state', $data ?? [], null); + $this->setIfExists('employing_entity_abn', $data ?? [], null); + $this->setIfExists('employing_entity_id', $data ?? [], null); + $this->setIfExists('previous_surname', $data ?? [], null); + $this->setIfExists('australian_resident', $data ?? [], null); + $this->setIfExists('claim_tax_free_threshold', $data ?? [], null); + $this->setIfExists('seniors_tax_offset', $data ?? [], null); + $this->setIfExists('other_tax_offset', $data ?? [], null); + $this->setIfExists('stsl_debt', $data ?? [], null); + $this->setIfExists('is_exempt_from_flood_levy', $data ?? [], null); + $this->setIfExists('has_approved_working_holiday_visa', $data ?? [], null); + $this->setIfExists('working_holiday_visa_country', $data ?? [], null); + $this->setIfExists('working_holiday_visa_start_date', $data ?? [], null); + $this->setIfExists('is_seasonal_worker', $data ?? [], null); + $this->setIfExists('has_withholding_variation', $data ?? [], null); + $this->setIfExists('tax_variation', $data ?? [], null); + $this->setIfExists('date_tax_file_declaration_signed', $data ?? [], null); + $this->setIfExists('date_tax_file_declaration_reported', $data ?? [], null); + $this->setIfExists('business_award_package', $data ?? [], null); + $this->setIfExists('employment_agreement', $data ?? [], null); + $this->setIfExists('is_exempt_from_payroll_tax', $data ?? [], null); + $this->setIfExists('bank_account1_bsb', $data ?? [], null); + $this->setIfExists('bank_account2_bsb', $data ?? [], null); + $this->setIfExists('bank_account3_bsb', $data ?? [], null); + $this->setIfExists('super_fund1_product_code', $data ?? [], null); + $this->setIfExists('super_fund1_fund_name', $data ?? [], null); + $this->setIfExists('super_fund1_member_number', $data ?? [], null); + $this->setIfExists('super_fund1_allocated_percentage', $data ?? [], null); + $this->setIfExists('super_fund1_fixed_amount', $data ?? [], null); + $this->setIfExists('super_fund1_employer_nominated_fund', $data ?? [], null); + $this->setIfExists('super_fund2_product_code', $data ?? [], null); + $this->setIfExists('super_fund2_fund_name', $data ?? [], null); + $this->setIfExists('super_fund2_member_number', $data ?? [], null); + $this->setIfExists('super_fund2_allocated_percentage', $data ?? [], null); + $this->setIfExists('super_fund2_fixed_amount', $data ?? [], null); + $this->setIfExists('super_fund2_employer_nominated_fund', $data ?? [], null); + $this->setIfExists('super_fund3_product_code', $data ?? [], null); + $this->setIfExists('super_fund3_fund_name', $data ?? [], null); + $this->setIfExists('super_fund3_member_number', $data ?? [], null); + $this->setIfExists('super_fund3_allocated_percentage', $data ?? [], null); + $this->setIfExists('super_fund3_fixed_amount', $data ?? [], null); + $this->setIfExists('super_fund3_employer_nominated_fund', $data ?? [], null); + $this->setIfExists('super_threshold_amount', $data ?? [], null); + $this->setIfExists('maximum_quarterly_super_contributions_base', $data ?? [], null); + $this->setIfExists('medicare_levy_exemption', $data ?? [], null); + $this->setIfExists('closely_held_employee', $data ?? [], null); + $this->setIfExists('closely_held_reporting', $data ?? [], null); + $this->setIfExists('single_touch_payroll', $data ?? [], null); + $this->setIfExists('hours_per_day', $data ?? [], null); + $this->setIfExists('postal_address_is_overseas', $data ?? [], null); + $this->setIfExists('residential_address_is_overseas', $data ?? [], null); + $this->setIfExists('employment_type', $data ?? [], null); + $this->setIfExists('contractor_abn', $data ?? [], null); + $this->setIfExists('termination_reason', $data ?? [], null); + $this->setIfExists('tax_category', $data ?? [], null); + $this->setIfExists('medicare_levy_surcharge_withholding_tier', $data ?? [], null); + $this->setIfExists('claim_medicare_levy_reduction', $data ?? [], null); + $this->setIfExists('medicare_levy_reduction_spouse', $data ?? [], null); + $this->setIfExists('medicare_levy_reduction_dependent_count', $data ?? [], null); + $this->setIfExists('dvl_pay_slip_description', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('preferred_name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('middle_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('gender', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('residential_street_address', $data ?? [], null); + $this->setIfExists('residential_address_line2', $data ?? [], null); + $this->setIfExists('residential_post_code', $data ?? [], null); + $this->setIfExists('residential_country', $data ?? [], null); + $this->setIfExists('postal_street_address', $data ?? [], null); + $this->setIfExists('postal_address_line2', $data ?? [], null); + $this->setIfExists('postal_post_code', $data ?? [], null); + $this->setIfExists('postal_country', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('home_phone', $data ?? [], null); + $this->setIfExists('work_phone', $data ?? [], null); + $this->setIfExists('mobile_phone', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('anniversary_date', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('job_title', $data ?? [], null); + $this->setIfExists('pay_schedule', $data ?? [], null); + $this->setIfExists('primary_pay_category', $data ?? [], null); + $this->setIfExists('primary_location', $data ?? [], null); + $this->setIfExists('pay_slip_notification_type', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('override_template_rate', $data ?? [], null); + $this->setIfExists('rate_unit', $data ?? [], null); + $this->setIfExists('hours_per_week', $data ?? [], null); + $this->setIfExists('automatically_pay_employee', $data ?? [], null); + $this->setIfExists('leave_template', $data ?? [], null); + $this->setIfExists('pay_rate_template', $data ?? [], null); + $this->setIfExists('pay_condition_rule_set', $data ?? [], null); + $this->setIfExists('is_enabled_for_timesheets', $data ?? [], null); + $this->setIfExists('locations', $data ?? [], null); + $this->setIfExists('work_types', $data ?? [], null); + $this->setIfExists('emergency_contact1_name', $data ?? [], null); + $this->setIfExists('emergency_contact1_relationship', $data ?? [], null); + $this->setIfExists('emergency_contact1_address', $data ?? [], null); + $this->setIfExists('emergency_contact1_contact_number', $data ?? [], null); + $this->setIfExists('emergency_contact1_alternate_contact_number', $data ?? [], null); + $this->setIfExists('emergency_contact2_name', $data ?? [], null); + $this->setIfExists('emergency_contact2_relationship', $data ?? [], null); + $this->setIfExists('emergency_contact2_address', $data ?? [], null); + $this->setIfExists('emergency_contact2_contact_number', $data ?? [], null); + $this->setIfExists('emergency_contact2_alternate_contact_number', $data ?? [], null); + $this->setIfExists('bank_account1_account_number', $data ?? [], null); + $this->setIfExists('bank_account1_account_name', $data ?? [], null); + $this->setIfExists('bank_account1_allocated_percentage', $data ?? [], null); + $this->setIfExists('bank_account1_fixed_amount', $data ?? [], null); + $this->setIfExists('bank_account2_account_number', $data ?? [], null); + $this->setIfExists('bank_account2_account_name', $data ?? [], null); + $this->setIfExists('bank_account2_allocated_percentage', $data ?? [], null); + $this->setIfExists('bank_account2_fixed_amount', $data ?? [], null); + $this->setIfExists('bank_account3_account_number', $data ?? [], null); + $this->setIfExists('bank_account3_account_name', $data ?? [], null); + $this->setIfExists('bank_account3_allocated_percentage', $data ?? [], null); + $this->setIfExists('bank_account3_fixed_amount', $data ?? [], null); + $this->setIfExists('rostering_notification_choices', $data ?? [], null); + $this->setIfExists('leave_accrual_start_date_type', $data ?? [], null); + $this->setIfExists('leave_year_start', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('reporting_dimension_values', $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; } /** @@ -1112,7 +1329,8 @@ public function listInvalidProperties() $allowedValues = $this->getCloselyHeldReportingAllowableValues(); if (!is_null($this->container['closely_held_reporting']) && !in_array($this->container['closely_held_reporting'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'closely_held_reporting', must be one of '%s'", + "invalid value '%s' for 'closely_held_reporting', must be one of '%s'", + $this->container['closely_held_reporting'], implode("', '", $allowedValues) ); } @@ -1120,7 +1338,8 @@ public function listInvalidProperties() $allowedValues = $this->getSingleTouchPayrollAllowableValues(); if (!is_null($this->container['single_touch_payroll']) && !in_array($this->container['single_touch_payroll'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'single_touch_payroll', must be one of '%s'", + "invalid value '%s' for 'single_touch_payroll', must be one of '%s'", + $this->container['single_touch_payroll'], implode("', '", $allowedValues) ); } @@ -1128,7 +1347,8 @@ public function listInvalidProperties() $allowedValues = $this->getTaxCategoryAllowableValues(); if (!is_null($this->container['tax_category']) && !in_array($this->container['tax_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'tax_category', must be one of '%s'", + "invalid value '%s' for 'tax_category', must be one of '%s'", + $this->container['tax_category'], implode("', '", $allowedValues) ); } @@ -1136,7 +1356,8 @@ public function listInvalidProperties() $allowedValues = $this->getMedicareLevySurchargeWithholdingTierAllowableValues(); if (!is_null($this->container['medicare_levy_surcharge_withholding_tier']) && !in_array($this->container['medicare_levy_surcharge_withholding_tier'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'medicare_levy_surcharge_withholding_tier', must be one of '%s'", + "invalid value '%s' for 'medicare_levy_surcharge_withholding_tier', must be one of '%s'", + $this->container['medicare_levy_surcharge_withholding_tier'], implode("', '", $allowedValues) ); } @@ -1224,7 +1445,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); if (!is_null($this->container['leave_accrual_start_date_type']) && !in_array($this->container['leave_accrual_start_date_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $this->container['leave_accrual_start_date_type'], implode("', '", $allowedValues) ); } @@ -1232,7 +1454,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -1255,7 +1478,7 @@ public function valid() /** * Gets tax_file_number * - * @return string + * @return string|null */ public function getTaxFileNumber() { @@ -1265,12 +1488,15 @@ public function getTaxFileNumber() /** * Sets tax_file_number * - * @param string $tax_file_number + * @param string|null $tax_file_number * - * @return $this + * @return self */ public function setTaxFileNumber($tax_file_number) { + if (is_null($tax_file_number)) { + throw new \InvalidArgumentException('non-nullable tax_file_number cannot be null'); + } $this->container['tax_file_number'] = $tax_file_number; return $this; @@ -1279,7 +1505,7 @@ public function setTaxFileNumber($tax_file_number) /** * Gets residential_suburb * - * @return string + * @return string|null */ public function getResidentialSuburb() { @@ -1289,12 +1515,15 @@ public function getResidentialSuburb() /** * Sets residential_suburb * - * @param string $residential_suburb + * @param string|null $residential_suburb * - * @return $this + * @return self */ public function setResidentialSuburb($residential_suburb) { + if (is_null($residential_suburb)) { + throw new \InvalidArgumentException('non-nullable residential_suburb cannot be null'); + } $this->container['residential_suburb'] = $residential_suburb; return $this; @@ -1303,7 +1532,7 @@ public function setResidentialSuburb($residential_suburb) /** * Gets residential_state * - * @return string + * @return string|null */ public function getResidentialState() { @@ -1313,12 +1542,15 @@ public function getResidentialState() /** * Sets residential_state * - * @param string $residential_state + * @param string|null $residential_state * - * @return $this + * @return self */ public function setResidentialState($residential_state) { + if (is_null($residential_state)) { + throw new \InvalidArgumentException('non-nullable residential_state cannot be null'); + } $this->container['residential_state'] = $residential_state; return $this; @@ -1327,7 +1559,7 @@ public function setResidentialState($residential_state) /** * Gets postal_suburb * - * @return string + * @return string|null */ public function getPostalSuburb() { @@ -1337,12 +1569,15 @@ public function getPostalSuburb() /** * Sets postal_suburb * - * @param string $postal_suburb + * @param string|null $postal_suburb * - * @return $this + * @return self */ public function setPostalSuburb($postal_suburb) { + if (is_null($postal_suburb)) { + throw new \InvalidArgumentException('non-nullable postal_suburb cannot be null'); + } $this->container['postal_suburb'] = $postal_suburb; return $this; @@ -1351,7 +1586,7 @@ public function setPostalSuburb($postal_suburb) /** * Gets postal_state * - * @return string + * @return string|null */ public function getPostalState() { @@ -1361,12 +1596,15 @@ public function getPostalState() /** * Sets postal_state * - * @param string $postal_state + * @param string|null $postal_state * - * @return $this + * @return self */ public function setPostalState($postal_state) { + if (is_null($postal_state)) { + throw new \InvalidArgumentException('non-nullable postal_state cannot be null'); + } $this->container['postal_state'] = $postal_state; return $this; @@ -1375,7 +1613,7 @@ public function setPostalState($postal_state) /** * Gets employing_entity_abn * - * @return string + * @return string|null */ public function getEmployingEntityAbn() { @@ -1385,12 +1623,15 @@ public function getEmployingEntityAbn() /** * Sets employing_entity_abn * - * @param string $employing_entity_abn + * @param string|null $employing_entity_abn * - * @return $this + * @return self */ public function setEmployingEntityAbn($employing_entity_abn) { + if (is_null($employing_entity_abn)) { + throw new \InvalidArgumentException('non-nullable employing_entity_abn cannot be null'); + } $this->container['employing_entity_abn'] = $employing_entity_abn; return $this; @@ -1399,7 +1640,7 @@ public function setEmployingEntityAbn($employing_entity_abn) /** * Gets employing_entity_id * - * @return string + * @return string|null */ public function getEmployingEntityId() { @@ -1409,12 +1650,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param string $employing_entity_id + * @param string|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -1423,7 +1667,7 @@ public function setEmployingEntityId($employing_entity_id) /** * Gets previous_surname * - * @return string + * @return string|null */ public function getPreviousSurname() { @@ -1433,12 +1677,15 @@ public function getPreviousSurname() /** * Sets previous_surname * - * @param string $previous_surname + * @param string|null $previous_surname * - * @return $this + * @return self */ public function setPreviousSurname($previous_surname) { + if (is_null($previous_surname)) { + throw new \InvalidArgumentException('non-nullable previous_surname cannot be null'); + } $this->container['previous_surname'] = $previous_surname; return $this; @@ -1447,7 +1694,7 @@ public function setPreviousSurname($previous_surname) /** * Gets australian_resident * - * @return bool + * @return bool|null */ public function getAustralianResident() { @@ -1457,12 +1704,15 @@ public function getAustralianResident() /** * Sets australian_resident * - * @param bool $australian_resident + * @param bool|null $australian_resident * - * @return $this + * @return self */ public function setAustralianResident($australian_resident) { + if (is_null($australian_resident)) { + throw new \InvalidArgumentException('non-nullable australian_resident cannot be null'); + } $this->container['australian_resident'] = $australian_resident; return $this; @@ -1471,7 +1721,7 @@ public function setAustralianResident($australian_resident) /** * Gets claim_tax_free_threshold * - * @return bool + * @return bool|null */ public function getClaimTaxFreeThreshold() { @@ -1481,12 +1731,15 @@ public function getClaimTaxFreeThreshold() /** * Sets claim_tax_free_threshold * - * @param bool $claim_tax_free_threshold + * @param bool|null $claim_tax_free_threshold * - * @return $this + * @return self */ public function setClaimTaxFreeThreshold($claim_tax_free_threshold) { + if (is_null($claim_tax_free_threshold)) { + throw new \InvalidArgumentException('non-nullable claim_tax_free_threshold cannot be null'); + } $this->container['claim_tax_free_threshold'] = $claim_tax_free_threshold; return $this; @@ -1495,7 +1748,7 @@ public function setClaimTaxFreeThreshold($claim_tax_free_threshold) /** * Gets seniors_tax_offset * - * @return bool + * @return bool|null */ public function getSeniorsTaxOffset() { @@ -1505,12 +1758,15 @@ public function getSeniorsTaxOffset() /** * Sets seniors_tax_offset * - * @param bool $seniors_tax_offset + * @param bool|null $seniors_tax_offset * - * @return $this + * @return self */ public function setSeniorsTaxOffset($seniors_tax_offset) { + if (is_null($seniors_tax_offset)) { + throw new \InvalidArgumentException('non-nullable seniors_tax_offset cannot be null'); + } $this->container['seniors_tax_offset'] = $seniors_tax_offset; return $this; @@ -1519,7 +1775,7 @@ public function setSeniorsTaxOffset($seniors_tax_offset) /** * Gets other_tax_offset * - * @return bool + * @return bool|null */ public function getOtherTaxOffset() { @@ -1529,12 +1785,15 @@ public function getOtherTaxOffset() /** * Sets other_tax_offset * - * @param bool $other_tax_offset + * @param bool|null $other_tax_offset * - * @return $this + * @return self */ public function setOtherTaxOffset($other_tax_offset) { + if (is_null($other_tax_offset)) { + throw new \InvalidArgumentException('non-nullable other_tax_offset cannot be null'); + } $this->container['other_tax_offset'] = $other_tax_offset; return $this; @@ -1543,7 +1802,7 @@ public function setOtherTaxOffset($other_tax_offset) /** * Gets stsl_debt * - * @return bool + * @return bool|null */ public function getStslDebt() { @@ -1553,12 +1812,15 @@ public function getStslDebt() /** * Sets stsl_debt * - * @param bool $stsl_debt + * @param bool|null $stsl_debt * - * @return $this + * @return self */ public function setStslDebt($stsl_debt) { + if (is_null($stsl_debt)) { + throw new \InvalidArgumentException('non-nullable stsl_debt cannot be null'); + } $this->container['stsl_debt'] = $stsl_debt; return $this; @@ -1567,7 +1829,7 @@ public function setStslDebt($stsl_debt) /** * Gets is_exempt_from_flood_levy * - * @return bool + * @return bool|null */ public function getIsExemptFromFloodLevy() { @@ -1577,12 +1839,15 @@ public function getIsExemptFromFloodLevy() /** * Sets is_exempt_from_flood_levy * - * @param bool $is_exempt_from_flood_levy + * @param bool|null $is_exempt_from_flood_levy * - * @return $this + * @return self */ public function setIsExemptFromFloodLevy($is_exempt_from_flood_levy) { + if (is_null($is_exempt_from_flood_levy)) { + throw new \InvalidArgumentException('non-nullable is_exempt_from_flood_levy cannot be null'); + } $this->container['is_exempt_from_flood_levy'] = $is_exempt_from_flood_levy; return $this; @@ -1591,7 +1856,7 @@ public function setIsExemptFromFloodLevy($is_exempt_from_flood_levy) /** * Gets has_approved_working_holiday_visa * - * @return bool + * @return bool|null */ public function getHasApprovedWorkingHolidayVisa() { @@ -1601,12 +1866,15 @@ public function getHasApprovedWorkingHolidayVisa() /** * Sets has_approved_working_holiday_visa * - * @param bool $has_approved_working_holiday_visa + * @param bool|null $has_approved_working_holiday_visa * - * @return $this + * @return self */ public function setHasApprovedWorkingHolidayVisa($has_approved_working_holiday_visa) { + if (is_null($has_approved_working_holiday_visa)) { + throw new \InvalidArgumentException('non-nullable has_approved_working_holiday_visa cannot be null'); + } $this->container['has_approved_working_holiday_visa'] = $has_approved_working_holiday_visa; return $this; @@ -1615,7 +1883,7 @@ public function setHasApprovedWorkingHolidayVisa($has_approved_working_holiday_v /** * Gets working_holiday_visa_country * - * @return string + * @return string|null */ public function getWorkingHolidayVisaCountry() { @@ -1625,12 +1893,15 @@ public function getWorkingHolidayVisaCountry() /** * Sets working_holiday_visa_country * - * @param string $working_holiday_visa_country + * @param string|null $working_holiday_visa_country * - * @return $this + * @return self */ public function setWorkingHolidayVisaCountry($working_holiday_visa_country) { + if (is_null($working_holiday_visa_country)) { + throw new \InvalidArgumentException('non-nullable working_holiday_visa_country cannot be null'); + } $this->container['working_holiday_visa_country'] = $working_holiday_visa_country; return $this; @@ -1639,7 +1910,7 @@ public function setWorkingHolidayVisaCountry($working_holiday_visa_country) /** * Gets working_holiday_visa_start_date * - * @return \DateTime + * @return \DateTime|null */ public function getWorkingHolidayVisaStartDate() { @@ -1649,12 +1920,15 @@ public function getWorkingHolidayVisaStartDate() /** * Sets working_holiday_visa_start_date * - * @param \DateTime $working_holiday_visa_start_date + * @param \DateTime|null $working_holiday_visa_start_date * - * @return $this + * @return self */ public function setWorkingHolidayVisaStartDate($working_holiday_visa_start_date) { + if (is_null($working_holiday_visa_start_date)) { + throw new \InvalidArgumentException('non-nullable working_holiday_visa_start_date cannot be null'); + } $this->container['working_holiday_visa_start_date'] = $working_holiday_visa_start_date; return $this; @@ -1663,7 +1937,7 @@ public function setWorkingHolidayVisaStartDate($working_holiday_visa_start_date) /** * Gets is_seasonal_worker * - * @return bool + * @return bool|null */ public function getIsSeasonalWorker() { @@ -1673,12 +1947,15 @@ public function getIsSeasonalWorker() /** * Sets is_seasonal_worker * - * @param bool $is_seasonal_worker + * @param bool|null $is_seasonal_worker * - * @return $this + * @return self */ public function setIsSeasonalWorker($is_seasonal_worker) { + if (is_null($is_seasonal_worker)) { + throw new \InvalidArgumentException('non-nullable is_seasonal_worker cannot be null'); + } $this->container['is_seasonal_worker'] = $is_seasonal_worker; return $this; @@ -1687,7 +1964,7 @@ public function setIsSeasonalWorker($is_seasonal_worker) /** * Gets has_withholding_variation * - * @return bool + * @return bool|null */ public function getHasWithholdingVariation() { @@ -1697,12 +1974,15 @@ public function getHasWithholdingVariation() /** * Sets has_withholding_variation * - * @param bool $has_withholding_variation + * @param bool|null $has_withholding_variation * - * @return $this + * @return self */ public function setHasWithholdingVariation($has_withholding_variation) { + if (is_null($has_withholding_variation)) { + throw new \InvalidArgumentException('non-nullable has_withholding_variation cannot be null'); + } $this->container['has_withholding_variation'] = $has_withholding_variation; return $this; @@ -1711,7 +1991,7 @@ public function setHasWithholdingVariation($has_withholding_variation) /** * Gets tax_variation * - * @return double + * @return float|null */ public function getTaxVariation() { @@ -1721,12 +2001,15 @@ public function getTaxVariation() /** * Sets tax_variation * - * @param double $tax_variation + * @param float|null $tax_variation * - * @return $this + * @return self */ public function setTaxVariation($tax_variation) { + if (is_null($tax_variation)) { + throw new \InvalidArgumentException('non-nullable tax_variation cannot be null'); + } $this->container['tax_variation'] = $tax_variation; return $this; @@ -1735,7 +2018,7 @@ public function setTaxVariation($tax_variation) /** * Gets date_tax_file_declaration_signed * - * @return \DateTime + * @return \DateTime|null */ public function getDateTaxFileDeclarationSigned() { @@ -1745,12 +2028,15 @@ public function getDateTaxFileDeclarationSigned() /** * Sets date_tax_file_declaration_signed * - * @param \DateTime $date_tax_file_declaration_signed + * @param \DateTime|null $date_tax_file_declaration_signed * - * @return $this + * @return self */ public function setDateTaxFileDeclarationSigned($date_tax_file_declaration_signed) { + if (is_null($date_tax_file_declaration_signed)) { + throw new \InvalidArgumentException('non-nullable date_tax_file_declaration_signed cannot be null'); + } $this->container['date_tax_file_declaration_signed'] = $date_tax_file_declaration_signed; return $this; @@ -1759,7 +2045,7 @@ public function setDateTaxFileDeclarationSigned($date_tax_file_declaration_signe /** * Gets date_tax_file_declaration_reported * - * @return \DateTime + * @return \DateTime|null */ public function getDateTaxFileDeclarationReported() { @@ -1769,12 +2055,15 @@ public function getDateTaxFileDeclarationReported() /** * Sets date_tax_file_declaration_reported * - * @param \DateTime $date_tax_file_declaration_reported + * @param \DateTime|null $date_tax_file_declaration_reported * - * @return $this + * @return self */ public function setDateTaxFileDeclarationReported($date_tax_file_declaration_reported) { + if (is_null($date_tax_file_declaration_reported)) { + throw new \InvalidArgumentException('non-nullable date_tax_file_declaration_reported cannot be null'); + } $this->container['date_tax_file_declaration_reported'] = $date_tax_file_declaration_reported; return $this; @@ -1783,7 +2072,7 @@ public function setDateTaxFileDeclarationReported($date_tax_file_declaration_rep /** * Gets business_award_package * - * @return string + * @return string|null */ public function getBusinessAwardPackage() { @@ -1793,12 +2082,15 @@ public function getBusinessAwardPackage() /** * Sets business_award_package * - * @param string $business_award_package + * @param string|null $business_award_package * - * @return $this + * @return self */ public function setBusinessAwardPackage($business_award_package) { + if (is_null($business_award_package)) { + throw new \InvalidArgumentException('non-nullable business_award_package cannot be null'); + } $this->container['business_award_package'] = $business_award_package; return $this; @@ -1807,7 +2099,7 @@ public function setBusinessAwardPackage($business_award_package) /** * Gets employment_agreement * - * @return string + * @return string|null */ public function getEmploymentAgreement() { @@ -1817,12 +2109,15 @@ public function getEmploymentAgreement() /** * Sets employment_agreement * - * @param string $employment_agreement + * @param string|null $employment_agreement * - * @return $this + * @return self */ public function setEmploymentAgreement($employment_agreement) { + if (is_null($employment_agreement)) { + throw new \InvalidArgumentException('non-nullable employment_agreement cannot be null'); + } $this->container['employment_agreement'] = $employment_agreement; return $this; @@ -1831,7 +2126,7 @@ public function setEmploymentAgreement($employment_agreement) /** * Gets is_exempt_from_payroll_tax * - * @return bool + * @return bool|null */ public function getIsExemptFromPayrollTax() { @@ -1841,12 +2136,15 @@ public function getIsExemptFromPayrollTax() /** * Sets is_exempt_from_payroll_tax * - * @param bool $is_exempt_from_payroll_tax + * @param bool|null $is_exempt_from_payroll_tax * - * @return $this + * @return self */ public function setIsExemptFromPayrollTax($is_exempt_from_payroll_tax) { + if (is_null($is_exempt_from_payroll_tax)) { + throw new \InvalidArgumentException('non-nullable is_exempt_from_payroll_tax cannot be null'); + } $this->container['is_exempt_from_payroll_tax'] = $is_exempt_from_payroll_tax; return $this; @@ -1855,7 +2153,7 @@ public function setIsExemptFromPayrollTax($is_exempt_from_payroll_tax) /** * Gets bank_account1_bsb * - * @return string + * @return string|null */ public function getBankAccount1Bsb() { @@ -1865,12 +2163,15 @@ public function getBankAccount1Bsb() /** * Sets bank_account1_bsb * - * @param string $bank_account1_bsb + * @param string|null $bank_account1_bsb * - * @return $this + * @return self */ public function setBankAccount1Bsb($bank_account1_bsb) { + if (is_null($bank_account1_bsb)) { + throw new \InvalidArgumentException('non-nullable bank_account1_bsb cannot be null'); + } $this->container['bank_account1_bsb'] = $bank_account1_bsb; return $this; @@ -1879,7 +2180,7 @@ public function setBankAccount1Bsb($bank_account1_bsb) /** * Gets bank_account2_bsb * - * @return string + * @return string|null */ public function getBankAccount2Bsb() { @@ -1889,12 +2190,15 @@ public function getBankAccount2Bsb() /** * Sets bank_account2_bsb * - * @param string $bank_account2_bsb + * @param string|null $bank_account2_bsb * - * @return $this + * @return self */ public function setBankAccount2Bsb($bank_account2_bsb) { + if (is_null($bank_account2_bsb)) { + throw new \InvalidArgumentException('non-nullable bank_account2_bsb cannot be null'); + } $this->container['bank_account2_bsb'] = $bank_account2_bsb; return $this; @@ -1903,7 +2207,7 @@ public function setBankAccount2Bsb($bank_account2_bsb) /** * Gets bank_account3_bsb * - * @return string + * @return string|null */ public function getBankAccount3Bsb() { @@ -1913,12 +2217,15 @@ public function getBankAccount3Bsb() /** * Sets bank_account3_bsb * - * @param string $bank_account3_bsb + * @param string|null $bank_account3_bsb * - * @return $this + * @return self */ public function setBankAccount3Bsb($bank_account3_bsb) { + if (is_null($bank_account3_bsb)) { + throw new \InvalidArgumentException('non-nullable bank_account3_bsb cannot be null'); + } $this->container['bank_account3_bsb'] = $bank_account3_bsb; return $this; @@ -1927,7 +2234,7 @@ public function setBankAccount3Bsb($bank_account3_bsb) /** * Gets super_fund1_product_code * - * @return string + * @return string|null */ public function getSuperFund1ProductCode() { @@ -1937,12 +2244,15 @@ public function getSuperFund1ProductCode() /** * Sets super_fund1_product_code * - * @param string $super_fund1_product_code Nullable

Must be \"SMSF\" for a self managed super fund + * @param string|null $super_fund1_product_code Nullable

Must be \"SMSF\" for a self managed super fund * - * @return $this + * @return self */ public function setSuperFund1ProductCode($super_fund1_product_code) { + if (is_null($super_fund1_product_code)) { + throw new \InvalidArgumentException('non-nullable super_fund1_product_code cannot be null'); + } $this->container['super_fund1_product_code'] = $super_fund1_product_code; return $this; @@ -1951,7 +2261,7 @@ public function setSuperFund1ProductCode($super_fund1_product_code) /** * Gets super_fund1_fund_name * - * @return string + * @return string|null */ public function getSuperFund1FundName() { @@ -1961,12 +2271,15 @@ public function getSuperFund1FundName() /** * Sets super_fund1_fund_name * - * @param string $super_fund1_fund_name + * @param string|null $super_fund1_fund_name * - * @return $this + * @return self */ public function setSuperFund1FundName($super_fund1_fund_name) { + if (is_null($super_fund1_fund_name)) { + throw new \InvalidArgumentException('non-nullable super_fund1_fund_name cannot be null'); + } $this->container['super_fund1_fund_name'] = $super_fund1_fund_name; return $this; @@ -1975,7 +2288,7 @@ public function setSuperFund1FundName($super_fund1_fund_name) /** * Gets super_fund1_member_number * - * @return string + * @return string|null */ public function getSuperFund1MemberNumber() { @@ -1985,12 +2298,15 @@ public function getSuperFund1MemberNumber() /** * Sets super_fund1_member_number * - * @param string $super_fund1_member_number + * @param string|null $super_fund1_member_number * - * @return $this + * @return self */ public function setSuperFund1MemberNumber($super_fund1_member_number) { + if (is_null($super_fund1_member_number)) { + throw new \InvalidArgumentException('non-nullable super_fund1_member_number cannot be null'); + } $this->container['super_fund1_member_number'] = $super_fund1_member_number; return $this; @@ -1999,7 +2315,7 @@ public function setSuperFund1MemberNumber($super_fund1_member_number) /** * Gets super_fund1_allocated_percentage * - * @return double + * @return float|null */ public function getSuperFund1AllocatedPercentage() { @@ -2009,12 +2325,15 @@ public function getSuperFund1AllocatedPercentage() /** * Sets super_fund1_allocated_percentage * - * @param double $super_fund1_allocated_percentage + * @param float|null $super_fund1_allocated_percentage * - * @return $this + * @return self */ public function setSuperFund1AllocatedPercentage($super_fund1_allocated_percentage) { + if (is_null($super_fund1_allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable super_fund1_allocated_percentage cannot be null'); + } $this->container['super_fund1_allocated_percentage'] = $super_fund1_allocated_percentage; return $this; @@ -2023,7 +2342,7 @@ public function setSuperFund1AllocatedPercentage($super_fund1_allocated_percenta /** * Gets super_fund1_fixed_amount * - * @return double + * @return float|null */ public function getSuperFund1FixedAmount() { @@ -2033,12 +2352,15 @@ public function getSuperFund1FixedAmount() /** * Sets super_fund1_fixed_amount * - * @param double $super_fund1_fixed_amount + * @param float|null $super_fund1_fixed_amount * - * @return $this + * @return self */ public function setSuperFund1FixedAmount($super_fund1_fixed_amount) { + if (is_null($super_fund1_fixed_amount)) { + throw new \InvalidArgumentException('non-nullable super_fund1_fixed_amount cannot be null'); + } $this->container['super_fund1_fixed_amount'] = $super_fund1_fixed_amount; return $this; @@ -2047,7 +2369,7 @@ public function setSuperFund1FixedAmount($super_fund1_fixed_amount) /** * Gets super_fund1_employer_nominated_fund * - * @return bool + * @return bool|null */ public function getSuperFund1EmployerNominatedFund() { @@ -2057,12 +2379,15 @@ public function getSuperFund1EmployerNominatedFund() /** * Sets super_fund1_employer_nominated_fund * - * @param bool $super_fund1_employer_nominated_fund + * @param bool|null $super_fund1_employer_nominated_fund * - * @return $this + * @return self */ public function setSuperFund1EmployerNominatedFund($super_fund1_employer_nominated_fund) { + if (is_null($super_fund1_employer_nominated_fund)) { + throw new \InvalidArgumentException('non-nullable super_fund1_employer_nominated_fund cannot be null'); + } $this->container['super_fund1_employer_nominated_fund'] = $super_fund1_employer_nominated_fund; return $this; @@ -2071,7 +2396,7 @@ public function setSuperFund1EmployerNominatedFund($super_fund1_employer_nominat /** * Gets super_fund2_product_code * - * @return string + * @return string|null */ public function getSuperFund2ProductCode() { @@ -2081,12 +2406,15 @@ public function getSuperFund2ProductCode() /** * Sets super_fund2_product_code * - * @param string $super_fund2_product_code Nullable

Must be \"SMSF\" for a self managed super fund + * @param string|null $super_fund2_product_code Nullable

Must be \"SMSF\" for a self managed super fund * - * @return $this + * @return self */ public function setSuperFund2ProductCode($super_fund2_product_code) { + if (is_null($super_fund2_product_code)) { + throw new \InvalidArgumentException('non-nullable super_fund2_product_code cannot be null'); + } $this->container['super_fund2_product_code'] = $super_fund2_product_code; return $this; @@ -2095,7 +2423,7 @@ public function setSuperFund2ProductCode($super_fund2_product_code) /** * Gets super_fund2_fund_name * - * @return string + * @return string|null */ public function getSuperFund2FundName() { @@ -2105,12 +2433,15 @@ public function getSuperFund2FundName() /** * Sets super_fund2_fund_name * - * @param string $super_fund2_fund_name + * @param string|null $super_fund2_fund_name * - * @return $this + * @return self */ public function setSuperFund2FundName($super_fund2_fund_name) { + if (is_null($super_fund2_fund_name)) { + throw new \InvalidArgumentException('non-nullable super_fund2_fund_name cannot be null'); + } $this->container['super_fund2_fund_name'] = $super_fund2_fund_name; return $this; @@ -2119,7 +2450,7 @@ public function setSuperFund2FundName($super_fund2_fund_name) /** * Gets super_fund2_member_number * - * @return string + * @return string|null */ public function getSuperFund2MemberNumber() { @@ -2129,12 +2460,15 @@ public function getSuperFund2MemberNumber() /** * Sets super_fund2_member_number * - * @param string $super_fund2_member_number + * @param string|null $super_fund2_member_number * - * @return $this + * @return self */ public function setSuperFund2MemberNumber($super_fund2_member_number) { + if (is_null($super_fund2_member_number)) { + throw new \InvalidArgumentException('non-nullable super_fund2_member_number cannot be null'); + } $this->container['super_fund2_member_number'] = $super_fund2_member_number; return $this; @@ -2143,7 +2477,7 @@ public function setSuperFund2MemberNumber($super_fund2_member_number) /** * Gets super_fund2_allocated_percentage * - * @return double + * @return float|null */ public function getSuperFund2AllocatedPercentage() { @@ -2153,12 +2487,15 @@ public function getSuperFund2AllocatedPercentage() /** * Sets super_fund2_allocated_percentage * - * @param double $super_fund2_allocated_percentage + * @param float|null $super_fund2_allocated_percentage * - * @return $this + * @return self */ public function setSuperFund2AllocatedPercentage($super_fund2_allocated_percentage) { + if (is_null($super_fund2_allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable super_fund2_allocated_percentage cannot be null'); + } $this->container['super_fund2_allocated_percentage'] = $super_fund2_allocated_percentage; return $this; @@ -2167,7 +2504,7 @@ public function setSuperFund2AllocatedPercentage($super_fund2_allocated_percenta /** * Gets super_fund2_fixed_amount * - * @return double + * @return float|null */ public function getSuperFund2FixedAmount() { @@ -2177,12 +2514,15 @@ public function getSuperFund2FixedAmount() /** * Sets super_fund2_fixed_amount * - * @param double $super_fund2_fixed_amount + * @param float|null $super_fund2_fixed_amount * - * @return $this + * @return self */ public function setSuperFund2FixedAmount($super_fund2_fixed_amount) { + if (is_null($super_fund2_fixed_amount)) { + throw new \InvalidArgumentException('non-nullable super_fund2_fixed_amount cannot be null'); + } $this->container['super_fund2_fixed_amount'] = $super_fund2_fixed_amount; return $this; @@ -2191,7 +2531,7 @@ public function setSuperFund2FixedAmount($super_fund2_fixed_amount) /** * Gets super_fund2_employer_nominated_fund * - * @return bool + * @return bool|null */ public function getSuperFund2EmployerNominatedFund() { @@ -2201,12 +2541,15 @@ public function getSuperFund2EmployerNominatedFund() /** * Sets super_fund2_employer_nominated_fund * - * @param bool $super_fund2_employer_nominated_fund + * @param bool|null $super_fund2_employer_nominated_fund * - * @return $this + * @return self */ public function setSuperFund2EmployerNominatedFund($super_fund2_employer_nominated_fund) { + if (is_null($super_fund2_employer_nominated_fund)) { + throw new \InvalidArgumentException('non-nullable super_fund2_employer_nominated_fund cannot be null'); + } $this->container['super_fund2_employer_nominated_fund'] = $super_fund2_employer_nominated_fund; return $this; @@ -2215,7 +2558,7 @@ public function setSuperFund2EmployerNominatedFund($super_fund2_employer_nominat /** * Gets super_fund3_product_code * - * @return string + * @return string|null */ public function getSuperFund3ProductCode() { @@ -2225,12 +2568,15 @@ public function getSuperFund3ProductCode() /** * Sets super_fund3_product_code * - * @param string $super_fund3_product_code Nullable

Must be \"SMSF\" for a self managed super fund + * @param string|null $super_fund3_product_code Nullable

Must be \"SMSF\" for a self managed super fund * - * @return $this + * @return self */ public function setSuperFund3ProductCode($super_fund3_product_code) { + if (is_null($super_fund3_product_code)) { + throw new \InvalidArgumentException('non-nullable super_fund3_product_code cannot be null'); + } $this->container['super_fund3_product_code'] = $super_fund3_product_code; return $this; @@ -2239,7 +2585,7 @@ public function setSuperFund3ProductCode($super_fund3_product_code) /** * Gets super_fund3_fund_name * - * @return string + * @return string|null */ public function getSuperFund3FundName() { @@ -2249,12 +2595,15 @@ public function getSuperFund3FundName() /** * Sets super_fund3_fund_name * - * @param string $super_fund3_fund_name + * @param string|null $super_fund3_fund_name * - * @return $this + * @return self */ public function setSuperFund3FundName($super_fund3_fund_name) { + if (is_null($super_fund3_fund_name)) { + throw new \InvalidArgumentException('non-nullable super_fund3_fund_name cannot be null'); + } $this->container['super_fund3_fund_name'] = $super_fund3_fund_name; return $this; @@ -2263,7 +2612,7 @@ public function setSuperFund3FundName($super_fund3_fund_name) /** * Gets super_fund3_member_number * - * @return string + * @return string|null */ public function getSuperFund3MemberNumber() { @@ -2273,12 +2622,15 @@ public function getSuperFund3MemberNumber() /** * Sets super_fund3_member_number * - * @param string $super_fund3_member_number + * @param string|null $super_fund3_member_number * - * @return $this + * @return self */ public function setSuperFund3MemberNumber($super_fund3_member_number) { + if (is_null($super_fund3_member_number)) { + throw new \InvalidArgumentException('non-nullable super_fund3_member_number cannot be null'); + } $this->container['super_fund3_member_number'] = $super_fund3_member_number; return $this; @@ -2287,7 +2639,7 @@ public function setSuperFund3MemberNumber($super_fund3_member_number) /** * Gets super_fund3_allocated_percentage * - * @return double + * @return float|null */ public function getSuperFund3AllocatedPercentage() { @@ -2297,12 +2649,15 @@ public function getSuperFund3AllocatedPercentage() /** * Sets super_fund3_allocated_percentage * - * @param double $super_fund3_allocated_percentage + * @param float|null $super_fund3_allocated_percentage * - * @return $this + * @return self */ public function setSuperFund3AllocatedPercentage($super_fund3_allocated_percentage) { + if (is_null($super_fund3_allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable super_fund3_allocated_percentage cannot be null'); + } $this->container['super_fund3_allocated_percentage'] = $super_fund3_allocated_percentage; return $this; @@ -2311,7 +2666,7 @@ public function setSuperFund3AllocatedPercentage($super_fund3_allocated_percenta /** * Gets super_fund3_fixed_amount * - * @return double + * @return float|null */ public function getSuperFund3FixedAmount() { @@ -2321,12 +2676,15 @@ public function getSuperFund3FixedAmount() /** * Sets super_fund3_fixed_amount * - * @param double $super_fund3_fixed_amount + * @param float|null $super_fund3_fixed_amount * - * @return $this + * @return self */ public function setSuperFund3FixedAmount($super_fund3_fixed_amount) { + if (is_null($super_fund3_fixed_amount)) { + throw new \InvalidArgumentException('non-nullable super_fund3_fixed_amount cannot be null'); + } $this->container['super_fund3_fixed_amount'] = $super_fund3_fixed_amount; return $this; @@ -2335,7 +2693,7 @@ public function setSuperFund3FixedAmount($super_fund3_fixed_amount) /** * Gets super_fund3_employer_nominated_fund * - * @return bool + * @return bool|null */ public function getSuperFund3EmployerNominatedFund() { @@ -2345,12 +2703,15 @@ public function getSuperFund3EmployerNominatedFund() /** * Sets super_fund3_employer_nominated_fund * - * @param bool $super_fund3_employer_nominated_fund + * @param bool|null $super_fund3_employer_nominated_fund * - * @return $this + * @return self */ public function setSuperFund3EmployerNominatedFund($super_fund3_employer_nominated_fund) { + if (is_null($super_fund3_employer_nominated_fund)) { + throw new \InvalidArgumentException('non-nullable super_fund3_employer_nominated_fund cannot be null'); + } $this->container['super_fund3_employer_nominated_fund'] = $super_fund3_employer_nominated_fund; return $this; @@ -2359,7 +2720,7 @@ public function setSuperFund3EmployerNominatedFund($super_fund3_employer_nominat /** * Gets super_threshold_amount * - * @return double + * @return float|null */ public function getSuperThresholdAmount() { @@ -2369,12 +2730,15 @@ public function getSuperThresholdAmount() /** * Sets super_threshold_amount * - * @param double $super_threshold_amount + * @param float|null $super_threshold_amount * - * @return $this + * @return self */ public function setSuperThresholdAmount($super_threshold_amount) { + if (is_null($super_threshold_amount)) { + throw new \InvalidArgumentException('non-nullable super_threshold_amount cannot be null'); + } $this->container['super_threshold_amount'] = $super_threshold_amount; return $this; @@ -2383,7 +2747,7 @@ public function setSuperThresholdAmount($super_threshold_amount) /** * Gets maximum_quarterly_super_contributions_base * - * @return double + * @return float|null */ public function getMaximumQuarterlySuperContributionsBase() { @@ -2393,12 +2757,15 @@ public function getMaximumQuarterlySuperContributionsBase() /** * Sets maximum_quarterly_super_contributions_base * - * @param double $maximum_quarterly_super_contributions_base + * @param float|null $maximum_quarterly_super_contributions_base * - * @return $this + * @return self */ public function setMaximumQuarterlySuperContributionsBase($maximum_quarterly_super_contributions_base) { + if (is_null($maximum_quarterly_super_contributions_base)) { + throw new \InvalidArgumentException('non-nullable maximum_quarterly_super_contributions_base cannot be null'); + } $this->container['maximum_quarterly_super_contributions_base'] = $maximum_quarterly_super_contributions_base; return $this; @@ -2407,7 +2774,7 @@ public function setMaximumQuarterlySuperContributionsBase($maximum_quarterly_sup /** * Gets medicare_levy_exemption * - * @return string + * @return string|null */ public function getMedicareLevyExemption() { @@ -2417,12 +2784,15 @@ public function getMedicareLevyExemption() /** * Sets medicare_levy_exemption * - * @param string $medicare_levy_exemption + * @param string|null $medicare_levy_exemption * - * @return $this + * @return self */ public function setMedicareLevyExemption($medicare_levy_exemption) { + if (is_null($medicare_levy_exemption)) { + throw new \InvalidArgumentException('non-nullable medicare_levy_exemption cannot be null'); + } $this->container['medicare_levy_exemption'] = $medicare_levy_exemption; return $this; @@ -2431,7 +2801,7 @@ public function setMedicareLevyExemption($medicare_levy_exemption) /** * Gets closely_held_employee * - * @return bool + * @return bool|null */ public function getCloselyHeldEmployee() { @@ -2441,12 +2811,15 @@ public function getCloselyHeldEmployee() /** * Sets closely_held_employee * - * @param bool $closely_held_employee Nullable

Note:A non-null value here will overwrite the SingleTouchPayroll value. Set this to null if SingleTouchPayroll value should be used. + * @param bool|null $closely_held_employee Nullable

Note:A non-null value here will overwrite the SingleTouchPayroll value. Set this to null if SingleTouchPayroll value should be used. * - * @return $this + * @return self */ public function setCloselyHeldEmployee($closely_held_employee) { + if (is_null($closely_held_employee)) { + throw new \InvalidArgumentException('non-nullable closely_held_employee cannot be null'); + } $this->container['closely_held_employee'] = $closely_held_employee; return $this; @@ -2455,7 +2828,7 @@ public function setCloselyHeldEmployee($closely_held_employee) /** * Gets closely_held_reporting * - * @return string + * @return string|null */ public function getCloselyHeldReporting() { @@ -2465,17 +2838,21 @@ public function getCloselyHeldReporting() /** * Sets closely_held_reporting * - * @param string $closely_held_reporting Nullable

Note:During a transition period, a null value will default to PayPerQuarter if CloselyHeldEmployee is \"true\".

A null value with CloselyHeldEmployee = \"true\" will not be valid in the future. + * @param string|null $closely_held_reporting Nullable

Note:During a transition period, a null value will default to PayPerQuarter if CloselyHeldEmployee is \"true\".

A null value with CloselyHeldEmployee = \"true\" will not be valid in the future. * - * @return $this + * @return self */ public function setCloselyHeldReporting($closely_held_reporting) { + if (is_null($closely_held_reporting)) { + throw new \InvalidArgumentException('non-nullable closely_held_reporting cannot be null'); + } $allowedValues = $this->getCloselyHeldReportingAllowableValues(); - if (!is_null($closely_held_reporting) && !in_array($closely_held_reporting, $allowedValues, true)) { + if (!in_array($closely_held_reporting, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'closely_held_reporting', must be one of '%s'", + "Invalid value '%s' for 'closely_held_reporting', must be one of '%s'", + $closely_held_reporting, implode("', '", $allowedValues) ) ); @@ -2488,7 +2865,7 @@ public function setCloselyHeldReporting($closely_held_reporting) /** * Gets single_touch_payroll * - * @return string + * @return string|null */ public function getSingleTouchPayroll() { @@ -2498,17 +2875,21 @@ public function getSingleTouchPayroll() /** * Sets single_touch_payroll * - * @param string $single_touch_payroll + * @param string|null $single_touch_payroll * - * @return $this + * @return self */ public function setSingleTouchPayroll($single_touch_payroll) { + if (is_null($single_touch_payroll)) { + throw new \InvalidArgumentException('non-nullable single_touch_payroll cannot be null'); + } $allowedValues = $this->getSingleTouchPayrollAllowableValues(); - if (!is_null($single_touch_payroll) && !in_array($single_touch_payroll, $allowedValues, true)) { + if (!in_array($single_touch_payroll, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'single_touch_payroll', must be one of '%s'", + "Invalid value '%s' for 'single_touch_payroll', must be one of '%s'", + $single_touch_payroll, implode("', '", $allowedValues) ) ); @@ -2521,7 +2902,7 @@ public function setSingleTouchPayroll($single_touch_payroll) /** * Gets hours_per_day * - * @return double + * @return float|null */ public function getHoursPerDay() { @@ -2531,12 +2912,15 @@ public function getHoursPerDay() /** * Sets hours_per_day * - * @param double $hours_per_day Nullable

A null value will default to the business setting for Standard hours per day + * @param float|null $hours_per_day Nullable

A null value will default to the business setting for Standard hours per day * - * @return $this + * @return self */ public function setHoursPerDay($hours_per_day) { + if (is_null($hours_per_day)) { + throw new \InvalidArgumentException('non-nullable hours_per_day cannot be null'); + } $this->container['hours_per_day'] = $hours_per_day; return $this; @@ -2545,7 +2929,7 @@ public function setHoursPerDay($hours_per_day) /** * Gets postal_address_is_overseas * - * @return bool + * @return bool|null */ public function getPostalAddressIsOverseas() { @@ -2555,12 +2939,15 @@ public function getPostalAddressIsOverseas() /** * Sets postal_address_is_overseas * - * @param bool $postal_address_is_overseas + * @param bool|null $postal_address_is_overseas * - * @return $this + * @return self */ public function setPostalAddressIsOverseas($postal_address_is_overseas) { + if (is_null($postal_address_is_overseas)) { + throw new \InvalidArgumentException('non-nullable postal_address_is_overseas cannot be null'); + } $this->container['postal_address_is_overseas'] = $postal_address_is_overseas; return $this; @@ -2569,7 +2956,7 @@ public function setPostalAddressIsOverseas($postal_address_is_overseas) /** * Gets residential_address_is_overseas * - * @return bool + * @return bool|null */ public function getResidentialAddressIsOverseas() { @@ -2579,12 +2966,15 @@ public function getResidentialAddressIsOverseas() /** * Sets residential_address_is_overseas * - * @param bool $residential_address_is_overseas + * @param bool|null $residential_address_is_overseas * - * @return $this + * @return self */ public function setResidentialAddressIsOverseas($residential_address_is_overseas) { + if (is_null($residential_address_is_overseas)) { + throw new \InvalidArgumentException('non-nullable residential_address_is_overseas cannot be null'); + } $this->container['residential_address_is_overseas'] = $residential_address_is_overseas; return $this; @@ -2593,7 +2983,7 @@ public function setResidentialAddressIsOverseas($residential_address_is_overseas /** * Gets employment_type * - * @return string + * @return string|null */ public function getEmploymentType() { @@ -2603,12 +2993,15 @@ public function getEmploymentType() /** * Sets employment_type * - * @param string $employment_type + * @param string|null $employment_type * - * @return $this + * @return self */ public function setEmploymentType($employment_type) { + if (is_null($employment_type)) { + throw new \InvalidArgumentException('non-nullable employment_type cannot be null'); + } $this->container['employment_type'] = $employment_type; return $this; @@ -2617,7 +3010,7 @@ public function setEmploymentType($employment_type) /** * Gets contractor_abn * - * @return string + * @return string|null */ public function getContractorAbn() { @@ -2627,12 +3020,15 @@ public function getContractorAbn() /** * Sets contractor_abn * - * @param string $contractor_abn + * @param string|null $contractor_abn * - * @return $this + * @return self */ public function setContractorAbn($contractor_abn) { + if (is_null($contractor_abn)) { + throw new \InvalidArgumentException('non-nullable contractor_abn cannot be null'); + } $this->container['contractor_abn'] = $contractor_abn; return $this; @@ -2641,7 +3037,7 @@ public function setContractorAbn($contractor_abn) /** * Gets termination_reason * - * @return string + * @return string|null */ public function getTerminationReason() { @@ -2651,12 +3047,15 @@ public function getTerminationReason() /** * Sets termination_reason * - * @param string $termination_reason + * @param string|null $termination_reason * - * @return $this + * @return self */ public function setTerminationReason($termination_reason) { + if (is_null($termination_reason)) { + throw new \InvalidArgumentException('non-nullable termination_reason cannot be null'); + } $this->container['termination_reason'] = $termination_reason; return $this; @@ -2665,7 +3064,7 @@ public function setTerminationReason($termination_reason) /** * Gets tax_category * - * @return string + * @return string|null */ public function getTaxCategory() { @@ -2675,17 +3074,21 @@ public function getTaxCategory() /** * Sets tax_category * - * @param string $tax_category + * @param string|null $tax_category * - * @return $this + * @return self */ public function setTaxCategory($tax_category) { + if (is_null($tax_category)) { + throw new \InvalidArgumentException('non-nullable tax_category cannot be null'); + } $allowedValues = $this->getTaxCategoryAllowableValues(); - if (!is_null($tax_category) && !in_array($tax_category, $allowedValues, true)) { + if (!in_array($tax_category, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'tax_category', must be one of '%s'", + "Invalid value '%s' for 'tax_category', must be one of '%s'", + $tax_category, implode("', '", $allowedValues) ) ); @@ -2698,7 +3101,7 @@ public function setTaxCategory($tax_category) /** * Gets medicare_levy_surcharge_withholding_tier * - * @return string + * @return string|null */ public function getMedicareLevySurchargeWithholdingTier() { @@ -2708,17 +3111,21 @@ public function getMedicareLevySurchargeWithholdingTier() /** * Sets medicare_levy_surcharge_withholding_tier * - * @param string $medicare_levy_surcharge_withholding_tier + * @param string|null $medicare_levy_surcharge_withholding_tier * - * @return $this + * @return self */ public function setMedicareLevySurchargeWithholdingTier($medicare_levy_surcharge_withholding_tier) { + if (is_null($medicare_levy_surcharge_withholding_tier)) { + throw new \InvalidArgumentException('non-nullable medicare_levy_surcharge_withholding_tier cannot be null'); + } $allowedValues = $this->getMedicareLevySurchargeWithholdingTierAllowableValues(); - if (!is_null($medicare_levy_surcharge_withholding_tier) && !in_array($medicare_levy_surcharge_withholding_tier, $allowedValues, true)) { + if (!in_array($medicare_levy_surcharge_withholding_tier, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'medicare_levy_surcharge_withholding_tier', must be one of '%s'", + "Invalid value '%s' for 'medicare_levy_surcharge_withholding_tier', must be one of '%s'", + $medicare_levy_surcharge_withholding_tier, implode("', '", $allowedValues) ) ); @@ -2731,7 +3138,7 @@ public function setMedicareLevySurchargeWithholdingTier($medicare_levy_surcharge /** * Gets claim_medicare_levy_reduction * - * @return bool + * @return bool|null */ public function getClaimMedicareLevyReduction() { @@ -2741,12 +3148,15 @@ public function getClaimMedicareLevyReduction() /** * Sets claim_medicare_levy_reduction * - * @param bool $claim_medicare_levy_reduction + * @param bool|null $claim_medicare_levy_reduction * - * @return $this + * @return self */ public function setClaimMedicareLevyReduction($claim_medicare_levy_reduction) { + if (is_null($claim_medicare_levy_reduction)) { + throw new \InvalidArgumentException('non-nullable claim_medicare_levy_reduction cannot be null'); + } $this->container['claim_medicare_levy_reduction'] = $claim_medicare_levy_reduction; return $this; @@ -2755,7 +3165,7 @@ public function setClaimMedicareLevyReduction($claim_medicare_levy_reduction) /** * Gets medicare_levy_reduction_spouse * - * @return bool + * @return bool|null */ public function getMedicareLevyReductionSpouse() { @@ -2765,12 +3175,15 @@ public function getMedicareLevyReductionSpouse() /** * Sets medicare_levy_reduction_spouse * - * @param bool $medicare_levy_reduction_spouse + * @param bool|null $medicare_levy_reduction_spouse * - * @return $this + * @return self */ public function setMedicareLevyReductionSpouse($medicare_levy_reduction_spouse) { + if (is_null($medicare_levy_reduction_spouse)) { + throw new \InvalidArgumentException('non-nullable medicare_levy_reduction_spouse cannot be null'); + } $this->container['medicare_levy_reduction_spouse'] = $medicare_levy_reduction_spouse; return $this; @@ -2779,7 +3192,7 @@ public function setMedicareLevyReductionSpouse($medicare_levy_reduction_spouse) /** * Gets medicare_levy_reduction_dependent_count * - * @return int + * @return int|null */ public function getMedicareLevyReductionDependentCount() { @@ -2789,12 +3202,15 @@ public function getMedicareLevyReductionDependentCount() /** * Sets medicare_levy_reduction_dependent_count * - * @param int $medicare_levy_reduction_dependent_count + * @param int|null $medicare_levy_reduction_dependent_count * - * @return $this + * @return self */ public function setMedicareLevyReductionDependentCount($medicare_levy_reduction_dependent_count) { + if (is_null($medicare_levy_reduction_dependent_count)) { + throw new \InvalidArgumentException('non-nullable medicare_levy_reduction_dependent_count cannot be null'); + } $this->container['medicare_levy_reduction_dependent_count'] = $medicare_levy_reduction_dependent_count; return $this; @@ -2803,7 +3219,7 @@ public function setMedicareLevyReductionDependentCount($medicare_levy_reduction_ /** * Gets dvl_pay_slip_description * - * @return string + * @return string|null */ public function getDvlPaySlipDescription() { @@ -2813,12 +3229,15 @@ public function getDvlPaySlipDescription() /** * Sets dvl_pay_slip_description * - * @param string $dvl_pay_slip_description String

Possible values are:

  • EmployeePrimaryPayCategory
  • The name of any other pay category

+ * @param string|null $dvl_pay_slip_description String

Possible values are:

  • EmployeePrimaryPayCategory
  • The name of any other pay category

* - * @return $this + * @return self */ public function setDvlPaySlipDescription($dvl_pay_slip_description) { + if (is_null($dvl_pay_slip_description)) { + throw new \InvalidArgumentException('non-nullable dvl_pay_slip_description cannot be null'); + } $this->container['dvl_pay_slip_description'] = $dvl_pay_slip_description; return $this; @@ -2827,7 +3246,7 @@ public function setDvlPaySlipDescription($dvl_pay_slip_description) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -2837,12 +3256,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -2851,7 +3273,7 @@ public function setId($id) /** * Gets title * - * @return string + * @return string|null */ public function getTitle() { @@ -2861,12 +3283,15 @@ public function getTitle() /** * Sets title * - * @param string $title + * @param string|null $title * - * @return $this + * @return self */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -2875,7 +3300,7 @@ public function setTitle($title) /** * Gets preferred_name * - * @return string + * @return string|null */ public function getPreferredName() { @@ -2885,12 +3310,15 @@ public function getPreferredName() /** * Sets preferred_name * - * @param string $preferred_name + * @param string|null $preferred_name * - * @return $this + * @return self */ public function setPreferredName($preferred_name) { + if (is_null($preferred_name)) { + throw new \InvalidArgumentException('non-nullable preferred_name cannot be null'); + } $this->container['preferred_name'] = $preferred_name; return $this; @@ -2899,7 +3327,7 @@ public function setPreferredName($preferred_name) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -2909,12 +3337,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -2923,7 +3354,7 @@ public function setFirstName($first_name) /** * Gets middle_name * - * @return string + * @return string|null */ public function getMiddleName() { @@ -2933,12 +3364,15 @@ public function getMiddleName() /** * Sets middle_name * - * @param string $middle_name + * @param string|null $middle_name * - * @return $this + * @return self */ public function setMiddleName($middle_name) { + if (is_null($middle_name)) { + throw new \InvalidArgumentException('non-nullable middle_name cannot be null'); + } $this->container['middle_name'] = $middle_name; return $this; @@ -2947,7 +3381,7 @@ public function setMiddleName($middle_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -2957,12 +3391,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -2971,7 +3408,7 @@ public function setSurname($surname) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -2981,12 +3418,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -2995,7 +3435,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets gender * - * @return string + * @return string|null */ public function getGender() { @@ -3005,12 +3445,15 @@ public function getGender() /** * Sets gender * - * @param string $gender + * @param string|null $gender * - * @return $this + * @return self */ public function setGender($gender) { + if (is_null($gender)) { + throw new \InvalidArgumentException('non-nullable gender cannot be null'); + } $this->container['gender'] = $gender; return $this; @@ -3019,7 +3462,7 @@ public function setGender($gender) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -3029,12 +3472,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -3043,7 +3489,7 @@ public function setExternalId($external_id) /** * Gets residential_street_address * - * @return string + * @return string|null */ public function getResidentialStreetAddress() { @@ -3053,12 +3499,15 @@ public function getResidentialStreetAddress() /** * Sets residential_street_address * - * @param string $residential_street_address + * @param string|null $residential_street_address * - * @return $this + * @return self */ public function setResidentialStreetAddress($residential_street_address) { + if (is_null($residential_street_address)) { + throw new \InvalidArgumentException('non-nullable residential_street_address cannot be null'); + } $this->container['residential_street_address'] = $residential_street_address; return $this; @@ -3067,7 +3516,7 @@ public function setResidentialStreetAddress($residential_street_address) /** * Gets residential_address_line2 * - * @return string + * @return string|null */ public function getResidentialAddressLine2() { @@ -3077,12 +3526,15 @@ public function getResidentialAddressLine2() /** * Sets residential_address_line2 * - * @param string $residential_address_line2 + * @param string|null $residential_address_line2 * - * @return $this + * @return self */ public function setResidentialAddressLine2($residential_address_line2) { + if (is_null($residential_address_line2)) { + throw new \InvalidArgumentException('non-nullable residential_address_line2 cannot be null'); + } $this->container['residential_address_line2'] = $residential_address_line2; return $this; @@ -3091,7 +3543,7 @@ public function setResidentialAddressLine2($residential_address_line2) /** * Gets residential_post_code * - * @return string + * @return string|null */ public function getResidentialPostCode() { @@ -3101,12 +3553,15 @@ public function getResidentialPostCode() /** * Sets residential_post_code * - * @param string $residential_post_code + * @param string|null $residential_post_code * - * @return $this + * @return self */ public function setResidentialPostCode($residential_post_code) { + if (is_null($residential_post_code)) { + throw new \InvalidArgumentException('non-nullable residential_post_code cannot be null'); + } $this->container['residential_post_code'] = $residential_post_code; return $this; @@ -3115,7 +3570,7 @@ public function setResidentialPostCode($residential_post_code) /** * Gets residential_country * - * @return string + * @return string|null */ public function getResidentialCountry() { @@ -3125,12 +3580,15 @@ public function getResidentialCountry() /** * Sets residential_country * - * @param string $residential_country + * @param string|null $residential_country * - * @return $this + * @return self */ public function setResidentialCountry($residential_country) { + if (is_null($residential_country)) { + throw new \InvalidArgumentException('non-nullable residential_country cannot be null'); + } $this->container['residential_country'] = $residential_country; return $this; @@ -3139,7 +3597,7 @@ public function setResidentialCountry($residential_country) /** * Gets postal_street_address * - * @return string + * @return string|null */ public function getPostalStreetAddress() { @@ -3149,12 +3607,15 @@ public function getPostalStreetAddress() /** * Sets postal_street_address * - * @param string $postal_street_address + * @param string|null $postal_street_address * - * @return $this + * @return self */ public function setPostalStreetAddress($postal_street_address) { + if (is_null($postal_street_address)) { + throw new \InvalidArgumentException('non-nullable postal_street_address cannot be null'); + } $this->container['postal_street_address'] = $postal_street_address; return $this; @@ -3163,7 +3624,7 @@ public function setPostalStreetAddress($postal_street_address) /** * Gets postal_address_line2 * - * @return string + * @return string|null */ public function getPostalAddressLine2() { @@ -3173,12 +3634,15 @@ public function getPostalAddressLine2() /** * Sets postal_address_line2 * - * @param string $postal_address_line2 + * @param string|null $postal_address_line2 * - * @return $this + * @return self */ public function setPostalAddressLine2($postal_address_line2) { + if (is_null($postal_address_line2)) { + throw new \InvalidArgumentException('non-nullable postal_address_line2 cannot be null'); + } $this->container['postal_address_line2'] = $postal_address_line2; return $this; @@ -3187,7 +3651,7 @@ public function setPostalAddressLine2($postal_address_line2) /** * Gets postal_post_code * - * @return string + * @return string|null */ public function getPostalPostCode() { @@ -3197,12 +3661,15 @@ public function getPostalPostCode() /** * Sets postal_post_code * - * @param string $postal_post_code + * @param string|null $postal_post_code * - * @return $this + * @return self */ public function setPostalPostCode($postal_post_code) { + if (is_null($postal_post_code)) { + throw new \InvalidArgumentException('non-nullable postal_post_code cannot be null'); + } $this->container['postal_post_code'] = $postal_post_code; return $this; @@ -3211,7 +3678,7 @@ public function setPostalPostCode($postal_post_code) /** * Gets postal_country * - * @return string + * @return string|null */ public function getPostalCountry() { @@ -3221,12 +3688,15 @@ public function getPostalCountry() /** * Sets postal_country * - * @param string $postal_country + * @param string|null $postal_country * - * @return $this + * @return self */ public function setPostalCountry($postal_country) { + if (is_null($postal_country)) { + throw new \InvalidArgumentException('non-nullable postal_country cannot be null'); + } $this->container['postal_country'] = $postal_country; return $this; @@ -3235,7 +3705,7 @@ public function setPostalCountry($postal_country) /** * Gets email_address * - * @return string + * @return string|null */ public function getEmailAddress() { @@ -3245,12 +3715,15 @@ public function getEmailAddress() /** * Sets email_address * - * @param string $email_address + * @param string|null $email_address * - * @return $this + * @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; @@ -3259,7 +3732,7 @@ public function setEmailAddress($email_address) /** * Gets home_phone * - * @return string + * @return string|null */ public function getHomePhone() { @@ -3269,12 +3742,15 @@ public function getHomePhone() /** * Sets home_phone * - * @param string $home_phone + * @param string|null $home_phone * - * @return $this + * @return self */ public function setHomePhone($home_phone) { + if (is_null($home_phone)) { + throw new \InvalidArgumentException('non-nullable home_phone cannot be null'); + } $this->container['home_phone'] = $home_phone; return $this; @@ -3283,7 +3759,7 @@ public function setHomePhone($home_phone) /** * Gets work_phone * - * @return string + * @return string|null */ public function getWorkPhone() { @@ -3293,12 +3769,15 @@ public function getWorkPhone() /** * Sets work_phone * - * @param string $work_phone + * @param string|null $work_phone * - * @return $this + * @return self */ public function setWorkPhone($work_phone) { + if (is_null($work_phone)) { + throw new \InvalidArgumentException('non-nullable work_phone cannot be null'); + } $this->container['work_phone'] = $work_phone; return $this; @@ -3307,7 +3786,7 @@ public function setWorkPhone($work_phone) /** * Gets mobile_phone * - * @return string + * @return string|null */ public function getMobilePhone() { @@ -3317,12 +3796,15 @@ public function getMobilePhone() /** * Sets mobile_phone * - * @param string $mobile_phone + * @param string|null $mobile_phone * - * @return $this + * @return self */ public function setMobilePhone($mobile_phone) { + if (is_null($mobile_phone)) { + throw new \InvalidArgumentException('non-nullable mobile_phone cannot be null'); + } $this->container['mobile_phone'] = $mobile_phone; return $this; @@ -3331,7 +3813,7 @@ public function setMobilePhone($mobile_phone) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -3341,12 +3823,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -3355,7 +3840,7 @@ public function setStartDate($start_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -3365,12 +3850,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -3379,7 +3867,7 @@ public function setEndDate($end_date) /** * Gets anniversary_date * - * @return \DateTime + * @return \DateTime|null */ public function getAnniversaryDate() { @@ -3389,12 +3877,15 @@ public function getAnniversaryDate() /** * Sets anniversary_date * - * @param \DateTime $anniversary_date + * @param \DateTime|null $anniversary_date * - * @return $this + * @return self */ public function setAnniversaryDate($anniversary_date) { + if (is_null($anniversary_date)) { + throw new \InvalidArgumentException('non-nullable anniversary_date cannot be null'); + } $this->container['anniversary_date'] = $anniversary_date; return $this; @@ -3403,7 +3894,7 @@ public function setAnniversaryDate($anniversary_date) /** * Gets tags * - * @return string + * @return string|null */ public function getTags() { @@ -3413,12 +3904,15 @@ public function getTags() /** * Sets tags * - * @param string $tags + * @param string|null $tags * - * @return $this + * @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; @@ -3427,7 +3921,7 @@ public function setTags($tags) /** * Gets job_title * - * @return string + * @return string|null */ public function getJobTitle() { @@ -3437,12 +3931,15 @@ public function getJobTitle() /** * Sets job_title * - * @param string $job_title + * @param string|null $job_title * - * @return $this + * @return self */ public function setJobTitle($job_title) { + if (is_null($job_title)) { + throw new \InvalidArgumentException('non-nullable job_title cannot be null'); + } $this->container['job_title'] = $job_title; return $this; @@ -3451,7 +3948,7 @@ public function setJobTitle($job_title) /** * Gets pay_schedule * - * @return string + * @return string|null */ public function getPaySchedule() { @@ -3461,12 +3958,15 @@ public function getPaySchedule() /** * Sets pay_schedule * - * @param string $pay_schedule + * @param string|null $pay_schedule * - * @return $this + * @return self */ public function setPaySchedule($pay_schedule) { + if (is_null($pay_schedule)) { + throw new \InvalidArgumentException('non-nullable pay_schedule cannot be null'); + } $this->container['pay_schedule'] = $pay_schedule; return $this; @@ -3475,7 +3975,7 @@ public function setPaySchedule($pay_schedule) /** * Gets primary_pay_category * - * @return string + * @return string|null */ public function getPrimaryPayCategory() { @@ -3485,12 +3985,15 @@ public function getPrimaryPayCategory() /** * Sets primary_pay_category * - * @param string $primary_pay_category + * @param string|null $primary_pay_category * - * @return $this + * @return self */ public function setPrimaryPayCategory($primary_pay_category) { + if (is_null($primary_pay_category)) { + throw new \InvalidArgumentException('non-nullable primary_pay_category cannot be null'); + } $this->container['primary_pay_category'] = $primary_pay_category; return $this; @@ -3499,7 +4002,7 @@ public function setPrimaryPayCategory($primary_pay_category) /** * Gets primary_location * - * @return string + * @return string|null */ public function getPrimaryLocation() { @@ -3509,12 +4012,15 @@ public function getPrimaryLocation() /** * Sets primary_location * - * @param string $primary_location + * @param string|null $primary_location * - * @return $this + * @return self */ public function setPrimaryLocation($primary_location) { + if (is_null($primary_location)) { + throw new \InvalidArgumentException('non-nullable primary_location cannot be null'); + } $this->container['primary_location'] = $primary_location; return $this; @@ -3523,7 +4029,7 @@ public function setPrimaryLocation($primary_location) /** * Gets pay_slip_notification_type * - * @return string + * @return string|null */ public function getPaySlipNotificationType() { @@ -3533,12 +4039,15 @@ public function getPaySlipNotificationType() /** * Sets pay_slip_notification_type * - * @param string $pay_slip_notification_type + * @param string|null $pay_slip_notification_type * - * @return $this + * @return self */ public function setPaySlipNotificationType($pay_slip_notification_type) { + if (is_null($pay_slip_notification_type)) { + throw new \InvalidArgumentException('non-nullable pay_slip_notification_type cannot be null'); + } $this->container['pay_slip_notification_type'] = $pay_slip_notification_type; return $this; @@ -3547,7 +4056,7 @@ public function setPaySlipNotificationType($pay_slip_notification_type) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -3557,12 +4066,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -3571,7 +4083,7 @@ public function setRate($rate) /** * Gets override_template_rate * - * @return string + * @return string|null */ public function getOverrideTemplateRate() { @@ -3581,12 +4093,15 @@ public function getOverrideTemplateRate() /** * Sets override_template_rate * - * @param string $override_template_rate + * @param string|null $override_template_rate * - * @return $this + * @return self */ public function setOverrideTemplateRate($override_template_rate) { + if (is_null($override_template_rate)) { + throw new \InvalidArgumentException('non-nullable override_template_rate cannot be null'); + } $this->container['override_template_rate'] = $override_template_rate; return $this; @@ -3595,7 +4110,7 @@ public function setOverrideTemplateRate($override_template_rate) /** * Gets rate_unit * - * @return string + * @return string|null */ public function getRateUnit() { @@ -3605,12 +4120,15 @@ public function getRateUnit() /** * Sets rate_unit * - * @param string $rate_unit + * @param string|null $rate_unit * - * @return $this + * @return self */ public function setRateUnit($rate_unit) { + if (is_null($rate_unit)) { + throw new \InvalidArgumentException('non-nullable rate_unit cannot be null'); + } $this->container['rate_unit'] = $rate_unit; return $this; @@ -3619,7 +4137,7 @@ public function setRateUnit($rate_unit) /** * Gets hours_per_week * - * @return double + * @return float|null */ public function getHoursPerWeek() { @@ -3629,12 +4147,15 @@ public function getHoursPerWeek() /** * Sets hours_per_week * - * @param double $hours_per_week + * @param float|null $hours_per_week * - * @return $this + * @return self */ public function setHoursPerWeek($hours_per_week) { + if (is_null($hours_per_week)) { + throw new \InvalidArgumentException('non-nullable hours_per_week cannot be null'); + } $this->container['hours_per_week'] = $hours_per_week; return $this; @@ -3643,7 +4164,7 @@ public function setHoursPerWeek($hours_per_week) /** * Gets automatically_pay_employee * - * @return string + * @return string|null */ public function getAutomaticallyPayEmployee() { @@ -3653,12 +4174,15 @@ public function getAutomaticallyPayEmployee() /** * Sets automatically_pay_employee * - * @param string $automatically_pay_employee + * @param string|null $automatically_pay_employee * - * @return $this + * @return self */ public function setAutomaticallyPayEmployee($automatically_pay_employee) { + if (is_null($automatically_pay_employee)) { + throw new \InvalidArgumentException('non-nullable automatically_pay_employee cannot be null'); + } $this->container['automatically_pay_employee'] = $automatically_pay_employee; return $this; @@ -3667,7 +4191,7 @@ public function setAutomaticallyPayEmployee($automatically_pay_employee) /** * Gets leave_template * - * @return string + * @return string|null */ public function getLeaveTemplate() { @@ -3677,12 +4201,15 @@ public function getLeaveTemplate() /** * Sets leave_template * - * @param string $leave_template + * @param string|null $leave_template * - * @return $this + * @return self */ public function setLeaveTemplate($leave_template) { + if (is_null($leave_template)) { + throw new \InvalidArgumentException('non-nullable leave_template cannot be null'); + } $this->container['leave_template'] = $leave_template; return $this; @@ -3691,7 +4218,7 @@ public function setLeaveTemplate($leave_template) /** * Gets pay_rate_template * - * @return string + * @return string|null */ public function getPayRateTemplate() { @@ -3701,12 +4228,15 @@ public function getPayRateTemplate() /** * Sets pay_rate_template * - * @param string $pay_rate_template + * @param string|null $pay_rate_template * - * @return $this + * @return self */ public function setPayRateTemplate($pay_rate_template) { + if (is_null($pay_rate_template)) { + throw new \InvalidArgumentException('non-nullable pay_rate_template cannot be null'); + } $this->container['pay_rate_template'] = $pay_rate_template; return $this; @@ -3715,7 +4245,7 @@ public function setPayRateTemplate($pay_rate_template) /** * Gets pay_condition_rule_set * - * @return string + * @return string|null */ public function getPayConditionRuleSet() { @@ -3725,12 +4255,15 @@ public function getPayConditionRuleSet() /** * Sets pay_condition_rule_set * - * @param string $pay_condition_rule_set + * @param string|null $pay_condition_rule_set * - * @return $this + * @return self */ public function setPayConditionRuleSet($pay_condition_rule_set) { + if (is_null($pay_condition_rule_set)) { + throw new \InvalidArgumentException('non-nullable pay_condition_rule_set cannot be null'); + } $this->container['pay_condition_rule_set'] = $pay_condition_rule_set; return $this; @@ -3739,7 +4272,7 @@ public function setPayConditionRuleSet($pay_condition_rule_set) /** * Gets is_enabled_for_timesheets * - * @return string + * @return string|null */ public function getIsEnabledForTimesheets() { @@ -3749,12 +4282,15 @@ public function getIsEnabledForTimesheets() /** * Sets is_enabled_for_timesheets * - * @param string $is_enabled_for_timesheets + * @param string|null $is_enabled_for_timesheets * - * @return $this + * @return self */ public function setIsEnabledForTimesheets($is_enabled_for_timesheets) { + if (is_null($is_enabled_for_timesheets)) { + throw new \InvalidArgumentException('non-nullable is_enabled_for_timesheets cannot be null'); + } $this->container['is_enabled_for_timesheets'] = $is_enabled_for_timesheets; return $this; @@ -3763,7 +4299,7 @@ public function setIsEnabledForTimesheets($is_enabled_for_timesheets) /** * Gets locations * - * @return string + * @return string|null */ public function getLocations() { @@ -3773,12 +4309,15 @@ public function getLocations() /** * Sets locations * - * @param string $locations + * @param string|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -3787,7 +4326,7 @@ public function setLocations($locations) /** * Gets work_types * - * @return string + * @return string|null */ public function getWorkTypes() { @@ -3797,12 +4336,15 @@ public function getWorkTypes() /** * Sets work_types * - * @param string $work_types + * @param string|null $work_types * - * @return $this + * @return self */ public function setWorkTypes($work_types) { + if (is_null($work_types)) { + throw new \InvalidArgumentException('non-nullable work_types cannot be null'); + } $this->container['work_types'] = $work_types; return $this; @@ -3811,7 +4353,7 @@ public function setWorkTypes($work_types) /** * Gets emergency_contact1_name * - * @return string + * @return string|null */ public function getEmergencyContact1Name() { @@ -3821,16 +4363,19 @@ public function getEmergencyContact1Name() /** * Sets emergency_contact1_name * - * @param string $emergency_contact1_name + * @param string|null $emergency_contact1_name * - * @return $this + * @return self */ public function setEmergencyContact1Name($emergency_contact1_name) { - if (!is_null($emergency_contact1_name) && (mb_strlen($emergency_contact1_name) > 100)) { + if (is_null($emergency_contact1_name)) { + throw new \InvalidArgumentException('non-nullable emergency_contact1_name cannot be null'); + } + if ((mb_strlen($emergency_contact1_name) > 100)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_name when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 100.'); } - if (!is_null($emergency_contact1_name) && (mb_strlen($emergency_contact1_name) < 0)) { + if ((mb_strlen($emergency_contact1_name) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_name when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -3842,7 +4387,7 @@ public function setEmergencyContact1Name($emergency_contact1_name) /** * Gets emergency_contact1_relationship * - * @return string + * @return string|null */ public function getEmergencyContact1Relationship() { @@ -3852,16 +4397,19 @@ public function getEmergencyContact1Relationship() /** * Sets emergency_contact1_relationship * - * @param string $emergency_contact1_relationship + * @param string|null $emergency_contact1_relationship * - * @return $this + * @return self */ public function setEmergencyContact1Relationship($emergency_contact1_relationship) { - if (!is_null($emergency_contact1_relationship) && (mb_strlen($emergency_contact1_relationship) > 100)) { + if (is_null($emergency_contact1_relationship)) { + throw new \InvalidArgumentException('non-nullable emergency_contact1_relationship cannot be null'); + } + if ((mb_strlen($emergency_contact1_relationship) > 100)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_relationship when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 100.'); } - if (!is_null($emergency_contact1_relationship) && (mb_strlen($emergency_contact1_relationship) < 0)) { + if ((mb_strlen($emergency_contact1_relationship) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_relationship when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -3873,7 +4421,7 @@ public function setEmergencyContact1Relationship($emergency_contact1_relationshi /** * Gets emergency_contact1_address * - * @return string + * @return string|null */ public function getEmergencyContact1Address() { @@ -3883,16 +4431,19 @@ public function getEmergencyContact1Address() /** * Sets emergency_contact1_address * - * @param string $emergency_contact1_address + * @param string|null $emergency_contact1_address * - * @return $this + * @return self */ public function setEmergencyContact1Address($emergency_contact1_address) { - if (!is_null($emergency_contact1_address) && (mb_strlen($emergency_contact1_address) > 500)) { + if (is_null($emergency_contact1_address)) { + throw new \InvalidArgumentException('non-nullable emergency_contact1_address cannot be null'); + } + if ((mb_strlen($emergency_contact1_address) > 500)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_address when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 500.'); } - if (!is_null($emergency_contact1_address) && (mb_strlen($emergency_contact1_address) < 0)) { + if ((mb_strlen($emergency_contact1_address) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_address when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -3904,7 +4455,7 @@ public function setEmergencyContact1Address($emergency_contact1_address) /** * Gets emergency_contact1_contact_number * - * @return string + * @return string|null */ public function getEmergencyContact1ContactNumber() { @@ -3914,16 +4465,19 @@ public function getEmergencyContact1ContactNumber() /** * Sets emergency_contact1_contact_number * - * @param string $emergency_contact1_contact_number + * @param string|null $emergency_contact1_contact_number * - * @return $this + * @return self */ public function setEmergencyContact1ContactNumber($emergency_contact1_contact_number) { - if (!is_null($emergency_contact1_contact_number) && (mb_strlen($emergency_contact1_contact_number) > 50)) { + if (is_null($emergency_contact1_contact_number)) { + throw new \InvalidArgumentException('non-nullable emergency_contact1_contact_number cannot be null'); + } + if ((mb_strlen($emergency_contact1_contact_number) > 50)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_contact_number when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 50.'); } - if (!is_null($emergency_contact1_contact_number) && (mb_strlen($emergency_contact1_contact_number) < 0)) { + if ((mb_strlen($emergency_contact1_contact_number) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_contact_number when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -3935,7 +4489,7 @@ public function setEmergencyContact1ContactNumber($emergency_contact1_contact_nu /** * Gets emergency_contact1_alternate_contact_number * - * @return string + * @return string|null */ public function getEmergencyContact1AlternateContactNumber() { @@ -3945,16 +4499,19 @@ public function getEmergencyContact1AlternateContactNumber() /** * Sets emergency_contact1_alternate_contact_number * - * @param string $emergency_contact1_alternate_contact_number + * @param string|null $emergency_contact1_alternate_contact_number * - * @return $this + * @return self */ public function setEmergencyContact1AlternateContactNumber($emergency_contact1_alternate_contact_number) { - if (!is_null($emergency_contact1_alternate_contact_number) && (mb_strlen($emergency_contact1_alternate_contact_number) > 50)) { + if (is_null($emergency_contact1_alternate_contact_number)) { + throw new \InvalidArgumentException('non-nullable emergency_contact1_alternate_contact_number cannot be null'); + } + if ((mb_strlen($emergency_contact1_alternate_contact_number) > 50)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_alternate_contact_number when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 50.'); } - if (!is_null($emergency_contact1_alternate_contact_number) && (mb_strlen($emergency_contact1_alternate_contact_number) < 0)) { + if ((mb_strlen($emergency_contact1_alternate_contact_number) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact1_alternate_contact_number when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -3966,7 +4523,7 @@ public function setEmergencyContact1AlternateContactNumber($emergency_contact1_a /** * Gets emergency_contact2_name * - * @return string + * @return string|null */ public function getEmergencyContact2Name() { @@ -3976,16 +4533,19 @@ public function getEmergencyContact2Name() /** * Sets emergency_contact2_name * - * @param string $emergency_contact2_name + * @param string|null $emergency_contact2_name * - * @return $this + * @return self */ public function setEmergencyContact2Name($emergency_contact2_name) { - if (!is_null($emergency_contact2_name) && (mb_strlen($emergency_contact2_name) > 100)) { + if (is_null($emergency_contact2_name)) { + throw new \InvalidArgumentException('non-nullable emergency_contact2_name cannot be null'); + } + if ((mb_strlen($emergency_contact2_name) > 100)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_name when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 100.'); } - if (!is_null($emergency_contact2_name) && (mb_strlen($emergency_contact2_name) < 0)) { + if ((mb_strlen($emergency_contact2_name) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_name when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -3997,7 +4557,7 @@ public function setEmergencyContact2Name($emergency_contact2_name) /** * Gets emergency_contact2_relationship * - * @return string + * @return string|null */ public function getEmergencyContact2Relationship() { @@ -4007,16 +4567,19 @@ public function getEmergencyContact2Relationship() /** * Sets emergency_contact2_relationship * - * @param string $emergency_contact2_relationship + * @param string|null $emergency_contact2_relationship * - * @return $this + * @return self */ public function setEmergencyContact2Relationship($emergency_contact2_relationship) { - if (!is_null($emergency_contact2_relationship) && (mb_strlen($emergency_contact2_relationship) > 100)) { + if (is_null($emergency_contact2_relationship)) { + throw new \InvalidArgumentException('non-nullable emergency_contact2_relationship cannot be null'); + } + if ((mb_strlen($emergency_contact2_relationship) > 100)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_relationship when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 100.'); } - if (!is_null($emergency_contact2_relationship) && (mb_strlen($emergency_contact2_relationship) < 0)) { + if ((mb_strlen($emergency_contact2_relationship) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_relationship when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -4028,7 +4591,7 @@ public function setEmergencyContact2Relationship($emergency_contact2_relationshi /** * Gets emergency_contact2_address * - * @return string + * @return string|null */ public function getEmergencyContact2Address() { @@ -4038,16 +4601,19 @@ public function getEmergencyContact2Address() /** * Sets emergency_contact2_address * - * @param string $emergency_contact2_address + * @param string|null $emergency_contact2_address * - * @return $this + * @return self */ public function setEmergencyContact2Address($emergency_contact2_address) { - if (!is_null($emergency_contact2_address) && (mb_strlen($emergency_contact2_address) > 500)) { + if (is_null($emergency_contact2_address)) { + throw new \InvalidArgumentException('non-nullable emergency_contact2_address cannot be null'); + } + if ((mb_strlen($emergency_contact2_address) > 500)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_address when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 500.'); } - if (!is_null($emergency_contact2_address) && (mb_strlen($emergency_contact2_address) < 0)) { + if ((mb_strlen($emergency_contact2_address) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_address when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -4059,7 +4625,7 @@ public function setEmergencyContact2Address($emergency_contact2_address) /** * Gets emergency_contact2_contact_number * - * @return string + * @return string|null */ public function getEmergencyContact2ContactNumber() { @@ -4069,16 +4635,19 @@ public function getEmergencyContact2ContactNumber() /** * Sets emergency_contact2_contact_number * - * @param string $emergency_contact2_contact_number + * @param string|null $emergency_contact2_contact_number * - * @return $this + * @return self */ public function setEmergencyContact2ContactNumber($emergency_contact2_contact_number) { - if (!is_null($emergency_contact2_contact_number) && (mb_strlen($emergency_contact2_contact_number) > 50)) { + if (is_null($emergency_contact2_contact_number)) { + throw new \InvalidArgumentException('non-nullable emergency_contact2_contact_number cannot be null'); + } + if ((mb_strlen($emergency_contact2_contact_number) > 50)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_contact_number when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 50.'); } - if (!is_null($emergency_contact2_contact_number) && (mb_strlen($emergency_contact2_contact_number) < 0)) { + if ((mb_strlen($emergency_contact2_contact_number) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_contact_number when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -4090,7 +4659,7 @@ public function setEmergencyContact2ContactNumber($emergency_contact2_contact_nu /** * Gets emergency_contact2_alternate_contact_number * - * @return string + * @return string|null */ public function getEmergencyContact2AlternateContactNumber() { @@ -4100,16 +4669,19 @@ public function getEmergencyContact2AlternateContactNumber() /** * Sets emergency_contact2_alternate_contact_number * - * @param string $emergency_contact2_alternate_contact_number + * @param string|null $emergency_contact2_alternate_contact_number * - * @return $this + * @return self */ public function setEmergencyContact2AlternateContactNumber($emergency_contact2_alternate_contact_number) { - if (!is_null($emergency_contact2_alternate_contact_number) && (mb_strlen($emergency_contact2_alternate_contact_number) > 50)) { + if (is_null($emergency_contact2_alternate_contact_number)) { + throw new \InvalidArgumentException('non-nullable emergency_contact2_alternate_contact_number cannot be null'); + } + if ((mb_strlen($emergency_contact2_alternate_contact_number) > 50)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_alternate_contact_number when calling AuUnstructuredEmployeeModel., must be smaller than or equal to 50.'); } - if (!is_null($emergency_contact2_alternate_contact_number) && (mb_strlen($emergency_contact2_alternate_contact_number) < 0)) { + if ((mb_strlen($emergency_contact2_alternate_contact_number) < 0)) { throw new \InvalidArgumentException('invalid length for $emergency_contact2_alternate_contact_number when calling AuUnstructuredEmployeeModel., must be bigger than or equal to 0.'); } @@ -4121,7 +4693,7 @@ public function setEmergencyContact2AlternateContactNumber($emergency_contact2_a /** * Gets bank_account1_account_number * - * @return string + * @return string|null */ public function getBankAccount1AccountNumber() { @@ -4131,12 +4703,15 @@ public function getBankAccount1AccountNumber() /** * Sets bank_account1_account_number * - * @param string $bank_account1_account_number + * @param string|null $bank_account1_account_number * - * @return $this + * @return self */ public function setBankAccount1AccountNumber($bank_account1_account_number) { + if (is_null($bank_account1_account_number)) { + throw new \InvalidArgumentException('non-nullable bank_account1_account_number cannot be null'); + } $this->container['bank_account1_account_number'] = $bank_account1_account_number; return $this; @@ -4145,7 +4720,7 @@ public function setBankAccount1AccountNumber($bank_account1_account_number) /** * Gets bank_account1_account_name * - * @return string + * @return string|null */ public function getBankAccount1AccountName() { @@ -4155,12 +4730,15 @@ public function getBankAccount1AccountName() /** * Sets bank_account1_account_name * - * @param string $bank_account1_account_name + * @param string|null $bank_account1_account_name * - * @return $this + * @return self */ public function setBankAccount1AccountName($bank_account1_account_name) { + if (is_null($bank_account1_account_name)) { + throw new \InvalidArgumentException('non-nullable bank_account1_account_name cannot be null'); + } $this->container['bank_account1_account_name'] = $bank_account1_account_name; return $this; @@ -4169,7 +4747,7 @@ public function setBankAccount1AccountName($bank_account1_account_name) /** * Gets bank_account1_allocated_percentage * - * @return double + * @return float|null */ public function getBankAccount1AllocatedPercentage() { @@ -4179,12 +4757,15 @@ public function getBankAccount1AllocatedPercentage() /** * Sets bank_account1_allocated_percentage * - * @param double $bank_account1_allocated_percentage + * @param float|null $bank_account1_allocated_percentage * - * @return $this + * @return self */ public function setBankAccount1AllocatedPercentage($bank_account1_allocated_percentage) { + if (is_null($bank_account1_allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable bank_account1_allocated_percentage cannot be null'); + } $this->container['bank_account1_allocated_percentage'] = $bank_account1_allocated_percentage; return $this; @@ -4193,7 +4774,7 @@ public function setBankAccount1AllocatedPercentage($bank_account1_allocated_perc /** * Gets bank_account1_fixed_amount * - * @return double + * @return float|null */ public function getBankAccount1FixedAmount() { @@ -4203,12 +4784,15 @@ public function getBankAccount1FixedAmount() /** * Sets bank_account1_fixed_amount * - * @param double $bank_account1_fixed_amount + * @param float|null $bank_account1_fixed_amount * - * @return $this + * @return self */ public function setBankAccount1FixedAmount($bank_account1_fixed_amount) { + if (is_null($bank_account1_fixed_amount)) { + throw new \InvalidArgumentException('non-nullable bank_account1_fixed_amount cannot be null'); + } $this->container['bank_account1_fixed_amount'] = $bank_account1_fixed_amount; return $this; @@ -4217,7 +4801,7 @@ public function setBankAccount1FixedAmount($bank_account1_fixed_amount) /** * Gets bank_account2_account_number * - * @return string + * @return string|null */ public function getBankAccount2AccountNumber() { @@ -4227,12 +4811,15 @@ public function getBankAccount2AccountNumber() /** * Sets bank_account2_account_number * - * @param string $bank_account2_account_number + * @param string|null $bank_account2_account_number * - * @return $this + * @return self */ public function setBankAccount2AccountNumber($bank_account2_account_number) { + if (is_null($bank_account2_account_number)) { + throw new \InvalidArgumentException('non-nullable bank_account2_account_number cannot be null'); + } $this->container['bank_account2_account_number'] = $bank_account2_account_number; return $this; @@ -4241,7 +4828,7 @@ public function setBankAccount2AccountNumber($bank_account2_account_number) /** * Gets bank_account2_account_name * - * @return string + * @return string|null */ public function getBankAccount2AccountName() { @@ -4251,12 +4838,15 @@ public function getBankAccount2AccountName() /** * Sets bank_account2_account_name * - * @param string $bank_account2_account_name + * @param string|null $bank_account2_account_name * - * @return $this + * @return self */ public function setBankAccount2AccountName($bank_account2_account_name) { + if (is_null($bank_account2_account_name)) { + throw new \InvalidArgumentException('non-nullable bank_account2_account_name cannot be null'); + } $this->container['bank_account2_account_name'] = $bank_account2_account_name; return $this; @@ -4265,7 +4855,7 @@ public function setBankAccount2AccountName($bank_account2_account_name) /** * Gets bank_account2_allocated_percentage * - * @return double + * @return float|null */ public function getBankAccount2AllocatedPercentage() { @@ -4275,12 +4865,15 @@ public function getBankAccount2AllocatedPercentage() /** * Sets bank_account2_allocated_percentage * - * @param double $bank_account2_allocated_percentage + * @param float|null $bank_account2_allocated_percentage * - * @return $this + * @return self */ public function setBankAccount2AllocatedPercentage($bank_account2_allocated_percentage) { + if (is_null($bank_account2_allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable bank_account2_allocated_percentage cannot be null'); + } $this->container['bank_account2_allocated_percentage'] = $bank_account2_allocated_percentage; return $this; @@ -4289,7 +4882,7 @@ public function setBankAccount2AllocatedPercentage($bank_account2_allocated_perc /** * Gets bank_account2_fixed_amount * - * @return double + * @return float|null */ public function getBankAccount2FixedAmount() { @@ -4299,12 +4892,15 @@ public function getBankAccount2FixedAmount() /** * Sets bank_account2_fixed_amount * - * @param double $bank_account2_fixed_amount + * @param float|null $bank_account2_fixed_amount * - * @return $this + * @return self */ public function setBankAccount2FixedAmount($bank_account2_fixed_amount) { + if (is_null($bank_account2_fixed_amount)) { + throw new \InvalidArgumentException('non-nullable bank_account2_fixed_amount cannot be null'); + } $this->container['bank_account2_fixed_amount'] = $bank_account2_fixed_amount; return $this; @@ -4313,7 +4909,7 @@ public function setBankAccount2FixedAmount($bank_account2_fixed_amount) /** * Gets bank_account3_account_number * - * @return string + * @return string|null */ public function getBankAccount3AccountNumber() { @@ -4323,12 +4919,15 @@ public function getBankAccount3AccountNumber() /** * Sets bank_account3_account_number * - * @param string $bank_account3_account_number + * @param string|null $bank_account3_account_number * - * @return $this + * @return self */ public function setBankAccount3AccountNumber($bank_account3_account_number) { + if (is_null($bank_account3_account_number)) { + throw new \InvalidArgumentException('non-nullable bank_account3_account_number cannot be null'); + } $this->container['bank_account3_account_number'] = $bank_account3_account_number; return $this; @@ -4337,7 +4936,7 @@ public function setBankAccount3AccountNumber($bank_account3_account_number) /** * Gets bank_account3_account_name * - * @return string + * @return string|null */ public function getBankAccount3AccountName() { @@ -4347,12 +4946,15 @@ public function getBankAccount3AccountName() /** * Sets bank_account3_account_name * - * @param string $bank_account3_account_name + * @param string|null $bank_account3_account_name * - * @return $this + * @return self */ public function setBankAccount3AccountName($bank_account3_account_name) { + if (is_null($bank_account3_account_name)) { + throw new \InvalidArgumentException('non-nullable bank_account3_account_name cannot be null'); + } $this->container['bank_account3_account_name'] = $bank_account3_account_name; return $this; @@ -4361,7 +4963,7 @@ public function setBankAccount3AccountName($bank_account3_account_name) /** * Gets bank_account3_allocated_percentage * - * @return double + * @return float|null */ public function getBankAccount3AllocatedPercentage() { @@ -4371,12 +4973,15 @@ public function getBankAccount3AllocatedPercentage() /** * Sets bank_account3_allocated_percentage * - * @param double $bank_account3_allocated_percentage + * @param float|null $bank_account3_allocated_percentage * - * @return $this + * @return self */ public function setBankAccount3AllocatedPercentage($bank_account3_allocated_percentage) { + if (is_null($bank_account3_allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable bank_account3_allocated_percentage cannot be null'); + } $this->container['bank_account3_allocated_percentage'] = $bank_account3_allocated_percentage; return $this; @@ -4385,7 +4990,7 @@ public function setBankAccount3AllocatedPercentage($bank_account3_allocated_perc /** * Gets bank_account3_fixed_amount * - * @return double + * @return float|null */ public function getBankAccount3FixedAmount() { @@ -4395,12 +5000,15 @@ public function getBankAccount3FixedAmount() /** * Sets bank_account3_fixed_amount * - * @param double $bank_account3_fixed_amount + * @param float|null $bank_account3_fixed_amount * - * @return $this + * @return self */ public function setBankAccount3FixedAmount($bank_account3_fixed_amount) { + if (is_null($bank_account3_fixed_amount)) { + throw new \InvalidArgumentException('non-nullable bank_account3_fixed_amount cannot be null'); + } $this->container['bank_account3_fixed_amount'] = $bank_account3_fixed_amount; return $this; @@ -4409,7 +5017,7 @@ public function setBankAccount3FixedAmount($bank_account3_fixed_amount) /** * Gets rostering_notification_choices * - * @return string + * @return string|null */ public function getRosteringNotificationChoices() { @@ -4419,12 +5027,15 @@ public function getRosteringNotificationChoices() /** * Sets rostering_notification_choices * - * @param string $rostering_notification_choices + * @param string|null $rostering_notification_choices * - * @return $this + * @return self */ public function setRosteringNotificationChoices($rostering_notification_choices) { + if (is_null($rostering_notification_choices)) { + throw new \InvalidArgumentException('non-nullable rostering_notification_choices cannot be null'); + } $this->container['rostering_notification_choices'] = $rostering_notification_choices; return $this; @@ -4433,7 +5044,7 @@ public function setRosteringNotificationChoices($rostering_notification_choices) /** * Gets leave_accrual_start_date_type * - * @return string + * @return string|null */ public function getLeaveAccrualStartDateType() { @@ -4443,17 +5054,21 @@ public function getLeaveAccrualStartDateType() /** * Sets leave_accrual_start_date_type * - * @param string $leave_accrual_start_date_type + * @param string|null $leave_accrual_start_date_type * - * @return $this + * @return self */ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) { + if (is_null($leave_accrual_start_date_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_start_date_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); - if (!is_null($leave_accrual_start_date_type) && !in_array($leave_accrual_start_date_type, $allowedValues, true)) { + if (!in_array($leave_accrual_start_date_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $leave_accrual_start_date_type, implode("', '", $allowedValues) ) ); @@ -4466,7 +5081,7 @@ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) /** * Gets leave_year_start * - * @return \DateTime + * @return \DateTime|null */ public function getLeaveYearStart() { @@ -4476,12 +5091,15 @@ public function getLeaveYearStart() /** * Sets leave_year_start * - * @param \DateTime $leave_year_start + * @param \DateTime|null $leave_year_start * - * @return $this + * @return self */ public function setLeaveYearStart($leave_year_start) { + if (is_null($leave_year_start)) { + throw new \InvalidArgumentException('non-nullable leave_year_start cannot be null'); + } $this->container['leave_year_start'] = $leave_year_start; return $this; @@ -4490,7 +5108,7 @@ public function setLeaveYearStart($leave_year_start) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -4500,17 +5118,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -4523,7 +5145,7 @@ public function setStatus($status) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -4533,12 +5155,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -4547,7 +5172,7 @@ public function setDateCreated($date_created) /** * Gets reporting_dimension_values * - * @return string + * @return string|null */ public function getReportingDimensionValues() { @@ -4557,12 +5182,15 @@ public function getReportingDimensionValues() /** * Sets reporting_dimension_values * - * @param string $reporting_dimension_values + * @param string|null $reporting_dimension_values * - * @return $this + * @return self */ public function setReportingDimensionValues($reporting_dimension_values) { + if (is_null($reporting_dimension_values)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_values cannot be null'); + } $this->container['reporting_dimension_values'] = $reporting_dimension_values; return $this; @@ -4574,7 +5202,7 @@ public function setReportingDimensionValues($reporting_dimension_values) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -4584,22 +5212,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -4615,11 +5244,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -4627,13 +5269,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AuWorkTypeModel.php b/src/lib/Model/AuWorkTypeModel.php index 0c75d1c..404db3b 100644 --- a/src/lib/Model/AuWorkTypeModel.php +++ b/src/lib/Model/AuWorkTypeModel.php @@ -2,61 +2,61 @@ /** * AuWorkTypeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AuWorkTypeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AuWorkTypeModel implements ModelInterface, ArrayAccess +class AuWorkTypeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AuWorkTypeModel'; + protected static $openAPIModelName = 'AuWorkTypeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employment_types' => 'string[]', 'award_package_id' => 'int', 'award_package_name' => 'string', @@ -75,8 +75,10 @@ class AuWorkTypeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employment_types' => null, 'award_package_id' => 'int32', 'award_package_name' => null, @@ -91,14 +93,41 @@ class AuWorkTypeModel implements ModelInterface, ArrayAccess 'short_code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employment_types' => false, + 'award_package_id' => false, + 'award_package_name' => false, + 'id' => false, + 'name' => false, + 'pay_category_id' => false, + 'leave_category_id' => false, + 'external_id' => false, + 'source' => false, + 'accrues_leave' => false, + 'mapping_type' => false, + 'short_code' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -210,22 +291,20 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYMENT_TYPES_UNKNOWN = 'Unknown'; - const EMPLOYMENT_TYPES_FULL_TIME = 'FullTime'; - const EMPLOYMENT_TYPES_PART_TIME = 'PartTime'; - const EMPLOYMENT_TYPES_LABOUR_HIRE = 'LabourHire'; - const EMPLOYMENT_TYPES_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; - const EMPLOYMENT_TYPES_CASUAL = 'Casual'; - const MAPPING_TYPE_PAY_CATEGORY = 'PayCategory'; - const MAPPING_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; - const MAPPING_TYPE_PRIMARY_PAY_CATEGORY = 'PrimaryPayCategory'; - const MAPPING_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - + public const EMPLOYMENT_TYPES_UNKNOWN = 'Unknown'; + public const EMPLOYMENT_TYPES_FULL_TIME = 'FullTime'; + public const EMPLOYMENT_TYPES_PART_TIME = 'PartTime'; + public const EMPLOYMENT_TYPES_LABOUR_HIRE = 'LabourHire'; + public const EMPLOYMENT_TYPES_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; + public const EMPLOYMENT_TYPES_CASUAL = 'Casual'; + public const MAPPING_TYPE_PAY_CATEGORY = 'PayCategory'; + public const MAPPING_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; + public const MAPPING_TYPE_PRIMARY_PAY_CATEGORY = 'PrimaryPayCategory'; + public const MAPPING_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - /** * Gets allowable values of the enum * @@ -242,7 +321,7 @@ public function getEmploymentTypesAllowableValues() self::EMPLOYMENT_TYPES_CASUAL, ]; } - + /** * Gets allowable values of the enum * @@ -257,7 +336,6 @@ public function getMappingTypeAllowableValues() self::MAPPING_TYPE_SHIFT_CONDITION, ]; } - /** * Associative array for storing property values @@ -274,18 +352,36 @@ public function getMappingTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['employment_types'] = isset($data['employment_types']) ? $data['employment_types'] : null; - $this->container['award_package_id'] = isset($data['award_package_id']) ? $data['award_package_id'] : null; - $this->container['award_package_name'] = isset($data['award_package_name']) ? $data['award_package_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['accrues_leave'] = isset($data['accrues_leave']) ? $data['accrues_leave'] : null; - $this->container['mapping_type'] = isset($data['mapping_type']) ? $data['mapping_type'] : null; - $this->container['short_code'] = isset($data['short_code']) ? $data['short_code'] : null; + $this->setIfExists('employment_types', $data ?? [], null); + $this->setIfExists('award_package_id', $data ?? [], null); + $this->setIfExists('award_package_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('accrues_leave', $data ?? [], null); + $this->setIfExists('mapping_type', $data ?? [], null); + $this->setIfExists('short_code', $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; } /** @@ -300,7 +396,8 @@ public function listInvalidProperties() $allowedValues = $this->getMappingTypeAllowableValues(); if (!is_null($this->container['mapping_type']) && !in_array($this->container['mapping_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'mapping_type', must be one of '%s'", + "invalid value '%s' for 'mapping_type', must be one of '%s'", + $this->container['mapping_type'], implode("', '", $allowedValues) ); } @@ -323,7 +420,7 @@ public function valid() /** * Gets employment_types * - * @return string[] + * @return string[]|null */ public function getEmploymentTypes() { @@ -333,14 +430,17 @@ public function getEmploymentTypes() /** * Sets employment_types * - * @param string[] $employment_types + * @param string[]|null $employment_types * - * @return $this + * @return self */ public function setEmploymentTypes($employment_types) { + if (is_null($employment_types)) { + throw new \InvalidArgumentException('non-nullable employment_types cannot be null'); + } $allowedValues = $this->getEmploymentTypesAllowableValues(); - if (!is_null($employment_types) && array_diff($employment_types, $allowedValues)) { + if (array_diff($employment_types, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'employment_types', must be one of '%s'", @@ -356,7 +456,7 @@ public function setEmploymentTypes($employment_types) /** * Gets award_package_id * - * @return int + * @return int|null */ public function getAwardPackageId() { @@ -366,12 +466,15 @@ public function getAwardPackageId() /** * Sets award_package_id * - * @param int $award_package_id + * @param int|null $award_package_id * - * @return $this + * @return self */ public function setAwardPackageId($award_package_id) { + if (is_null($award_package_id)) { + throw new \InvalidArgumentException('non-nullable award_package_id cannot be null'); + } $this->container['award_package_id'] = $award_package_id; return $this; @@ -380,7 +483,7 @@ public function setAwardPackageId($award_package_id) /** * Gets award_package_name * - * @return string + * @return string|null */ public function getAwardPackageName() { @@ -390,12 +493,15 @@ public function getAwardPackageName() /** * Sets award_package_name * - * @param string $award_package_name + * @param string|null $award_package_name * - * @return $this + * @return self */ public function setAwardPackageName($award_package_name) { + if (is_null($award_package_name)) { + throw new \InvalidArgumentException('non-nullable award_package_name cannot be null'); + } $this->container['award_package_name'] = $award_package_name; return $this; @@ -404,7 +510,7 @@ public function setAwardPackageName($award_package_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -414,12 +520,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -428,7 +537,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -438,12 +547,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -452,7 +564,7 @@ public function setName($name) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -462,12 +574,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -476,7 +591,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -486,12 +601,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -500,7 +618,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -510,12 +628,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -524,7 +645,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -534,12 +655,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -548,7 +672,7 @@ public function setSource($source) /** * Gets accrues_leave * - * @return bool + * @return bool|null */ public function getAccruesLeave() { @@ -558,12 +682,15 @@ public function getAccruesLeave() /** * Sets accrues_leave * - * @param bool $accrues_leave + * @param bool|null $accrues_leave * - * @return $this + * @return self */ public function setAccruesLeave($accrues_leave) { + if (is_null($accrues_leave)) { + throw new \InvalidArgumentException('non-nullable accrues_leave cannot be null'); + } $this->container['accrues_leave'] = $accrues_leave; return $this; @@ -572,7 +699,7 @@ public function setAccruesLeave($accrues_leave) /** * Gets mapping_type * - * @return string + * @return string|null */ public function getMappingType() { @@ -582,17 +709,21 @@ public function getMappingType() /** * Sets mapping_type * - * @param string $mapping_type + * @param string|null $mapping_type * - * @return $this + * @return self */ public function setMappingType($mapping_type) { + if (is_null($mapping_type)) { + throw new \InvalidArgumentException('non-nullable mapping_type cannot be null'); + } $allowedValues = $this->getMappingTypeAllowableValues(); - if (!is_null($mapping_type) && !in_array($mapping_type, $allowedValues, true)) { + if (!in_array($mapping_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'mapping_type', must be one of '%s'", + "Invalid value '%s' for 'mapping_type', must be one of '%s'", + $mapping_type, implode("', '", $allowedValues) ) ); @@ -605,7 +736,7 @@ public function setMappingType($mapping_type) /** * Gets short_code * - * @return string + * @return string|null */ public function getShortCode() { @@ -615,12 +746,15 @@ public function getShortCode() /** * Sets short_code * - * @param string $short_code + * @param string|null $short_code * - * @return $this + * @return self */ public function setShortCode($short_code) { + if (is_null($short_code)) { + throw new \InvalidArgumentException('non-nullable short_code cannot be null'); + } $this->container['short_code'] = $short_code; return $this; @@ -632,7 +766,7 @@ public function setShortCode($short_code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -642,22 +776,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -673,11 +808,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -685,13 +833,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/AvailableEmployeeModel.php b/src/lib/Model/AvailableEmployeeModel.php index 77233ce..848c937 100644 --- a/src/lib/Model/AvailableEmployeeModel.php +++ b/src/lib/Model/AvailableEmployeeModel.php @@ -2,68 +2,68 @@ /** * AvailableEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * AvailableEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class AvailableEmployeeModel implements ModelInterface, ArrayAccess +class AvailableEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'AvailableEmployeeModel'; + protected static $openAPIModelName = 'AvailableEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'business_id' => 'int', 'business_name' => 'string', 'job_title' => 'string', 'has_profile_image' => 'bool', - 'branding' => '\Swagger\Client\Model\WhiteLabelBrandingModel', + 'branding' => '\OpenAPI\Client\Model\WhiteLabelBrandingModel', 'default_location_id' => 'int', 'profile_image_url' => 'string', 'region' => 'string' @@ -73,8 +73,10 @@ class AvailableEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'business_id' => 'int32', @@ -87,14 +89,39 @@ class AvailableEmployeeModel implements ModelInterface, ArrayAccess 'region' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'business_id' => false, + 'business_name' => false, + 'job_title' => false, + 'has_profile_image' => false, + 'branding' => false, + 'default_location_id' => false, + 'profile_image_url' => false, + 'region' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['business_id'] = isset($data['business_id']) ? $data['business_id'] : null; - $this->container['business_name'] = isset($data['business_name']) ? $data['business_name'] : null; - $this->container['job_title'] = isset($data['job_title']) ? $data['job_title'] : null; - $this->container['has_profile_image'] = isset($data['has_profile_image']) ? $data['has_profile_image'] : null; - $this->container['branding'] = isset($data['branding']) ? $data['branding'] : null; - $this->container['default_location_id'] = isset($data['default_location_id']) ? $data['default_location_id'] : null; - $this->container['profile_image_url'] = isset($data['profile_image_url']) ? $data['profile_image_url'] : null; - $this->container['region'] = isset($data['region']) ? $data['region'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('business_name', $data ?? [], null); + $this->setIfExists('job_title', $data ?? [], null); + $this->setIfExists('has_profile_image', $data ?? [], null); + $this->setIfExists('branding', $data ?? [], null); + $this->setIfExists('default_location_id', $data ?? [], null); + $this->setIfExists('profile_image_url', $data ?? [], null); + $this->setIfExists('region', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -295,12 +392,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -309,7 +409,7 @@ public function setName($name) /** * Gets business_id * - * @return int + * @return int|null */ public function getBusinessId() { @@ -319,12 +419,15 @@ public function getBusinessId() /** * Sets business_id * - * @param int $business_id + * @param int|null $business_id * - * @return $this + * @return self */ public function setBusinessId($business_id) { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } $this->container['business_id'] = $business_id; return $this; @@ -333,7 +436,7 @@ public function setBusinessId($business_id) /** * Gets business_name * - * @return string + * @return string|null */ public function getBusinessName() { @@ -343,12 +446,15 @@ public function getBusinessName() /** * Sets business_name * - * @param string $business_name + * @param string|null $business_name * - * @return $this + * @return self */ public function setBusinessName($business_name) { + if (is_null($business_name)) { + throw new \InvalidArgumentException('non-nullable business_name cannot be null'); + } $this->container['business_name'] = $business_name; return $this; @@ -357,7 +463,7 @@ public function setBusinessName($business_name) /** * Gets job_title * - * @return string + * @return string|null */ public function getJobTitle() { @@ -367,12 +473,15 @@ public function getJobTitle() /** * Sets job_title * - * @param string $job_title + * @param string|null $job_title * - * @return $this + * @return self */ public function setJobTitle($job_title) { + if (is_null($job_title)) { + throw new \InvalidArgumentException('non-nullable job_title cannot be null'); + } $this->container['job_title'] = $job_title; return $this; @@ -381,7 +490,7 @@ public function setJobTitle($job_title) /** * Gets has_profile_image * - * @return bool + * @return bool|null */ public function getHasProfileImage() { @@ -391,12 +500,15 @@ public function getHasProfileImage() /** * Sets has_profile_image * - * @param bool $has_profile_image + * @param bool|null $has_profile_image * - * @return $this + * @return self */ public function setHasProfileImage($has_profile_image) { + if (is_null($has_profile_image)) { + throw new \InvalidArgumentException('non-nullable has_profile_image cannot be null'); + } $this->container['has_profile_image'] = $has_profile_image; return $this; @@ -405,7 +517,7 @@ public function setHasProfileImage($has_profile_image) /** * Gets branding * - * @return \Swagger\Client\Model\WhiteLabelBrandingModel + * @return \OpenAPI\Client\Model\WhiteLabelBrandingModel|null */ public function getBranding() { @@ -415,12 +527,15 @@ public function getBranding() /** * Sets branding * - * @param \Swagger\Client\Model\WhiteLabelBrandingModel $branding + * @param \OpenAPI\Client\Model\WhiteLabelBrandingModel|null $branding branding * - * @return $this + * @return self */ public function setBranding($branding) { + if (is_null($branding)) { + throw new \InvalidArgumentException('non-nullable branding cannot be null'); + } $this->container['branding'] = $branding; return $this; @@ -429,7 +544,7 @@ public function setBranding($branding) /** * Gets default_location_id * - * @return int + * @return int|null */ public function getDefaultLocationId() { @@ -439,12 +554,15 @@ public function getDefaultLocationId() /** * Sets default_location_id * - * @param int $default_location_id + * @param int|null $default_location_id * - * @return $this + * @return self */ public function setDefaultLocationId($default_location_id) { + if (is_null($default_location_id)) { + throw new \InvalidArgumentException('non-nullable default_location_id cannot be null'); + } $this->container['default_location_id'] = $default_location_id; return $this; @@ -453,7 +571,7 @@ public function setDefaultLocationId($default_location_id) /** * Gets profile_image_url * - * @return string + * @return string|null */ public function getProfileImageUrl() { @@ -463,12 +581,15 @@ public function getProfileImageUrl() /** * Sets profile_image_url * - * @param string $profile_image_url + * @param string|null $profile_image_url * - * @return $this + * @return self */ public function setProfileImageUrl($profile_image_url) { + if (is_null($profile_image_url)) { + throw new \InvalidArgumentException('non-nullable profile_image_url cannot be null'); + } $this->container['profile_image_url'] = $profile_image_url; return $this; @@ -477,7 +598,7 @@ public function setProfileImageUrl($profile_image_url) /** * Gets region * - * @return string + * @return string|null */ public function getRegion() { @@ -487,12 +608,15 @@ public function getRegion() /** * Sets region * - * @param string $region + * @param string|null $region * - * @return $this + * @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; @@ -504,7 +628,7 @@ public function setRegion($region) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BankAccountEditModel.php b/src/lib/Model/BankAccountEditModel.php index 67bf688..04ca7ab 100644 --- a/src/lib/Model/BankAccountEditModel.php +++ b/src/lib/Model/BankAccountEditModel.php @@ -2,67 +2,67 @@ /** * BankAccountEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BankAccountEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BankAccountEditModel implements ModelInterface, ArrayAccess +class BankAccountEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BankAccountEditModel'; + protected static $openAPIModelName = 'BankAccountEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'bsb' => 'string', 'account_name' => 'string', 'account_number' => 'string', - 'allocated_percentage' => 'double', - 'fixed_amount' => 'double', + 'allocated_percentage' => 'float', + 'fixed_amount' => 'float', 'external_reference_id' => 'string', 'source' => 'string', 'allocate_balance' => 'bool', @@ -80,8 +80,10 @@ class BankAccountEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'bsb' => null, 'account_name' => null, @@ -101,14 +103,46 @@ class BankAccountEditModel implements ModelInterface, ArrayAccess 'my_other_bank_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'bsb' => false, + 'account_name' => false, + 'account_number' => false, + 'allocated_percentage' => false, + 'fixed_amount' => false, + 'external_reference_id' => false, + 'source' => false, + 'allocate_balance' => false, + 'is_employee_editable' => false, + 'can_be_deleted' => false, + 'account_type' => false, + 'roll_number' => false, + 'bank_swift' => false, + 'branch_code' => false, + 'my_bank_code' => false, + 'my_other_bank_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -116,9 +150,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -235,92 +321,90 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - const ACCOUNT_TYPE_ELECTRONIC = 'Electronic'; - const ACCOUNT_TYPE_MANUAL_DEPOSIT = 'ManualDeposit'; - const ACCOUNT_TYPE_CASH_OR_CHEQUE = 'CashOrCheque'; - const ACCOUNT_TYPE_BPAY = 'Bpay'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + public const ACCOUNT_TYPE_ELECTRONIC = 'Electronic'; + public const ACCOUNT_TYPE_MANUAL_DEPOSIT = 'ManualDeposit'; + public const ACCOUNT_TYPE_CASH_OR_CHEQUE = 'CashOrCheque'; + public const ACCOUNT_TYPE_BPAY = 'Bpay'; + /** * Gets allowable values of the enum * @@ -407,7 +491,7 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - + /** * Gets allowable values of the enum * @@ -422,7 +506,6 @@ public function getAccountTypeAllowableValues() self::ACCOUNT_TYPE_BPAY, ]; } - /** * Associative array for storing property values @@ -439,23 +522,41 @@ public function getAccountTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['fixed_amount'] = isset($data['fixed_amount']) ? $data['fixed_amount'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; - $this->container['is_employee_editable'] = isset($data['is_employee_editable']) ? $data['is_employee_editable'] : null; - $this->container['can_be_deleted'] = isset($data['can_be_deleted']) ? $data['can_be_deleted'] : null; - $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null; - $this->container['roll_number'] = isset($data['roll_number']) ? $data['roll_number'] : null; - $this->container['bank_swift'] = isset($data['bank_swift']) ? $data['bank_swift'] : null; - $this->container['branch_code'] = isset($data['branch_code']) ? $data['branch_code'] : null; - $this->container['my_bank_code'] = isset($data['my_bank_code']) ? $data['my_bank_code'] : null; - $this->container['my_other_bank_name'] = isset($data['my_other_bank_name']) ? $data['my_other_bank_name'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('fixed_amount', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('allocate_balance', $data ?? [], null); + $this->setIfExists('is_employee_editable', $data ?? [], null); + $this->setIfExists('can_be_deleted', $data ?? [], null); + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('roll_number', $data ?? [], null); + $this->setIfExists('bank_swift', $data ?? [], null); + $this->setIfExists('branch_code', $data ?? [], null); + $this->setIfExists('my_bank_code', $data ?? [], null); + $this->setIfExists('my_other_bank_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; } /** @@ -470,7 +571,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -478,7 +580,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccountTypeAllowableValues(); if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'account_type', must be one of '%s'", + "invalid value '%s' for 'account_type', must be one of '%s'", + $this->container['account_type'], implode("', '", $allowedValues) ); } @@ -501,7 +604,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -511,12 +614,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -525,7 +631,7 @@ public function setId($id) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -535,12 +641,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -549,7 +658,7 @@ public function setBsb($bsb) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -559,12 +668,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -573,7 +685,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -583,12 +695,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -597,7 +712,7 @@ public function setAccountNumber($account_number) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -607,12 +722,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -621,7 +739,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets fixed_amount * - * @return double + * @return float|null */ public function getFixedAmount() { @@ -631,12 +749,15 @@ public function getFixedAmount() /** * Sets fixed_amount * - * @param double $fixed_amount + * @param float|null $fixed_amount * - * @return $this + * @return self */ public function setFixedAmount($fixed_amount) { + if (is_null($fixed_amount)) { + throw new \InvalidArgumentException('non-nullable fixed_amount cannot be null'); + } $this->container['fixed_amount'] = $fixed_amount; return $this; @@ -645,7 +766,7 @@ public function setFixedAmount($fixed_amount) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -655,12 +776,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -669,7 +793,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -679,17 +803,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -702,7 +830,7 @@ public function setSource($source) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -712,12 +840,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -726,7 +857,7 @@ public function setAllocateBalance($allocate_balance) /** * Gets is_employee_editable * - * @return bool + * @return bool|null */ public function getIsEmployeeEditable() { @@ -736,12 +867,15 @@ public function getIsEmployeeEditable() /** * Sets is_employee_editable * - * @param bool $is_employee_editable + * @param bool|null $is_employee_editable * - * @return $this + * @return self */ public function setIsEmployeeEditable($is_employee_editable) { + if (is_null($is_employee_editable)) { + throw new \InvalidArgumentException('non-nullable is_employee_editable cannot be null'); + } $this->container['is_employee_editable'] = $is_employee_editable; return $this; @@ -750,7 +884,7 @@ public function setIsEmployeeEditable($is_employee_editable) /** * Gets can_be_deleted * - * @return bool + * @return bool|null */ public function getCanBeDeleted() { @@ -760,12 +894,15 @@ public function getCanBeDeleted() /** * Sets can_be_deleted * - * @param bool $can_be_deleted + * @param bool|null $can_be_deleted * - * @return $this + * @return self */ public function setCanBeDeleted($can_be_deleted) { + if (is_null($can_be_deleted)) { + throw new \InvalidArgumentException('non-nullable can_be_deleted cannot be null'); + } $this->container['can_be_deleted'] = $can_be_deleted; return $this; @@ -774,7 +911,7 @@ public function setCanBeDeleted($can_be_deleted) /** * Gets account_type * - * @return string + * @return string|null */ public function getAccountType() { @@ -784,17 +921,21 @@ public function getAccountType() /** * Sets account_type * - * @param string $account_type + * @param string|null $account_type * - * @return $this + * @return self */ public function setAccountType($account_type) { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } $allowedValues = $this->getAccountTypeAllowableValues(); - if (!is_null($account_type) && !in_array($account_type, $allowedValues, true)) { + if (!in_array($account_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'account_type', must be one of '%s'", + "Invalid value '%s' for 'account_type', must be one of '%s'", + $account_type, implode("', '", $allowedValues) ) ); @@ -807,7 +948,7 @@ public function setAccountType($account_type) /** * Gets roll_number * - * @return string + * @return string|null */ public function getRollNumber() { @@ -817,12 +958,15 @@ public function getRollNumber() /** * Sets roll_number * - * @param string $roll_number + * @param string|null $roll_number * - * @return $this + * @return self */ public function setRollNumber($roll_number) { + if (is_null($roll_number)) { + throw new \InvalidArgumentException('non-nullable roll_number cannot be null'); + } $this->container['roll_number'] = $roll_number; return $this; @@ -831,7 +975,7 @@ public function setRollNumber($roll_number) /** * Gets bank_swift * - * @return string + * @return string|null */ public function getBankSwift() { @@ -841,12 +985,15 @@ public function getBankSwift() /** * Sets bank_swift * - * @param string $bank_swift + * @param string|null $bank_swift * - * @return $this + * @return self */ public function setBankSwift($bank_swift) { + if (is_null($bank_swift)) { + throw new \InvalidArgumentException('non-nullable bank_swift cannot be null'); + } $this->container['bank_swift'] = $bank_swift; return $this; @@ -855,7 +1002,7 @@ public function setBankSwift($bank_swift) /** * Gets branch_code * - * @return string + * @return string|null */ public function getBranchCode() { @@ -865,12 +1012,15 @@ public function getBranchCode() /** * Sets branch_code * - * @param string $branch_code + * @param string|null $branch_code * - * @return $this + * @return self */ public function setBranchCode($branch_code) { + if (is_null($branch_code)) { + throw new \InvalidArgumentException('non-nullable branch_code cannot be null'); + } $this->container['branch_code'] = $branch_code; return $this; @@ -879,7 +1029,7 @@ public function setBranchCode($branch_code) /** * Gets my_bank_code * - * @return string + * @return string|null */ public function getMyBankCode() { @@ -889,12 +1039,15 @@ public function getMyBankCode() /** * Sets my_bank_code * - * @param string $my_bank_code + * @param string|null $my_bank_code * - * @return $this + * @return self */ public function setMyBankCode($my_bank_code) { + if (is_null($my_bank_code)) { + throw new \InvalidArgumentException('non-nullable my_bank_code cannot be null'); + } $this->container['my_bank_code'] = $my_bank_code; return $this; @@ -903,7 +1056,7 @@ public function setMyBankCode($my_bank_code) /** * Gets my_other_bank_name * - * @return string + * @return string|null */ public function getMyOtherBankName() { @@ -913,12 +1066,15 @@ public function getMyOtherBankName() /** * Sets my_other_bank_name * - * @param string $my_other_bank_name + * @param string|null $my_other_bank_name * - * @return $this + * @return self */ public function setMyOtherBankName($my_other_bank_name) { + if (is_null($my_other_bank_name)) { + throw new \InvalidArgumentException('non-nullable my_other_bank_name cannot be null'); + } $this->container['my_other_bank_name'] = $my_other_bank_name; return $this; @@ -930,7 +1086,7 @@ public function setMyOtherBankName($my_other_bank_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -940,22 +1096,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -971,11 +1128,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -983,13 +1153,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BasicEmploymentAgreementModel.php b/src/lib/Model/BasicEmploymentAgreementModel.php index 6f1b977..a89f22f 100644 --- a/src/lib/Model/BasicEmploymentAgreementModel.php +++ b/src/lib/Model/BasicEmploymentAgreementModel.php @@ -2,61 +2,61 @@ /** * BasicEmploymentAgreementModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BasicEmploymentAgreementModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BasicEmploymentAgreementModel implements ModelInterface, ArrayAccess +class BasicEmploymentAgreementModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BasicEmploymentAgreementModel'; + protected static $openAPIModelName = 'BasicEmploymentAgreementModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'classification' => 'string', 'employment_type' => 'string', @@ -70,8 +70,10 @@ class BasicEmploymentAgreementModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'classification' => null, 'employment_type' => null, @@ -81,14 +83,36 @@ class BasicEmploymentAgreementModel implements ModelInterface, ArrayAccess 'external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'classification' => false, + 'employment_type' => false, + 'name' => false, + 'award_name' => false, + 'rank' => false, + 'external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -185,18 +261,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYMENT_TYPE_UNKNOWN = 'Unknown'; - const EMPLOYMENT_TYPE_FULL_TIME = 'FullTime'; - const EMPLOYMENT_TYPE_PART_TIME = 'PartTime'; - const EMPLOYMENT_TYPE_LABOUR_HIRE = 'LabourHire'; - const EMPLOYMENT_TYPE_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; - const EMPLOYMENT_TYPE_CASUAL = 'Casual'; - + public const EMPLOYMENT_TYPE_UNKNOWN = 'Unknown'; + public const EMPLOYMENT_TYPE_FULL_TIME = 'FullTime'; + public const EMPLOYMENT_TYPE_PART_TIME = 'PartTime'; + public const EMPLOYMENT_TYPE_LABOUR_HIRE = 'LabourHire'; + public const EMPLOYMENT_TYPE_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; + public const EMPLOYMENT_TYPE_CASUAL = 'Casual'; - /** * Gets allowable values of the enum * @@ -213,7 +287,6 @@ public function getEmploymentTypeAllowableValues() self::EMPLOYMENT_TYPE_CASUAL, ]; } - /** * Associative array for storing property values @@ -230,13 +303,31 @@ public function getEmploymentTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['employment_type'] = isset($data['employment_type']) ? $data['employment_type'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['award_name'] = isset($data['award_name']) ? $data['award_name'] : null; - $this->container['rank'] = isset($data['rank']) ? $data['rank'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('employment_type', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('award_name', $data ?? [], null); + $this->setIfExists('rank', $data ?? [], null); + $this->setIfExists('external_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; } /** @@ -251,7 +342,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmploymentTypeAllowableValues(); if (!is_null($this->container['employment_type']) && !in_array($this->container['employment_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employment_type', must be one of '%s'", + "invalid value '%s' for 'employment_type', must be one of '%s'", + $this->container['employment_type'], implode("', '", $allowedValues) ); } @@ -274,7 +366,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -284,12 +376,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -298,7 +393,7 @@ public function setId($id) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -308,12 +403,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -322,7 +420,7 @@ public function setClassification($classification) /** * Gets employment_type * - * @return string + * @return string|null */ public function getEmploymentType() { @@ -332,17 +430,21 @@ public function getEmploymentType() /** * Sets employment_type * - * @param string $employment_type + * @param string|null $employment_type * - * @return $this + * @return self */ public function setEmploymentType($employment_type) { + if (is_null($employment_type)) { + throw new \InvalidArgumentException('non-nullable employment_type cannot be null'); + } $allowedValues = $this->getEmploymentTypeAllowableValues(); - if (!is_null($employment_type) && !in_array($employment_type, $allowedValues, true)) { + if (!in_array($employment_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employment_type', must be one of '%s'", + "Invalid value '%s' for 'employment_type', must be one of '%s'", + $employment_type, implode("', '", $allowedValues) ) ); @@ -355,7 +457,7 @@ public function setEmploymentType($employment_type) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -365,12 +467,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -379,7 +484,7 @@ public function setName($name) /** * Gets award_name * - * @return string + * @return string|null */ public function getAwardName() { @@ -389,12 +494,15 @@ public function getAwardName() /** * Sets award_name * - * @param string $award_name + * @param string|null $award_name * - * @return $this + * @return self */ public function setAwardName($award_name) { + if (is_null($award_name)) { + throw new \InvalidArgumentException('non-nullable award_name cannot be null'); + } $this->container['award_name'] = $award_name; return $this; @@ -403,7 +511,7 @@ public function setAwardName($award_name) /** * Gets rank * - * @return int + * @return int|null */ public function getRank() { @@ -413,12 +521,15 @@ public function getRank() /** * Sets rank * - * @param int $rank + * @param int|null $rank * - * @return $this + * @return self */ public function setRank($rank) { + if (is_null($rank)) { + throw new \InvalidArgumentException('non-nullable rank cannot be null'); + } $this->container['rank'] = $rank; return $this; @@ -427,7 +538,7 @@ public function setRank($rank) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -437,12 +548,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -454,7 +568,7 @@ public function setExternalId($external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -464,22 +578,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -495,11 +610,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -507,13 +635,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BasicKioskEmployeeModel.php b/src/lib/Model/BasicKioskEmployeeModel.php index 25cfb64..698662e 100644 --- a/src/lib/Model/BasicKioskEmployeeModel.php +++ b/src/lib/Model/BasicKioskEmployeeModel.php @@ -2,61 +2,61 @@ /** * BasicKioskEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BasicKioskEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BasicKioskEmployeeModel implements ModelInterface, ArrayAccess +class BasicKioskEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BasicKioskEmployeeModel'; + protected static $openAPIModelName = 'BasicKioskEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', @@ -78,8 +78,10 @@ class BasicKioskEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'first_name' => null, 'surname' => null, @@ -97,14 +99,44 @@ class BasicKioskEmployeeModel implements ModelInterface, ArrayAccess 'employee_start_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'name' => false, + 'has_email' => false, + 'profile_image_url' => false, + 'mobile_number' => false, + 'status' => false, + 'long_shift' => false, + 'clock_on_time_utc' => false, + 'break_start_time_utc' => false, + 'recorded_time_utc' => false, + 'current_shift_id' => false, + 'employee_group_ids' => false, + 'employee_start_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -225,16 +309,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; - const STATUS_CLOCKED_ON = 'ClockedOn'; - const STATUS_ON_BREAK = 'OnBreak'; - const STATUS_CLOCKED_OFF = 'ClockedOff'; - + public const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; + public const STATUS_CLOCKED_ON = 'ClockedOn'; + public const STATUS_ON_BREAK = 'OnBreak'; + public const STATUS_CLOCKED_OFF = 'ClockedOff'; - /** * Gets allowable values of the enum * @@ -249,7 +331,6 @@ public function getStatusAllowableValues() self::STATUS_CLOCKED_OFF, ]; } - /** * Associative array for storing property values @@ -266,21 +347,39 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['has_email'] = isset($data['has_email']) ? $data['has_email'] : null; - $this->container['profile_image_url'] = isset($data['profile_image_url']) ? $data['profile_image_url'] : null; - $this->container['mobile_number'] = isset($data['mobile_number']) ? $data['mobile_number'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['long_shift'] = isset($data['long_shift']) ? $data['long_shift'] : null; - $this->container['clock_on_time_utc'] = isset($data['clock_on_time_utc']) ? $data['clock_on_time_utc'] : null; - $this->container['break_start_time_utc'] = isset($data['break_start_time_utc']) ? $data['break_start_time_utc'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['current_shift_id'] = isset($data['current_shift_id']) ? $data['current_shift_id'] : null; - $this->container['employee_group_ids'] = isset($data['employee_group_ids']) ? $data['employee_group_ids'] : null; - $this->container['employee_start_date'] = isset($data['employee_start_date']) ? $data['employee_start_date'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('has_email', $data ?? [], null); + $this->setIfExists('profile_image_url', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('long_shift', $data ?? [], null); + $this->setIfExists('clock_on_time_utc', $data ?? [], null); + $this->setIfExists('break_start_time_utc', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('current_shift_id', $data ?? [], null); + $this->setIfExists('employee_group_ids', $data ?? [], null); + $this->setIfExists('employee_start_date', $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; } /** @@ -295,7 +394,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -318,7 +418,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -328,12 +428,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -342,7 +445,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -352,12 +455,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -366,7 +472,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -376,12 +482,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -390,7 +499,7 @@ public function setSurname($surname) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -400,12 +509,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -414,7 +526,7 @@ public function setName($name) /** * Gets has_email * - * @return bool + * @return bool|null */ public function getHasEmail() { @@ -424,12 +536,15 @@ public function getHasEmail() /** * Sets has_email * - * @param bool $has_email + * @param bool|null $has_email * - * @return $this + * @return self */ public function setHasEmail($has_email) { + if (is_null($has_email)) { + throw new \InvalidArgumentException('non-nullable has_email cannot be null'); + } $this->container['has_email'] = $has_email; return $this; @@ -438,7 +553,7 @@ public function setHasEmail($has_email) /** * Gets profile_image_url * - * @return string + * @return string|null */ public function getProfileImageUrl() { @@ -448,12 +563,15 @@ public function getProfileImageUrl() /** * Sets profile_image_url * - * @param string $profile_image_url + * @param string|null $profile_image_url * - * @return $this + * @return self */ public function setProfileImageUrl($profile_image_url) { + if (is_null($profile_image_url)) { + throw new \InvalidArgumentException('non-nullable profile_image_url cannot be null'); + } $this->container['profile_image_url'] = $profile_image_url; return $this; @@ -462,7 +580,7 @@ public function setProfileImageUrl($profile_image_url) /** * Gets mobile_number * - * @return string + * @return string|null */ public function getMobileNumber() { @@ -472,12 +590,15 @@ public function getMobileNumber() /** * Sets mobile_number * - * @param string $mobile_number + * @param string|null $mobile_number * - * @return $this + * @return self */ public function setMobileNumber($mobile_number) { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } $this->container['mobile_number'] = $mobile_number; return $this; @@ -486,7 +607,7 @@ public function setMobileNumber($mobile_number) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -496,17 +617,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -519,7 +644,7 @@ public function setStatus($status) /** * Gets long_shift * - * @return bool + * @return bool|null */ public function getLongShift() { @@ -529,12 +654,15 @@ public function getLongShift() /** * Sets long_shift * - * @param bool $long_shift + * @param bool|null $long_shift * - * @return $this + * @return self */ public function setLongShift($long_shift) { + if (is_null($long_shift)) { + throw new \InvalidArgumentException('non-nullable long_shift cannot be null'); + } $this->container['long_shift'] = $long_shift; return $this; @@ -543,7 +671,7 @@ public function setLongShift($long_shift) /** * Gets clock_on_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getClockOnTimeUtc() { @@ -553,12 +681,15 @@ public function getClockOnTimeUtc() /** * Sets clock_on_time_utc * - * @param \DateTime $clock_on_time_utc + * @param \DateTime|null $clock_on_time_utc * - * @return $this + * @return self */ public function setClockOnTimeUtc($clock_on_time_utc) { + if (is_null($clock_on_time_utc)) { + throw new \InvalidArgumentException('non-nullable clock_on_time_utc cannot be null'); + } $this->container['clock_on_time_utc'] = $clock_on_time_utc; return $this; @@ -567,7 +698,7 @@ public function setClockOnTimeUtc($clock_on_time_utc) /** * Gets break_start_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getBreakStartTimeUtc() { @@ -577,12 +708,15 @@ public function getBreakStartTimeUtc() /** * Sets break_start_time_utc * - * @param \DateTime $break_start_time_utc + * @param \DateTime|null $break_start_time_utc * - * @return $this + * @return self */ public function setBreakStartTimeUtc($break_start_time_utc) { + if (is_null($break_start_time_utc)) { + throw new \InvalidArgumentException('non-nullable break_start_time_utc cannot be null'); + } $this->container['break_start_time_utc'] = $break_start_time_utc; return $this; @@ -591,7 +725,7 @@ public function setBreakStartTimeUtc($break_start_time_utc) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -601,12 +735,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -615,7 +752,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets current_shift_id * - * @return int + * @return int|null */ public function getCurrentShiftId() { @@ -625,12 +762,15 @@ public function getCurrentShiftId() /** * Sets current_shift_id * - * @param int $current_shift_id + * @param int|null $current_shift_id * - * @return $this + * @return self */ public function setCurrentShiftId($current_shift_id) { + if (is_null($current_shift_id)) { + throw new \InvalidArgumentException('non-nullable current_shift_id cannot be null'); + } $this->container['current_shift_id'] = $current_shift_id; return $this; @@ -639,7 +779,7 @@ public function setCurrentShiftId($current_shift_id) /** * Gets employee_group_ids * - * @return int[] + * @return int[]|null */ public function getEmployeeGroupIds() { @@ -649,12 +789,15 @@ public function getEmployeeGroupIds() /** * Sets employee_group_ids * - * @param int[] $employee_group_ids + * @param int[]|null $employee_group_ids * - * @return $this + * @return self */ public function setEmployeeGroupIds($employee_group_ids) { + if (is_null($employee_group_ids)) { + throw new \InvalidArgumentException('non-nullable employee_group_ids cannot be null'); + } $this->container['employee_group_ids'] = $employee_group_ids; return $this; @@ -663,7 +806,7 @@ public function setEmployeeGroupIds($employee_group_ids) /** * Gets employee_start_date * - * @return \DateTime + * @return \DateTime|null */ public function getEmployeeStartDate() { @@ -673,12 +816,15 @@ public function getEmployeeStartDate() /** * Sets employee_start_date * - * @param \DateTime $employee_start_date + * @param \DateTime|null $employee_start_date * - * @return $this + * @return self */ public function setEmployeeStartDate($employee_start_date) { + if (is_null($employee_start_date)) { + throw new \InvalidArgumentException('non-nullable employee_start_date cannot be null'); + } $this->container['employee_start_date'] = $employee_start_date; return $this; @@ -690,7 +836,7 @@ public function setEmployeeStartDate($employee_start_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -700,22 +846,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -731,11 +878,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -743,13 +903,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BiddingEmployee.php b/src/lib/Model/BiddingEmployee.php index f1de8aa..43559ff 100644 --- a/src/lib/Model/BiddingEmployee.php +++ b/src/lib/Model/BiddingEmployee.php @@ -2,61 +2,61 @@ /** * BiddingEmployee * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BiddingEmployee Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BiddingEmployee implements ModelInterface, ArrayAccess +class BiddingEmployee implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BiddingEmployee'; + protected static $openAPIModelName = 'BiddingEmployee'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_name' => 'string', 'employee_phone_number' => 'string' @@ -66,21 +66,41 @@ class BiddingEmployee implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_name' => null, 'employee_phone_number' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_name' => false, + 'employee_phone_number' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_phone_number'] = isset($data['employee_phone_number']) ? $data['employee_phone_number'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_phone_number', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -253,12 +343,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -267,7 +360,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_phone_number * - * @return string + * @return string|null */ public function getEmployeePhoneNumber() { @@ -277,12 +370,15 @@ public function getEmployeePhoneNumber() /** * Sets employee_phone_number * - * @param string $employee_phone_number + * @param string|null $employee_phone_number * - * @return $this + * @return self */ public function setEmployeePhoneNumber($employee_phone_number) { + if (is_null($employee_phone_number)) { + throw new \InvalidArgumentException('non-nullable employee_phone_number cannot be null'); + } $this->container['employee_phone_number'] = $employee_phone_number; return $this; @@ -294,7 +390,7 @@ public function setEmployeePhoneNumber($employee_phone_number) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BirthdayReportExportModel.php b/src/lib/Model/BirthdayReportExportModel.php index 81ed482..0001df2 100644 --- a/src/lib/Model/BirthdayReportExportModel.php +++ b/src/lib/Model/BirthdayReportExportModel.php @@ -2,61 +2,61 @@ /** * BirthdayReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BirthdayReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BirthdayReportExportModel implements ModelInterface, ArrayAccess +class BirthdayReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BirthdayReportExportModel'; + protected static $openAPIModelName = 'BirthdayReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location' => 'string', 'date_of_birth' => '\DateTime', 'employee_id' => 'int', @@ -71,8 +71,10 @@ class BirthdayReportExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location' => null, 'date_of_birth' => 'date-time', 'employee_id' => 'int32', @@ -83,14 +85,37 @@ class BirthdayReportExportModel implements ModelInterface, ArrayAccess 'age' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location' => false, + 'date_of_birth' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'employment_status' => false, + 'age' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['employment_status'] = isset($data['employment_status']) ? $data['employment_status'] : null; - $this->container['age'] = isset($data['age']) ? $data['age'] : null; + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('employment_status', $data ?? [], null); + $this->setIfExists('age', $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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -259,12 +351,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -273,7 +368,7 @@ public function setLocation($location) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -283,12 +378,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -297,7 +395,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -307,12 +405,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -321,7 +422,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -331,12 +432,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -345,7 +449,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -355,12 +459,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -369,7 +476,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -379,12 +486,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -393,7 +503,7 @@ public function setExternalId($external_id) /** * Gets employment_status * - * @return string + * @return string|null */ public function getEmploymentStatus() { @@ -403,12 +513,15 @@ public function getEmploymentStatus() /** * Sets employment_status * - * @param string $employment_status + * @param string|null $employment_status * - * @return $this + * @return self */ public function setEmploymentStatus($employment_status) { + if (is_null($employment_status)) { + throw new \InvalidArgumentException('non-nullable employment_status cannot be null'); + } $this->container['employment_status'] = $employment_status; return $this; @@ -417,7 +530,7 @@ public function setEmploymentStatus($employment_status) /** * Gets age * - * @return int + * @return int|null */ public function getAge() { @@ -427,12 +540,15 @@ public function getAge() /** * Sets age * - * @param int $age + * @param int|null $age * - * @return $this + * @return self */ public function setAge($age) { + if (is_null($age)) { + throw new \InvalidArgumentException('non-nullable age cannot be null'); + } $this->container['age'] = $age; return $this; @@ -444,7 +560,7 @@ public function setAge($age) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BrandModel.php b/src/lib/Model/BrandModel.php index 574232e..85d99de 100644 --- a/src/lib/Model/BrandModel.php +++ b/src/lib/Model/BrandModel.php @@ -2,61 +2,61 @@ /** * BrandModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BrandModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BrandModel implements ModelInterface, ArrayAccess +class BrandModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BrandModel'; + protected static $openAPIModelName = 'BrandModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class BrandModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BulkApplyLeaveRequestModel.php b/src/lib/Model/BulkApplyLeaveRequestModel.php index 806185b..223c882 100644 --- a/src/lib/Model/BulkApplyLeaveRequestModel.php +++ b/src/lib/Model/BulkApplyLeaveRequestModel.php @@ -2,61 +2,61 @@ /** * BulkApplyLeaveRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BulkApplyLeaveRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BulkApplyLeaveRequestModel implements ModelInterface, ArrayAccess +class BulkApplyLeaveRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BulkApplyLeaveRequestModel'; + protected static $openAPIModelName = 'BulkApplyLeaveRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_request_ids' => 'int[]', 'align_to_pay_run_period' => 'bool' ]; @@ -65,20 +65,39 @@ class BulkApplyLeaveRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_request_ids' => 'int32', 'align_to_pay_run_period' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_request_ids' => false, + 'align_to_pay_run_period' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['leave_request_ids'] = isset($data['leave_request_ids']) ? $data['leave_request_ids'] : null; - $this->container['align_to_pay_run_period'] = isset($data['align_to_pay_run_period']) ? $data['align_to_pay_run_period'] : null; + $this->setIfExists('leave_request_ids', $data ?? [], null); + $this->setIfExists('align_to_pay_run_period', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets leave_request_ids * - * @return int[] + * @return int[]|null */ public function getLeaveRequestIds() { @@ -223,12 +309,15 @@ public function getLeaveRequestIds() /** * Sets leave_request_ids * - * @param int[] $leave_request_ids + * @param int[]|null $leave_request_ids * - * @return $this + * @return self */ public function setLeaveRequestIds($leave_request_ids) { + if (is_null($leave_request_ids)) { + throw new \InvalidArgumentException('non-nullable leave_request_ids cannot be null'); + } $this->container['leave_request_ids'] = $leave_request_ids; return $this; @@ -237,7 +326,7 @@ public function setLeaveRequestIds($leave_request_ids) /** * Gets align_to_pay_run_period * - * @return bool + * @return bool|null */ public function getAlignToPayRunPeriod() { @@ -247,12 +336,15 @@ public function getAlignToPayRunPeriod() /** * Sets align_to_pay_run_period * - * @param bool $align_to_pay_run_period + * @param bool|null $align_to_pay_run_period * - * @return $this + * @return self */ public function setAlignToPayRunPeriod($align_to_pay_run_period) { + if (is_null($align_to_pay_run_period)) { + throw new \InvalidArgumentException('non-nullable align_to_pay_run_period cannot be null'); + } $this->container['align_to_pay_run_period'] = $align_to_pay_run_period; return $this; @@ -264,7 +356,7 @@ public function setAlignToPayRunPeriod($align_to_pay_run_period) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BusinessAbaModel.php b/src/lib/Model/BusinessAbaModel.php index 3e291a5..633fa83 100644 --- a/src/lib/Model/BusinessAbaModel.php +++ b/src/lib/Model/BusinessAbaModel.php @@ -2,61 +2,61 @@ /** * BusinessAbaModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BusinessAbaModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BusinessAbaModel implements ModelInterface, ArrayAccess +class BusinessAbaModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BusinessAbaModel'; + protected static $openAPIModelName = 'BusinessAbaModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'bsb' => 'string', 'account_number' => 'string', @@ -76,8 +76,10 @@ class BusinessAbaModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'bsb' => null, 'account_number' => null, @@ -93,14 +95,42 @@ class BusinessAbaModel implements ModelInterface, ArrayAccess 'balance_additional_content' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'bsb' => false, + 'account_number' => false, + 'account_name' => false, + 'financial_institution_code' => false, + 'lodgement_reference' => false, + 'user_name' => false, + 'user_id' => false, + 'include_self_balancing_transaction' => false, + 'merge_multiple_account_payments' => false, + 'balance_lodgement_reference' => false, + 'payment_additional_content' => false, + 'balance_additional_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -215,21 +297,19 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const PAYMENT_ADDITIONAL_CONTENT_NONE = 'None'; - const PAYMENT_ADDITIONAL_CONTENT_PERIOD_ENDING_DATE = 'PeriodEndingDate'; - const PAYMENT_ADDITIONAL_CONTENT_PAYMENT_DATE = 'PaymentDate'; - const PAYMENT_ADDITIONAL_CONTENT_EMPLOYEE_ID = 'EmployeeId'; - const PAYMENT_ADDITIONAL_CONTENT_PAY_RUN_ID = 'PayRunId'; - const BALANCE_ADDITIONAL_CONTENT_NONE = 'None'; - const BALANCE_ADDITIONAL_CONTENT_PERIOD_ENDING_DATE = 'PeriodEndingDate'; - const BALANCE_ADDITIONAL_CONTENT_PAYMENT_DATE = 'PaymentDate'; - const BALANCE_ADDITIONAL_CONTENT_PAY_RUN_ID = 'PayRunId'; - + public const PAYMENT_ADDITIONAL_CONTENT_NONE = 'None'; + public const PAYMENT_ADDITIONAL_CONTENT_PERIOD_ENDING_DATE = 'PeriodEndingDate'; + public const PAYMENT_ADDITIONAL_CONTENT_PAYMENT_DATE = 'PaymentDate'; + public const PAYMENT_ADDITIONAL_CONTENT_EMPLOYEE_ID = 'EmployeeId'; + public const PAYMENT_ADDITIONAL_CONTENT_PAY_RUN_ID = 'PayRunId'; + public const BALANCE_ADDITIONAL_CONTENT_NONE = 'None'; + public const BALANCE_ADDITIONAL_CONTENT_PERIOD_ENDING_DATE = 'PeriodEndingDate'; + public const BALANCE_ADDITIONAL_CONTENT_PAYMENT_DATE = 'PaymentDate'; + public const BALANCE_ADDITIONAL_CONTENT_PAY_RUN_ID = 'PayRunId'; - /** * Gets allowable values of the enum * @@ -245,7 +325,7 @@ public function getPaymentAdditionalContentAllowableValues() self::PAYMENT_ADDITIONAL_CONTENT_PAY_RUN_ID, ]; } - + /** * Gets allowable values of the enum * @@ -260,7 +340,6 @@ public function getBalanceAdditionalContentAllowableValues() self::BALANCE_ADDITIONAL_CONTENT_PAY_RUN_ID, ]; } - /** * Associative array for storing property values @@ -277,19 +356,37 @@ public function getBalanceAdditionalContentAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['financial_institution_code'] = isset($data['financial_institution_code']) ? $data['financial_institution_code'] : null; - $this->container['lodgement_reference'] = isset($data['lodgement_reference']) ? $data['lodgement_reference'] : null; - $this->container['user_name'] = isset($data['user_name']) ? $data['user_name'] : null; - $this->container['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; - $this->container['include_self_balancing_transaction'] = isset($data['include_self_balancing_transaction']) ? $data['include_self_balancing_transaction'] : null; - $this->container['merge_multiple_account_payments'] = isset($data['merge_multiple_account_payments']) ? $data['merge_multiple_account_payments'] : null; - $this->container['balance_lodgement_reference'] = isset($data['balance_lodgement_reference']) ? $data['balance_lodgement_reference'] : null; - $this->container['payment_additional_content'] = isset($data['payment_additional_content']) ? $data['payment_additional_content'] : null; - $this->container['balance_additional_content'] = isset($data['balance_additional_content']) ? $data['balance_additional_content'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('financial_institution_code', $data ?? [], null); + $this->setIfExists('lodgement_reference', $data ?? [], null); + $this->setIfExists('user_name', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('include_self_balancing_transaction', $data ?? [], null); + $this->setIfExists('merge_multiple_account_payments', $data ?? [], null); + $this->setIfExists('balance_lodgement_reference', $data ?? [], null); + $this->setIfExists('payment_additional_content', $data ?? [], null); + $this->setIfExists('balance_additional_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; } /** @@ -304,7 +401,8 @@ public function listInvalidProperties() $allowedValues = $this->getPaymentAdditionalContentAllowableValues(); if (!is_null($this->container['payment_additional_content']) && !in_array($this->container['payment_additional_content'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'payment_additional_content', must be one of '%s'", + "invalid value '%s' for 'payment_additional_content', must be one of '%s'", + $this->container['payment_additional_content'], implode("', '", $allowedValues) ); } @@ -312,7 +410,8 @@ public function listInvalidProperties() $allowedValues = $this->getBalanceAdditionalContentAllowableValues(); if (!is_null($this->container['balance_additional_content']) && !in_array($this->container['balance_additional_content'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'balance_additional_content', must be one of '%s'", + "invalid value '%s' for 'balance_additional_content', must be one of '%s'", + $this->container['balance_additional_content'], implode("', '", $allowedValues) ); } @@ -335,7 +434,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -345,12 +444,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -359,7 +461,7 @@ public function setId($id) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -369,12 +471,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -383,7 +488,7 @@ public function setBsb($bsb) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -393,12 +498,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -407,7 +515,7 @@ public function setAccountNumber($account_number) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -417,12 +525,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -431,7 +542,7 @@ public function setAccountName($account_name) /** * Gets financial_institution_code * - * @return string + * @return string|null */ public function getFinancialInstitutionCode() { @@ -441,12 +552,15 @@ public function getFinancialInstitutionCode() /** * Sets financial_institution_code * - * @param string $financial_institution_code + * @param string|null $financial_institution_code * - * @return $this + * @return self */ public function setFinancialInstitutionCode($financial_institution_code) { + if (is_null($financial_institution_code)) { + throw new \InvalidArgumentException('non-nullable financial_institution_code cannot be null'); + } $this->container['financial_institution_code'] = $financial_institution_code; return $this; @@ -455,7 +569,7 @@ public function setFinancialInstitutionCode($financial_institution_code) /** * Gets lodgement_reference * - * @return string + * @return string|null */ public function getLodgementReference() { @@ -465,12 +579,15 @@ public function getLodgementReference() /** * Sets lodgement_reference * - * @param string $lodgement_reference + * @param string|null $lodgement_reference * - * @return $this + * @return self */ public function setLodgementReference($lodgement_reference) { + if (is_null($lodgement_reference)) { + throw new \InvalidArgumentException('non-nullable lodgement_reference cannot be null'); + } $this->container['lodgement_reference'] = $lodgement_reference; return $this; @@ -479,7 +596,7 @@ public function setLodgementReference($lodgement_reference) /** * Gets user_name * - * @return string + * @return string|null */ public function getUserName() { @@ -489,12 +606,15 @@ public function getUserName() /** * Sets user_name * - * @param string $user_name + * @param string|null $user_name * - * @return $this + * @return self */ public function setUserName($user_name) { + if (is_null($user_name)) { + throw new \InvalidArgumentException('non-nullable user_name cannot be null'); + } $this->container['user_name'] = $user_name; return $this; @@ -503,7 +623,7 @@ public function setUserName($user_name) /** * Gets user_id * - * @return string + * @return string|null */ public function getUserId() { @@ -513,12 +633,15 @@ public function getUserId() /** * Sets user_id * - * @param string $user_id + * @param string|null $user_id * - * @return $this + * @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; @@ -527,7 +650,7 @@ public function setUserId($user_id) /** * Gets include_self_balancing_transaction * - * @return bool + * @return bool|null */ public function getIncludeSelfBalancingTransaction() { @@ -537,12 +660,15 @@ public function getIncludeSelfBalancingTransaction() /** * Sets include_self_balancing_transaction * - * @param bool $include_self_balancing_transaction + * @param bool|null $include_self_balancing_transaction * - * @return $this + * @return self */ public function setIncludeSelfBalancingTransaction($include_self_balancing_transaction) { + if (is_null($include_self_balancing_transaction)) { + throw new \InvalidArgumentException('non-nullable include_self_balancing_transaction cannot be null'); + } $this->container['include_self_balancing_transaction'] = $include_self_balancing_transaction; return $this; @@ -551,7 +677,7 @@ public function setIncludeSelfBalancingTransaction($include_self_balancing_trans /** * Gets merge_multiple_account_payments * - * @return bool + * @return bool|null */ public function getMergeMultipleAccountPayments() { @@ -561,12 +687,15 @@ public function getMergeMultipleAccountPayments() /** * Sets merge_multiple_account_payments * - * @param bool $merge_multiple_account_payments + * @param bool|null $merge_multiple_account_payments * - * @return $this + * @return self */ public function setMergeMultipleAccountPayments($merge_multiple_account_payments) { + if (is_null($merge_multiple_account_payments)) { + throw new \InvalidArgumentException('non-nullable merge_multiple_account_payments cannot be null'); + } $this->container['merge_multiple_account_payments'] = $merge_multiple_account_payments; return $this; @@ -575,7 +704,7 @@ public function setMergeMultipleAccountPayments($merge_multiple_account_payments /** * Gets balance_lodgement_reference * - * @return string + * @return string|null */ public function getBalanceLodgementReference() { @@ -585,12 +714,15 @@ public function getBalanceLodgementReference() /** * Sets balance_lodgement_reference * - * @param string $balance_lodgement_reference + * @param string|null $balance_lodgement_reference * - * @return $this + * @return self */ public function setBalanceLodgementReference($balance_lodgement_reference) { + if (is_null($balance_lodgement_reference)) { + throw new \InvalidArgumentException('non-nullable balance_lodgement_reference cannot be null'); + } $this->container['balance_lodgement_reference'] = $balance_lodgement_reference; return $this; @@ -599,7 +731,7 @@ public function setBalanceLodgementReference($balance_lodgement_reference) /** * Gets payment_additional_content * - * @return string + * @return string|null */ public function getPaymentAdditionalContent() { @@ -609,17 +741,21 @@ public function getPaymentAdditionalContent() /** * Sets payment_additional_content * - * @param string $payment_additional_content + * @param string|null $payment_additional_content * - * @return $this + * @return self */ public function setPaymentAdditionalContent($payment_additional_content) { + if (is_null($payment_additional_content)) { + throw new \InvalidArgumentException('non-nullable payment_additional_content cannot be null'); + } $allowedValues = $this->getPaymentAdditionalContentAllowableValues(); - if (!is_null($payment_additional_content) && !in_array($payment_additional_content, $allowedValues, true)) { + if (!in_array($payment_additional_content, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'payment_additional_content', must be one of '%s'", + "Invalid value '%s' for 'payment_additional_content', must be one of '%s'", + $payment_additional_content, implode("', '", $allowedValues) ) ); @@ -632,7 +768,7 @@ public function setPaymentAdditionalContent($payment_additional_content) /** * Gets balance_additional_content * - * @return string + * @return string|null */ public function getBalanceAdditionalContent() { @@ -642,17 +778,21 @@ public function getBalanceAdditionalContent() /** * Sets balance_additional_content * - * @param string $balance_additional_content + * @param string|null $balance_additional_content * - * @return $this + * @return self */ public function setBalanceAdditionalContent($balance_additional_content) { + if (is_null($balance_additional_content)) { + throw new \InvalidArgumentException('non-nullable balance_additional_content cannot be null'); + } $allowedValues = $this->getBalanceAdditionalContentAllowableValues(); - if (!is_null($balance_additional_content) && !in_array($balance_additional_content, $allowedValues, true)) { + if (!in_array($balance_additional_content, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'balance_additional_content', must be one of '%s'", + "Invalid value '%s' for 'balance_additional_content', must be one of '%s'", + $balance_additional_content, implode("', '", $allowedValues) ) ); @@ -668,7 +808,7 @@ public function setBalanceAdditionalContent($balance_additional_content) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -678,22 +818,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -709,11 +850,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -721,13 +875,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BusinessAccessModel.php b/src/lib/Model/BusinessAccessModel.php index 458cec2..0ec73d0 100644 --- a/src/lib/Model/BusinessAccessModel.php +++ b/src/lib/Model/BusinessAccessModel.php @@ -2,66 +2,66 @@ /** * BusinessAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BusinessAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BusinessAccessModel implements ModelInterface, ArrayAccess +class BusinessAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BusinessAccessModel'; + protected static $openAPIModelName = 'BusinessAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'access_type' => 'string', - 'employee_groups' => '\Swagger\Client\Model\EmployeeGroupAccessModel[]', - 'location_access' => '\Swagger\Client\Model\LocationAccessModel[]', - 'reports' => '\Swagger\Client\Model\ReportAccessModel', - 'kiosk_access' => '\Swagger\Client\Model\KioskAccessModel', + 'employee_groups' => '\OpenAPI\Client\Model\EmployeeGroupAccessModel[]', + 'location_access' => '\OpenAPI\Client\Model\LocationAccessModel[]', + 'reports' => '\OpenAPI\Client\Model\ReportAccessModel', + 'kiosk_access' => '\OpenAPI\Client\Model\KioskAccessModel', 'name' => 'string', 'email' => 'string' ]; @@ -70,8 +70,10 @@ class BusinessAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'access_type' => null, 'employee_groups' => null, 'location_access' => null, @@ -81,14 +83,36 @@ class BusinessAccessModel implements ModelInterface, ArrayAccess 'email' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_type' => false, + 'employee_groups' => false, + 'location_access' => false, + 'reports' => false, + 'kiosk_access' => false, + 'name' => false, + 'email' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -185,14 +261,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCESS_TYPE_UNRESTRICTED = 'Unrestricted'; - const ACCESS_TYPE_RESTRICTED = 'Restricted'; - + public const ACCESS_TYPE_UNRESTRICTED = 'Unrestricted'; + public const ACCESS_TYPE_RESTRICTED = 'Restricted'; - /** * Gets allowable values of the enum * @@ -205,7 +279,6 @@ public function getAccessTypeAllowableValues() self::ACCESS_TYPE_RESTRICTED, ]; } - /** * Associative array for storing property values @@ -222,13 +295,31 @@ public function getAccessTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['access_type'] = isset($data['access_type']) ? $data['access_type'] : null; - $this->container['employee_groups'] = isset($data['employee_groups']) ? $data['employee_groups'] : null; - $this->container['location_access'] = isset($data['location_access']) ? $data['location_access'] : null; - $this->container['reports'] = isset($data['reports']) ? $data['reports'] : null; - $this->container['kiosk_access'] = isset($data['kiosk_access']) ? $data['kiosk_access'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('access_type', $data ?? [], null); + $this->setIfExists('employee_groups', $data ?? [], null); + $this->setIfExists('location_access', $data ?? [], null); + $this->setIfExists('reports', $data ?? [], null); + $this->setIfExists('kiosk_access', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $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; } /** @@ -243,7 +334,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccessTypeAllowableValues(); if (!is_null($this->container['access_type']) && !in_array($this->container['access_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'access_type', must be one of '%s'", + "invalid value '%s' for 'access_type', must be one of '%s'", + $this->container['access_type'], implode("', '", $allowedValues) ); } @@ -266,7 +358,7 @@ public function valid() /** * Gets access_type * - * @return string + * @return string|null */ public function getAccessType() { @@ -276,17 +368,21 @@ public function getAccessType() /** * Sets access_type * - * @param string $access_type + * @param string|null $access_type * - * @return $this + * @return self */ public function setAccessType($access_type) { + if (is_null($access_type)) { + throw new \InvalidArgumentException('non-nullable access_type cannot be null'); + } $allowedValues = $this->getAccessTypeAllowableValues(); - if (!is_null($access_type) && !in_array($access_type, $allowedValues, true)) { + if (!in_array($access_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'access_type', must be one of '%s'", + "Invalid value '%s' for 'access_type', must be one of '%s'", + $access_type, implode("', '", $allowedValues) ) ); @@ -299,7 +395,7 @@ public function setAccessType($access_type) /** * Gets employee_groups * - * @return \Swagger\Client\Model\EmployeeGroupAccessModel[] + * @return \OpenAPI\Client\Model\EmployeeGroupAccessModel[]|null */ public function getEmployeeGroups() { @@ -309,12 +405,15 @@ public function getEmployeeGroups() /** * Sets employee_groups * - * @param \Swagger\Client\Model\EmployeeGroupAccessModel[] $employee_groups + * @param \OpenAPI\Client\Model\EmployeeGroupAccessModel[]|null $employee_groups * - * @return $this + * @return self */ public function setEmployeeGroups($employee_groups) { + if (is_null($employee_groups)) { + throw new \InvalidArgumentException('non-nullable employee_groups cannot be null'); + } $this->container['employee_groups'] = $employee_groups; return $this; @@ -323,7 +422,7 @@ public function setEmployeeGroups($employee_groups) /** * Gets location_access * - * @return \Swagger\Client\Model\LocationAccessModel[] + * @return \OpenAPI\Client\Model\LocationAccessModel[]|null */ public function getLocationAccess() { @@ -333,12 +432,15 @@ public function getLocationAccess() /** * Sets location_access * - * @param \Swagger\Client\Model\LocationAccessModel[] $location_access + * @param \OpenAPI\Client\Model\LocationAccessModel[]|null $location_access * - * @return $this + * @return self */ public function setLocationAccess($location_access) { + if (is_null($location_access)) { + throw new \InvalidArgumentException('non-nullable location_access cannot be null'); + } $this->container['location_access'] = $location_access; return $this; @@ -347,7 +449,7 @@ public function setLocationAccess($location_access) /** * Gets reports * - * @return \Swagger\Client\Model\ReportAccessModel + * @return \OpenAPI\Client\Model\ReportAccessModel|null */ public function getReports() { @@ -357,12 +459,15 @@ public function getReports() /** * Sets reports * - * @param \Swagger\Client\Model\ReportAccessModel $reports + * @param \OpenAPI\Client\Model\ReportAccessModel|null $reports reports * - * @return $this + * @return self */ public function setReports($reports) { + if (is_null($reports)) { + throw new \InvalidArgumentException('non-nullable reports cannot be null'); + } $this->container['reports'] = $reports; return $this; @@ -371,7 +476,7 @@ public function setReports($reports) /** * Gets kiosk_access * - * @return \Swagger\Client\Model\KioskAccessModel + * @return \OpenAPI\Client\Model\KioskAccessModel|null */ public function getKioskAccess() { @@ -381,12 +486,15 @@ public function getKioskAccess() /** * Sets kiosk_access * - * @param \Swagger\Client\Model\KioskAccessModel $kiosk_access + * @param \OpenAPI\Client\Model\KioskAccessModel|null $kiosk_access kiosk_access * - * @return $this + * @return self */ public function setKioskAccess($kiosk_access) { + if (is_null($kiosk_access)) { + throw new \InvalidArgumentException('non-nullable kiosk_access cannot be null'); + } $this->container['kiosk_access'] = $kiosk_access; return $this; @@ -395,7 +503,7 @@ public function setKioskAccess($kiosk_access) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -405,12 +513,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -419,7 +530,7 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -429,12 +540,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -446,7 +560,7 @@ public function setEmail($email) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -456,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -487,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -499,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BusinessAction.php b/src/lib/Model/BusinessAction.php index c7a3402..eb32cea 100644 --- a/src/lib/Model/BusinessAction.php +++ b/src/lib/Model/BusinessAction.php @@ -2,61 +2,61 @@ /** * BusinessAction * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BusinessAction Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BusinessAction implements ModelInterface, ArrayAccess +class BusinessAction implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BusinessAction'; + protected static $openAPIModelName = 'BusinessAction'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'date' => '\DateTime', 'title' => 'string', 'id' => 'int', @@ -67,22 +67,43 @@ class BusinessAction implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'date' => 'date-time', 'title' => null, 'id' => 'int32', 'high_priority' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'date' => false, + 'title' => false, + 'id' => false, + 'high_priority' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['high_priority'] = isset($data['high_priority']) ? $data['high_priority'] : null; + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('high_priority', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets date * - * @return \DateTime + * @return \DateTime|null */ public function getDate() { @@ -235,12 +323,15 @@ public function getDate() /** * Sets date * - * @param \DateTime $date + * @param \DateTime|null $date * - * @return $this + * @return self */ public function setDate($date) { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -249,7 +340,7 @@ public function setDate($date) /** * Gets title * - * @return string + * @return string|null */ public function getTitle() { @@ -259,12 +350,15 @@ public function getTitle() /** * Sets title * - * @param string $title + * @param string|null $title * - * @return $this + * @return self */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -273,7 +367,7 @@ public function setTitle($title) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -283,12 +377,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setId($id) /** * Gets high_priority * - * @return bool + * @return bool|null */ public function getHighPriority() { @@ -307,12 +404,15 @@ public function getHighPriority() /** * Sets high_priority * - * @param bool $high_priority + * @param bool|null $high_priority * - * @return $this + * @return self */ public function setHighPriority($high_priority) { + if (is_null($high_priority)) { + throw new \InvalidArgumentException('non-nullable high_priority cannot be null'); + } $this->container['high_priority'] = $high_priority; return $this; @@ -324,7 +424,7 @@ public function setHighPriority($high_priority) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BusinessAtoSupplierModel.php b/src/lib/Model/BusinessAtoSupplierModel.php index a9e6c5a..162a766 100644 --- a/src/lib/Model/BusinessAtoSupplierModel.php +++ b/src/lib/Model/BusinessAtoSupplierModel.php @@ -2,61 +2,61 @@ /** * BusinessAtoSupplierModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BusinessAtoSupplierModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BusinessAtoSupplierModel implements ModelInterface, ArrayAccess +class BusinessAtoSupplierModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BusinessAtoSupplierModel'; + protected static $openAPIModelName = 'BusinessAtoSupplierModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'abn' => 'string', 'name' => 'string', @@ -83,8 +83,10 @@ class BusinessAtoSupplierModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'abn' => null, 'name' => null, @@ -107,14 +109,49 @@ class BusinessAtoSupplierModel implements ModelInterface, ArrayAccess 'intermediary_contact_phone' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'abn' => false, + 'name' => false, + 'address_line1' => false, + 'address_line2' => false, + 'suburb' => false, + 'state' => false, + 'post_code' => false, + 'contact_name' => false, + 'signatory_name' => false, + 'phone_number' => false, + 'fax_number' => false, + 'country' => false, + 'branch' => false, + 'role' => false, + 'tax_agent_number' => false, + 'intermediary_abn' => false, + 'intermediary_contact_name' => false, + 'intermediary_contact_email' => false, + 'intermediary_contact_phone' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -122,9 +159,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -250,15 +339,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ROLE_EMPLOYER = 'Employer'; - const ROLE_REGISTERED_TAX_AGENT = 'RegisteredTaxAgent'; - const ROLE_INTERMEDIARY = 'Intermediary'; - + public const ROLE_EMPLOYER = 'Employer'; + public const ROLE_REGISTERED_TAX_AGENT = 'RegisteredTaxAgent'; + public const ROLE_INTERMEDIARY = 'Intermediary'; - /** * Gets allowable values of the enum * @@ -272,7 +359,6 @@ public function getRoleAllowableValues() self::ROLE_INTERMEDIARY, ]; } - /** * Associative array for storing property values @@ -289,26 +375,44 @@ public function getRoleAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['address_line1'] = isset($data['address_line1']) ? $data['address_line1'] : null; - $this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null; - $this->container['suburb'] = isset($data['suburb']) ? $data['suburb'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['post_code'] = isset($data['post_code']) ? $data['post_code'] : null; - $this->container['contact_name'] = isset($data['contact_name']) ? $data['contact_name'] : null; - $this->container['signatory_name'] = isset($data['signatory_name']) ? $data['signatory_name'] : null; - $this->container['phone_number'] = isset($data['phone_number']) ? $data['phone_number'] : null; - $this->container['fax_number'] = isset($data['fax_number']) ? $data['fax_number'] : null; - $this->container['country'] = isset($data['country']) ? $data['country'] : null; - $this->container['branch'] = isset($data['branch']) ? $data['branch'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['tax_agent_number'] = isset($data['tax_agent_number']) ? $data['tax_agent_number'] : null; - $this->container['intermediary_abn'] = isset($data['intermediary_abn']) ? $data['intermediary_abn'] : null; - $this->container['intermediary_contact_name'] = isset($data['intermediary_contact_name']) ? $data['intermediary_contact_name'] : null; - $this->container['intermediary_contact_email'] = isset($data['intermediary_contact_email']) ? $data['intermediary_contact_email'] : null; - $this->container['intermediary_contact_phone'] = isset($data['intermediary_contact_phone']) ? $data['intermediary_contact_phone'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('address_line1', $data ?? [], null); + $this->setIfExists('address_line2', $data ?? [], null); + $this->setIfExists('suburb', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('contact_name', $data ?? [], null); + $this->setIfExists('signatory_name', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('fax_number', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('branch', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('tax_agent_number', $data ?? [], null); + $this->setIfExists('intermediary_abn', $data ?? [], null); + $this->setIfExists('intermediary_contact_name', $data ?? [], null); + $this->setIfExists('intermediary_contact_email', $data ?? [], null); + $this->setIfExists('intermediary_contact_phone', $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; } /** @@ -323,7 +427,8 @@ public function listInvalidProperties() $allowedValues = $this->getRoleAllowableValues(); if (!is_null($this->container['role']) && !in_array($this->container['role'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'role', must be one of '%s'", + "invalid value '%s' for 'role', must be one of '%s'", + $this->container['role'], implode("', '", $allowedValues) ); } @@ -346,7 +451,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -356,12 +461,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -370,7 +478,7 @@ public function setId($id) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -380,12 +488,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -394,7 +505,7 @@ public function setAbn($abn) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -404,12 +515,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -418,7 +532,7 @@ public function setName($name) /** * Gets address_line1 * - * @return string + * @return string|null */ public function getAddressLine1() { @@ -428,12 +542,15 @@ public function getAddressLine1() /** * Sets address_line1 * - * @param string $address_line1 + * @param string|null $address_line1 * - * @return $this + * @return self */ public function setAddressLine1($address_line1) { + if (is_null($address_line1)) { + throw new \InvalidArgumentException('non-nullable address_line1 cannot be null'); + } $this->container['address_line1'] = $address_line1; return $this; @@ -442,7 +559,7 @@ public function setAddressLine1($address_line1) /** * Gets address_line2 * - * @return string + * @return string|null */ public function getAddressLine2() { @@ -452,12 +569,15 @@ public function getAddressLine2() /** * Sets address_line2 * - * @param string $address_line2 + * @param string|null $address_line2 * - * @return $this + * @return self */ public function setAddressLine2($address_line2) { + if (is_null($address_line2)) { + throw new \InvalidArgumentException('non-nullable address_line2 cannot be null'); + } $this->container['address_line2'] = $address_line2; return $this; @@ -466,7 +586,7 @@ public function setAddressLine2($address_line2) /** * Gets suburb * - * @return string + * @return string|null */ public function getSuburb() { @@ -476,12 +596,15 @@ public function getSuburb() /** * Sets suburb * - * @param string $suburb + * @param string|null $suburb * - * @return $this + * @return self */ public function setSuburb($suburb) { + if (is_null($suburb)) { + throw new \InvalidArgumentException('non-nullable suburb cannot be null'); + } $this->container['suburb'] = $suburb; return $this; @@ -490,7 +613,7 @@ public function setSuburb($suburb) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -500,12 +623,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -514,7 +640,7 @@ public function setState($state) /** * Gets post_code * - * @return string + * @return string|null */ public function getPostCode() { @@ -524,12 +650,15 @@ public function getPostCode() /** * Sets post_code * - * @param string $post_code + * @param string|null $post_code * - * @return $this + * @return self */ public function setPostCode($post_code) { + if (is_null($post_code)) { + throw new \InvalidArgumentException('non-nullable post_code cannot be null'); + } $this->container['post_code'] = $post_code; return $this; @@ -538,7 +667,7 @@ public function setPostCode($post_code) /** * Gets contact_name * - * @return string + * @return string|null */ public function getContactName() { @@ -548,12 +677,15 @@ public function getContactName() /** * Sets contact_name * - * @param string $contact_name + * @param string|null $contact_name * - * @return $this + * @return self */ public function setContactName($contact_name) { + if (is_null($contact_name)) { + throw new \InvalidArgumentException('non-nullable contact_name cannot be null'); + } $this->container['contact_name'] = $contact_name; return $this; @@ -562,7 +694,7 @@ public function setContactName($contact_name) /** * Gets signatory_name * - * @return string + * @return string|null */ public function getSignatoryName() { @@ -572,12 +704,15 @@ public function getSignatoryName() /** * Sets signatory_name * - * @param string $signatory_name + * @param string|null $signatory_name * - * @return $this + * @return self */ public function setSignatoryName($signatory_name) { + if (is_null($signatory_name)) { + throw new \InvalidArgumentException('non-nullable signatory_name cannot be null'); + } $this->container['signatory_name'] = $signatory_name; return $this; @@ -586,7 +721,7 @@ public function setSignatoryName($signatory_name) /** * Gets phone_number * - * @return string + * @return string|null */ public function getPhoneNumber() { @@ -596,12 +731,15 @@ public function getPhoneNumber() /** * Sets phone_number * - * @param string $phone_number + * @param string|null $phone_number * - * @return $this + * @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; @@ -610,7 +748,7 @@ public function setPhoneNumber($phone_number) /** * Gets fax_number * - * @return string + * @return string|null */ public function getFaxNumber() { @@ -620,12 +758,15 @@ public function getFaxNumber() /** * Sets fax_number * - * @param string $fax_number + * @param string|null $fax_number * - * @return $this + * @return self */ public function setFaxNumber($fax_number) { + if (is_null($fax_number)) { + throw new \InvalidArgumentException('non-nullable fax_number cannot be null'); + } $this->container['fax_number'] = $fax_number; return $this; @@ -634,7 +775,7 @@ public function setFaxNumber($fax_number) /** * Gets country * - * @return string + * @return string|null */ public function getCountry() { @@ -644,12 +785,15 @@ public function getCountry() /** * Sets country * - * @param string $country + * @param string|null $country * - * @return $this + * @return self */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -658,7 +802,7 @@ public function setCountry($country) /** * Gets branch * - * @return string + * @return string|null */ public function getBranch() { @@ -668,12 +812,15 @@ public function getBranch() /** * Sets branch * - * @param string $branch + * @param string|null $branch * - * @return $this + * @return self */ public function setBranch($branch) { + if (is_null($branch)) { + throw new \InvalidArgumentException('non-nullable branch cannot be null'); + } $this->container['branch'] = $branch; return $this; @@ -682,7 +829,7 @@ public function setBranch($branch) /** * Gets role * - * @return string + * @return string|null */ public function getRole() { @@ -692,17 +839,21 @@ public function getRole() /** * Sets role * - * @param string $role + * @param string|null $role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $allowedValues = $this->getRoleAllowableValues(); - if (!is_null($role) && !in_array($role, $allowedValues, true)) { + if (!in_array($role, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'role', must be one of '%s'", + "Invalid value '%s' for 'role', must be one of '%s'", + $role, implode("', '", $allowedValues) ) ); @@ -715,7 +866,7 @@ public function setRole($role) /** * Gets tax_agent_number * - * @return string + * @return string|null */ public function getTaxAgentNumber() { @@ -725,12 +876,15 @@ public function getTaxAgentNumber() /** * Sets tax_agent_number * - * @param string $tax_agent_number + * @param string|null $tax_agent_number * - * @return $this + * @return self */ public function setTaxAgentNumber($tax_agent_number) { + if (is_null($tax_agent_number)) { + throw new \InvalidArgumentException('non-nullable tax_agent_number cannot be null'); + } $this->container['tax_agent_number'] = $tax_agent_number; return $this; @@ -739,7 +893,7 @@ public function setTaxAgentNumber($tax_agent_number) /** * Gets intermediary_abn * - * @return string + * @return string|null */ public function getIntermediaryAbn() { @@ -749,12 +903,15 @@ public function getIntermediaryAbn() /** * Sets intermediary_abn * - * @param string $intermediary_abn + * @param string|null $intermediary_abn * - * @return $this + * @return self */ public function setIntermediaryAbn($intermediary_abn) { + if (is_null($intermediary_abn)) { + throw new \InvalidArgumentException('non-nullable intermediary_abn cannot be null'); + } $this->container['intermediary_abn'] = $intermediary_abn; return $this; @@ -763,7 +920,7 @@ public function setIntermediaryAbn($intermediary_abn) /** * Gets intermediary_contact_name * - * @return string + * @return string|null */ public function getIntermediaryContactName() { @@ -773,12 +930,15 @@ public function getIntermediaryContactName() /** * Sets intermediary_contact_name * - * @param string $intermediary_contact_name + * @param string|null $intermediary_contact_name * - * @return $this + * @return self */ public function setIntermediaryContactName($intermediary_contact_name) { + if (is_null($intermediary_contact_name)) { + throw new \InvalidArgumentException('non-nullable intermediary_contact_name cannot be null'); + } $this->container['intermediary_contact_name'] = $intermediary_contact_name; return $this; @@ -787,7 +947,7 @@ public function setIntermediaryContactName($intermediary_contact_name) /** * Gets intermediary_contact_email * - * @return string + * @return string|null */ public function getIntermediaryContactEmail() { @@ -797,12 +957,15 @@ public function getIntermediaryContactEmail() /** * Sets intermediary_contact_email * - * @param string $intermediary_contact_email + * @param string|null $intermediary_contact_email * - * @return $this + * @return self */ public function setIntermediaryContactEmail($intermediary_contact_email) { + if (is_null($intermediary_contact_email)) { + throw new \InvalidArgumentException('non-nullable intermediary_contact_email cannot be null'); + } $this->container['intermediary_contact_email'] = $intermediary_contact_email; return $this; @@ -811,7 +974,7 @@ public function setIntermediaryContactEmail($intermediary_contact_email) /** * Gets intermediary_contact_phone * - * @return string + * @return string|null */ public function getIntermediaryContactPhone() { @@ -821,12 +984,15 @@ public function getIntermediaryContactPhone() /** * Sets intermediary_contact_phone * - * @param string $intermediary_contact_phone + * @param string|null $intermediary_contact_phone * - * @return $this + * @return self */ public function setIntermediaryContactPhone($intermediary_contact_phone) { + if (is_null($intermediary_contact_phone)) { + throw new \InvalidArgumentException('non-nullable intermediary_contact_phone cannot be null'); + } $this->container['intermediary_contact_phone'] = $intermediary_contact_phone; return $this; @@ -838,7 +1004,7 @@ public function setIntermediaryContactPhone($intermediary_contact_phone) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -848,22 +1014,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -879,11 +1046,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -891,13 +1071,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/BusinessTemplateModel.php b/src/lib/Model/BusinessTemplateModel.php index cc3f685..1f5c79c 100644 --- a/src/lib/Model/BusinessTemplateModel.php +++ b/src/lib/Model/BusinessTemplateModel.php @@ -2,61 +2,61 @@ /** * BusinessTemplateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * BusinessTemplateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class BusinessTemplateModel implements ModelInterface, ArrayAccess +class BusinessTemplateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'BusinessTemplateModel'; + protected static $openAPIModelName = 'BusinessTemplateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class BusinessTemplateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ByteArrayContent.php b/src/lib/Model/ByteArrayContent.php index ab7c8d0..d7c1eee 100644 --- a/src/lib/Model/ByteArrayContent.php +++ b/src/lib/Model/ByteArrayContent.php @@ -2,81 +2,99 @@ /** * ByteArrayContent * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ByteArrayContent Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ByteArrayContent implements ModelInterface, ArrayAccess +class ByteArrayContent implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ByteArrayContent'; + protected static $openAPIModelName = 'ByteArrayContent'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'headers' => '\Swagger\Client\Model\KeyValuePairOfStringAndIEnumerableOfString[]' + protected static $openAPITypes = [ + 'headers' => '\OpenAPI\Client\Model\KeyValuePairOfStringAndIEnumerableOfString[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : 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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets headers * - * @return \Swagger\Client\Model\KeyValuePairOfStringAndIEnumerableOfString[] + * @return \OpenAPI\Client\Model\KeyValuePairOfStringAndIEnumerableOfString[]|null */ public function getHeaders() { @@ -217,12 +302,15 @@ public function getHeaders() /** * Sets headers * - * @param \Swagger\Client\Model\KeyValuePairOfStringAndIEnumerableOfString[] $headers + * @param \OpenAPI\Client\Model\KeyValuePairOfStringAndIEnumerableOfString[]|null $headers * - * @return $this + * @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; @@ -234,7 +322,7 @@ public function setHeaders($headers) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChangeKioskPinModel.php b/src/lib/Model/ChangeKioskPinModel.php index 4b21cb0..a531afb 100644 --- a/src/lib/Model/ChangeKioskPinModel.php +++ b/src/lib/Model/ChangeKioskPinModel.php @@ -2,61 +2,61 @@ /** * ChangeKioskPinModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChangeKioskPinModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChangeKioskPinModel implements ModelInterface, ArrayAccess +class ChangeKioskPinModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChangeKioskPinModel'; + protected static $openAPIModelName = 'ChangeKioskPinModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'old_pin' => 'string', 'new_pin' => 'string' @@ -66,21 +66,41 @@ class ChangeKioskPinModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'old_pin' => null, 'new_pin' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'old_pin' => false, + 'new_pin' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['old_pin'] = isset($data['old_pin']) ? $data['old_pin'] : null; - $this->container['new_pin'] = isset($data['new_pin']) ? $data['new_pin'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('old_pin', $data ?? [], null); + $this->setIfExists('new_pin', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -229,12 +316,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -243,7 +333,7 @@ public function setEmployeeId($employee_id) /** * Gets old_pin * - * @return string + * @return string|null */ public function getOldPin() { @@ -253,12 +343,15 @@ public function getOldPin() /** * Sets old_pin * - * @param string $old_pin + * @param string|null $old_pin * - * @return $this + * @return self */ public function setOldPin($old_pin) { + if (is_null($old_pin)) { + throw new \InvalidArgumentException('non-nullable old_pin cannot be null'); + } $this->container['old_pin'] = $old_pin; return $this; @@ -267,7 +360,7 @@ public function setOldPin($old_pin) /** * Gets new_pin * - * @return string + * @return string|null */ public function getNewPin() { @@ -277,12 +370,15 @@ public function getNewPin() /** * Sets new_pin * - * @param string $new_pin + * @param string|null $new_pin * - * @return $this + * @return self */ public function setNewPin($new_pin) { + if (is_null($new_pin)) { + throw new \InvalidArgumentException('non-nullable new_pin cannot be null'); + } $this->container['new_pin'] = $new_pin; return $this; @@ -294,7 +390,7 @@ public function setNewPin($new_pin) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChartOfAccountsCategoryModel.php b/src/lib/Model/ChartOfAccountsCategoryModel.php index 228dd07..e604dd6 100644 --- a/src/lib/Model/ChartOfAccountsCategoryModel.php +++ b/src/lib/Model/ChartOfAccountsCategoryModel.php @@ -2,61 +2,61 @@ /** * ChartOfAccountsCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChartOfAccountsCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChartOfAccountsCategoryModel implements ModelInterface, ArrayAccess +class ChartOfAccountsCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChartOfAccountsCategoryModel'; + protected static $openAPIModelName = 'ChartOfAccountsCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'split_by_location' => 'bool', 'id' => 'int', 'name' => 'string', @@ -67,22 +67,43 @@ class ChartOfAccountsCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'split_by_location' => null, 'id' => 'int32', 'name' => null, 'expense_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'split_by_location' => false, + 'id' => false, + 'name' => false, + 'expense_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['split_by_location'] = isset($data['split_by_location']) ? $data['split_by_location'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_account_id'] = isset($data['expense_account_id']) ? $data['expense_account_id'] : null; + $this->setIfExists('split_by_location', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_account_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets split_by_location * - * @return bool + * @return bool|null */ public function getSplitByLocation() { @@ -235,12 +323,15 @@ public function getSplitByLocation() /** * Sets split_by_location * - * @param bool $split_by_location + * @param bool|null $split_by_location * - * @return $this + * @return self */ public function setSplitByLocation($split_by_location) { + if (is_null($split_by_location)) { + throw new \InvalidArgumentException('non-nullable split_by_location cannot be null'); + } $this->container['split_by_location'] = $split_by_location; return $this; @@ -249,7 +340,7 @@ public function setSplitByLocation($split_by_location) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -259,12 +350,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -273,7 +367,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -283,12 +377,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setName($name) /** * Gets expense_account_id * - * @return int + * @return int|null */ public function getExpenseAccountId() { @@ -307,12 +404,15 @@ public function getExpenseAccountId() /** * Sets expense_account_id * - * @param int $expense_account_id + * @param int|null $expense_account_id * - * @return $this + * @return self */ public function setExpenseAccountId($expense_account_id) { + if (is_null($expense_account_id)) { + throw new \InvalidArgumentException('non-nullable expense_account_id cannot be null'); + } $this->container['expense_account_id'] = $expense_account_id; return $this; @@ -324,7 +424,7 @@ public function setExpenseAccountId($expense_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChartOfAccountsLeaveCategoryModel.php b/src/lib/Model/ChartOfAccountsLeaveCategoryModel.php index 07b7d0e..f178d2e 100644 --- a/src/lib/Model/ChartOfAccountsLeaveCategoryModel.php +++ b/src/lib/Model/ChartOfAccountsLeaveCategoryModel.php @@ -2,61 +2,61 @@ /** * ChartOfAccountsLeaveCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChartOfAccountsLeaveCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChartOfAccountsLeaveCategoryModel implements ModelInterface, ArrayAccess +class ChartOfAccountsLeaveCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChartOfAccountsLeaveCategoryModel'; + protected static $openAPIModelName = 'ChartOfAccountsLeaveCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'liability_account_id' => 'int', 'accrue_from_contingent_period' => 'bool', 'split_by_location' => 'bool', @@ -69,8 +69,10 @@ class ChartOfAccountsLeaveCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'liability_account_id' => 'int32', 'accrue_from_contingent_period' => null, 'split_by_location' => null, @@ -79,14 +81,35 @@ class ChartOfAccountsLeaveCategoryModel implements ModelInterface, ArrayAccess 'expense_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'liability_account_id' => false, + 'accrue_from_contingent_period' => false, + 'split_by_location' => false, + 'id' => false, + 'name' => false, + 'expense_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['liability_account_id'] = isset($data['liability_account_id']) ? $data['liability_account_id'] : null; - $this->container['accrue_from_contingent_period'] = isset($data['accrue_from_contingent_period']) ? $data['accrue_from_contingent_period'] : null; - $this->container['split_by_location'] = isset($data['split_by_location']) ? $data['split_by_location'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_account_id'] = isset($data['expense_account_id']) ? $data['expense_account_id'] : null; + $this->setIfExists('liability_account_id', $data ?? [], null); + $this->setIfExists('accrue_from_contingent_period', $data ?? [], null); + $this->setIfExists('split_by_location', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_account_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets liability_account_id * - * @return int + * @return int|null */ public function getLiabilityAccountId() { @@ -247,12 +337,15 @@ public function getLiabilityAccountId() /** * Sets liability_account_id * - * @param int $liability_account_id + * @param int|null $liability_account_id * - * @return $this + * @return self */ public function setLiabilityAccountId($liability_account_id) { + if (is_null($liability_account_id)) { + throw new \InvalidArgumentException('non-nullable liability_account_id cannot be null'); + } $this->container['liability_account_id'] = $liability_account_id; return $this; @@ -261,7 +354,7 @@ public function setLiabilityAccountId($liability_account_id) /** * Gets accrue_from_contingent_period * - * @return bool + * @return bool|null */ public function getAccrueFromContingentPeriod() { @@ -271,12 +364,15 @@ public function getAccrueFromContingentPeriod() /** * Sets accrue_from_contingent_period * - * @param bool $accrue_from_contingent_period + * @param bool|null $accrue_from_contingent_period * - * @return $this + * @return self */ public function setAccrueFromContingentPeriod($accrue_from_contingent_period) { + if (is_null($accrue_from_contingent_period)) { + throw new \InvalidArgumentException('non-nullable accrue_from_contingent_period cannot be null'); + } $this->container['accrue_from_contingent_period'] = $accrue_from_contingent_period; return $this; @@ -285,7 +381,7 @@ public function setAccrueFromContingentPeriod($accrue_from_contingent_period) /** * Gets split_by_location * - * @return bool + * @return bool|null */ public function getSplitByLocation() { @@ -295,12 +391,15 @@ public function getSplitByLocation() /** * Sets split_by_location * - * @param bool $split_by_location + * @param bool|null $split_by_location * - * @return $this + * @return self */ public function setSplitByLocation($split_by_location) { + if (is_null($split_by_location)) { + throw new \InvalidArgumentException('non-nullable split_by_location cannot be null'); + } $this->container['split_by_location'] = $split_by_location; return $this; @@ -309,7 +408,7 @@ public function setSplitByLocation($split_by_location) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -319,12 +418,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -333,7 +435,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -343,12 +445,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -357,7 +462,7 @@ public function setName($name) /** * Gets expense_account_id * - * @return int + * @return int|null */ public function getExpenseAccountId() { @@ -367,12 +472,15 @@ public function getExpenseAccountId() /** * Sets expense_account_id * - * @param int $expense_account_id + * @param int|null $expense_account_id * - * @return $this + * @return self */ public function setExpenseAccountId($expense_account_id) { + if (is_null($expense_account_id)) { + throw new \InvalidArgumentException('non-nullable expense_account_id cannot be null'); + } $this->container['expense_account_id'] = $expense_account_id; return $this; @@ -384,7 +492,7 @@ public function setExpenseAccountId($expense_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChartOfAccountsLiabilityCategoryModel.php b/src/lib/Model/ChartOfAccountsLiabilityCategoryModel.php index 17b55bf..6c85f37 100644 --- a/src/lib/Model/ChartOfAccountsLiabilityCategoryModel.php +++ b/src/lib/Model/ChartOfAccountsLiabilityCategoryModel.php @@ -2,61 +2,61 @@ /** * ChartOfAccountsLiabilityCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChartOfAccountsLiabilityCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChartOfAccountsLiabilityCategoryModel implements ModelInterface, ArrayAccess +class ChartOfAccountsLiabilityCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChartOfAccountsLiabilityCategoryModel'; + protected static $openAPIModelName = 'ChartOfAccountsLiabilityCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'liability_account_id' => 'int', 'split_by_location' => 'bool', 'id' => 'int', @@ -68,8 +68,10 @@ class ChartOfAccountsLiabilityCategoryModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'liability_account_id' => 'int32', 'split_by_location' => null, 'id' => 'int32', @@ -77,14 +79,34 @@ class ChartOfAccountsLiabilityCategoryModel implements ModelInterface, ArrayAcce 'expense_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'liability_account_id' => false, + 'split_by_location' => false, + 'id' => false, + 'name' => false, + 'expense_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['liability_account_id'] = isset($data['liability_account_id']) ? $data['liability_account_id'] : null; - $this->container['split_by_location'] = isset($data['split_by_location']) ? $data['split_by_location'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_account_id'] = isset($data['expense_account_id']) ? $data['expense_account_id'] : null; + $this->setIfExists('liability_account_id', $data ?? [], null); + $this->setIfExists('split_by_location', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_account_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets liability_account_id * - * @return int + * @return int|null */ public function getLiabilityAccountId() { @@ -241,12 +330,15 @@ public function getLiabilityAccountId() /** * Sets liability_account_id * - * @param int $liability_account_id + * @param int|null $liability_account_id * - * @return $this + * @return self */ public function setLiabilityAccountId($liability_account_id) { + if (is_null($liability_account_id)) { + throw new \InvalidArgumentException('non-nullable liability_account_id cannot be null'); + } $this->container['liability_account_id'] = $liability_account_id; return $this; @@ -255,7 +347,7 @@ public function setLiabilityAccountId($liability_account_id) /** * Gets split_by_location * - * @return bool + * @return bool|null */ public function getSplitByLocation() { @@ -265,12 +357,15 @@ public function getSplitByLocation() /** * Sets split_by_location * - * @param bool $split_by_location + * @param bool|null $split_by_location * - * @return $this + * @return self */ public function setSplitByLocation($split_by_location) { + if (is_null($split_by_location)) { + throw new \InvalidArgumentException('non-nullable split_by_location cannot be null'); + } $this->container['split_by_location'] = $split_by_location; return $this; @@ -279,7 +374,7 @@ public function setSplitByLocation($split_by_location) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -289,12 +384,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -303,7 +401,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -313,12 +411,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -327,7 +428,7 @@ public function setName($name) /** * Gets expense_account_id * - * @return int + * @return int|null */ public function getExpenseAccountId() { @@ -337,12 +438,15 @@ public function getExpenseAccountId() /** * Sets expense_account_id * - * @param int $expense_account_id + * @param int|null $expense_account_id * - * @return $this + * @return self */ public function setExpenseAccountId($expense_account_id) { + if (is_null($expense_account_id)) { + throw new \InvalidArgumentException('non-nullable expense_account_id cannot be null'); + } $this->container['expense_account_id'] = $expense_account_id; return $this; @@ -354,7 +458,7 @@ public function setExpenseAccountId($expense_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChartOfAccountsLiabilityLocationCategoryModel.php b/src/lib/Model/ChartOfAccountsLiabilityLocationCategoryModel.php index 0eb84fa..876a79b 100644 --- a/src/lib/Model/ChartOfAccountsLiabilityLocationCategoryModel.php +++ b/src/lib/Model/ChartOfAccountsLiabilityLocationCategoryModel.php @@ -2,61 +2,61 @@ /** * ChartOfAccountsLiabilityLocationCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChartOfAccountsLiabilityLocationCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChartOfAccountsLiabilityLocationCategoryModel implements ModelInterface, ArrayAccess +class ChartOfAccountsLiabilityLocationCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChartOfAccountsLiabilityLocationCategoryModel'; + protected static $openAPIModelName = 'ChartOfAccountsLiabilityLocationCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'liability_account_id' => 'int', 'id' => 'int', 'name' => 'string', @@ -67,22 +67,43 @@ class ChartOfAccountsLiabilityLocationCategoryModel implements ModelInterface, A * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'liability_account_id' => 'int32', 'id' => 'int32', 'name' => null, 'expense_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'liability_account_id' => false, + 'id' => false, + 'name' => false, + 'expense_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['liability_account_id'] = isset($data['liability_account_id']) ? $data['liability_account_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_account_id'] = isset($data['expense_account_id']) ? $data['expense_account_id'] : null; + $this->setIfExists('liability_account_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_account_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets liability_account_id * - * @return int + * @return int|null */ public function getLiabilityAccountId() { @@ -235,12 +323,15 @@ public function getLiabilityAccountId() /** * Sets liability_account_id * - * @param int $liability_account_id + * @param int|null $liability_account_id * - * @return $this + * @return self */ public function setLiabilityAccountId($liability_account_id) { + if (is_null($liability_account_id)) { + throw new \InvalidArgumentException('non-nullable liability_account_id cannot be null'); + } $this->container['liability_account_id'] = $liability_account_id; return $this; @@ -249,7 +340,7 @@ public function setLiabilityAccountId($liability_account_id) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -259,12 +350,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -273,7 +367,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -283,12 +377,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setName($name) /** * Gets expense_account_id * - * @return int + * @return int|null */ public function getExpenseAccountId() { @@ -307,12 +404,15 @@ public function getExpenseAccountId() /** * Sets expense_account_id * - * @param int $expense_account_id + * @param int|null $expense_account_id * - * @return $this + * @return self */ public function setExpenseAccountId($expense_account_id) { + if (is_null($expense_account_id)) { + throw new \InvalidArgumentException('non-nullable expense_account_id cannot be null'); + } $this->container['expense_account_id'] = $expense_account_id; return $this; @@ -324,7 +424,7 @@ public function setExpenseAccountId($expense_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChartOfAccountsLocationCategoryModel.php b/src/lib/Model/ChartOfAccountsLocationCategoryModel.php index c3d111e..11cc65d 100644 --- a/src/lib/Model/ChartOfAccountsLocationCategoryModel.php +++ b/src/lib/Model/ChartOfAccountsLocationCategoryModel.php @@ -2,61 +2,61 @@ /** * ChartOfAccountsLocationCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChartOfAccountsLocationCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChartOfAccountsLocationCategoryModel implements ModelInterface, ArrayAccess +class ChartOfAccountsLocationCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChartOfAccountsLocationCategoryModel'; + protected static $openAPIModelName = 'ChartOfAccountsLocationCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'expense_account_id' => 'int' @@ -66,21 +66,41 @@ class ChartOfAccountsLocationCategoryModel implements ModelInterface, ArrayAcces * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'expense_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'expense_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_account_id'] = isset($data['expense_account_id']) ? $data['expense_account_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_account_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets expense_account_id * - * @return int + * @return int|null */ public function getExpenseAccountId() { @@ -277,12 +370,15 @@ public function getExpenseAccountId() /** * Sets expense_account_id * - * @param int $expense_account_id + * @param int|null $expense_account_id * - * @return $this + * @return self */ public function setExpenseAccountId($expense_account_id) { + if (is_null($expense_account_id)) { + throw new \InvalidArgumentException('non-nullable expense_account_id cannot be null'); + } $this->container['expense_account_id'] = $expense_account_id; return $this; @@ -294,7 +390,7 @@ public function setExpenseAccountId($expense_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ChartOfAccountsLocationLeaveCategoryModel.php b/src/lib/Model/ChartOfAccountsLocationLeaveCategoryModel.php index 25b7c91..7010913 100644 --- a/src/lib/Model/ChartOfAccountsLocationLeaveCategoryModel.php +++ b/src/lib/Model/ChartOfAccountsLocationLeaveCategoryModel.php @@ -2,61 +2,61 @@ /** * ChartOfAccountsLocationLeaveCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ChartOfAccountsLocationLeaveCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ChartOfAccountsLocationLeaveCategoryModel implements ModelInterface, ArrayAccess +class ChartOfAccountsLocationLeaveCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ChartOfAccountsLocationLeaveCategoryModel'; + protected static $openAPIModelName = 'ChartOfAccountsLocationLeaveCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'liability_account_id' => 'int', 'accrue_from_contingent_period' => 'bool', 'id' => 'int', @@ -68,8 +68,10 @@ class ChartOfAccountsLocationLeaveCategoryModel implements ModelInterface, Array * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'liability_account_id' => 'int32', 'accrue_from_contingent_period' => null, 'id' => 'int32', @@ -77,14 +79,34 @@ class ChartOfAccountsLocationLeaveCategoryModel implements ModelInterface, Array 'expense_account_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'liability_account_id' => false, + 'accrue_from_contingent_period' => false, + 'id' => false, + 'name' => false, + 'expense_account_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['liability_account_id'] = isset($data['liability_account_id']) ? $data['liability_account_id'] : null; - $this->container['accrue_from_contingent_period'] = isset($data['accrue_from_contingent_period']) ? $data['accrue_from_contingent_period'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_account_id'] = isset($data['expense_account_id']) ? $data['expense_account_id'] : null; + $this->setIfExists('liability_account_id', $data ?? [], null); + $this->setIfExists('accrue_from_contingent_period', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_account_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets liability_account_id * - * @return int + * @return int|null */ public function getLiabilityAccountId() { @@ -241,12 +330,15 @@ public function getLiabilityAccountId() /** * Sets liability_account_id * - * @param int $liability_account_id + * @param int|null $liability_account_id * - * @return $this + * @return self */ public function setLiabilityAccountId($liability_account_id) { + if (is_null($liability_account_id)) { + throw new \InvalidArgumentException('non-nullable liability_account_id cannot be null'); + } $this->container['liability_account_id'] = $liability_account_id; return $this; @@ -255,7 +347,7 @@ public function setLiabilityAccountId($liability_account_id) /** * Gets accrue_from_contingent_period * - * @return bool + * @return bool|null */ public function getAccrueFromContingentPeriod() { @@ -265,12 +357,15 @@ public function getAccrueFromContingentPeriod() /** * Sets accrue_from_contingent_period * - * @param bool $accrue_from_contingent_period + * @param bool|null $accrue_from_contingent_period * - * @return $this + * @return self */ public function setAccrueFromContingentPeriod($accrue_from_contingent_period) { + if (is_null($accrue_from_contingent_period)) { + throw new \InvalidArgumentException('non-nullable accrue_from_contingent_period cannot be null'); + } $this->container['accrue_from_contingent_period'] = $accrue_from_contingent_period; return $this; @@ -279,7 +374,7 @@ public function setAccrueFromContingentPeriod($accrue_from_contingent_period) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -289,12 +384,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -303,7 +401,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -313,12 +411,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -327,7 +428,7 @@ public function setName($name) /** * Gets expense_account_id * - * @return int + * @return int|null */ public function getExpenseAccountId() { @@ -337,12 +438,15 @@ public function getExpenseAccountId() /** * Sets expense_account_id * - * @param int $expense_account_id + * @param int|null $expense_account_id * - * @return $this + * @return self */ public function setExpenseAccountId($expense_account_id) { + if (is_null($expense_account_id)) { + throw new \InvalidArgumentException('non-nullable expense_account_id cannot be null'); + } $this->container['expense_account_id'] = $expense_account_id; return $this; @@ -354,7 +458,7 @@ public function setExpenseAccountId($expense_account_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/CheckKioskEmployeeIdModel.php b/src/lib/Model/CheckKioskEmployeeIdModel.php index 032f0a9..bd65f5a 100644 --- a/src/lib/Model/CheckKioskEmployeeIdModel.php +++ b/src/lib/Model/CheckKioskEmployeeIdModel.php @@ -2,61 +2,61 @@ /** * CheckKioskEmployeeIdModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * CheckKioskEmployeeIdModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class CheckKioskEmployeeIdModel implements ModelInterface, ArrayAccess +class CheckKioskEmployeeIdModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CheckKioskEmployeeIdModel'; + protected static $openAPIModelName = 'CheckKioskEmployeeIdModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int' ]; @@ -64,19 +64,37 @@ class CheckKioskEmployeeIdModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; + $this->setIfExists('employee_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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -217,12 +302,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -234,7 +322,7 @@ public function setEmployeeId($employee_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/CheckKioskPinModel.php b/src/lib/Model/CheckKioskPinModel.php index 8dd1a18..52cbf23 100644 --- a/src/lib/Model/CheckKioskPinModel.php +++ b/src/lib/Model/CheckKioskPinModel.php @@ -2,61 +2,61 @@ /** * CheckKioskPinModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * CheckKioskPinModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class CheckKioskPinModel implements ModelInterface, ArrayAccess +class CheckKioskPinModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CheckKioskPinModel'; + protected static $openAPIModelName = 'CheckKioskPinModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'pin' => 'string' ]; @@ -65,20 +65,39 @@ class CheckKioskPinModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'pin' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'pin' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['pin'] = isset($data['pin']) ? $data['pin'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('pin', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -223,12 +309,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -237,7 +326,7 @@ public function setEmployeeId($employee_id) /** * Gets pin * - * @return string + * @return string|null */ public function getPin() { @@ -247,12 +336,15 @@ public function getPin() /** * Sets pin * - * @param string $pin + * @param string|null $pin * - * @return $this + * @return self */ public function setPin($pin) { + if (is_null($pin)) { + throw new \InvalidArgumentException('non-nullable pin cannot be null'); + } $this->container['pin'] = $pin; return $this; @@ -264,7 +356,7 @@ public function setPin($pin) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ClassificationLookupModel.php b/src/lib/Model/ClassificationLookupModel.php index 6b9a565..d51d4c0 100644 --- a/src/lib/Model/ClassificationLookupModel.php +++ b/src/lib/Model/ClassificationLookupModel.php @@ -2,62 +2,62 @@ /** * ClassificationLookupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ClassificationLookupModel Class Doc Comment * * @category Class * @description temporary class until ClassificationSelectModel uses the same base class as the other two - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ClassificationLookupModel implements ModelInterface, ArrayAccess +class ClassificationLookupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ClassificationLookupModel'; + protected static $openAPIModelName = 'ClassificationLookupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'description' => 'string' ]; @@ -66,20 +66,39 @@ class ClassificationLookupModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -87,9 +106,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -161,12 +232,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -183,8 +251,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('id', $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; } /** @@ -214,7 +300,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -224,12 +310,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -238,7 +327,7 @@ public function setId($id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -248,12 +337,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -265,7 +357,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -275,22 +367,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -306,11 +399,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -318,13 +424,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ClassificationSelectModel.php b/src/lib/Model/ClassificationSelectModel.php index 4bddc6a..395e173 100644 --- a/src/lib/Model/ClassificationSelectModel.php +++ b/src/lib/Model/ClassificationSelectModel.php @@ -2,61 +2,61 @@ /** * ClassificationSelectModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ClassificationSelectModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ClassificationSelectModel implements ModelInterface, ArrayAccess +class ClassificationSelectModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ClassificationSelectModel'; + protected static $openAPIModelName = 'ClassificationSelectModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', 'id' => 'int' ]; @@ -65,20 +65,39 @@ class ClassificationSelectModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->setIfExists('name', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -223,12 +309,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setName($name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -247,12 +336,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setId($id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ClockOffModel.php b/src/lib/Model/ClockOffModel.php index b805899..cd66f5e 100644 --- a/src/lib/Model/ClockOffModel.php +++ b/src/lib/Model/ClockOffModel.php @@ -2,66 +2,66 @@ /** * ClockOffModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ClockOffModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ClockOffModel implements ModelInterface, ArrayAccess +class ClockOffModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ClockOffModel'; + protected static $openAPIModelName = 'ClockOffModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'note' => 'string', 'is_paid_break' => 'bool', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -75,8 +75,10 @@ class ClockOffModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'note' => null, 'is_paid_break' => null, 'employee_id' => 'int32', @@ -91,14 +93,41 @@ class ClockOffModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'note' => false, + 'is_paid_break' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -210,14 +291,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -230,7 +309,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -247,18 +325,36 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('is_paid_break', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -277,7 +373,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -300,7 +397,7 @@ public function valid() /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -310,12 +407,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -324,7 +424,7 @@ public function setNote($note) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -334,12 +434,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -348,7 +451,7 @@ public function setIsPaidBreak($is_paid_break) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -358,12 +461,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -372,7 +478,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -382,12 +488,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -396,7 +505,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -406,12 +515,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -420,7 +532,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -430,12 +542,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -444,7 +559,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -454,12 +569,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -468,7 +586,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -478,15 +596,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling ClockOffModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling ClockOffModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -497,7 +618,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -507,12 +628,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -521,7 +645,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -531,12 +655,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -545,7 +672,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -555,12 +682,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -569,7 +699,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -579,17 +709,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -605,7 +739,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -615,22 +749,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -646,11 +781,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -658,13 +806,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ClockOnModel.php b/src/lib/Model/ClockOnModel.php index 3f5aa42..42bbdc6 100644 --- a/src/lib/Model/ClockOnModel.php +++ b/src/lib/Model/ClockOnModel.php @@ -2,69 +2,69 @@ /** * ClockOnModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ClockOnModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ClockOnModel implements ModelInterface, ArrayAccess +class ClockOnModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ClockOnModel'; + protected static $openAPIModelName = 'ClockOnModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'classification_id' => 'int', 'work_type_id' => 'int', 'shift_condition_ids' => 'int[]', 'note' => 'string', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -78,8 +78,10 @@ class ClockOnModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'classification_id' => 'int32', 'work_type_id' => 'int32', @@ -97,14 +99,44 @@ class ClockOnModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'classification_id' => false, + 'work_type_id' => false, + 'shift_condition_ids' => false, + 'note' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -225,14 +309,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -245,7 +327,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -262,21 +343,39 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -295,7 +394,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -318,7 +418,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -328,12 +428,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -342,7 +445,7 @@ public function setLocationId($location_id) /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -352,12 +455,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -366,7 +472,7 @@ public function setClassificationId($classification_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -376,12 +482,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -390,7 +499,7 @@ public function setWorkTypeId($work_type_id) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -400,12 +509,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -414,7 +526,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -424,12 +536,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -438,7 +553,7 @@ public function setNote($note) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -448,12 +563,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -462,7 +580,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -472,12 +590,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -486,7 +607,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -496,12 +617,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -510,7 +634,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -520,12 +644,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -534,7 +661,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -544,12 +671,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -558,7 +688,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -568,15 +698,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling ClockOnModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling ClockOnModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -587,7 +720,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -597,12 +730,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -611,7 +747,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -621,12 +757,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -635,7 +774,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -645,12 +784,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -659,7 +801,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -669,17 +811,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -695,7 +841,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -705,22 +851,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -736,11 +883,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -748,13 +908,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/CostingReportRequestModel.php b/src/lib/Model/CostingReportRequestModel.php index 8544ba1..3937ee2 100644 --- a/src/lib/Model/CostingReportRequestModel.php +++ b/src/lib/Model/CostingReportRequestModel.php @@ -2,61 +2,61 @@ /** * CostingReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * CostingReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class CostingReportRequestModel implements ModelInterface, ArrayAccess +class CostingReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CostingReportRequestModel'; + protected static $openAPIModelName = 'CostingReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'show_zero_pay_categories' => 'bool', 'pay_schedule_id' => 'int', 'include_post_tax_deductions' => 'bool', @@ -70,8 +70,10 @@ class CostingReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'show_zero_pay_categories' => null, 'pay_schedule_id' => 'int32', 'include_post_tax_deductions' => null, @@ -81,14 +83,36 @@ class CostingReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'show_zero_pay_categories' => false, + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['show_zero_pay_categories'] = isset($data['show_zero_pay_categories']) ? $data['show_zero_pay_categories'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('show_zero_pay_categories', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets show_zero_pay_categories * - * @return bool + * @return bool|null */ public function getShowZeroPayCategories() { @@ -253,12 +344,15 @@ public function getShowZeroPayCategories() /** * Sets show_zero_pay_categories * - * @param bool $show_zero_pay_categories + * @param bool|null $show_zero_pay_categories * - * @return $this + * @return self */ public function setShowZeroPayCategories($show_zero_pay_categories) { + if (is_null($show_zero_pay_categories)) { + throw new \InvalidArgumentException('non-nullable show_zero_pay_categories cannot be null'); + } $this->container['show_zero_pay_categories'] = $show_zero_pay_categories; return $this; @@ -267,7 +361,7 @@ public function setShowZeroPayCategories($show_zero_pay_categories) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -277,12 +371,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -291,7 +388,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -301,12 +398,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -315,7 +415,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -325,12 +425,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -339,7 +442,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -349,12 +452,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -363,7 +469,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -373,12 +479,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -387,7 +496,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -397,12 +506,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -414,7 +526,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/CreateBusinessAccessModel.php b/src/lib/Model/CreateBusinessAccessModel.php index 5090dc5..67af38e 100644 --- a/src/lib/Model/CreateBusinessAccessModel.php +++ b/src/lib/Model/CreateBusinessAccessModel.php @@ -2,68 +2,68 @@ /** * CreateBusinessAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * CreateBusinessAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class CreateBusinessAccessModel implements ModelInterface, ArrayAccess +class CreateBusinessAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CreateBusinessAccessModel'; + protected static $openAPIModelName = 'CreateBusinessAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'suppress_notification_emails' => 'bool', 'merge_existing_access' => 'bool', 'access_type' => 'string', - 'employee_groups' => '\Swagger\Client\Model\EmployeeGroupAccessModel[]', - 'location_access' => '\Swagger\Client\Model\LocationAccessModel[]', - 'reports' => '\Swagger\Client\Model\ReportAccessModel', - 'kiosk_access' => '\Swagger\Client\Model\KioskAccessModel', + 'employee_groups' => '\OpenAPI\Client\Model\EmployeeGroupAccessModel[]', + 'location_access' => '\OpenAPI\Client\Model\LocationAccessModel[]', + 'reports' => '\OpenAPI\Client\Model\ReportAccessModel', + 'kiosk_access' => '\OpenAPI\Client\Model\KioskAccessModel', 'name' => 'string', 'email' => 'string' ]; @@ -72,8 +72,10 @@ class CreateBusinessAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'suppress_notification_emails' => null, 'merge_existing_access' => null, 'access_type' => null, @@ -85,14 +87,38 @@ class CreateBusinessAccessModel implements ModelInterface, ArrayAccess 'email' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'suppress_notification_emails' => false, + 'merge_existing_access' => false, + 'access_type' => false, + 'employee_groups' => false, + 'location_access' => false, + 'reports' => false, + 'kiosk_access' => false, + 'name' => false, + 'email' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -195,14 +273,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCESS_TYPE_UNRESTRICTED = 'Unrestricted'; - const ACCESS_TYPE_RESTRICTED = 'Restricted'; - + public const ACCESS_TYPE_UNRESTRICTED = 'Unrestricted'; + public const ACCESS_TYPE_RESTRICTED = 'Restricted'; - /** * Gets allowable values of the enum * @@ -215,7 +291,6 @@ public function getAccessTypeAllowableValues() self::ACCESS_TYPE_RESTRICTED, ]; } - /** * Associative array for storing property values @@ -232,15 +307,33 @@ public function getAccessTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['suppress_notification_emails'] = isset($data['suppress_notification_emails']) ? $data['suppress_notification_emails'] : null; - $this->container['merge_existing_access'] = isset($data['merge_existing_access']) ? $data['merge_existing_access'] : null; - $this->container['access_type'] = isset($data['access_type']) ? $data['access_type'] : null; - $this->container['employee_groups'] = isset($data['employee_groups']) ? $data['employee_groups'] : null; - $this->container['location_access'] = isset($data['location_access']) ? $data['location_access'] : null; - $this->container['reports'] = isset($data['reports']) ? $data['reports'] : null; - $this->container['kiosk_access'] = isset($data['kiosk_access']) ? $data['kiosk_access'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('suppress_notification_emails', $data ?? [], null); + $this->setIfExists('merge_existing_access', $data ?? [], null); + $this->setIfExists('access_type', $data ?? [], null); + $this->setIfExists('employee_groups', $data ?? [], null); + $this->setIfExists('location_access', $data ?? [], null); + $this->setIfExists('reports', $data ?? [], null); + $this->setIfExists('kiosk_access', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $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; } /** @@ -255,7 +348,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccessTypeAllowableValues(); if (!is_null($this->container['access_type']) && !in_array($this->container['access_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'access_type', must be one of '%s'", + "invalid value '%s' for 'access_type', must be one of '%s'", + $this->container['access_type'], implode("', '", $allowedValues) ); } @@ -278,7 +372,7 @@ public function valid() /** * Gets suppress_notification_emails * - * @return bool + * @return bool|null */ public function getSuppressNotificationEmails() { @@ -288,12 +382,15 @@ public function getSuppressNotificationEmails() /** * Sets suppress_notification_emails * - * @param bool $suppress_notification_emails + * @param bool|null $suppress_notification_emails * - * @return $this + * @return self */ public function setSuppressNotificationEmails($suppress_notification_emails) { + if (is_null($suppress_notification_emails)) { + throw new \InvalidArgumentException('non-nullable suppress_notification_emails cannot be null'); + } $this->container['suppress_notification_emails'] = $suppress_notification_emails; return $this; @@ -302,7 +399,7 @@ public function setSuppressNotificationEmails($suppress_notification_emails) /** * Gets merge_existing_access * - * @return bool + * @return bool|null */ public function getMergeExistingAccess() { @@ -312,12 +409,15 @@ public function getMergeExistingAccess() /** * Sets merge_existing_access * - * @param bool $merge_existing_access + * @param bool|null $merge_existing_access * - * @return $this + * @return self */ public function setMergeExistingAccess($merge_existing_access) { + if (is_null($merge_existing_access)) { + throw new \InvalidArgumentException('non-nullable merge_existing_access cannot be null'); + } $this->container['merge_existing_access'] = $merge_existing_access; return $this; @@ -326,7 +426,7 @@ public function setMergeExistingAccess($merge_existing_access) /** * Gets access_type * - * @return string + * @return string|null */ public function getAccessType() { @@ -336,17 +436,21 @@ public function getAccessType() /** * Sets access_type * - * @param string $access_type + * @param string|null $access_type * - * @return $this + * @return self */ public function setAccessType($access_type) { + if (is_null($access_type)) { + throw new \InvalidArgumentException('non-nullable access_type cannot be null'); + } $allowedValues = $this->getAccessTypeAllowableValues(); - if (!is_null($access_type) && !in_array($access_type, $allowedValues, true)) { + if (!in_array($access_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'access_type', must be one of '%s'", + "Invalid value '%s' for 'access_type', must be one of '%s'", + $access_type, implode("', '", $allowedValues) ) ); @@ -359,7 +463,7 @@ public function setAccessType($access_type) /** * Gets employee_groups * - * @return \Swagger\Client\Model\EmployeeGroupAccessModel[] + * @return \OpenAPI\Client\Model\EmployeeGroupAccessModel[]|null */ public function getEmployeeGroups() { @@ -369,12 +473,15 @@ public function getEmployeeGroups() /** * Sets employee_groups * - * @param \Swagger\Client\Model\EmployeeGroupAccessModel[] $employee_groups + * @param \OpenAPI\Client\Model\EmployeeGroupAccessModel[]|null $employee_groups * - * @return $this + * @return self */ public function setEmployeeGroups($employee_groups) { + if (is_null($employee_groups)) { + throw new \InvalidArgumentException('non-nullable employee_groups cannot be null'); + } $this->container['employee_groups'] = $employee_groups; return $this; @@ -383,7 +490,7 @@ public function setEmployeeGroups($employee_groups) /** * Gets location_access * - * @return \Swagger\Client\Model\LocationAccessModel[] + * @return \OpenAPI\Client\Model\LocationAccessModel[]|null */ public function getLocationAccess() { @@ -393,12 +500,15 @@ public function getLocationAccess() /** * Sets location_access * - * @param \Swagger\Client\Model\LocationAccessModel[] $location_access + * @param \OpenAPI\Client\Model\LocationAccessModel[]|null $location_access * - * @return $this + * @return self */ public function setLocationAccess($location_access) { + if (is_null($location_access)) { + throw new \InvalidArgumentException('non-nullable location_access cannot be null'); + } $this->container['location_access'] = $location_access; return $this; @@ -407,7 +517,7 @@ public function setLocationAccess($location_access) /** * Gets reports * - * @return \Swagger\Client\Model\ReportAccessModel + * @return \OpenAPI\Client\Model\ReportAccessModel|null */ public function getReports() { @@ -417,12 +527,15 @@ public function getReports() /** * Sets reports * - * @param \Swagger\Client\Model\ReportAccessModel $reports + * @param \OpenAPI\Client\Model\ReportAccessModel|null $reports reports * - * @return $this + * @return self */ public function setReports($reports) { + if (is_null($reports)) { + throw new \InvalidArgumentException('non-nullable reports cannot be null'); + } $this->container['reports'] = $reports; return $this; @@ -431,7 +544,7 @@ public function setReports($reports) /** * Gets kiosk_access * - * @return \Swagger\Client\Model\KioskAccessModel + * @return \OpenAPI\Client\Model\KioskAccessModel|null */ public function getKioskAccess() { @@ -441,12 +554,15 @@ public function getKioskAccess() /** * Sets kiosk_access * - * @param \Swagger\Client\Model\KioskAccessModel $kiosk_access + * @param \OpenAPI\Client\Model\KioskAccessModel|null $kiosk_access kiosk_access * - * @return $this + * @return self */ public function setKioskAccess($kiosk_access) { + if (is_null($kiosk_access)) { + throw new \InvalidArgumentException('non-nullable kiosk_access cannot be null'); + } $this->container['kiosk_access'] = $kiosk_access; return $this; @@ -455,7 +571,7 @@ public function setKioskAccess($kiosk_access) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -465,12 +581,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -479,7 +598,7 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -489,12 +608,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -506,7 +628,7 @@ public function setEmail($email) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -516,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -547,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -559,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/CreateEmployeeAccessModel.php b/src/lib/Model/CreateEmployeeAccessModel.php index dccb2fb..11fda01 100644 --- a/src/lib/Model/CreateEmployeeAccessModel.php +++ b/src/lib/Model/CreateEmployeeAccessModel.php @@ -2,61 +2,61 @@ /** * CreateEmployeeAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * CreateEmployeeAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class CreateEmployeeAccessModel implements ModelInterface, ArrayAccess +class CreateEmployeeAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CreateEmployeeAccessModel'; + protected static $openAPIModelName = 'CreateEmployeeAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'suppress_notification_emails' => 'bool', 'name' => 'string', 'email' => 'string' @@ -66,21 +66,41 @@ class CreateEmployeeAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'suppress_notification_emails' => null, 'name' => null, 'email' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'suppress_notification_emails' => false, + 'name' => false, + 'email' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['suppress_notification_emails'] = isset($data['suppress_notification_emails']) ? $data['suppress_notification_emails'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('suppress_notification_emails', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets suppress_notification_emails * - * @return bool + * @return bool|null */ public function getSuppressNotificationEmails() { @@ -229,12 +316,15 @@ public function getSuppressNotificationEmails() /** * Sets suppress_notification_emails * - * @param bool $suppress_notification_emails + * @param bool|null $suppress_notification_emails * - * @return $this + * @return self */ public function setSuppressNotificationEmails($suppress_notification_emails) { + if (is_null($suppress_notification_emails)) { + throw new \InvalidArgumentException('non-nullable suppress_notification_emails cannot be null'); + } $this->container['suppress_notification_emails'] = $suppress_notification_emails; return $this; @@ -243,7 +333,7 @@ public function setSuppressNotificationEmails($suppress_notification_emails) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -277,12 +370,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -294,7 +390,7 @@ public function setEmail($email) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/CreateEmployeeNoteModel.php b/src/lib/Model/CreateEmployeeNoteModel.php index 0577b21..75ff056 100644 --- a/src/lib/Model/CreateEmployeeNoteModel.php +++ b/src/lib/Model/CreateEmployeeNoteModel.php @@ -2,61 +2,61 @@ /** * CreateEmployeeNoteModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * CreateEmployeeNoteModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class CreateEmployeeNoteModel implements ModelInterface, ArrayAccess +class CreateEmployeeNoteModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'CreateEmployeeNoteModel'; + protected static $openAPIModelName = 'CreateEmployeeNoteModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'note' => 'string' ]; @@ -64,19 +64,37 @@ class CreateEmployeeNoteModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'note' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'note' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['note'] = isset($data['note']) ? $data['note'] : null; + $this->setIfExists('note', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -217,12 +302,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -234,7 +322,7 @@ public function setNote($note) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeclineLeaveRequest.php b/src/lib/Model/DeclineLeaveRequest.php index 46532a2..e6692ce 100644 --- a/src/lib/Model/DeclineLeaveRequest.php +++ b/src/lib/Model/DeclineLeaveRequest.php @@ -2,61 +2,61 @@ /** * DeclineLeaveRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeclineLeaveRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeclineLeaveRequest implements ModelInterface, ArrayAccess +class DeclineLeaveRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeclineLeaveRequest'; + protected static $openAPIModelName = 'DeclineLeaveRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'reason' => 'string' ]; @@ -64,19 +64,37 @@ class DeclineLeaveRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'reason' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; + $this->setIfExists('reason', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -217,12 +302,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -234,7 +322,7 @@ public function setReason($reason) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeclineReason.php b/src/lib/Model/DeclineReason.php index ef7e7b2..efa87d3 100644 --- a/src/lib/Model/DeclineReason.php +++ b/src/lib/Model/DeclineReason.php @@ -2,61 +2,61 @@ /** * DeclineReason * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeclineReason Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeclineReason implements ModelInterface, ArrayAccess +class DeclineReason implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeclineReason'; + protected static $openAPIModelName = 'DeclineReason'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'reason' => 'string' ]; @@ -64,19 +64,37 @@ class DeclineReason implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'reason' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; + $this->setIfExists('reason', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -217,12 +302,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -234,7 +322,7 @@ public function setReason($reason) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeductionModel.php b/src/lib/Model/DeductionModel.php index 608b366..11a9619 100644 --- a/src/lib/Model/DeductionModel.php +++ b/src/lib/Model/DeductionModel.php @@ -2,64 +2,64 @@ /** * DeductionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeductionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeductionModel implements ModelInterface, ArrayAccess +class DeductionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeductionModel'; + protected static $openAPIModelName = 'DeductionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'deduction_category_id' => 'string', 'deduction_category_name' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'notes' => 'string', 'payment_reference' => 'string', 'note' => 'string', @@ -85,8 +85,10 @@ class DeductionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deduction_category_id' => null, 'deduction_category_name' => null, 'amount' => 'double', @@ -111,14 +113,51 @@ class DeductionModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deduction_category_id' => false, + 'deduction_category_name' => false, + 'amount' => false, + 'notes' => false, + 'payment_reference' => false, + 'note' => false, + 'associated_employee_deduction_category_id' => false, + 'pay_to_bank_account_bsb' => false, + 'pay_to_bank_account_swift' => false, + 'pay_to_bank_account_bank_code' => false, + 'pay_to_bank_account_number' => false, + 'pay_to_super_fund_name' => false, + 'pay_to_super_fund_member_number' => false, + 'pay_to' => false, + 'additional_data' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -126,9 +165,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -260,12 +351,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -282,28 +370,46 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['deduction_category_id'] = isset($data['deduction_category_id']) ? $data['deduction_category_id'] : null; - $this->container['deduction_category_name'] = isset($data['deduction_category_name']) ? $data['deduction_category_name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['payment_reference'] = isset($data['payment_reference']) ? $data['payment_reference'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['associated_employee_deduction_category_id'] = isset($data['associated_employee_deduction_category_id']) ? $data['associated_employee_deduction_category_id'] : null; - $this->container['pay_to_bank_account_bsb'] = isset($data['pay_to_bank_account_bsb']) ? $data['pay_to_bank_account_bsb'] : null; - $this->container['pay_to_bank_account_swift'] = isset($data['pay_to_bank_account_swift']) ? $data['pay_to_bank_account_swift'] : null; - $this->container['pay_to_bank_account_bank_code'] = isset($data['pay_to_bank_account_bank_code']) ? $data['pay_to_bank_account_bank_code'] : null; - $this->container['pay_to_bank_account_number'] = isset($data['pay_to_bank_account_number']) ? $data['pay_to_bank_account_number'] : null; - $this->container['pay_to_super_fund_name'] = isset($data['pay_to_super_fund_name']) ? $data['pay_to_super_fund_name'] : null; - $this->container['pay_to_super_fund_member_number'] = isset($data['pay_to_super_fund_member_number']) ? $data['pay_to_super_fund_member_number'] : null; - $this->container['pay_to'] = isset($data['pay_to']) ? $data['pay_to'] : null; - $this->container['additional_data'] = isset($data['additional_data']) ? $data['additional_data'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('deduction_category_id', $data ?? [], null); + $this->setIfExists('deduction_category_name', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('payment_reference', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('associated_employee_deduction_category_id', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_bsb', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_swift', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_bank_code', $data ?? [], null); + $this->setIfExists('pay_to_bank_account_number', $data ?? [], null); + $this->setIfExists('pay_to_super_fund_name', $data ?? [], null); + $this->setIfExists('pay_to_super_fund_member_number', $data ?? [], null); + $this->setIfExists('pay_to', $data ?? [], null); + $this->setIfExists('additional_data', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -333,7 +439,7 @@ public function valid() /** * Gets deduction_category_id * - * @return string + * @return string|null */ public function getDeductionCategoryId() { @@ -343,12 +449,15 @@ public function getDeductionCategoryId() /** * Sets deduction_category_id * - * @param string $deduction_category_id + * @param string|null $deduction_category_id * - * @return $this + * @return self */ public function setDeductionCategoryId($deduction_category_id) { + if (is_null($deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id cannot be null'); + } $this->container['deduction_category_id'] = $deduction_category_id; return $this; @@ -357,7 +466,7 @@ public function setDeductionCategoryId($deduction_category_id) /** * Gets deduction_category_name * - * @return string + * @return string|null */ public function getDeductionCategoryName() { @@ -367,12 +476,15 @@ public function getDeductionCategoryName() /** * Sets deduction_category_name * - * @param string $deduction_category_name + * @param string|null $deduction_category_name * - * @return $this + * @return self */ public function setDeductionCategoryName($deduction_category_name) { + if (is_null($deduction_category_name)) { + throw new \InvalidArgumentException('non-nullable deduction_category_name cannot be null'); + } $this->container['deduction_category_name'] = $deduction_category_name; return $this; @@ -381,7 +493,7 @@ public function setDeductionCategoryName($deduction_category_name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -391,12 +503,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -405,7 +520,7 @@ public function setAmount($amount) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -415,12 +530,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -429,7 +547,7 @@ public function setNotes($notes) /** * Gets payment_reference * - * @return string + * @return string|null */ public function getPaymentReference() { @@ -439,12 +557,15 @@ public function getPaymentReference() /** * Sets payment_reference * - * @param string $payment_reference + * @param string|null $payment_reference * - * @return $this + * @return self */ public function setPaymentReference($payment_reference) { + if (is_null($payment_reference)) { + throw new \InvalidArgumentException('non-nullable payment_reference cannot be null'); + } $this->container['payment_reference'] = $payment_reference; return $this; @@ -453,7 +574,7 @@ public function setPaymentReference($payment_reference) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -463,12 +584,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -477,7 +601,7 @@ public function setNote($note) /** * Gets associated_employee_deduction_category_id * - * @return int + * @return int|null */ public function getAssociatedEmployeeDeductionCategoryId() { @@ -487,12 +611,15 @@ public function getAssociatedEmployeeDeductionCategoryId() /** * Sets associated_employee_deduction_category_id * - * @param int $associated_employee_deduction_category_id + * @param int|null $associated_employee_deduction_category_id * - * @return $this + * @return self */ public function setAssociatedEmployeeDeductionCategoryId($associated_employee_deduction_category_id) { + if (is_null($associated_employee_deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable associated_employee_deduction_category_id cannot be null'); + } $this->container['associated_employee_deduction_category_id'] = $associated_employee_deduction_category_id; return $this; @@ -501,7 +628,7 @@ public function setAssociatedEmployeeDeductionCategoryId($associated_employee_de /** * Gets pay_to_bank_account_bsb * - * @return string + * @return string|null */ public function getPayToBankAccountBsb() { @@ -511,12 +638,15 @@ public function getPayToBankAccountBsb() /** * Sets pay_to_bank_account_bsb * - * @param string $pay_to_bank_account_bsb + * @param string|null $pay_to_bank_account_bsb * - * @return $this + * @return self */ public function setPayToBankAccountBsb($pay_to_bank_account_bsb) { + if (is_null($pay_to_bank_account_bsb)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_bsb cannot be null'); + } $this->container['pay_to_bank_account_bsb'] = $pay_to_bank_account_bsb; return $this; @@ -525,7 +655,7 @@ public function setPayToBankAccountBsb($pay_to_bank_account_bsb) /** * Gets pay_to_bank_account_swift * - * @return string + * @return string|null */ public function getPayToBankAccountSwift() { @@ -535,12 +665,15 @@ public function getPayToBankAccountSwift() /** * Sets pay_to_bank_account_swift * - * @param string $pay_to_bank_account_swift + * @param string|null $pay_to_bank_account_swift * - * @return $this + * @return self */ public function setPayToBankAccountSwift($pay_to_bank_account_swift) { + if (is_null($pay_to_bank_account_swift)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_swift cannot be null'); + } $this->container['pay_to_bank_account_swift'] = $pay_to_bank_account_swift; return $this; @@ -549,7 +682,7 @@ public function setPayToBankAccountSwift($pay_to_bank_account_swift) /** * Gets pay_to_bank_account_bank_code * - * @return string + * @return string|null */ public function getPayToBankAccountBankCode() { @@ -559,12 +692,15 @@ public function getPayToBankAccountBankCode() /** * Sets pay_to_bank_account_bank_code * - * @param string $pay_to_bank_account_bank_code + * @param string|null $pay_to_bank_account_bank_code * - * @return $this + * @return self */ public function setPayToBankAccountBankCode($pay_to_bank_account_bank_code) { + if (is_null($pay_to_bank_account_bank_code)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_bank_code cannot be null'); + } $this->container['pay_to_bank_account_bank_code'] = $pay_to_bank_account_bank_code; return $this; @@ -573,7 +709,7 @@ public function setPayToBankAccountBankCode($pay_to_bank_account_bank_code) /** * Gets pay_to_bank_account_number * - * @return string + * @return string|null */ public function getPayToBankAccountNumber() { @@ -583,12 +719,15 @@ public function getPayToBankAccountNumber() /** * Sets pay_to_bank_account_number * - * @param string $pay_to_bank_account_number + * @param string|null $pay_to_bank_account_number * - * @return $this + * @return self */ public function setPayToBankAccountNumber($pay_to_bank_account_number) { + if (is_null($pay_to_bank_account_number)) { + throw new \InvalidArgumentException('non-nullable pay_to_bank_account_number cannot be null'); + } $this->container['pay_to_bank_account_number'] = $pay_to_bank_account_number; return $this; @@ -597,7 +736,7 @@ public function setPayToBankAccountNumber($pay_to_bank_account_number) /** * Gets pay_to_super_fund_name * - * @return string + * @return string|null */ public function getPayToSuperFundName() { @@ -607,12 +746,15 @@ public function getPayToSuperFundName() /** * Sets pay_to_super_fund_name * - * @param string $pay_to_super_fund_name + * @param string|null $pay_to_super_fund_name * - * @return $this + * @return self */ public function setPayToSuperFundName($pay_to_super_fund_name) { + if (is_null($pay_to_super_fund_name)) { + throw new \InvalidArgumentException('non-nullable pay_to_super_fund_name cannot be null'); + } $this->container['pay_to_super_fund_name'] = $pay_to_super_fund_name; return $this; @@ -621,7 +763,7 @@ public function setPayToSuperFundName($pay_to_super_fund_name) /** * Gets pay_to_super_fund_member_number * - * @return string + * @return string|null */ public function getPayToSuperFundMemberNumber() { @@ -631,12 +773,15 @@ public function getPayToSuperFundMemberNumber() /** * Sets pay_to_super_fund_member_number * - * @param string $pay_to_super_fund_member_number + * @param string|null $pay_to_super_fund_member_number * - * @return $this + * @return self */ public function setPayToSuperFundMemberNumber($pay_to_super_fund_member_number) { + if (is_null($pay_to_super_fund_member_number)) { + throw new \InvalidArgumentException('non-nullable pay_to_super_fund_member_number cannot be null'); + } $this->container['pay_to_super_fund_member_number'] = $pay_to_super_fund_member_number; return $this; @@ -645,7 +790,7 @@ public function setPayToSuperFundMemberNumber($pay_to_super_fund_member_number) /** * Gets pay_to * - * @return string + * @return string|null */ public function getPayTo() { @@ -655,12 +800,15 @@ public function getPayTo() /** * Sets pay_to * - * @param string $pay_to + * @param string|null $pay_to * - * @return $this + * @return self */ public function setPayTo($pay_to) { + if (is_null($pay_to)) { + throw new \InvalidArgumentException('non-nullable pay_to cannot be null'); + } $this->container['pay_to'] = $pay_to; return $this; @@ -669,7 +817,7 @@ public function setPayTo($pay_to) /** * Gets additional_data * - * @return int + * @return int|null */ public function getAdditionalData() { @@ -679,12 +827,15 @@ public function getAdditionalData() /** * Sets additional_data * - * @param int $additional_data + * @param int|null $additional_data * - * @return $this + * @return self */ public function setAdditionalData($additional_data) { + if (is_null($additional_data)) { + throw new \InvalidArgumentException('non-nullable additional_data cannot be null'); + } $this->container['additional_data'] = $additional_data; return $this; @@ -693,7 +844,7 @@ public function setAdditionalData($additional_data) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -703,12 +854,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -717,7 +871,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -727,12 +881,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -741,7 +898,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -751,12 +908,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -765,7 +925,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -775,12 +935,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -789,7 +952,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -799,12 +962,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -813,7 +979,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -823,12 +989,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -837,7 +1006,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -847,12 +1016,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -864,7 +1036,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -874,22 +1046,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -905,11 +1078,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -917,13 +1103,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeductionsReportDeductionAmountModel.php b/src/lib/Model/DeductionsReportDeductionAmountModel.php index e6a9c00..d0ea4d1 100644 --- a/src/lib/Model/DeductionsReportDeductionAmountModel.php +++ b/src/lib/Model/DeductionsReportDeductionAmountModel.php @@ -2,85 +2,105 @@ /** * DeductionsReportDeductionAmountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeductionsReportDeductionAmountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeductionsReportDeductionAmountModel implements ModelInterface, ArrayAccess +class DeductionsReportDeductionAmountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeductionsReportDeductionAmountModel'; + protected static $openAPIModelName = 'DeductionsReportDeductionAmountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'deduction_category_id' => 'int', 'deduction_category_name' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deduction_category_id' => 'int32', 'deduction_category_name' => null, 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deduction_category_id' => false, + 'deduction_category_name' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['deduction_category_id'] = isset($data['deduction_category_id']) ? $data['deduction_category_id'] : null; - $this->container['deduction_category_name'] = isset($data['deduction_category_name']) ? $data['deduction_category_name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('deduction_category_id', $data ?? [], null); + $this->setIfExists('deduction_category_name', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets deduction_category_id * - * @return int + * @return int|null */ public function getDeductionCategoryId() { @@ -229,12 +316,15 @@ public function getDeductionCategoryId() /** * Sets deduction_category_id * - * @param int $deduction_category_id + * @param int|null $deduction_category_id * - * @return $this + * @return self */ public function setDeductionCategoryId($deduction_category_id) { + if (is_null($deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id cannot be null'); + } $this->container['deduction_category_id'] = $deduction_category_id; return $this; @@ -243,7 +333,7 @@ public function setDeductionCategoryId($deduction_category_id) /** * Gets deduction_category_name * - * @return string + * @return string|null */ public function getDeductionCategoryName() { @@ -253,12 +343,15 @@ public function getDeductionCategoryName() /** * Sets deduction_category_name * - * @param string $deduction_category_name + * @param string|null $deduction_category_name * - * @return $this + * @return self */ public function setDeductionCategoryName($deduction_category_name) { + if (is_null($deduction_category_name)) { + throw new \InvalidArgumentException('non-nullable deduction_category_name cannot be null'); + } $this->container['deduction_category_name'] = $deduction_category_name; return $this; @@ -267,7 +360,7 @@ public function setDeductionCategoryName($deduction_category_name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -277,12 +370,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -294,7 +390,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeductionsReportExportModel.php b/src/lib/Model/DeductionsReportExportModel.php index e8b3a8d..ce4667a 100644 --- a/src/lib/Model/DeductionsReportExportModel.php +++ b/src/lib/Model/DeductionsReportExportModel.php @@ -2,61 +2,61 @@ /** * DeductionsReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeductionsReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeductionsReportExportModel implements ModelInterface, ArrayAccess +class DeductionsReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeductionsReportExportModel'; + protected static $openAPIModelName = 'DeductionsReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run' => 'string', 'date_paid' => '\DateTime', 'employee_id' => 'int', @@ -64,7 +64,7 @@ class DeductionsReportExportModel implements ModelInterface, ArrayAccess 'surname' => 'string', 'external_id' => 'string', 'location' => 'string', - 'amounts' => '\Swagger\Client\Model\DeductionsReportDeductionAmountModel[]', + 'amounts' => '\OpenAPI\Client\Model\DeductionsReportDeductionAmountModel[]', 'note' => 'string' ]; @@ -72,8 +72,10 @@ class DeductionsReportExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run' => null, 'date_paid' => 'date-time', 'employee_id' => 'int32', @@ -85,14 +87,38 @@ class DeductionsReportExportModel implements ModelInterface, ArrayAccess 'note' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run' => false, + 'date_paid' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'location' => false, + 'amounts' => false, + 'note' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run'] = isset($data['pay_run']) ? $data['pay_run'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['amounts'] = isset($data['amounts']) ? $data['amounts'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; + $this->setIfExists('pay_run', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('amounts', $data ?? [], null); + $this->setIfExists('note', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets pay_run * - * @return string + * @return string|null */ public function getPayRun() { @@ -265,12 +358,15 @@ public function getPayRun() /** * Sets pay_run * - * @param string $pay_run + * @param string|null $pay_run * - * @return $this + * @return self */ public function setPayRun($pay_run) { + if (is_null($pay_run)) { + throw new \InvalidArgumentException('non-nullable pay_run cannot be null'); + } $this->container['pay_run'] = $pay_run; return $this; @@ -279,7 +375,7 @@ public function setPayRun($pay_run) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -289,12 +385,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -303,7 +402,7 @@ public function setDatePaid($date_paid) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -313,12 +412,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -327,7 +429,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -337,12 +439,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -351,7 +456,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -361,12 +466,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -375,7 +483,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -385,12 +493,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -399,7 +510,7 @@ public function setExternalId($external_id) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -409,12 +520,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -423,7 +537,7 @@ public function setLocation($location) /** * Gets amounts * - * @return \Swagger\Client\Model\DeductionsReportDeductionAmountModel[] + * @return \OpenAPI\Client\Model\DeductionsReportDeductionAmountModel[]|null */ public function getAmounts() { @@ -433,12 +547,15 @@ public function getAmounts() /** * Sets amounts * - * @param \Swagger\Client\Model\DeductionsReportDeductionAmountModel[] $amounts + * @param \OpenAPI\Client\Model\DeductionsReportDeductionAmountModel[]|null $amounts * - * @return $this + * @return self */ public function setAmounts($amounts) { + if (is_null($amounts)) { + throw new \InvalidArgumentException('non-nullable amounts cannot be null'); + } $this->container['amounts'] = $amounts; return $this; @@ -447,7 +564,7 @@ public function setAmounts($amounts) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -457,12 +574,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -474,7 +594,7 @@ public function setNote($note) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeductionsReportRequestModel.php b/src/lib/Model/DeductionsReportRequestModel.php index 99cf536..fa7ff3d 100644 --- a/src/lib/Model/DeductionsReportRequestModel.php +++ b/src/lib/Model/DeductionsReportRequestModel.php @@ -2,61 +2,61 @@ /** * DeductionsReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeductionsReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeductionsReportRequestModel implements ModelInterface, ArrayAccess +class DeductionsReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeductionsReportRequestModel'; + protected static $openAPIModelName = 'DeductionsReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'deduction_category_id' => 'int', 'disable_rollup_reporting' => 'bool', @@ -72,8 +72,10 @@ class DeductionsReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'deduction_category_id' => 'int32', 'disable_rollup_reporting' => null, @@ -85,14 +87,38 @@ class DeductionsReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'deduction_category_id' => false, + 'disable_rollup_reporting' => false, + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['deduction_category_id'] = isset($data['deduction_category_id']) ? $data['deduction_category_id'] : null; - $this->container['disable_rollup_reporting'] = isset($data['disable_rollup_reporting']) ? $data['disable_rollup_reporting'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('deduction_category_id', $data ?? [], null); + $this->setIfExists('disable_rollup_reporting', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -265,12 +358,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -279,7 +375,7 @@ public function setEmployeeId($employee_id) /** * Gets deduction_category_id * - * @return int + * @return int|null */ public function getDeductionCategoryId() { @@ -289,12 +385,15 @@ public function getDeductionCategoryId() /** * Sets deduction_category_id * - * @param int $deduction_category_id + * @param int|null $deduction_category_id * - * @return $this + * @return self */ public function setDeductionCategoryId($deduction_category_id) { + if (is_null($deduction_category_id)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id cannot be null'); + } $this->container['deduction_category_id'] = $deduction_category_id; return $this; @@ -303,7 +402,7 @@ public function setDeductionCategoryId($deduction_category_id) /** * Gets disable_rollup_reporting * - * @return bool + * @return bool|null */ public function getDisableRollupReporting() { @@ -313,12 +412,15 @@ public function getDisableRollupReporting() /** * Sets disable_rollup_reporting * - * @param bool $disable_rollup_reporting + * @param bool|null $disable_rollup_reporting * - * @return $this + * @return self */ public function setDisableRollupReporting($disable_rollup_reporting) { + if (is_null($disable_rollup_reporting)) { + throw new \InvalidArgumentException('non-nullable disable_rollup_reporting cannot be null'); + } $this->container['disable_rollup_reporting'] = $disable_rollup_reporting; return $this; @@ -327,7 +429,7 @@ public function setDisableRollupReporting($disable_rollup_reporting) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -337,12 +439,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -351,7 +456,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -361,12 +466,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -375,7 +483,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -385,12 +493,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -399,7 +510,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -409,12 +520,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -423,7 +537,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -433,12 +547,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -447,7 +564,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -457,12 +574,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -474,7 +594,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DetailedPayRunWarningModel.php b/src/lib/Model/DetailedPayRunWarningModel.php index 935cc51..877f2f2 100644 --- a/src/lib/Model/DetailedPayRunWarningModel.php +++ b/src/lib/Model/DetailedPayRunWarningModel.php @@ -2,61 +2,61 @@ /** * DetailedPayRunWarningModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DetailedPayRunWarningModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DetailedPayRunWarningModel implements ModelInterface, ArrayAccess +class DetailedPayRunWarningModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DetailedPayRunWarningModel'; + protected static $openAPIModelName = 'DetailedPayRunWarningModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'warning_type' => 'string', 'warning_type_description' => 'string', 'employee_id' => 'int', @@ -68,8 +68,10 @@ class DetailedPayRunWarningModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'warning_type' => null, 'warning_type_description' => null, 'employee_id' => 'int32', @@ -77,14 +79,34 @@ class DetailedPayRunWarningModel implements ModelInterface, ArrayAccess 'warning' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'warning_type' => false, + 'warning_type_description' => false, + 'employee_id' => false, + 'employee_name' => false, + 'warning' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -175,94 +249,92 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const WARNING_TYPE_PAYMENT_FILE = 'PaymentFile'; - const WARNING_TYPE_MORE_LEAVE_THAN_ACCRUED = 'MoreLeaveThanAccrued'; - const WARNING_TYPE_UNPAID_EARNINGS = 'UnpaidEarnings'; - const WARNING_TYPE_BIRTHDAY = 'Birthday'; - const WARNING_TYPE_ANNIVERSARY = 'Anniversary'; - const WARNING_TYPE_NEGATIVE_EARNINGS = 'NegativeEarnings'; - const WARNING_TYPE_PREVIOUSLY_TERMINATED = 'PreviouslyTerminated'; - const WARNING_TYPE_TERMINATED_WITH_EXPENSE_REIMBURSEMENTS = 'TerminatedWithExpenseReimbursements'; - const WARNING_TYPE_EXPIRED_QUALIFICATION = 'ExpiredQualification'; - const WARNING_TYPE_DUPLICATE_EARNINGS_LINES = 'DuplicateEarningsLines'; - const WARNING_TYPE_TAX_CODE_MISSING = 'TaxCodeMissing'; - const WARNING_TYPE_BPAY = 'Bpay'; - const WARNING_TYPE_LEAVE_YEAR_CAP_REACHED = 'LeaveYearCapReached'; - const WARNING_TYPE_AUTO_ENROLMENT_CHANGES = 'AutoEnrolmentChanges'; - const WARNING_TYPE_EMPLOYEE_PENSION_CONTRIBUTION_REFUND = 'EmployeePensionContributionRefund'; - const WARNING_TYPE_PENSION_SCHEME_REQUIRES_AUTHORIZATION = 'PensionSchemeRequiresAuthorization'; - const WARNING_TYPE_UK_TAX_CODE_UPDATE = 'UkTaxCodeUpdate'; - const WARNING_TYPE_UK_TAX_CODE_UPDATE_ERROR = 'UkTaxCodeUpdateError'; - const WARNING_TYPE_NINO_UNKNOWN = 'NINOUnknown'; - const WARNING_TYPE_PRO_RATA_EARNINGS = 'ProRataEarnings'; - const WARNING_TYPE_HMRC_LATE_REASON_WARNING = 'HmrcLateReasonWarning'; - const WARNING_TYPE_BELOW_MINIMUM_WAGE = 'BelowMinimumWage'; - const WARNING_TYPE_EXPIRED_SPECIAL_TAX_RATE = 'ExpiredSpecialTaxRate'; - const WARNING_TYPE_EXPIRED_STUDENT_LOAN_RATE = 'ExpiredStudentLoanRate'; - const WARNING_TYPE_PENDING_LEAVE_REQUEST = 'PendingLeaveRequest'; - const WARNING_TYPE_LEAVE_REQUEST_BEYOND_PAY_PERIOD = 'LeaveRequestBeyondPayPeriod'; - const WARNING_TYPE_PRECEDING_LEAVE_REQUEST = 'PrecedingLeaveRequest'; - const WARNING_TYPE_INCOMPLETE_PAY_RUN_TASKS = 'IncompletePayRunTasks'; - const WARNING_TYPE_PENDING_EXPENSE_REQUESTS = 'PendingExpenseRequests'; - const WARNING_TYPE_PAY_DAY_FILING = 'PayDayFiling'; - const WARNING_TYPE_PAY_DAY_FILING_AMENDMENT = 'PayDayFilingAmendment'; - const WARNING_TYPE_EMPLOYEE_INFORMATION = 'EmployeeInformation'; - const WARNING_TYPE_IRD_SETTINGS = 'IrdSettings'; - const WARNING_TYPE_AUTO_UPDATED_NI_CATEGORY = 'AutoUpdatedNICategory'; - const WARNING_TYPE_UK_STUDENT_LOAN_UPDATE = 'UkStudentLoanUpdate'; - const WARNING_TYPE_PENSION_PROVIDER_DOES_NOT_ALLOW_OVERSEAS_ADDRESS = 'PensionProviderDoesNotAllowOverseasAddress'; - const WARNING_TYPE_MISSING_LEAVE_YEAR_ENTITLEMENT = 'MissingLeaveYearEntitlement'; - const WARNING_TYPE_LEAVE_REQUEST_UNIT_TYPE_MISMATCH = 'LeaveRequestUnitTypeMismatch'; - const WARNING_TYPE_EXPIRED_NRIC = 'ExpiredNric'; - const WARNING_TYPE_EXCESS_OVERTIME = 'ExcessOvertime'; - const WARNING_TYPE_FOREIGN_EMPLOYEE = 'ForeignEmployee'; - const WARNING_TYPE_EXCESS_DEDUCTIONS = 'ExcessDeductions'; - const WARNING_TYPE_TERMINATED_FOREIGN_EMPLOYEE = 'TerminatedForeignEmployee'; - const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED = 'StatutoryPaymentApplied'; - const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED_PREVIOUS = 'StatutoryPaymentAppliedPrevious'; - const WARNING_TYPE_NATIONAL_INSURANCE_VALIDATIONS = 'NationalInsuranceValidations'; - const WARNING_TYPE_MIXED_OFFSETS = 'MixedOffsets'; - const WARNING_TYPE_PENDING_SAP_PAYMENT = 'PendingSapPayment'; - const WARNING_TYPE_SCHEDULED_UPDATE_APPLIED = 'ScheduledUpdateApplied'; - const WARNING_TYPE_PENSION_SETTINGS_UPDATED = 'PensionSettingsUpdated'; - const WARNING_TYPE_TAX_RELIEF_THRESHOLD_EXCEEDED = 'TaxReliefThresholdExceeded'; - const WARNING_TYPE_UK_NOT_NOTICE_UPDATE = 'UkNotNoticeUpdate'; - const WARNING_TYPE_EARNINGS_AUTOMATICALLY_ADJUSTED = 'EarningsAutomaticallyAdjusted'; - const WARNING_TYPE_EARNINGS_REQUIRE_ADJUSTMENT = 'EarningsRequireAdjustment'; - const WARNING_TYPE_UK_TAX_CODE_P9_UPDATE = 'UkTaxCodeP9Update'; - const WARNING_TYPE_HRDF_EMPLOYEE_WARNING = 'HrdfEmployeeWarning'; - const WARNING_TYPE_NEW_PAYROLLED_BENEFITS = 'NewPayrolledBenefits'; - const WARNING_TYPE_SUBMIT_TERMINATED_EMPLOYEE_TO_HMRC = 'SubmitTerminatedEmployeeToHmrc'; - const WARNING_TYPE_SUPER_RECONCILIATION_PREVIOUS_PAY_RUN = 'SuperReconciliationPreviousPayRun'; - const WARNING_TYPE_SUPER_RECONCILIATION_THIS_PAY_RUN = 'SuperReconciliationThisPayRun'; - const WARNING_TYPE_MORE_THAN28_DAYS_WITHOUT_TFN_QUOTED = 'MoreThan28DaysWithoutTfnQuoted'; - const WARNING_TYPE_BACK_CALCULATIONS_APPLIED = 'BackCalculationsApplied'; - const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_PREVIOUS_PAY_RUN = 'LeaveAccrualReconciliationPreviousPayRun'; - const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_THIS_PAY_RUN = 'LeaveAccrualReconciliationThisPayRun'; - const WARNING_TYPE_PUBLIC_HOLIDAY_AUTOMATION = 'PublicHolidayAutomation'; - const WARNING_TYPE_CIS_SUBCONTRACTOR_REQUIRES_VERIFICATION = 'CisSubcontractorRequiresVerification'; - const WARNING_TYPE_ITN_REQUIRES_UPDATE = 'ItnRequiresUpdate'; - const WARNING_TYPE_CIS_SUBCONTRACTOR_LAST_PAYMENT_DATE = 'CisSubcontractorLastPaymentDate'; - const WARNING_TYPE_CIS_SUBCONTRACTOR_UNMATCHED = 'CisSubcontractorUnmatched'; - const WARNING_TYPE_CPF_REFUND_REQUIRED = 'CpfRefundRequired'; - const WARNING_TYPE_CPF_YEAR_END_RECALCULATION_REQUIRED = 'CpfYearEndRecalculationRequired'; - const WARNING_TYPE_TAX_CODE_DISPLAY_NAME_TOO_LONG = 'TaxCodeDisplayNameTooLong'; - const WARNING_TYPE_TIMESHEET_OUT_OF_SEQUENCE = 'TimesheetOutOfSequence'; - const WARNING_TYPE_EXPIRED_CONTRACTOR_TAX_RATE = 'ExpiredContractorTaxRate'; - const WARNING_TYPE_CONCURRENT_PAY_RUN = 'ConcurrentPayRun'; - const WARNING_TYPE_STUDENT_LOAN_ADJUSTMENT = 'StudentLoanAdjustment'; - const WARNING_TYPE_UNPAID_LEAVE_WITH_AVAILABLE_BALANCE = 'UnpaidLeaveWithAvailableBalance'; - const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED = 'OccupationalLeaveApplied'; - const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED_PREVIOUS = 'OccupationalLeaveAppliedPrevious'; - const WARNING_TYPE_OCCUPATIONAL_LEAVE_ENTITLEMENT_EXHAUSTED = 'OccupationalLeaveEntitlementExhausted'; - const WARNING_TYPE_ANNUAL_LEAVE_CASHED_OUT = 'AnnualLeaveCashedOut'; - const WARNING_TYPE_EMPLOYEE_HAS_TAKEN_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'EmployeeHasTakenPaidFamilyAndDomesticViolenceLeave'; - - - + return self::$openAPIModelName; + } + + public const WARNING_TYPE_PAYMENT_FILE = 'PaymentFile'; + public const WARNING_TYPE_MORE_LEAVE_THAN_ACCRUED = 'MoreLeaveThanAccrued'; + public const WARNING_TYPE_UNPAID_EARNINGS = 'UnpaidEarnings'; + public const WARNING_TYPE_BIRTHDAY = 'Birthday'; + public const WARNING_TYPE_ANNIVERSARY = 'Anniversary'; + public const WARNING_TYPE_NEGATIVE_EARNINGS = 'NegativeEarnings'; + public const WARNING_TYPE_PREVIOUSLY_TERMINATED = 'PreviouslyTerminated'; + public const WARNING_TYPE_TERMINATED_WITH_EXPENSE_REIMBURSEMENTS = 'TerminatedWithExpenseReimbursements'; + public const WARNING_TYPE_EXPIRED_QUALIFICATION = 'ExpiredQualification'; + public const WARNING_TYPE_DUPLICATE_EARNINGS_LINES = 'DuplicateEarningsLines'; + public const WARNING_TYPE_TAX_CODE_MISSING = 'TaxCodeMissing'; + public const WARNING_TYPE_BPAY = 'Bpay'; + public const WARNING_TYPE_LEAVE_YEAR_CAP_REACHED = 'LeaveYearCapReached'; + public const WARNING_TYPE_AUTO_ENROLMENT_CHANGES = 'AutoEnrolmentChanges'; + public const WARNING_TYPE_EMPLOYEE_PENSION_CONTRIBUTION_REFUND = 'EmployeePensionContributionRefund'; + public const WARNING_TYPE_PENSION_SCHEME_REQUIRES_AUTHORIZATION = 'PensionSchemeRequiresAuthorization'; + public const WARNING_TYPE_UK_TAX_CODE_UPDATE = 'UkTaxCodeUpdate'; + public const WARNING_TYPE_UK_TAX_CODE_UPDATE_ERROR = 'UkTaxCodeUpdateError'; + public const WARNING_TYPE_NINO_UNKNOWN = 'NINOUnknown'; + public const WARNING_TYPE_PRO_RATA_EARNINGS = 'ProRataEarnings'; + public const WARNING_TYPE_HMRC_LATE_REASON_WARNING = 'HmrcLateReasonWarning'; + public const WARNING_TYPE_BELOW_MINIMUM_WAGE = 'BelowMinimumWage'; + public const WARNING_TYPE_EXPIRED_SPECIAL_TAX_RATE = 'ExpiredSpecialTaxRate'; + public const WARNING_TYPE_EXPIRED_STUDENT_LOAN_RATE = 'ExpiredStudentLoanRate'; + public const WARNING_TYPE_PENDING_LEAVE_REQUEST = 'PendingLeaveRequest'; + public const WARNING_TYPE_LEAVE_REQUEST_BEYOND_PAY_PERIOD = 'LeaveRequestBeyondPayPeriod'; + public const WARNING_TYPE_PRECEDING_LEAVE_REQUEST = 'PrecedingLeaveRequest'; + public const WARNING_TYPE_INCOMPLETE_PAY_RUN_TASKS = 'IncompletePayRunTasks'; + public const WARNING_TYPE_PENDING_EXPENSE_REQUESTS = 'PendingExpenseRequests'; + public const WARNING_TYPE_PAY_DAY_FILING = 'PayDayFiling'; + public const WARNING_TYPE_PAY_DAY_FILING_AMENDMENT = 'PayDayFilingAmendment'; + public const WARNING_TYPE_EMPLOYEE_INFORMATION = 'EmployeeInformation'; + public const WARNING_TYPE_IRD_SETTINGS = 'IrdSettings'; + public const WARNING_TYPE_AUTO_UPDATED_NI_CATEGORY = 'AutoUpdatedNICategory'; + public const WARNING_TYPE_UK_STUDENT_LOAN_UPDATE = 'UkStudentLoanUpdate'; + public const WARNING_TYPE_PENSION_PROVIDER_DOES_NOT_ALLOW_OVERSEAS_ADDRESS = 'PensionProviderDoesNotAllowOverseasAddress'; + public const WARNING_TYPE_MISSING_LEAVE_YEAR_ENTITLEMENT = 'MissingLeaveYearEntitlement'; + public const WARNING_TYPE_LEAVE_REQUEST_UNIT_TYPE_MISMATCH = 'LeaveRequestUnitTypeMismatch'; + public const WARNING_TYPE_EXPIRED_NRIC = 'ExpiredNric'; + public const WARNING_TYPE_EXCESS_OVERTIME = 'ExcessOvertime'; + public const WARNING_TYPE_FOREIGN_EMPLOYEE = 'ForeignEmployee'; + public const WARNING_TYPE_EXCESS_DEDUCTIONS = 'ExcessDeductions'; + public const WARNING_TYPE_TERMINATED_FOREIGN_EMPLOYEE = 'TerminatedForeignEmployee'; + public const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED = 'StatutoryPaymentApplied'; + public const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED_PREVIOUS = 'StatutoryPaymentAppliedPrevious'; + public const WARNING_TYPE_NATIONAL_INSURANCE_VALIDATIONS = 'NationalInsuranceValidations'; + public const WARNING_TYPE_MIXED_OFFSETS = 'MixedOffsets'; + public const WARNING_TYPE_PENDING_SAP_PAYMENT = 'PendingSapPayment'; + public const WARNING_TYPE_SCHEDULED_UPDATE_APPLIED = 'ScheduledUpdateApplied'; + public const WARNING_TYPE_PENSION_SETTINGS_UPDATED = 'PensionSettingsUpdated'; + public const WARNING_TYPE_TAX_RELIEF_THRESHOLD_EXCEEDED = 'TaxReliefThresholdExceeded'; + public const WARNING_TYPE_UK_NOT_NOTICE_UPDATE = 'UkNotNoticeUpdate'; + public const WARNING_TYPE_EARNINGS_AUTOMATICALLY_ADJUSTED = 'EarningsAutomaticallyAdjusted'; + public const WARNING_TYPE_EARNINGS_REQUIRE_ADJUSTMENT = 'EarningsRequireAdjustment'; + public const WARNING_TYPE_UK_TAX_CODE_P9_UPDATE = 'UkTaxCodeP9Update'; + public const WARNING_TYPE_HRDF_EMPLOYEE_WARNING = 'HrdfEmployeeWarning'; + public const WARNING_TYPE_NEW_PAYROLLED_BENEFITS = 'NewPayrolledBenefits'; + public const WARNING_TYPE_SUBMIT_TERMINATED_EMPLOYEE_TO_HMRC = 'SubmitTerminatedEmployeeToHmrc'; + public const WARNING_TYPE_SUPER_RECONCILIATION_PREVIOUS_PAY_RUN = 'SuperReconciliationPreviousPayRun'; + public const WARNING_TYPE_SUPER_RECONCILIATION_THIS_PAY_RUN = 'SuperReconciliationThisPayRun'; + public const WARNING_TYPE_MORE_THAN28_DAYS_WITHOUT_TFN_QUOTED = 'MoreThan28DaysWithoutTfnQuoted'; + public const WARNING_TYPE_BACK_CALCULATIONS_APPLIED = 'BackCalculationsApplied'; + public const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_PREVIOUS_PAY_RUN = 'LeaveAccrualReconciliationPreviousPayRun'; + public const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_THIS_PAY_RUN = 'LeaveAccrualReconciliationThisPayRun'; + public const WARNING_TYPE_PUBLIC_HOLIDAY_AUTOMATION = 'PublicHolidayAutomation'; + public const WARNING_TYPE_CIS_SUBCONTRACTOR_REQUIRES_VERIFICATION = 'CisSubcontractorRequiresVerification'; + public const WARNING_TYPE_ITN_REQUIRES_UPDATE = 'ItnRequiresUpdate'; + public const WARNING_TYPE_CIS_SUBCONTRACTOR_LAST_PAYMENT_DATE = 'CisSubcontractorLastPaymentDate'; + public const WARNING_TYPE_CIS_SUBCONTRACTOR_UNMATCHED = 'CisSubcontractorUnmatched'; + public const WARNING_TYPE_CPF_REFUND_REQUIRED = 'CpfRefundRequired'; + public const WARNING_TYPE_CPF_YEAR_END_RECALCULATION_REQUIRED = 'CpfYearEndRecalculationRequired'; + public const WARNING_TYPE_TAX_CODE_DISPLAY_NAME_TOO_LONG = 'TaxCodeDisplayNameTooLong'; + public const WARNING_TYPE_TIMESHEET_OUT_OF_SEQUENCE = 'TimesheetOutOfSequence'; + public const WARNING_TYPE_EXPIRED_CONTRACTOR_TAX_RATE = 'ExpiredContractorTaxRate'; + public const WARNING_TYPE_CONCURRENT_PAY_RUN = 'ConcurrentPayRun'; + public const WARNING_TYPE_STUDENT_LOAN_ADJUSTMENT = 'StudentLoanAdjustment'; + public const WARNING_TYPE_UNPAID_LEAVE_WITH_AVAILABLE_BALANCE = 'UnpaidLeaveWithAvailableBalance'; + public const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED = 'OccupationalLeaveApplied'; + public const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED_PREVIOUS = 'OccupationalLeaveAppliedPrevious'; + public const WARNING_TYPE_OCCUPATIONAL_LEAVE_ENTITLEMENT_EXHAUSTED = 'OccupationalLeaveEntitlementExhausted'; + public const WARNING_TYPE_ANNUAL_LEAVE_CASHED_OUT = 'AnnualLeaveCashedOut'; + public const WARNING_TYPE_EMPLOYEE_HAS_TAKEN_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'EmployeeHasTakenPaidFamilyAndDomesticViolenceLeave'; + /** * Gets allowable values of the enum * @@ -355,7 +427,6 @@ public function getWarningTypeAllowableValues() self::WARNING_TYPE_EMPLOYEE_HAS_TAKEN_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE, ]; } - /** * Associative array for storing property values @@ -372,11 +443,29 @@ public function getWarningTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['warning_type'] = isset($data['warning_type']) ? $data['warning_type'] : null; - $this->container['warning_type_description'] = isset($data['warning_type_description']) ? $data['warning_type_description'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['warning'] = isset($data['warning']) ? $data['warning'] : null; + $this->setIfExists('warning_type', $data ?? [], null); + $this->setIfExists('warning_type_description', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('warning', $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; } /** @@ -391,7 +480,8 @@ public function listInvalidProperties() $allowedValues = $this->getWarningTypeAllowableValues(); if (!is_null($this->container['warning_type']) && !in_array($this->container['warning_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'warning_type', must be one of '%s'", + "invalid value '%s' for 'warning_type', must be one of '%s'", + $this->container['warning_type'], implode("', '", $allowedValues) ); } @@ -414,7 +504,7 @@ public function valid() /** * Gets warning_type * - * @return string + * @return string|null */ public function getWarningType() { @@ -424,17 +514,21 @@ public function getWarningType() /** * Sets warning_type * - * @param string $warning_type + * @param string|null $warning_type * - * @return $this + * @return self */ public function setWarningType($warning_type) { + if (is_null($warning_type)) { + throw new \InvalidArgumentException('non-nullable warning_type cannot be null'); + } $allowedValues = $this->getWarningTypeAllowableValues(); - if (!is_null($warning_type) && !in_array($warning_type, $allowedValues, true)) { + if (!in_array($warning_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'warning_type', must be one of '%s'", + "Invalid value '%s' for 'warning_type', must be one of '%s'", + $warning_type, implode("', '", $allowedValues) ) ); @@ -447,7 +541,7 @@ public function setWarningType($warning_type) /** * Gets warning_type_description * - * @return string + * @return string|null */ public function getWarningTypeDescription() { @@ -457,12 +551,15 @@ public function getWarningTypeDescription() /** * Sets warning_type_description * - * @param string $warning_type_description + * @param string|null $warning_type_description * - * @return $this + * @return self */ public function setWarningTypeDescription($warning_type_description) { + if (is_null($warning_type_description)) { + throw new \InvalidArgumentException('non-nullable warning_type_description cannot be null'); + } $this->container['warning_type_description'] = $warning_type_description; return $this; @@ -471,7 +568,7 @@ public function setWarningTypeDescription($warning_type_description) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -481,12 +578,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -495,7 +595,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -505,12 +605,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -519,7 +622,7 @@ public function setEmployeeName($employee_name) /** * Gets warning * - * @return string + * @return string|null */ public function getWarning() { @@ -529,12 +632,15 @@ public function getWarning() /** * Sets warning * - * @param string $warning + * @param string|null $warning * - * @return $this + * @return self */ public function setWarning($warning) { + if (is_null($warning)) { + throw new \InvalidArgumentException('non-nullable warning cannot be null'); + } $this->container['warning'] = $warning; return $this; @@ -546,7 +652,7 @@ public function setWarning($warning) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -556,22 +662,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -587,11 +694,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -599,13 +719,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DeviceTokenModel.php b/src/lib/Model/DeviceTokenModel.php index fff2287..98688d8 100644 --- a/src/lib/Model/DeviceTokenModel.php +++ b/src/lib/Model/DeviceTokenModel.php @@ -2,61 +2,61 @@ /** * DeviceTokenModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DeviceTokenModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DeviceTokenModel implements ModelInterface, ArrayAccess +class DeviceTokenModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DeviceTokenModel'; + protected static $openAPIModelName = 'DeviceTokenModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'token' => 'string', 'platform' => 'string' ]; @@ -65,20 +65,39 @@ class DeviceTokenModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'token' => null, 'platform' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'token' => false, + 'platform' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,14 +231,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const PLATFORM_I_OS = 'iOS'; - const PLATFORM_ANDROID = 'Android'; - + public const PLATFORM_I_OS = 'iOS'; + public const PLATFORM_ANDROID = 'Android'; - /** * Gets allowable values of the enum * @@ -180,7 +249,6 @@ public function getPlatformAllowableValues() self::PLATFORM_ANDROID, ]; } - /** * Associative array for storing property values @@ -197,8 +265,26 @@ public function getPlatformAllowableValues() */ public function __construct(array $data = null) { - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['platform'] = isset($data['platform']) ? $data['platform'] : null; + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('platform', $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; } /** @@ -213,7 +299,8 @@ public function listInvalidProperties() $allowedValues = $this->getPlatformAllowableValues(); if (!is_null($this->container['platform']) && !in_array($this->container['platform'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'platform', must be one of '%s'", + "invalid value '%s' for 'platform', must be one of '%s'", + $this->container['platform'], implode("', '", $allowedValues) ); } @@ -236,7 +323,7 @@ public function valid() /** * Gets token * - * @return string + * @return string|null */ public function getToken() { @@ -246,12 +333,15 @@ public function getToken() /** * Sets token * - * @param string $token + * @param string|null $token * - * @return $this + * @return self */ public function setToken($token) { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -260,7 +350,7 @@ public function setToken($token) /** * Gets platform * - * @return string + * @return string|null */ public function getPlatform() { @@ -270,17 +360,21 @@ public function getPlatform() /** * Sets platform * - * @param string $platform + * @param string|null $platform * - * @return $this + * @return self */ public function setPlatform($platform) { + if (is_null($platform)) { + throw new \InvalidArgumentException('non-nullable platform cannot be null'); + } $allowedValues = $this->getPlatformAllowableValues(); - if (!is_null($platform) && !in_array($platform, $allowedValues, true)) { + if (!in_array($platform, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'platform', must be one of '%s'", + "Invalid value '%s' for 'platform', must be one of '%s'", + $platform, implode("', '", $allowedValues) ) ); @@ -296,7 +390,7 @@ public function setPlatform($platform) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -306,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -337,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -349,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DimensionEarningsLineSplitApiModel.php b/src/lib/Model/DimensionEarningsLineSplitApiModel.php index d83fa1d..6724463 100644 --- a/src/lib/Model/DimensionEarningsLineSplitApiModel.php +++ b/src/lib/Model/DimensionEarningsLineSplitApiModel.php @@ -2,64 +2,64 @@ /** * DimensionEarningsLineSplitApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DimensionEarningsLineSplitApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DimensionEarningsLineSplitApiModel implements ModelInterface, ArrayAccess +class DimensionEarningsLineSplitApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DimensionEarningsLineSplitApiModel'; + protected static $openAPIModelName = 'DimensionEarningsLineSplitApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', - 'reporting_dimension_values' => '\Swagger\Client\Model\ReducedReportingDimensionValueApiModel[]', - 'allocated_percentage' => 'double', + 'reporting_dimension_values' => '\OpenAPI\Client\Model\ReducedReportingDimensionValueApiModel[]', + 'allocated_percentage' => 'float', 'allocate_balance' => 'bool' ]; @@ -67,22 +67,43 @@ class DimensionEarningsLineSplitApiModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'reporting_dimension_values' => null, 'allocated_percentage' => 'double', 'allocate_balance' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'reporting_dimension_values' => false, + 'allocated_percentage' => false, + 'allocate_balance' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['reporting_dimension_values'] = isset($data['reporting_dimension_values']) ? $data['reporting_dimension_values'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('reporting_dimension_values', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('allocate_balance', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets reporting_dimension_values * - * @return \Swagger\Client\Model\ReducedReportingDimensionValueApiModel[] + * @return \OpenAPI\Client\Model\ReducedReportingDimensionValueApiModel[]|null */ public function getReportingDimensionValues() { @@ -259,12 +350,15 @@ public function getReportingDimensionValues() /** * Sets reporting_dimension_values * - * @param \Swagger\Client\Model\ReducedReportingDimensionValueApiModel[] $reporting_dimension_values + * @param \OpenAPI\Client\Model\ReducedReportingDimensionValueApiModel[]|null $reporting_dimension_values * - * @return $this + * @return self */ public function setReportingDimensionValues($reporting_dimension_values) { + if (is_null($reporting_dimension_values)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_values cannot be null'); + } $this->container['reporting_dimension_values'] = $reporting_dimension_values; return $this; @@ -273,7 +367,7 @@ public function setReportingDimensionValues($reporting_dimension_values) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -283,12 +377,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -297,7 +394,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -307,12 +404,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -324,7 +424,7 @@ public function setAllocateBalance($allocate_balance) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DocumentAcknowledgementsReportExportModel.php b/src/lib/Model/DocumentAcknowledgementsReportExportModel.php index ce87da1..7f661e5 100644 --- a/src/lib/Model/DocumentAcknowledgementsReportExportModel.php +++ b/src/lib/Model/DocumentAcknowledgementsReportExportModel.php @@ -2,61 +2,61 @@ /** * DocumentAcknowledgementsReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DocumentAcknowledgementsReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DocumentAcknowledgementsReportExportModel implements ModelInterface, ArrayAccess +class DocumentAcknowledgementsReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DocumentAcknowledgementsReportExportModel'; + protected static $openAPIModelName = 'DocumentAcknowledgementsReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'status' => 'string', 'document_name' => 'string', 'employee_id' => 'int', @@ -71,8 +71,10 @@ class DocumentAcknowledgementsReportExportModel implements ModelInterface, Array * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'status' => null, 'document_name' => null, 'employee_id' => 'int32', @@ -83,14 +85,37 @@ class DocumentAcknowledgementsReportExportModel implements ModelInterface, Array 'location_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'document_name' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'last_notification' => false, + 'location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['document_name'] = isset($data['document_name']) ? $data['document_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['last_notification'] = isset($data['last_notification']) ? $data['last_notification'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('document_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('last_notification', $data ?? [], null); + $this->setIfExists('location_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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -259,12 +351,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -273,7 +368,7 @@ public function setStatus($status) /** * Gets document_name * - * @return string + * @return string|null */ public function getDocumentName() { @@ -283,12 +378,15 @@ public function getDocumentName() /** * Sets document_name * - * @param string $document_name + * @param string|null $document_name * - * @return $this + * @return self */ public function setDocumentName($document_name) { + if (is_null($document_name)) { + throw new \InvalidArgumentException('non-nullable document_name cannot be null'); + } $this->container['document_name'] = $document_name; return $this; @@ -297,7 +395,7 @@ public function setDocumentName($document_name) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -307,12 +405,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -321,7 +422,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -331,12 +432,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -345,7 +449,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -355,12 +459,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -369,7 +476,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -379,12 +486,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -393,7 +503,7 @@ public function setExternalId($external_id) /** * Gets last_notification * - * @return \DateTime + * @return \DateTime|null */ public function getLastNotification() { @@ -403,12 +513,15 @@ public function getLastNotification() /** * Sets last_notification * - * @param \DateTime $last_notification + * @param \DateTime|null $last_notification * - * @return $this + * @return self */ public function setLastNotification($last_notification) { + if (is_null($last_notification)) { + throw new \InvalidArgumentException('non-nullable last_notification cannot be null'); + } $this->container['last_notification'] = $last_notification; return $this; @@ -417,7 +530,7 @@ public function setLastNotification($last_notification) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -427,12 +540,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -444,7 +560,7 @@ public function setLocationName($location_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DocumentFile.php b/src/lib/Model/DocumentFile.php index a4e487d..392ff83 100644 --- a/src/lib/Model/DocumentFile.php +++ b/src/lib/Model/DocumentFile.php @@ -2,61 +2,61 @@ /** * DocumentFile * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DocumentFile Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DocumentFile implements ModelInterface, ArrayAccess +class DocumentFile implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DocumentFile'; + protected static $openAPIModelName = 'DocumentFile'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'content_length' => 'int', 'content_type' => 'string', 'bytes' => 'string', @@ -67,22 +67,43 @@ class DocumentFile implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'content_length' => 'int64', 'content_type' => null, 'bytes' => 'byte', 'filename' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content_length' => false, + 'content_type' => false, + 'bytes' => false, + 'filename' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['content_length'] = isset($data['content_length']) ? $data['content_length'] : null; - $this->container['content_type'] = isset($data['content_type']) ? $data['content_type'] : null; - $this->container['bytes'] = isset($data['bytes']) ? $data['bytes'] : null; - $this->container['filename'] = isset($data['filename']) ? $data['filename'] : null; + $this->setIfExists('content_length', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('bytes', $data ?? [], null); + $this->setIfExists('filename', $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; } /** @@ -229,7 +317,7 @@ public function valid() /** * Gets content_length * - * @return int + * @return int|null */ public function getContentLength() { @@ -239,12 +327,15 @@ public function getContentLength() /** * Sets content_length * - * @param int $content_length + * @param int|null $content_length * - * @return $this + * @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; @@ -253,7 +344,7 @@ public function setContentLength($content_length) /** * Gets content_type * - * @return string + * @return string|null */ public function getContentType() { @@ -263,12 +354,15 @@ public function getContentType() /** * Sets content_type * - * @param string $content_type + * @param string|null $content_type * - * @return $this + * @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; @@ -277,7 +371,7 @@ public function setContentType($content_type) /** * Gets bytes * - * @return string + * @return string|null */ public function getBytes() { @@ -287,15 +381,18 @@ public function getBytes() /** * Sets bytes * - * @param string $bytes + * @param string|null $bytes * - * @return $this + * @return self */ public function setBytes($bytes) { + if (is_null($bytes)) { + throw new \InvalidArgumentException('non-nullable bytes cannot be null'); + } - if (!is_null($bytes) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $bytes))) { - throw new \InvalidArgumentException("invalid value for $bytes when calling DocumentFile., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $bytes))) { + throw new \InvalidArgumentException("invalid value for \$bytes when calling DocumentFile., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['bytes'] = $bytes; @@ -306,7 +403,7 @@ public function setBytes($bytes) /** * Gets filename * - * @return string + * @return string|null */ public function getFilename() { @@ -316,12 +413,15 @@ public function getFilename() /** * Sets filename * - * @param string $filename + * @param string|null $filename * - * @return $this + * @return self */ public function setFilename($filename) { + if (is_null($filename)) { + throw new \InvalidArgumentException('non-nullable filename cannot be null'); + } $this->container['filename'] = $filename; return $this; @@ -333,7 +433,7 @@ public function setFilename($filename) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -343,22 +443,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -374,11 +475,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -386,13 +500,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/DocumentModel.php b/src/lib/Model/DocumentModel.php index b115b59..d2364ed 100644 --- a/src/lib/Model/DocumentModel.php +++ b/src/lib/Model/DocumentModel.php @@ -2,67 +2,67 @@ /** * DocumentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * DocumentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class DocumentModel implements ModelInterface, ArrayAccess +class DocumentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'DocumentModel'; + protected static $openAPIModelName = 'DocumentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'friendly_name' => 'string', 'date_created' => '\DateTime', 'visible_to_all_employees' => 'bool', - 'selected_groups' => '\Swagger\Client\Model\EmployeeGroupItemModel[]', - 'selected_locations' => '\Swagger\Client\Model\LocationItemModel[]', + 'selected_groups' => '\OpenAPI\Client\Model\EmployeeGroupItemModel[]', + 'selected_locations' => '\OpenAPI\Client\Model\LocationItemModel[]', 'requires_employee_acknowledgement' => 'bool', 'send_notification_to_employee' => 'bool', 'send_notification_immediately' => 'bool', @@ -74,8 +74,10 @@ class DocumentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'friendly_name' => null, 'date_created' => 'date-time', @@ -89,14 +91,40 @@ class DocumentModel implements ModelInterface, ArrayAccess 'send_reminder_every_x_days' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'friendly_name' => false, + 'date_created' => false, + 'visible_to_all_employees' => false, + 'selected_groups' => false, + 'selected_locations' => false, + 'requires_employee_acknowledgement' => false, + 'send_notification_to_employee' => false, + 'send_notification_immediately' => false, + 'send_initial_notification_on' => false, + 'send_reminder_every_x_days' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['friendly_name'] = isset($data['friendly_name']) ? $data['friendly_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['visible_to_all_employees'] = isset($data['visible_to_all_employees']) ? $data['visible_to_all_employees'] : null; - $this->container['selected_groups'] = isset($data['selected_groups']) ? $data['selected_groups'] : null; - $this->container['selected_locations'] = isset($data['selected_locations']) ? $data['selected_locations'] : null; - $this->container['requires_employee_acknowledgement'] = isset($data['requires_employee_acknowledgement']) ? $data['requires_employee_acknowledgement'] : null; - $this->container['send_notification_to_employee'] = isset($data['send_notification_to_employee']) ? $data['send_notification_to_employee'] : null; - $this->container['send_notification_immediately'] = isset($data['send_notification_immediately']) ? $data['send_notification_immediately'] : null; - $this->container['send_initial_notification_on'] = isset($data['send_initial_notification_on']) ? $data['send_initial_notification_on'] : null; - $this->container['send_reminder_every_x_days'] = isset($data['send_reminder_every_x_days']) ? $data['send_reminder_every_x_days'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('friendly_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('visible_to_all_employees', $data ?? [], null); + $this->setIfExists('selected_groups', $data ?? [], null); + $this->setIfExists('selected_locations', $data ?? [], null); + $this->setIfExists('requires_employee_acknowledgement', $data ?? [], null); + $this->setIfExists('send_notification_to_employee', $data ?? [], null); + $this->setIfExists('send_notification_immediately', $data ?? [], null); + $this->setIfExists('send_initial_notification_on', $data ?? [], null); + $this->setIfExists('send_reminder_every_x_days', $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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -277,12 +372,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -291,7 +389,7 @@ public function setId($id) /** * Gets friendly_name * - * @return string + * @return string|null */ public function getFriendlyName() { @@ -301,12 +399,15 @@ public function getFriendlyName() /** * Sets friendly_name * - * @param string $friendly_name + * @param string|null $friendly_name * - * @return $this + * @return self */ public function setFriendlyName($friendly_name) { + if (is_null($friendly_name)) { + throw new \InvalidArgumentException('non-nullable friendly_name cannot be null'); + } $this->container['friendly_name'] = $friendly_name; return $this; @@ -315,7 +416,7 @@ public function setFriendlyName($friendly_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -325,12 +426,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -339,7 +443,7 @@ public function setDateCreated($date_created) /** * Gets visible_to_all_employees * - * @return bool + * @return bool|null */ public function getVisibleToAllEmployees() { @@ -349,12 +453,15 @@ public function getVisibleToAllEmployees() /** * Sets visible_to_all_employees * - * @param bool $visible_to_all_employees + * @param bool|null $visible_to_all_employees * - * @return $this + * @return self */ public function setVisibleToAllEmployees($visible_to_all_employees) { + if (is_null($visible_to_all_employees)) { + throw new \InvalidArgumentException('non-nullable visible_to_all_employees cannot be null'); + } $this->container['visible_to_all_employees'] = $visible_to_all_employees; return $this; @@ -363,7 +470,7 @@ public function setVisibleToAllEmployees($visible_to_all_employees) /** * Gets selected_groups * - * @return \Swagger\Client\Model\EmployeeGroupItemModel[] + * @return \OpenAPI\Client\Model\EmployeeGroupItemModel[]|null */ public function getSelectedGroups() { @@ -373,12 +480,15 @@ public function getSelectedGroups() /** * Sets selected_groups * - * @param \Swagger\Client\Model\EmployeeGroupItemModel[] $selected_groups + * @param \OpenAPI\Client\Model\EmployeeGroupItemModel[]|null $selected_groups * - * @return $this + * @return self */ public function setSelectedGroups($selected_groups) { + if (is_null($selected_groups)) { + throw new \InvalidArgumentException('non-nullable selected_groups cannot be null'); + } $this->container['selected_groups'] = $selected_groups; return $this; @@ -387,7 +497,7 @@ public function setSelectedGroups($selected_groups) /** * Gets selected_locations * - * @return \Swagger\Client\Model\LocationItemModel[] + * @return \OpenAPI\Client\Model\LocationItemModel[]|null */ public function getSelectedLocations() { @@ -397,12 +507,15 @@ public function getSelectedLocations() /** * Sets selected_locations * - * @param \Swagger\Client\Model\LocationItemModel[] $selected_locations + * @param \OpenAPI\Client\Model\LocationItemModel[]|null $selected_locations * - * @return $this + * @return self */ public function setSelectedLocations($selected_locations) { + if (is_null($selected_locations)) { + throw new \InvalidArgumentException('non-nullable selected_locations cannot be null'); + } $this->container['selected_locations'] = $selected_locations; return $this; @@ -411,7 +524,7 @@ public function setSelectedLocations($selected_locations) /** * Gets requires_employee_acknowledgement * - * @return bool + * @return bool|null */ public function getRequiresEmployeeAcknowledgement() { @@ -421,12 +534,15 @@ public function getRequiresEmployeeAcknowledgement() /** * Sets requires_employee_acknowledgement * - * @param bool $requires_employee_acknowledgement + * @param bool|null $requires_employee_acknowledgement * - * @return $this + * @return self */ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledgement) { + if (is_null($requires_employee_acknowledgement)) { + throw new \InvalidArgumentException('non-nullable requires_employee_acknowledgement cannot be null'); + } $this->container['requires_employee_acknowledgement'] = $requires_employee_acknowledgement; return $this; @@ -435,7 +551,7 @@ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledg /** * Gets send_notification_to_employee * - * @return bool + * @return bool|null */ public function getSendNotificationToEmployee() { @@ -445,12 +561,15 @@ public function getSendNotificationToEmployee() /** * Sets send_notification_to_employee * - * @param bool $send_notification_to_employee + * @param bool|null $send_notification_to_employee * - * @return $this + * @return self */ public function setSendNotificationToEmployee($send_notification_to_employee) { + if (is_null($send_notification_to_employee)) { + throw new \InvalidArgumentException('non-nullable send_notification_to_employee cannot be null'); + } $this->container['send_notification_to_employee'] = $send_notification_to_employee; return $this; @@ -459,7 +578,7 @@ public function setSendNotificationToEmployee($send_notification_to_employee) /** * Gets send_notification_immediately * - * @return bool + * @return bool|null */ public function getSendNotificationImmediately() { @@ -469,12 +588,15 @@ public function getSendNotificationImmediately() /** * Sets send_notification_immediately * - * @param bool $send_notification_immediately + * @param bool|null $send_notification_immediately * - * @return $this + * @return self */ public function setSendNotificationImmediately($send_notification_immediately) { + if (is_null($send_notification_immediately)) { + throw new \InvalidArgumentException('non-nullable send_notification_immediately cannot be null'); + } $this->container['send_notification_immediately'] = $send_notification_immediately; return $this; @@ -483,7 +605,7 @@ public function setSendNotificationImmediately($send_notification_immediately) /** * Gets send_initial_notification_on * - * @return \DateTime + * @return \DateTime|null */ public function getSendInitialNotificationOn() { @@ -493,12 +615,15 @@ public function getSendInitialNotificationOn() /** * Sets send_initial_notification_on * - * @param \DateTime $send_initial_notification_on + * @param \DateTime|null $send_initial_notification_on * - * @return $this + * @return self */ public function setSendInitialNotificationOn($send_initial_notification_on) { + if (is_null($send_initial_notification_on)) { + throw new \InvalidArgumentException('non-nullable send_initial_notification_on cannot be null'); + } $this->container['send_initial_notification_on'] = $send_initial_notification_on; return $this; @@ -507,7 +632,7 @@ public function setSendInitialNotificationOn($send_initial_notification_on) /** * Gets send_reminder_every_x_days * - * @return int + * @return int|null */ public function getSendReminderEveryXDays() { @@ -517,12 +642,15 @@ public function getSendReminderEveryXDays() /** * Sets send_reminder_every_x_days * - * @param int $send_reminder_every_x_days + * @param int|null $send_reminder_every_x_days * - * @return $this + * @return self */ public function setSendReminderEveryXDays($send_reminder_every_x_days) { + if (is_null($send_reminder_every_x_days)) { + throw new \InvalidArgumentException('non-nullable send_reminder_every_x_days cannot be null'); + } $this->container['send_reminder_every_x_days'] = $send_reminder_every_x_days; return $this; @@ -534,7 +662,7 @@ public function setSendReminderEveryXDays($send_reminder_every_x_days) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EarningsLineSplitApiModel.php b/src/lib/Model/EarningsLineSplitApiModel.php index ecb3617..de6c452 100644 --- a/src/lib/Model/EarningsLineSplitApiModel.php +++ b/src/lib/Model/EarningsLineSplitApiModel.php @@ -2,64 +2,64 @@ /** * EarningsLineSplitApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EarningsLineSplitApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EarningsLineSplitApiModel implements ModelInterface, ArrayAccess +class EarningsLineSplitApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EarningsLineSplitApiModel'; + protected static $openAPIModelName = 'EarningsLineSplitApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'location_name' => 'string', - 'allocated_percentage' => 'double', + 'allocated_percentage' => 'float', 'allocate_balance' => 'bool' ]; @@ -67,22 +67,43 @@ class EarningsLineSplitApiModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'location_name' => null, 'allocated_percentage' => 'double', 'allocate_balance' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'location_name' => false, + 'allocated_percentage' => false, + 'allocate_balance' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('allocate_balance', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -235,12 +323,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -249,7 +340,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -259,12 +350,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -273,7 +367,7 @@ public function setLocationName($location_name) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -283,12 +377,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -297,7 +394,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -307,12 +404,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -324,7 +424,7 @@ public function setAllocateBalance($allocate_balance) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EarningsLineSplitEditModel.php b/src/lib/Model/EarningsLineSplitEditModel.php index 789a22b..4dbbc01 100644 --- a/src/lib/Model/EarningsLineSplitEditModel.php +++ b/src/lib/Model/EarningsLineSplitEditModel.php @@ -2,63 +2,63 @@ /** * EarningsLineSplitEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EarningsLineSplitEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EarningsLineSplitEditModel implements ModelInterface, ArrayAccess +class EarningsLineSplitEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EarningsLineSplitEditModel'; + protected static $openAPIModelName = 'EarningsLineSplitEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', - 'allocated_percentage' => 'double', + 'allocated_percentage' => 'float', 'allocate_balance' => 'bool', 'reporting_dimension_value_ids' => 'int[]' ]; @@ -67,22 +67,43 @@ class EarningsLineSplitEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'allocated_percentage' => 'double', 'allocate_balance' => null, 'reporting_dimension_value_ids' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'allocated_percentage' => false, + 'allocate_balance' => false, + 'reporting_dimension_value_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; - $this->container['reporting_dimension_value_ids'] = isset($data['reporting_dimension_value_ids']) ? $data['reporting_dimension_value_ids'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('allocate_balance', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -235,12 +323,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -249,7 +340,7 @@ public function setLocationId($location_id) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -259,12 +350,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -273,7 +367,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -283,12 +377,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -297,7 +394,7 @@ public function setAllocateBalance($allocate_balance) /** * Gets reporting_dimension_value_ids * - * @return int[] + * @return int[]|null */ public function getReportingDimensionValueIds() { @@ -307,12 +404,15 @@ public function getReportingDimensionValueIds() /** * Sets reporting_dimension_value_ids * - * @param int[] $reporting_dimension_value_ids + * @param int[]|null $reporting_dimension_value_ids * - * @return $this + * @return self */ public function setReportingDimensionValueIds($reporting_dimension_value_ids) { + if (is_null($reporting_dimension_value_ids)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_ids cannot be null'); + } $this->container['reporting_dimension_value_ids'] = $reporting_dimension_value_ids; return $this; @@ -324,7 +424,7 @@ public function setReportingDimensionValueIds($reporting_dimension_value_ids) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmergencyContactEditModel.php b/src/lib/Model/EmergencyContactEditModel.php index 05916ba..7217236 100644 --- a/src/lib/Model/EmergencyContactEditModel.php +++ b/src/lib/Model/EmergencyContactEditModel.php @@ -2,61 +2,61 @@ /** * EmergencyContactEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmergencyContactEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmergencyContactEditModel implements ModelInterface, ArrayAccess +class EmergencyContactEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmergencyContactEditModel'; + protected static $openAPIModelName = 'EmergencyContactEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'relationship' => 'string', @@ -69,8 +69,10 @@ class EmergencyContactEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'relationship' => null, @@ -79,14 +81,35 @@ class EmergencyContactEditModel implements ModelInterface, ArrayAccess 'alternate_contact_number' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'relationship' => false, + 'address' => false, + 'contact_number' => false, + 'alternate_contact_number' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['relationship'] = isset($data['relationship']) ? $data['relationship'] : null; - $this->container['address'] = isset($data['address']) ? $data['address'] : null; - $this->container['contact_number'] = isset($data['contact_number']) ? $data['contact_number'] : null; - $this->container['alternate_contact_number'] = isset($data['alternate_contact_number']) ? $data['alternate_contact_number'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('relationship', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('contact_number', $data ?? [], null); + $this->setIfExists('alternate_contact_number', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -247,12 +337,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -271,12 +364,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -285,7 +381,7 @@ public function setName($name) /** * Gets relationship * - * @return string + * @return string|null */ public function getRelationship() { @@ -295,12 +391,15 @@ public function getRelationship() /** * Sets relationship * - * @param string $relationship + * @param string|null $relationship * - * @return $this + * @return self */ public function setRelationship($relationship) { + if (is_null($relationship)) { + throw new \InvalidArgumentException('non-nullable relationship cannot be null'); + } $this->container['relationship'] = $relationship; return $this; @@ -309,7 +408,7 @@ public function setRelationship($relationship) /** * Gets address * - * @return string + * @return string|null */ public function getAddress() { @@ -319,12 +418,15 @@ public function getAddress() /** * Sets address * - * @param string $address + * @param string|null $address * - * @return $this + * @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; @@ -333,7 +435,7 @@ public function setAddress($address) /** * Gets contact_number * - * @return string + * @return string|null */ public function getContactNumber() { @@ -343,12 +445,15 @@ public function getContactNumber() /** * Sets contact_number * - * @param string $contact_number + * @param string|null $contact_number * - * @return $this + * @return self */ public function setContactNumber($contact_number) { + if (is_null($contact_number)) { + throw new \InvalidArgumentException('non-nullable contact_number cannot be null'); + } $this->container['contact_number'] = $contact_number; return $this; @@ -357,7 +462,7 @@ public function setContactNumber($contact_number) /** * Gets alternate_contact_number * - * @return string + * @return string|null */ public function getAlternateContactNumber() { @@ -367,12 +472,15 @@ public function getAlternateContactNumber() /** * Sets alternate_contact_number * - * @param string $alternate_contact_number + * @param string|null $alternate_contact_number * - * @return $this + * @return self */ public function setAlternateContactNumber($alternate_contact_number) { + if (is_null($alternate_contact_number)) { + throw new \InvalidArgumentException('non-nullable alternate_contact_number cannot be null'); + } $this->container['alternate_contact_number'] = $alternate_contact_number; return $this; @@ -384,7 +492,7 @@ public function setAlternateContactNumber($alternate_contact_number) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeAccessModel.php b/src/lib/Model/EmployeeAccessModel.php index 84326dc..e672c86 100644 --- a/src/lib/Model/EmployeeAccessModel.php +++ b/src/lib/Model/EmployeeAccessModel.php @@ -2,61 +2,61 @@ /** * EmployeeAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeAccessModel implements ModelInterface, ArrayAccess +class EmployeeAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeAccessModel'; + protected static $openAPIModelName = 'EmployeeAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', 'email' => 'string' ]; @@ -65,20 +65,39 @@ class EmployeeAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'email' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -223,12 +309,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setName($name) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -247,12 +336,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -264,7 +356,7 @@ public function setEmail($email) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDetailsAuditReportApiModel.php b/src/lib/Model/EmployeeDetailsAuditReportApiModel.php index 2dc2d8d..2d1b17c 100644 --- a/src/lib/Model/EmployeeDetailsAuditReportApiModel.php +++ b/src/lib/Model/EmployeeDetailsAuditReportApiModel.php @@ -2,61 +2,61 @@ /** * EmployeeDetailsAuditReportApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDetailsAuditReportApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDetailsAuditReportApiModel implements ModelInterface, ArrayAccess +class EmployeeDetailsAuditReportApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDetailsAuditReportApiModel'; + protected static $openAPIModelName = 'EmployeeDetailsAuditReportApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', @@ -75,8 +75,10 @@ class EmployeeDetailsAuditReportApiModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'first_name' => null, 'surname' => null, @@ -91,14 +93,41 @@ class EmployeeDetailsAuditReportApiModel implements ModelInterface, ArrayAccess 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'timestamp_utc' => false, + 'timestamp_local' => false, + 'section' => false, + 'field_name' => false, + 'old_value' => false, + 'new_value' => false, + 'user_name' => false, + 'channel' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['timestamp_utc'] = isset($data['timestamp_utc']) ? $data['timestamp_utc'] : null; - $this->container['timestamp_local'] = isset($data['timestamp_local']) ? $data['timestamp_local'] : null; - $this->container['section'] = isset($data['section']) ? $data['section'] : null; - $this->container['field_name'] = isset($data['field_name']) ? $data['field_name'] : null; - $this->container['old_value'] = isset($data['old_value']) ? $data['old_value'] : null; - $this->container['new_value'] = isset($data['new_value']) ? $data['new_value'] : null; - $this->container['user_name'] = isset($data['user_name']) ? $data['user_name'] : null; - $this->container['channel'] = isset($data['channel']) ? $data['channel'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('timestamp_utc', $data ?? [], null); + $this->setIfExists('timestamp_local', $data ?? [], null); + $this->setIfExists('section', $data ?? [], null); + $this->setIfExists('field_name', $data ?? [], null); + $this->setIfExists('old_value', $data ?? [], null); + $this->setIfExists('new_value', $data ?? [], null); + $this->setIfExists('user_name', $data ?? [], null); + $this->setIfExists('channel', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -283,12 +379,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -297,7 +396,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -307,12 +406,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -321,7 +423,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -331,12 +433,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -345,7 +450,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -355,12 +460,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -369,7 +477,7 @@ public function setExternalId($external_id) /** * Gets timestamp_utc * - * @return \DateTime + * @return \DateTime|null */ public function getTimestampUtc() { @@ -379,12 +487,15 @@ public function getTimestampUtc() /** * Sets timestamp_utc * - * @param \DateTime $timestamp_utc + * @param \DateTime|null $timestamp_utc * - * @return $this + * @return self */ public function setTimestampUtc($timestamp_utc) { + if (is_null($timestamp_utc)) { + throw new \InvalidArgumentException('non-nullable timestamp_utc cannot be null'); + } $this->container['timestamp_utc'] = $timestamp_utc; return $this; @@ -393,7 +504,7 @@ public function setTimestampUtc($timestamp_utc) /** * Gets timestamp_local * - * @return \DateTime + * @return \DateTime|null */ public function getTimestampLocal() { @@ -403,12 +514,15 @@ public function getTimestampLocal() /** * Sets timestamp_local * - * @param \DateTime $timestamp_local + * @param \DateTime|null $timestamp_local * - * @return $this + * @return self */ public function setTimestampLocal($timestamp_local) { + if (is_null($timestamp_local)) { + throw new \InvalidArgumentException('non-nullable timestamp_local cannot be null'); + } $this->container['timestamp_local'] = $timestamp_local; return $this; @@ -417,7 +531,7 @@ public function setTimestampLocal($timestamp_local) /** * Gets section * - * @return string + * @return string|null */ public function getSection() { @@ -427,12 +541,15 @@ public function getSection() /** * Sets section * - * @param string $section + * @param string|null $section * - * @return $this + * @return self */ public function setSection($section) { + if (is_null($section)) { + throw new \InvalidArgumentException('non-nullable section cannot be null'); + } $this->container['section'] = $section; return $this; @@ -441,7 +558,7 @@ public function setSection($section) /** * Gets field_name * - * @return string + * @return string|null */ public function getFieldName() { @@ -451,12 +568,15 @@ public function getFieldName() /** * Sets field_name * - * @param string $field_name + * @param string|null $field_name * - * @return $this + * @return self */ public function setFieldName($field_name) { + if (is_null($field_name)) { + throw new \InvalidArgumentException('non-nullable field_name cannot be null'); + } $this->container['field_name'] = $field_name; return $this; @@ -465,7 +585,7 @@ public function setFieldName($field_name) /** * Gets old_value * - * @return string + * @return string|null */ public function getOldValue() { @@ -475,12 +595,15 @@ public function getOldValue() /** * Sets old_value * - * @param string $old_value + * @param string|null $old_value * - * @return $this + * @return self */ public function setOldValue($old_value) { + if (is_null($old_value)) { + throw new \InvalidArgumentException('non-nullable old_value cannot be null'); + } $this->container['old_value'] = $old_value; return $this; @@ -489,7 +612,7 @@ public function setOldValue($old_value) /** * Gets new_value * - * @return string + * @return string|null */ public function getNewValue() { @@ -499,12 +622,15 @@ public function getNewValue() /** * Sets new_value * - * @param string $new_value + * @param string|null $new_value * - * @return $this + * @return self */ public function setNewValue($new_value) { + if (is_null($new_value)) { + throw new \InvalidArgumentException('non-nullable new_value cannot be null'); + } $this->container['new_value'] = $new_value; return $this; @@ -513,7 +639,7 @@ public function setNewValue($new_value) /** * Gets user_name * - * @return string + * @return string|null */ public function getUserName() { @@ -523,12 +649,15 @@ public function getUserName() /** * Sets user_name * - * @param string $user_name + * @param string|null $user_name * - * @return $this + * @return self */ public function setUserName($user_name) { + if (is_null($user_name)) { + throw new \InvalidArgumentException('non-nullable user_name cannot be null'); + } $this->container['user_name'] = $user_name; return $this; @@ -537,7 +666,7 @@ public function setUserName($user_name) /** * Gets channel * - * @return string + * @return string|null */ public function getChannel() { @@ -547,12 +676,15 @@ public function getChannel() /** * Sets channel * - * @param string $channel + * @param string|null $channel * - * @return $this + * @return self */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $this->container['channel'] = $channel; return $this; @@ -564,7 +696,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDetailsAuditReportRequestModel.php b/src/lib/Model/EmployeeDetailsAuditReportRequestModel.php index 5cecb44..6a2984a 100644 --- a/src/lib/Model/EmployeeDetailsAuditReportRequestModel.php +++ b/src/lib/Model/EmployeeDetailsAuditReportRequestModel.php @@ -2,61 +2,61 @@ /** * EmployeeDetailsAuditReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDetailsAuditReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDetailsAuditReportRequestModel implements ModelInterface, ArrayAccess +class EmployeeDetailsAuditReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDetailsAuditReportRequestModel'; + protected static $openAPIModelName = 'EmployeeDetailsAuditReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'section' => 'string', 'pay_schedule_id' => 'int', @@ -71,8 +71,10 @@ class EmployeeDetailsAuditReportRequestModel implements ModelInterface, ArrayAcc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'section' => null, 'pay_schedule_id' => 'int32', @@ -83,14 +85,37 @@ class EmployeeDetailsAuditReportRequestModel implements ModelInterface, ArrayAcc 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'section' => false, + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,45 +267,43 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SECTION_EMPLOYEE_DETAILS = 'EmployeeDetails'; - const SECTION_EMERGENCY_CONTACTS = 'EmergencyContacts'; - const SECTION_TAX_FILE_DECLARATION = 'TaxFileDeclaration'; - const SECTION_PAY_RUN_DEFAULTS = 'PayRunDefaults'; - const SECTION_BANK_ACCOUNTS = 'BankAccounts'; - const SECTION_SUPER_FUNDS = 'SuperFunds'; - const SECTION_LOCATIONS = 'Locations'; - const SECTION_WORK_TYPES = 'WorkTypes'; - const SECTION_QUALIFICATIONS = 'Qualifications'; - const SECTION_RECURRING_TRANSACTIONS = 'RecurringTransactions'; - const SECTION_PAY_RATES = 'PayRates'; - const SECTION_LEAVE_ALLOWANCES = 'LeaveAllowances'; - const SECTION_ADDITIONAL_EARNINGS_LINES = 'AdditionalEarningsLines'; - const SECTION_NOTES = 'Notes'; - const SECTION_OPENING_BALANCES = 'OpeningBalances'; - const SECTION_EMPLOYEE_PORTAL_ACCESS = 'EmployeePortalAccess'; - const SECTION_KIOSK_ACCESS = 'KioskAccess'; - const SECTION_DOCUMENTS = 'Documents'; - const SECTION_UNAVAILABILITIES = 'Unavailabilities'; - const SECTION_NATIONAL_INSURANCE_RECORD = 'NationalInsuranceRecord'; - const SECTION_PENSION_SETTINGS = 'PensionSettings'; - const SECTION_KIWI_SAVER = 'KiwiSaver'; - const SECTION_TAX_CODE_DECLARATION = 'TaxCodeDeclaration'; - const SECTION_NATIONAL_REGISTRATION_IDENTITY_RECORD = 'NationalRegistrationIdentityRecord'; - const SECTION_LEAVE_PAY_SETTINGS = 'LeavePaySettings'; - const SECTION_EMPLOYEE_STATUTORY_DETAILS = 'EmployeeStatutoryDetails'; - const SECTION_EMPLOYEE_SCHEDULED_UPDATES = 'EmployeeScheduledUpdates'; - const SECTION_EARNINGS_CERTIFICATE = 'EarningsCertificate'; - const SECTION_PREVIOUS_EMPLOYER = 'PreviousEmployer'; - const SECTION_JOB_KEEPER = 'JobKeeper'; - const SECTION_JOB_MAKER = 'JobMaker'; - const SECTION_SELF_MANAGED_SUPER_FUNDS = 'SelfManagedSuperFunds'; - const SECTION_CIS_SUBCONTRACTOR = 'CisSubcontractor'; - - - + return self::$openAPIModelName; + } + + public const SECTION_EMPLOYEE_DETAILS = 'EmployeeDetails'; + public const SECTION_EMERGENCY_CONTACTS = 'EmergencyContacts'; + public const SECTION_TAX_FILE_DECLARATION = 'TaxFileDeclaration'; + public const SECTION_PAY_RUN_DEFAULTS = 'PayRunDefaults'; + public const SECTION_BANK_ACCOUNTS = 'BankAccounts'; + public const SECTION_SUPER_FUNDS = 'SuperFunds'; + public const SECTION_LOCATIONS = 'Locations'; + public const SECTION_WORK_TYPES = 'WorkTypes'; + public const SECTION_QUALIFICATIONS = 'Qualifications'; + public const SECTION_RECURRING_TRANSACTIONS = 'RecurringTransactions'; + public const SECTION_PAY_RATES = 'PayRates'; + public const SECTION_LEAVE_ALLOWANCES = 'LeaveAllowances'; + public const SECTION_ADDITIONAL_EARNINGS_LINES = 'AdditionalEarningsLines'; + public const SECTION_NOTES = 'Notes'; + public const SECTION_OPENING_BALANCES = 'OpeningBalances'; + public const SECTION_EMPLOYEE_PORTAL_ACCESS = 'EmployeePortalAccess'; + public const SECTION_KIOSK_ACCESS = 'KioskAccess'; + public const SECTION_DOCUMENTS = 'Documents'; + public const SECTION_UNAVAILABILITIES = 'Unavailabilities'; + public const SECTION_NATIONAL_INSURANCE_RECORD = 'NationalInsuranceRecord'; + public const SECTION_PENSION_SETTINGS = 'PensionSettings'; + public const SECTION_KIWI_SAVER = 'KiwiSaver'; + public const SECTION_TAX_CODE_DECLARATION = 'TaxCodeDeclaration'; + public const SECTION_NATIONAL_REGISTRATION_IDENTITY_RECORD = 'NationalRegistrationIdentityRecord'; + public const SECTION_LEAVE_PAY_SETTINGS = 'LeavePaySettings'; + public const SECTION_EMPLOYEE_STATUTORY_DETAILS = 'EmployeeStatutoryDetails'; + public const SECTION_EMPLOYEE_SCHEDULED_UPDATES = 'EmployeeScheduledUpdates'; + public const SECTION_EARNINGS_CERTIFICATE = 'EarningsCertificate'; + public const SECTION_PREVIOUS_EMPLOYER = 'PreviousEmployer'; + public const SECTION_JOB_KEEPER = 'JobKeeper'; + public const SECTION_JOB_MAKER = 'JobMaker'; + public const SECTION_SELF_MANAGED_SUPER_FUNDS = 'SelfManagedSuperFunds'; + public const SECTION_CIS_SUBCONTRACTOR = 'CisSubcontractor'; + /** * Gets allowable values of the enum * @@ -272,7 +347,6 @@ public function getSectionAllowableValues() self::SECTION_CIS_SUBCONTRACTOR, ]; } - /** * Associative array for storing property values @@ -289,14 +363,32 @@ public function getSectionAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['section'] = isset($data['section']) ? $data['section'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('section', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -311,7 +403,8 @@ public function listInvalidProperties() $allowedValues = $this->getSectionAllowableValues(); if (!is_null($this->container['section']) && !in_array($this->container['section'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'section', must be one of '%s'", + "invalid value '%s' for 'section', must be one of '%s'", + $this->container['section'], implode("', '", $allowedValues) ); } @@ -334,7 +427,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -344,12 +437,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -358,7 +454,7 @@ public function setEmployeeId($employee_id) /** * Gets section * - * @return string + * @return string|null */ public function getSection() { @@ -368,17 +464,21 @@ public function getSection() /** * Sets section * - * @param string $section + * @param string|null $section * - * @return $this + * @return self */ public function setSection($section) { + if (is_null($section)) { + throw new \InvalidArgumentException('non-nullable section cannot be null'); + } $allowedValues = $this->getSectionAllowableValues(); - if (!is_null($section) && !in_array($section, $allowedValues, true)) { + if (!in_array($section, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'section', must be one of '%s'", + "Invalid value '%s' for 'section', must be one of '%s'", + $section, implode("', '", $allowedValues) ) ); @@ -391,7 +491,7 @@ public function setSection($section) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -401,12 +501,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -415,7 +518,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -425,12 +528,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -439,7 +545,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -449,12 +555,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -463,7 +572,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -473,12 +582,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -487,7 +599,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -497,12 +609,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -511,7 +626,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -521,12 +636,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -538,7 +656,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -548,22 +666,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -579,11 +698,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -591,13 +723,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDetailsFields.php b/src/lib/Model/EmployeeDetailsFields.php index 0e9637e..83d1de6 100644 --- a/src/lib/Model/EmployeeDetailsFields.php +++ b/src/lib/Model/EmployeeDetailsFields.php @@ -2,61 +2,61 @@ /** * EmployeeDetailsFields * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDetailsFields Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDetailsFields implements ModelInterface, ArrayAccess +class EmployeeDetailsFields implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDetailsFields'; + protected static $openAPIModelName = 'EmployeeDetailsFields'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'show_start_date' => 'bool', 'show_title' => 'bool', 'show_preferred_name' => 'bool', @@ -73,8 +73,10 @@ class EmployeeDetailsFields implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'show_start_date' => null, 'show_title' => null, 'show_preferred_name' => null, @@ -87,14 +89,39 @@ class EmployeeDetailsFields implements ModelInterface, ArrayAccess 'is_address_mandatory' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'show_start_date' => false, + 'show_title' => false, + 'show_preferred_name' => false, + 'show_previous_surname' => false, + 'show_gender' => false, + 'show_date_of_birth' => false, + 'show_anniversary_date' => false, + 'show_postal_address' => false, + 'is_name_mandatory' => false, + 'is_address_mandatory' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['show_start_date'] = isset($data['show_start_date']) ? $data['show_start_date'] : null; - $this->container['show_title'] = isset($data['show_title']) ? $data['show_title'] : null; - $this->container['show_preferred_name'] = isset($data['show_preferred_name']) ? $data['show_preferred_name'] : null; - $this->container['show_previous_surname'] = isset($data['show_previous_surname']) ? $data['show_previous_surname'] : null; - $this->container['show_gender'] = isset($data['show_gender']) ? $data['show_gender'] : null; - $this->container['show_date_of_birth'] = isset($data['show_date_of_birth']) ? $data['show_date_of_birth'] : null; - $this->container['show_anniversary_date'] = isset($data['show_anniversary_date']) ? $data['show_anniversary_date'] : null; - $this->container['show_postal_address'] = isset($data['show_postal_address']) ? $data['show_postal_address'] : null; - $this->container['is_name_mandatory'] = isset($data['is_name_mandatory']) ? $data['is_name_mandatory'] : null; - $this->container['is_address_mandatory'] = isset($data['is_address_mandatory']) ? $data['is_address_mandatory'] : null; + $this->setIfExists('show_start_date', $data ?? [], null); + $this->setIfExists('show_title', $data ?? [], null); + $this->setIfExists('show_preferred_name', $data ?? [], null); + $this->setIfExists('show_previous_surname', $data ?? [], null); + $this->setIfExists('show_gender', $data ?? [], null); + $this->setIfExists('show_date_of_birth', $data ?? [], null); + $this->setIfExists('show_anniversary_date', $data ?? [], null); + $this->setIfExists('show_postal_address', $data ?? [], null); + $this->setIfExists('is_name_mandatory', $data ?? [], null); + $this->setIfExists('is_address_mandatory', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets show_start_date * - * @return bool + * @return bool|null */ public function getShowStartDate() { @@ -271,12 +365,15 @@ public function getShowStartDate() /** * Sets show_start_date * - * @param bool $show_start_date + * @param bool|null $show_start_date * - * @return $this + * @return self */ public function setShowStartDate($show_start_date) { + if (is_null($show_start_date)) { + throw new \InvalidArgumentException('non-nullable show_start_date cannot be null'); + } $this->container['show_start_date'] = $show_start_date; return $this; @@ -285,7 +382,7 @@ public function setShowStartDate($show_start_date) /** * Gets show_title * - * @return bool + * @return bool|null */ public function getShowTitle() { @@ -295,12 +392,15 @@ public function getShowTitle() /** * Sets show_title * - * @param bool $show_title + * @param bool|null $show_title * - * @return $this + * @return self */ public function setShowTitle($show_title) { + if (is_null($show_title)) { + throw new \InvalidArgumentException('non-nullable show_title cannot be null'); + } $this->container['show_title'] = $show_title; return $this; @@ -309,7 +409,7 @@ public function setShowTitle($show_title) /** * Gets show_preferred_name * - * @return bool + * @return bool|null */ public function getShowPreferredName() { @@ -319,12 +419,15 @@ public function getShowPreferredName() /** * Sets show_preferred_name * - * @param bool $show_preferred_name + * @param bool|null $show_preferred_name * - * @return $this + * @return self */ public function setShowPreferredName($show_preferred_name) { + if (is_null($show_preferred_name)) { + throw new \InvalidArgumentException('non-nullable show_preferred_name cannot be null'); + } $this->container['show_preferred_name'] = $show_preferred_name; return $this; @@ -333,7 +436,7 @@ public function setShowPreferredName($show_preferred_name) /** * Gets show_previous_surname * - * @return bool + * @return bool|null */ public function getShowPreviousSurname() { @@ -343,12 +446,15 @@ public function getShowPreviousSurname() /** * Sets show_previous_surname * - * @param bool $show_previous_surname + * @param bool|null $show_previous_surname * - * @return $this + * @return self */ public function setShowPreviousSurname($show_previous_surname) { + if (is_null($show_previous_surname)) { + throw new \InvalidArgumentException('non-nullable show_previous_surname cannot be null'); + } $this->container['show_previous_surname'] = $show_previous_surname; return $this; @@ -357,7 +463,7 @@ public function setShowPreviousSurname($show_previous_surname) /** * Gets show_gender * - * @return bool + * @return bool|null */ public function getShowGender() { @@ -367,12 +473,15 @@ public function getShowGender() /** * Sets show_gender * - * @param bool $show_gender + * @param bool|null $show_gender * - * @return $this + * @return self */ public function setShowGender($show_gender) { + if (is_null($show_gender)) { + throw new \InvalidArgumentException('non-nullable show_gender cannot be null'); + } $this->container['show_gender'] = $show_gender; return $this; @@ -381,7 +490,7 @@ public function setShowGender($show_gender) /** * Gets show_date_of_birth * - * @return bool + * @return bool|null */ public function getShowDateOfBirth() { @@ -391,12 +500,15 @@ public function getShowDateOfBirth() /** * Sets show_date_of_birth * - * @param bool $show_date_of_birth + * @param bool|null $show_date_of_birth * - * @return $this + * @return self */ public function setShowDateOfBirth($show_date_of_birth) { + if (is_null($show_date_of_birth)) { + throw new \InvalidArgumentException('non-nullable show_date_of_birth cannot be null'); + } $this->container['show_date_of_birth'] = $show_date_of_birth; return $this; @@ -405,7 +517,7 @@ public function setShowDateOfBirth($show_date_of_birth) /** * Gets show_anniversary_date * - * @return bool + * @return bool|null */ public function getShowAnniversaryDate() { @@ -415,12 +527,15 @@ public function getShowAnniversaryDate() /** * Sets show_anniversary_date * - * @param bool $show_anniversary_date + * @param bool|null $show_anniversary_date * - * @return $this + * @return self */ public function setShowAnniversaryDate($show_anniversary_date) { + if (is_null($show_anniversary_date)) { + throw new \InvalidArgumentException('non-nullable show_anniversary_date cannot be null'); + } $this->container['show_anniversary_date'] = $show_anniversary_date; return $this; @@ -429,7 +544,7 @@ public function setShowAnniversaryDate($show_anniversary_date) /** * Gets show_postal_address * - * @return bool + * @return bool|null */ public function getShowPostalAddress() { @@ -439,12 +554,15 @@ public function getShowPostalAddress() /** * Sets show_postal_address * - * @param bool $show_postal_address + * @param bool|null $show_postal_address * - * @return $this + * @return self */ public function setShowPostalAddress($show_postal_address) { + if (is_null($show_postal_address)) { + throw new \InvalidArgumentException('non-nullable show_postal_address cannot be null'); + } $this->container['show_postal_address'] = $show_postal_address; return $this; @@ -453,7 +571,7 @@ public function setShowPostalAddress($show_postal_address) /** * Gets is_name_mandatory * - * @return bool + * @return bool|null */ public function getIsNameMandatory() { @@ -463,12 +581,15 @@ public function getIsNameMandatory() /** * Sets is_name_mandatory * - * @param bool $is_name_mandatory + * @param bool|null $is_name_mandatory * - * @return $this + * @return self */ public function setIsNameMandatory($is_name_mandatory) { + if (is_null($is_name_mandatory)) { + throw new \InvalidArgumentException('non-nullable is_name_mandatory cannot be null'); + } $this->container['is_name_mandatory'] = $is_name_mandatory; return $this; @@ -477,7 +598,7 @@ public function setIsNameMandatory($is_name_mandatory) /** * Gets is_address_mandatory * - * @return bool + * @return bool|null */ public function getIsAddressMandatory() { @@ -487,12 +608,15 @@ public function getIsAddressMandatory() /** * Sets is_address_mandatory * - * @param bool $is_address_mandatory + * @param bool|null $is_address_mandatory * - * @return $this + * @return self */ public function setIsAddressMandatory($is_address_mandatory) { + if (is_null($is_address_mandatory)) { + throw new \InvalidArgumentException('non-nullable is_address_mandatory cannot be null'); + } $this->container['is_address_mandatory'] = $is_address_mandatory; return $this; @@ -504,7 +628,7 @@ public function setIsAddressMandatory($is_address_mandatory) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDetailsModel.php b/src/lib/Model/EmployeeDetailsModel.php index 1d774a8..ced318c 100644 --- a/src/lib/Model/EmployeeDetailsModel.php +++ b/src/lib/Model/EmployeeDetailsModel.php @@ -2,61 +2,61 @@ /** * EmployeeDetailsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDetailsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDetailsModel implements ModelInterface, ArrayAccess +class EmployeeDetailsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDetailsModel'; + protected static $openAPIModelName = 'EmployeeDetailsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'title' => 'string', 'first_name' => 'string', @@ -93,8 +93,10 @@ class EmployeeDetailsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'title' => null, 'first_name' => null, @@ -127,14 +129,59 @@ class EmployeeDetailsModel implements ModelInterface, ArrayAccess 'postal_county' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'first_name' => false, + 'preferred_name' => false, + 'middle_name' => false, + 'surname' => false, + 'gender' => false, + 'date_of_birth' => false, + 'anniversary_date' => false, + 'external_id' => false, + 'residential_street_address' => false, + 'residential_address_line2' => false, + 'residential_suburb' => false, + 'residential_state' => false, + 'residential_post_code' => false, + 'postal_street_address' => false, + 'postal_address_line2' => false, + 'postal_suburb' => false, + 'postal_state' => false, + 'postal_post_code' => false, + 'email_address' => false, + 'home_phone' => false, + 'work_phone' => false, + 'mobile_phone' => false, + 'start_date' => false, + 'end_date' => false, + 'residential_city' => false, + 'residential_county' => false, + 'postal_city' => false, + 'postal_county' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -142,9 +189,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -300,12 +399,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -322,36 +418,54 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title'] = isset($data['title']) ? $data['title'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['preferred_name'] = isset($data['preferred_name']) ? $data['preferred_name'] : null; - $this->container['middle_name'] = isset($data['middle_name']) ? $data['middle_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['anniversary_date'] = isset($data['anniversary_date']) ? $data['anniversary_date'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['residential_street_address'] = isset($data['residential_street_address']) ? $data['residential_street_address'] : null; - $this->container['residential_address_line2'] = isset($data['residential_address_line2']) ? $data['residential_address_line2'] : null; - $this->container['residential_suburb'] = isset($data['residential_suburb']) ? $data['residential_suburb'] : null; - $this->container['residential_state'] = isset($data['residential_state']) ? $data['residential_state'] : null; - $this->container['residential_post_code'] = isset($data['residential_post_code']) ? $data['residential_post_code'] : null; - $this->container['postal_street_address'] = isset($data['postal_street_address']) ? $data['postal_street_address'] : null; - $this->container['postal_address_line2'] = isset($data['postal_address_line2']) ? $data['postal_address_line2'] : null; - $this->container['postal_suburb'] = isset($data['postal_suburb']) ? $data['postal_suburb'] : null; - $this->container['postal_state'] = isset($data['postal_state']) ? $data['postal_state'] : null; - $this->container['postal_post_code'] = isset($data['postal_post_code']) ? $data['postal_post_code'] : null; - $this->container['email_address'] = isset($data['email_address']) ? $data['email_address'] : null; - $this->container['home_phone'] = isset($data['home_phone']) ? $data['home_phone'] : null; - $this->container['work_phone'] = isset($data['work_phone']) ? $data['work_phone'] : null; - $this->container['mobile_phone'] = isset($data['mobile_phone']) ? $data['mobile_phone'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['residential_city'] = isset($data['residential_city']) ? $data['residential_city'] : null; - $this->container['residential_county'] = isset($data['residential_county']) ? $data['residential_county'] : null; - $this->container['postal_city'] = isset($data['postal_city']) ? $data['postal_city'] : null; - $this->container['postal_county'] = isset($data['postal_county']) ? $data['postal_county'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('preferred_name', $data ?? [], null); + $this->setIfExists('middle_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('gender', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('anniversary_date', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('residential_street_address', $data ?? [], null); + $this->setIfExists('residential_address_line2', $data ?? [], null); + $this->setIfExists('residential_suburb', $data ?? [], null); + $this->setIfExists('residential_state', $data ?? [], null); + $this->setIfExists('residential_post_code', $data ?? [], null); + $this->setIfExists('postal_street_address', $data ?? [], null); + $this->setIfExists('postal_address_line2', $data ?? [], null); + $this->setIfExists('postal_suburb', $data ?? [], null); + $this->setIfExists('postal_state', $data ?? [], null); + $this->setIfExists('postal_post_code', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('home_phone', $data ?? [], null); + $this->setIfExists('work_phone', $data ?? [], null); + $this->setIfExists('mobile_phone', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('residential_city', $data ?? [], null); + $this->setIfExists('residential_county', $data ?? [], null); + $this->setIfExists('postal_city', $data ?? [], null); + $this->setIfExists('postal_county', $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; } /** @@ -381,7 +495,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -391,12 +505,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -405,7 +522,7 @@ public function setId($id) /** * Gets title * - * @return string + * @return string|null */ public function getTitle() { @@ -415,12 +532,15 @@ public function getTitle() /** * Sets title * - * @param string $title + * @param string|null $title * - * @return $this + * @return self */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -429,7 +549,7 @@ public function setTitle($title) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -439,12 +559,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -453,7 +576,7 @@ public function setFirstName($first_name) /** * Gets preferred_name * - * @return string + * @return string|null */ public function getPreferredName() { @@ -463,12 +586,15 @@ public function getPreferredName() /** * Sets preferred_name * - * @param string $preferred_name + * @param string|null $preferred_name * - * @return $this + * @return self */ public function setPreferredName($preferred_name) { + if (is_null($preferred_name)) { + throw new \InvalidArgumentException('non-nullable preferred_name cannot be null'); + } $this->container['preferred_name'] = $preferred_name; return $this; @@ -477,7 +603,7 @@ public function setPreferredName($preferred_name) /** * Gets middle_name * - * @return string + * @return string|null */ public function getMiddleName() { @@ -487,12 +613,15 @@ public function getMiddleName() /** * Sets middle_name * - * @param string $middle_name + * @param string|null $middle_name * - * @return $this + * @return self */ public function setMiddleName($middle_name) { + if (is_null($middle_name)) { + throw new \InvalidArgumentException('non-nullable middle_name cannot be null'); + } $this->container['middle_name'] = $middle_name; return $this; @@ -501,7 +630,7 @@ public function setMiddleName($middle_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -511,12 +640,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -525,7 +657,7 @@ public function setSurname($surname) /** * Gets gender * - * @return string + * @return string|null */ public function getGender() { @@ -535,12 +667,15 @@ public function getGender() /** * Sets gender * - * @param string $gender + * @param string|null $gender * - * @return $this + * @return self */ public function setGender($gender) { + if (is_null($gender)) { + throw new \InvalidArgumentException('non-nullable gender cannot be null'); + } $this->container['gender'] = $gender; return $this; @@ -549,7 +684,7 @@ public function setGender($gender) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -559,12 +694,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -573,7 +711,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets anniversary_date * - * @return \DateTime + * @return \DateTime|null */ public function getAnniversaryDate() { @@ -583,12 +721,15 @@ public function getAnniversaryDate() /** * Sets anniversary_date * - * @param \DateTime $anniversary_date + * @param \DateTime|null $anniversary_date * - * @return $this + * @return self */ public function setAnniversaryDate($anniversary_date) { + if (is_null($anniversary_date)) { + throw new \InvalidArgumentException('non-nullable anniversary_date cannot be null'); + } $this->container['anniversary_date'] = $anniversary_date; return $this; @@ -597,7 +738,7 @@ public function setAnniversaryDate($anniversary_date) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -607,12 +748,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -621,7 +765,7 @@ public function setExternalId($external_id) /** * Gets residential_street_address * - * @return string + * @return string|null */ public function getResidentialStreetAddress() { @@ -631,12 +775,15 @@ public function getResidentialStreetAddress() /** * Sets residential_street_address * - * @param string $residential_street_address + * @param string|null $residential_street_address * - * @return $this + * @return self */ public function setResidentialStreetAddress($residential_street_address) { + if (is_null($residential_street_address)) { + throw new \InvalidArgumentException('non-nullable residential_street_address cannot be null'); + } $this->container['residential_street_address'] = $residential_street_address; return $this; @@ -645,7 +792,7 @@ public function setResidentialStreetAddress($residential_street_address) /** * Gets residential_address_line2 * - * @return string + * @return string|null */ public function getResidentialAddressLine2() { @@ -655,12 +802,15 @@ public function getResidentialAddressLine2() /** * Sets residential_address_line2 * - * @param string $residential_address_line2 + * @param string|null $residential_address_line2 * - * @return $this + * @return self */ public function setResidentialAddressLine2($residential_address_line2) { + if (is_null($residential_address_line2)) { + throw new \InvalidArgumentException('non-nullable residential_address_line2 cannot be null'); + } $this->container['residential_address_line2'] = $residential_address_line2; return $this; @@ -669,7 +819,7 @@ public function setResidentialAddressLine2($residential_address_line2) /** * Gets residential_suburb * - * @return string + * @return string|null */ public function getResidentialSuburb() { @@ -679,12 +829,15 @@ public function getResidentialSuburb() /** * Sets residential_suburb * - * @param string $residential_suburb + * @param string|null $residential_suburb * - * @return $this + * @return self */ public function setResidentialSuburb($residential_suburb) { + if (is_null($residential_suburb)) { + throw new \InvalidArgumentException('non-nullable residential_suburb cannot be null'); + } $this->container['residential_suburb'] = $residential_suburb; return $this; @@ -693,7 +846,7 @@ public function setResidentialSuburb($residential_suburb) /** * Gets residential_state * - * @return string + * @return string|null */ public function getResidentialState() { @@ -703,12 +856,15 @@ public function getResidentialState() /** * Sets residential_state * - * @param string $residential_state + * @param string|null $residential_state * - * @return $this + * @return self */ public function setResidentialState($residential_state) { + if (is_null($residential_state)) { + throw new \InvalidArgumentException('non-nullable residential_state cannot be null'); + } $this->container['residential_state'] = $residential_state; return $this; @@ -717,7 +873,7 @@ public function setResidentialState($residential_state) /** * Gets residential_post_code * - * @return string + * @return string|null */ public function getResidentialPostCode() { @@ -727,12 +883,15 @@ public function getResidentialPostCode() /** * Sets residential_post_code * - * @param string $residential_post_code + * @param string|null $residential_post_code * - * @return $this + * @return self */ public function setResidentialPostCode($residential_post_code) { + if (is_null($residential_post_code)) { + throw new \InvalidArgumentException('non-nullable residential_post_code cannot be null'); + } $this->container['residential_post_code'] = $residential_post_code; return $this; @@ -741,7 +900,7 @@ public function setResidentialPostCode($residential_post_code) /** * Gets postal_street_address * - * @return string + * @return string|null */ public function getPostalStreetAddress() { @@ -751,12 +910,15 @@ public function getPostalStreetAddress() /** * Sets postal_street_address * - * @param string $postal_street_address + * @param string|null $postal_street_address * - * @return $this + * @return self */ public function setPostalStreetAddress($postal_street_address) { + if (is_null($postal_street_address)) { + throw new \InvalidArgumentException('non-nullable postal_street_address cannot be null'); + } $this->container['postal_street_address'] = $postal_street_address; return $this; @@ -765,7 +927,7 @@ public function setPostalStreetAddress($postal_street_address) /** * Gets postal_address_line2 * - * @return string + * @return string|null */ public function getPostalAddressLine2() { @@ -775,12 +937,15 @@ public function getPostalAddressLine2() /** * Sets postal_address_line2 * - * @param string $postal_address_line2 + * @param string|null $postal_address_line2 * - * @return $this + * @return self */ public function setPostalAddressLine2($postal_address_line2) { + if (is_null($postal_address_line2)) { + throw new \InvalidArgumentException('non-nullable postal_address_line2 cannot be null'); + } $this->container['postal_address_line2'] = $postal_address_line2; return $this; @@ -789,7 +954,7 @@ public function setPostalAddressLine2($postal_address_line2) /** * Gets postal_suburb * - * @return string + * @return string|null */ public function getPostalSuburb() { @@ -799,12 +964,15 @@ public function getPostalSuburb() /** * Sets postal_suburb * - * @param string $postal_suburb + * @param string|null $postal_suburb * - * @return $this + * @return self */ public function setPostalSuburb($postal_suburb) { + if (is_null($postal_suburb)) { + throw new \InvalidArgumentException('non-nullable postal_suburb cannot be null'); + } $this->container['postal_suburb'] = $postal_suburb; return $this; @@ -813,7 +981,7 @@ public function setPostalSuburb($postal_suburb) /** * Gets postal_state * - * @return string + * @return string|null */ public function getPostalState() { @@ -823,12 +991,15 @@ public function getPostalState() /** * Sets postal_state * - * @param string $postal_state + * @param string|null $postal_state * - * @return $this + * @return self */ public function setPostalState($postal_state) { + if (is_null($postal_state)) { + throw new \InvalidArgumentException('non-nullable postal_state cannot be null'); + } $this->container['postal_state'] = $postal_state; return $this; @@ -837,7 +1008,7 @@ public function setPostalState($postal_state) /** * Gets postal_post_code * - * @return string + * @return string|null */ public function getPostalPostCode() { @@ -847,12 +1018,15 @@ public function getPostalPostCode() /** * Sets postal_post_code * - * @param string $postal_post_code + * @param string|null $postal_post_code * - * @return $this + * @return self */ public function setPostalPostCode($postal_post_code) { + if (is_null($postal_post_code)) { + throw new \InvalidArgumentException('non-nullable postal_post_code cannot be null'); + } $this->container['postal_post_code'] = $postal_post_code; return $this; @@ -861,7 +1035,7 @@ public function setPostalPostCode($postal_post_code) /** * Gets email_address * - * @return string + * @return string|null */ public function getEmailAddress() { @@ -871,12 +1045,15 @@ public function getEmailAddress() /** * Sets email_address * - * @param string $email_address + * @param string|null $email_address * - * @return $this + * @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; @@ -885,7 +1062,7 @@ public function setEmailAddress($email_address) /** * Gets home_phone * - * @return string + * @return string|null */ public function getHomePhone() { @@ -895,12 +1072,15 @@ public function getHomePhone() /** * Sets home_phone * - * @param string $home_phone + * @param string|null $home_phone * - * @return $this + * @return self */ public function setHomePhone($home_phone) { + if (is_null($home_phone)) { + throw new \InvalidArgumentException('non-nullable home_phone cannot be null'); + } $this->container['home_phone'] = $home_phone; return $this; @@ -909,7 +1089,7 @@ public function setHomePhone($home_phone) /** * Gets work_phone * - * @return string + * @return string|null */ public function getWorkPhone() { @@ -919,12 +1099,15 @@ public function getWorkPhone() /** * Sets work_phone * - * @param string $work_phone + * @param string|null $work_phone * - * @return $this + * @return self */ public function setWorkPhone($work_phone) { + if (is_null($work_phone)) { + throw new \InvalidArgumentException('non-nullable work_phone cannot be null'); + } $this->container['work_phone'] = $work_phone; return $this; @@ -933,7 +1116,7 @@ public function setWorkPhone($work_phone) /** * Gets mobile_phone * - * @return string + * @return string|null */ public function getMobilePhone() { @@ -943,12 +1126,15 @@ public function getMobilePhone() /** * Sets mobile_phone * - * @param string $mobile_phone + * @param string|null $mobile_phone * - * @return $this + * @return self */ public function setMobilePhone($mobile_phone) { + if (is_null($mobile_phone)) { + throw new \InvalidArgumentException('non-nullable mobile_phone cannot be null'); + } $this->container['mobile_phone'] = $mobile_phone; return $this; @@ -957,7 +1143,7 @@ public function setMobilePhone($mobile_phone) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -967,12 +1153,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -981,7 +1170,7 @@ public function setStartDate($start_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -991,12 +1180,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -1005,7 +1197,7 @@ public function setEndDate($end_date) /** * Gets residential_city * - * @return string + * @return string|null */ public function getResidentialCity() { @@ -1015,12 +1207,15 @@ public function getResidentialCity() /** * Sets residential_city * - * @param string $residential_city + * @param string|null $residential_city * - * @return $this + * @return self */ public function setResidentialCity($residential_city) { + if (is_null($residential_city)) { + throw new \InvalidArgumentException('non-nullable residential_city cannot be null'); + } $this->container['residential_city'] = $residential_city; return $this; @@ -1029,7 +1224,7 @@ public function setResidentialCity($residential_city) /** * Gets residential_county * - * @return string + * @return string|null */ public function getResidentialCounty() { @@ -1039,12 +1234,15 @@ public function getResidentialCounty() /** * Sets residential_county * - * @param string $residential_county + * @param string|null $residential_county * - * @return $this + * @return self */ public function setResidentialCounty($residential_county) { + if (is_null($residential_county)) { + throw new \InvalidArgumentException('non-nullable residential_county cannot be null'); + } $this->container['residential_county'] = $residential_county; return $this; @@ -1053,7 +1251,7 @@ public function setResidentialCounty($residential_county) /** * Gets postal_city * - * @return string + * @return string|null */ public function getPostalCity() { @@ -1063,12 +1261,15 @@ public function getPostalCity() /** * Sets postal_city * - * @param string $postal_city + * @param string|null $postal_city * - * @return $this + * @return self */ public function setPostalCity($postal_city) { + if (is_null($postal_city)) { + throw new \InvalidArgumentException('non-nullable postal_city cannot be null'); + } $this->container['postal_city'] = $postal_city; return $this; @@ -1077,7 +1278,7 @@ public function setPostalCity($postal_city) /** * Gets postal_county * - * @return string + * @return string|null */ public function getPostalCounty() { @@ -1087,12 +1288,15 @@ public function getPostalCounty() /** * Sets postal_county * - * @param string $postal_county + * @param string|null $postal_county * - * @return $this + * @return self */ public function setPostalCounty($postal_county) { + if (is_null($postal_county)) { + throw new \InvalidArgumentException('non-nullable postal_county cannot be null'); + } $this->container['postal_county'] = $postal_county; return $this; @@ -1104,7 +1308,7 @@ public function setPostalCounty($postal_county) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1114,22 +1318,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1145,11 +1350,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1157,13 +1375,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDetailsReportField.php b/src/lib/Model/EmployeeDetailsReportField.php index bb212fe..0416061 100644 --- a/src/lib/Model/EmployeeDetailsReportField.php +++ b/src/lib/Model/EmployeeDetailsReportField.php @@ -2,61 +2,61 @@ /** * EmployeeDetailsReportField * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDetailsReportField Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDetailsReportField implements ModelInterface, ArrayAccess +class EmployeeDetailsReportField implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDetailsReportField'; + protected static $openAPIModelName = 'EmployeeDetailsReportField'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'value' => 'string', 'display_text' => 'string' ]; @@ -65,20 +65,39 @@ class EmployeeDetailsReportField implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'value' => null, 'display_text' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'value' => false, + 'display_text' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['display_text'] = isset($data['display_text']) ? $data['display_text'] : null; + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('display_text', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -223,12 +309,15 @@ public function getValue() /** * Sets value * - * @param string $value + * @param string|null $value * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setValue($value) /** * Gets display_text * - * @return string + * @return string|null */ public function getDisplayText() { @@ -247,12 +336,15 @@ public function getDisplayText() /** * Sets display_text * - * @param string $display_text + * @param string|null $display_text * - * @return $this + * @return self */ public function setDisplayText($display_text) { + if (is_null($display_text)) { + throw new \InvalidArgumentException('non-nullable display_text cannot be null'); + } $this->container['display_text'] = $display_text; return $this; @@ -264,7 +356,7 @@ public function setDisplayText($display_text) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDetailsReportRequestModel.php b/src/lib/Model/EmployeeDetailsReportRequestModel.php index 8e01f97..ea158b0 100644 --- a/src/lib/Model/EmployeeDetailsReportRequestModel.php +++ b/src/lib/Model/EmployeeDetailsReportRequestModel.php @@ -2,61 +2,61 @@ /** * EmployeeDetailsReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDetailsReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDetailsReportRequestModel implements ModelInterface, ArrayAccess +class EmployeeDetailsReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDetailsReportRequestModel'; + protected static $openAPIModelName = 'EmployeeDetailsReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'selected_columns' => 'string[]', 'location_id' => 'int', 'employing_entity_id' => 'int', @@ -68,8 +68,10 @@ class EmployeeDetailsReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'selected_columns' => null, 'location_id' => 'int32', 'employing_entity_id' => 'int32', @@ -77,14 +79,34 @@ class EmployeeDetailsReportRequestModel implements ModelInterface, ArrayAccess 'include_inactive' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'selected_columns' => false, + 'location_id' => false, + 'employing_entity_id' => false, + 'include_active' => false, + 'include_inactive' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['selected_columns'] = isset($data['selected_columns']) ? $data['selected_columns'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; - $this->container['include_active'] = isset($data['include_active']) ? $data['include_active'] : null; - $this->container['include_inactive'] = isset($data['include_inactive']) ? $data['include_inactive'] : null; + $this->setIfExists('selected_columns', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_id', $data ?? [], null); + $this->setIfExists('include_active', $data ?? [], null); + $this->setIfExists('include_inactive', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets selected_columns * - * @return string[] + * @return string[]|null */ public function getSelectedColumns() { @@ -241,12 +330,15 @@ public function getSelectedColumns() /** * Sets selected_columns * - * @param string[] $selected_columns + * @param string[]|null $selected_columns * - * @return $this + * @return self */ public function setSelectedColumns($selected_columns) { + if (is_null($selected_columns)) { + throw new \InvalidArgumentException('non-nullable selected_columns cannot be null'); + } $this->container['selected_columns'] = $selected_columns; return $this; @@ -255,7 +347,7 @@ public function setSelectedColumns($selected_columns) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -265,12 +357,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -279,7 +374,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -289,12 +384,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -303,7 +401,7 @@ public function setEmployingEntityId($employing_entity_id) /** * Gets include_active * - * @return bool + * @return bool|null */ public function getIncludeActive() { @@ -313,12 +411,15 @@ public function getIncludeActive() /** * Sets include_active * - * @param bool $include_active + * @param bool|null $include_active * - * @return $this + * @return self */ public function setIncludeActive($include_active) { + if (is_null($include_active)) { + throw new \InvalidArgumentException('non-nullable include_active cannot be null'); + } $this->container['include_active'] = $include_active; return $this; @@ -327,7 +428,7 @@ public function setIncludeActive($include_active) /** * Gets include_inactive * - * @return bool + * @return bool|null */ public function getIncludeInactive() { @@ -337,12 +438,15 @@ public function getIncludeInactive() /** * Sets include_inactive * - * @param bool $include_inactive + * @param bool|null $include_inactive * - * @return $this + * @return self */ public function setIncludeInactive($include_inactive) { + if (is_null($include_inactive)) { + throw new \InvalidArgumentException('non-nullable include_inactive cannot be null'); + } $this->container['include_inactive'] = $include_inactive; return $this; @@ -354,7 +458,7 @@ public function setIncludeInactive($include_inactive) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeDocumentModel.php b/src/lib/Model/EmployeeDocumentModel.php index 2a198e5..4ad2272 100644 --- a/src/lib/Model/EmployeeDocumentModel.php +++ b/src/lib/Model/EmployeeDocumentModel.php @@ -2,61 +2,61 @@ /** * EmployeeDocumentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeDocumentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeDocumentModel implements ModelInterface, ArrayAccess +class EmployeeDocumentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeDocumentModel'; + protected static $openAPIModelName = 'EmployeeDocumentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'friendly_name' => 'string', 'date_created' => '\DateTime', @@ -69,8 +69,10 @@ class EmployeeDocumentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'friendly_name' => null, 'date_created' => 'date-time', @@ -79,14 +81,35 @@ class EmployeeDocumentModel implements ModelInterface, ArrayAccess 'timesheet_line_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'friendly_name' => false, + 'date_created' => false, + 'visible' => false, + 'leave_request_id' => false, + 'timesheet_line_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['friendly_name'] = isset($data['friendly_name']) ? $data['friendly_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['visible'] = isset($data['visible']) ? $data['visible'] : null; - $this->container['leave_request_id'] = isset($data['leave_request_id']) ? $data['leave_request_id'] : null; - $this->container['timesheet_line_id'] = isset($data['timesheet_line_id']) ? $data['timesheet_line_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('friendly_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('visible', $data ?? [], null); + $this->setIfExists('leave_request_id', $data ?? [], null); + $this->setIfExists('timesheet_line_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -247,12 +337,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setId($id) /** * Gets friendly_name * - * @return string + * @return string|null */ public function getFriendlyName() { @@ -271,12 +364,15 @@ public function getFriendlyName() /** * Sets friendly_name * - * @param string $friendly_name + * @param string|null $friendly_name * - * @return $this + * @return self */ public function setFriendlyName($friendly_name) { + if (is_null($friendly_name)) { + throw new \InvalidArgumentException('non-nullable friendly_name cannot be null'); + } $this->container['friendly_name'] = $friendly_name; return $this; @@ -285,7 +381,7 @@ public function setFriendlyName($friendly_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -295,12 +391,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -309,7 +408,7 @@ public function setDateCreated($date_created) /** * Gets visible * - * @return bool + * @return bool|null */ public function getVisible() { @@ -319,12 +418,15 @@ public function getVisible() /** * Sets visible * - * @param bool $visible + * @param bool|null $visible * - * @return $this + * @return self */ public function setVisible($visible) { + if (is_null($visible)) { + throw new \InvalidArgumentException('non-nullable visible cannot be null'); + } $this->container['visible'] = $visible; return $this; @@ -333,7 +435,7 @@ public function setVisible($visible) /** * Gets leave_request_id * - * @return int + * @return int|null */ public function getLeaveRequestId() { @@ -343,12 +445,15 @@ public function getLeaveRequestId() /** * Sets leave_request_id * - * @param int $leave_request_id + * @param int|null $leave_request_id * - * @return $this + * @return self */ public function setLeaveRequestId($leave_request_id) { + if (is_null($leave_request_id)) { + throw new \InvalidArgumentException('non-nullable leave_request_id cannot be null'); + } $this->container['leave_request_id'] = $leave_request_id; return $this; @@ -357,7 +462,7 @@ public function setLeaveRequestId($leave_request_id) /** * Gets timesheet_line_id * - * @return int + * @return int|null */ public function getTimesheetLineId() { @@ -367,12 +472,15 @@ public function getTimesheetLineId() /** * Sets timesheet_line_id * - * @param int $timesheet_line_id + * @param int|null $timesheet_line_id * - * @return $this + * @return self */ public function setTimesheetLineId($timesheet_line_id) { + if (is_null($timesheet_line_id)) { + throw new \InvalidArgumentException('non-nullable timesheet_line_id cannot be null'); + } $this->container['timesheet_line_id'] = $timesheet_line_id; return $this; @@ -384,7 +492,7 @@ public function setTimesheetLineId($timesheet_line_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeEmergencyContactsEditModel.php b/src/lib/Model/EmployeeEmergencyContactsEditModel.php index b1eb047..8fa7e2f 100644 --- a/src/lib/Model/EmployeeEmergencyContactsEditModel.php +++ b/src/lib/Model/EmployeeEmergencyContactsEditModel.php @@ -2,63 +2,63 @@ /** * EmployeeEmergencyContactsEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeEmergencyContactsEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeEmergencyContactsEditModel implements ModelInterface, ArrayAccess +class EmployeeEmergencyContactsEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeEmergencyContactsEditModel'; + protected static $openAPIModelName = 'EmployeeEmergencyContactsEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'primary_emergency_contact' => '\Swagger\Client\Model\EmergencyContactEditModel', - 'secondary_emergency_contact' => '\Swagger\Client\Model\EmergencyContactEditModel', + protected static $openAPITypes = [ + 'primary_emergency_contact' => '\OpenAPI\Client\Model\EmergencyContactEditModel', + 'secondary_emergency_contact' => '\OpenAPI\Client\Model\EmergencyContactEditModel', 'can_edit' => 'bool' ]; @@ -66,21 +66,41 @@ class EmployeeEmergencyContactsEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'primary_emergency_contact' => null, 'secondary_emergency_contact' => null, 'can_edit' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'primary_emergency_contact' => false, + 'secondary_emergency_contact' => false, + 'can_edit' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['primary_emergency_contact'] = isset($data['primary_emergency_contact']) ? $data['primary_emergency_contact'] : null; - $this->container['secondary_emergency_contact'] = isset($data['secondary_emergency_contact']) ? $data['secondary_emergency_contact'] : null; - $this->container['can_edit'] = isset($data['can_edit']) ? $data['can_edit'] : null; + $this->setIfExists('primary_emergency_contact', $data ?? [], null); + $this->setIfExists('secondary_emergency_contact', $data ?? [], null); + $this->setIfExists('can_edit', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets primary_emergency_contact * - * @return \Swagger\Client\Model\EmergencyContactEditModel + * @return \OpenAPI\Client\Model\EmergencyContactEditModel|null */ public function getPrimaryEmergencyContact() { @@ -229,12 +316,15 @@ public function getPrimaryEmergencyContact() /** * Sets primary_emergency_contact * - * @param \Swagger\Client\Model\EmergencyContactEditModel $primary_emergency_contact + * @param \OpenAPI\Client\Model\EmergencyContactEditModel|null $primary_emergency_contact primary_emergency_contact * - * @return $this + * @return self */ public function setPrimaryEmergencyContact($primary_emergency_contact) { + if (is_null($primary_emergency_contact)) { + throw new \InvalidArgumentException('non-nullable primary_emergency_contact cannot be null'); + } $this->container['primary_emergency_contact'] = $primary_emergency_contact; return $this; @@ -243,7 +333,7 @@ public function setPrimaryEmergencyContact($primary_emergency_contact) /** * Gets secondary_emergency_contact * - * @return \Swagger\Client\Model\EmergencyContactEditModel + * @return \OpenAPI\Client\Model\EmergencyContactEditModel|null */ public function getSecondaryEmergencyContact() { @@ -253,12 +343,15 @@ public function getSecondaryEmergencyContact() /** * Sets secondary_emergency_contact * - * @param \Swagger\Client\Model\EmergencyContactEditModel $secondary_emergency_contact + * @param \OpenAPI\Client\Model\EmergencyContactEditModel|null $secondary_emergency_contact secondary_emergency_contact * - * @return $this + * @return self */ public function setSecondaryEmergencyContact($secondary_emergency_contact) { + if (is_null($secondary_emergency_contact)) { + throw new \InvalidArgumentException('non-nullable secondary_emergency_contact cannot be null'); + } $this->container['secondary_emergency_contact'] = $secondary_emergency_contact; return $this; @@ -267,7 +360,7 @@ public function setSecondaryEmergencyContact($secondary_emergency_contact) /** * Gets can_edit * - * @return bool + * @return bool|null */ public function getCanEdit() { @@ -277,12 +370,15 @@ public function getCanEdit() /** * Sets can_edit * - * @param bool $can_edit + * @param bool|null $can_edit * - * @return $this + * @return self */ public function setCanEdit($can_edit) { + if (is_null($can_edit)) { + throw new \InvalidArgumentException('non-nullable can_edit cannot be null'); + } $this->container['can_edit'] = $can_edit; return $this; @@ -294,7 +390,7 @@ public function setCanEdit($can_edit) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeExpenseCategoryModel.php b/src/lib/Model/EmployeeExpenseCategoryModel.php index b1325df..e3de881 100644 --- a/src/lib/Model/EmployeeExpenseCategoryModel.php +++ b/src/lib/Model/EmployeeExpenseCategoryModel.php @@ -2,61 +2,61 @@ /** * EmployeeExpenseCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeExpenseCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeExpenseCategoryModel implements ModelInterface, ArrayAccess +class EmployeeExpenseCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeExpenseCategoryModel'; + protected static $openAPIModelName = 'EmployeeExpenseCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'external_id' => 'string', @@ -65,15 +65,17 @@ class EmployeeExpenseCategoryModel implements ModelInterface, ArrayAccess 'external_reference_id' => 'string', 'external_tax_code_id' => 'string', 'tax_code' => 'string', - 'tax_rate' => 'double' + 'tax_rate' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'external_id' => null, @@ -85,14 +87,38 @@ class EmployeeExpenseCategoryModel implements ModelInterface, ArrayAccess 'tax_rate' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'external_id' => false, + 'general_ledger_mapping_code' => false, + 'description' => false, + 'external_reference_id' => false, + 'external_tax_code_id' => false, + 'tax_code' => false, + 'tax_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['general_ledger_mapping_code'] = isset($data['general_ledger_mapping_code']) ? $data['general_ledger_mapping_code'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['external_tax_code_id'] = isset($data['external_tax_code_id']) ? $data['external_tax_code_id'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('external_tax_code_id', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_rate', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +358,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +375,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -289,12 +385,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -303,7 +402,7 @@ public function setName($name) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -313,12 +412,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -327,7 +429,7 @@ public function setExternalId($external_id) /** * Gets general_ledger_mapping_code * - * @return string + * @return string|null */ public function getGeneralLedgerMappingCode() { @@ -337,12 +439,15 @@ public function getGeneralLedgerMappingCode() /** * Sets general_ledger_mapping_code * - * @param string $general_ledger_mapping_code + * @param string|null $general_ledger_mapping_code * - * @return $this + * @return self */ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) { + if (is_null($general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable general_ledger_mapping_code cannot be null'); + } $this->container['general_ledger_mapping_code'] = $general_ledger_mapping_code; return $this; @@ -351,7 +456,7 @@ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -361,12 +466,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -375,7 +483,7 @@ public function setDescription($description) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -385,12 +493,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -399,7 +510,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets external_tax_code_id * - * @return string + * @return string|null */ public function getExternalTaxCodeId() { @@ -409,12 +520,15 @@ public function getExternalTaxCodeId() /** * Sets external_tax_code_id * - * @param string $external_tax_code_id + * @param string|null $external_tax_code_id * - * @return $this + * @return self */ public function setExternalTaxCodeId($external_tax_code_id) { + if (is_null($external_tax_code_id)) { + throw new \InvalidArgumentException('non-nullable external_tax_code_id cannot be null'); + } $this->container['external_tax_code_id'] = $external_tax_code_id; return $this; @@ -423,7 +537,7 @@ public function setExternalTaxCodeId($external_tax_code_id) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -433,12 +547,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -447,7 +564,7 @@ public function setTaxCode($tax_code) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -457,12 +574,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -474,7 +594,7 @@ public function setTaxRate($tax_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeExpenseModel.php b/src/lib/Model/EmployeeExpenseModel.php index 3eab406..62ed97e 100644 --- a/src/lib/Model/EmployeeExpenseModel.php +++ b/src/lib/Model/EmployeeExpenseModel.php @@ -2,70 +2,70 @@ /** * EmployeeExpenseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeExpenseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeExpenseModel implements ModelInterface, ArrayAccess +class EmployeeExpenseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeExpenseModel'; + protected static $openAPIModelName = 'EmployeeExpenseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_expense_category_id' => 'string', 'employee_expense_category_name' => 'string', 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'tax_code' => 'string', - 'tax_rate' => 'double', + 'tax_rate' => 'float', 'tax_code_display_name' => 'string', 'reporting_dimension_value_ids' => 'int[]', - 'reporting_dimension_value_names' => 'map[string,string[]]', + 'reporting_dimension_value_names' => 'array', 'id' => 'int', 'external_id' => 'string', 'location_id' => 'string', @@ -79,8 +79,10 @@ class EmployeeExpenseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_expense_category_id' => null, 'employee_expense_category_name' => null, 'notes' => null, @@ -99,14 +101,45 @@ class EmployeeExpenseModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_expense_category_id' => false, + 'employee_expense_category_name' => false, + 'notes' => false, + 'amount' => false, + 'tax_code' => false, + 'tax_rate' => false, + 'tax_code_display_name' => false, + 'reporting_dimension_value_ids' => false, + 'reporting_dimension_value_names' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -114,9 +147,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -230,12 +315,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -252,22 +334,40 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_expense_category_id'] = isset($data['employee_expense_category_id']) ? $data['employee_expense_category_id'] : null; - $this->container['employee_expense_category_name'] = isset($data['employee_expense_category_name']) ? $data['employee_expense_category_name'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; - $this->container['tax_code_display_name'] = isset($data['tax_code_display_name']) ? $data['tax_code_display_name'] : null; - $this->container['reporting_dimension_value_ids'] = isset($data['reporting_dimension_value_ids']) ? $data['reporting_dimension_value_ids'] : null; - $this->container['reporting_dimension_value_names'] = isset($data['reporting_dimension_value_names']) ? $data['reporting_dimension_value_names'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('employee_expense_category_id', $data ?? [], null); + $this->setIfExists('employee_expense_category_name', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_rate', $data ?? [], null); + $this->setIfExists('tax_code_display_name', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_ids', $data ?? [], null); + $this->setIfExists('reporting_dimension_value_names', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -297,7 +397,7 @@ public function valid() /** * Gets employee_expense_category_id * - * @return string + * @return string|null */ public function getEmployeeExpenseCategoryId() { @@ -307,12 +407,15 @@ public function getEmployeeExpenseCategoryId() /** * Sets employee_expense_category_id * - * @param string $employee_expense_category_id + * @param string|null $employee_expense_category_id * - * @return $this + * @return self */ public function setEmployeeExpenseCategoryId($employee_expense_category_id) { + if (is_null($employee_expense_category_id)) { + throw new \InvalidArgumentException('non-nullable employee_expense_category_id cannot be null'); + } $this->container['employee_expense_category_id'] = $employee_expense_category_id; return $this; @@ -321,7 +424,7 @@ public function setEmployeeExpenseCategoryId($employee_expense_category_id) /** * Gets employee_expense_category_name * - * @return string + * @return string|null */ public function getEmployeeExpenseCategoryName() { @@ -331,12 +434,15 @@ public function getEmployeeExpenseCategoryName() /** * Sets employee_expense_category_name * - * @param string $employee_expense_category_name + * @param string|null $employee_expense_category_name * - * @return $this + * @return self */ public function setEmployeeExpenseCategoryName($employee_expense_category_name) { + if (is_null($employee_expense_category_name)) { + throw new \InvalidArgumentException('non-nullable employee_expense_category_name cannot be null'); + } $this->container['employee_expense_category_name'] = $employee_expense_category_name; return $this; @@ -345,7 +451,7 @@ public function setEmployeeExpenseCategoryName($employee_expense_category_name) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -355,12 +461,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -369,7 +478,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -379,12 +488,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -393,7 +505,7 @@ public function setAmount($amount) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -403,12 +515,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -417,7 +532,7 @@ public function setTaxCode($tax_code) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -427,12 +542,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -441,7 +559,7 @@ public function setTaxRate($tax_rate) /** * Gets tax_code_display_name * - * @return string + * @return string|null */ public function getTaxCodeDisplayName() { @@ -451,12 +569,15 @@ public function getTaxCodeDisplayName() /** * Sets tax_code_display_name * - * @param string $tax_code_display_name + * @param string|null $tax_code_display_name * - * @return $this + * @return self */ public function setTaxCodeDisplayName($tax_code_display_name) { + if (is_null($tax_code_display_name)) { + throw new \InvalidArgumentException('non-nullable tax_code_display_name cannot be null'); + } $this->container['tax_code_display_name'] = $tax_code_display_name; return $this; @@ -465,7 +586,7 @@ public function setTaxCodeDisplayName($tax_code_display_name) /** * Gets reporting_dimension_value_ids * - * @return int[] + * @return int[]|null */ public function getReportingDimensionValueIds() { @@ -475,12 +596,15 @@ public function getReportingDimensionValueIds() /** * Sets reporting_dimension_value_ids * - * @param int[] $reporting_dimension_value_ids Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an array of dimension value ids (normally only one-per dimension) eg [1,3,7].

If you prefer to specify dimension values by name, use the ReportingDimensionValueNames field instead.

If this field is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) + * @param int[]|null $reporting_dimension_value_ids Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an array of dimension value ids (normally only one-per dimension) eg [1,3,7].

If you prefer to specify dimension values by name, use the ReportingDimensionValueNames field instead.

If this field is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) * - * @return $this + * @return self */ public function setReportingDimensionValueIds($reporting_dimension_value_ids) { + if (is_null($reporting_dimension_value_ids)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_ids cannot be null'); + } $this->container['reporting_dimension_value_ids'] = $reporting_dimension_value_ids; return $this; @@ -489,7 +613,7 @@ public function setReportingDimensionValueIds($reporting_dimension_value_ids) /** * Gets reporting_dimension_value_names * - * @return map[string,string[]] + * @return array|null */ public function getReportingDimensionValueNames() { @@ -499,12 +623,15 @@ public function getReportingDimensionValueNames() /** * Sets reporting_dimension_value_names * - * @param map[string,string[]] $reporting_dimension_value_names Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an object with dimension names and for each one, specify an array of associated value names (normally one-per dimension) eg { \"Department\": [\"Accounting\"], \"Job Code\": [\"JC1\"] }.

If you prefer to specify dimension values directly by Id, use the ReportingDimensionValueIds field instead.

If ReportingDimensionValueIds is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) + * @param array|null $reporting_dimension_value_names Nullable

Note: Only applicable to businesses where the Dimensions feature is enabled.

Specify an object with dimension names and for each one, specify an array of associated value names (normally one-per dimension) eg { \"Department\": [\"Accounting\"], \"Job Code\": [\"JC1\"] }.

If you prefer to specify dimension values directly by Id, use the ReportingDimensionValueIds field instead.

If ReportingDimensionValueIds is used, ReportingDimensionValueNames will be ignored (the Ids take precedence) * - * @return $this + * @return self */ public function setReportingDimensionValueNames($reporting_dimension_value_names) { + if (is_null($reporting_dimension_value_names)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_value_names cannot be null'); + } $this->container['reporting_dimension_value_names'] = $reporting_dimension_value_names; return $this; @@ -513,7 +640,7 @@ public function setReportingDimensionValueNames($reporting_dimension_value_names /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -523,12 +650,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -537,7 +667,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -547,12 +677,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -561,7 +694,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -571,12 +704,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -585,7 +721,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -595,12 +731,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -609,7 +748,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -619,12 +758,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -633,7 +775,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -643,12 +785,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -657,7 +802,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -667,12 +812,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -684,7 +832,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -694,22 +842,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -725,11 +874,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -737,13 +899,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeExpensePaymentSummaryModel.php b/src/lib/Model/EmployeeExpensePaymentSummaryModel.php index 421a207..9f52a1a 100644 --- a/src/lib/Model/EmployeeExpensePaymentSummaryModel.php +++ b/src/lib/Model/EmployeeExpensePaymentSummaryModel.php @@ -2,74 +2,76 @@ /** * EmployeeExpensePaymentSummaryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeExpensePaymentSummaryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeExpensePaymentSummaryModel implements ModelInterface, ArrayAccess +class EmployeeExpensePaymentSummaryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeExpensePaymentSummaryModel'; + protected static $openAPIModelName = 'EmployeeExpensePaymentSummaryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'expense_category_id' => 'int', 'expense_category_name' => 'string', - 'ytd_amount' => 'double', - 'total_amount' => 'double' + 'ytd_amount' => 'float', + 'total_amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'expense_category_id' => 'int32', 'expense_category_name' => null, @@ -77,14 +79,34 @@ class EmployeeExpensePaymentSummaryModel implements ModelInterface, ArrayAccess 'total_amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'expense_category_id' => false, + 'expense_category_name' => false, + 'ytd_amount' => false, + 'total_amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['expense_category_id'] = isset($data['expense_category_id']) ? $data['expense_category_id'] : null; - $this->container['expense_category_name'] = isset($data['expense_category_name']) ? $data['expense_category_name'] : null; - $this->container['ytd_amount'] = isset($data['ytd_amount']) ? $data['ytd_amount'] : null; - $this->container['total_amount'] = isset($data['total_amount']) ? $data['total_amount'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('expense_category_id', $data ?? [], null); + $this->setIfExists('expense_category_name', $data ?? [], null); + $this->setIfExists('ytd_amount', $data ?? [], null); + $this->setIfExists('total_amount', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -241,12 +330,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -255,7 +347,7 @@ public function setEmployeeId($employee_id) /** * Gets expense_category_id * - * @return int + * @return int|null */ public function getExpenseCategoryId() { @@ -265,12 +357,15 @@ public function getExpenseCategoryId() /** * Sets expense_category_id * - * @param int $expense_category_id + * @param int|null $expense_category_id * - * @return $this + * @return self */ public function setExpenseCategoryId($expense_category_id) { + if (is_null($expense_category_id)) { + throw new \InvalidArgumentException('non-nullable expense_category_id cannot be null'); + } $this->container['expense_category_id'] = $expense_category_id; return $this; @@ -279,7 +374,7 @@ public function setExpenseCategoryId($expense_category_id) /** * Gets expense_category_name * - * @return string + * @return string|null */ public function getExpenseCategoryName() { @@ -289,12 +384,15 @@ public function getExpenseCategoryName() /** * Sets expense_category_name * - * @param string $expense_category_name + * @param string|null $expense_category_name * - * @return $this + * @return self */ public function setExpenseCategoryName($expense_category_name) { + if (is_null($expense_category_name)) { + throw new \InvalidArgumentException('non-nullable expense_category_name cannot be null'); + } $this->container['expense_category_name'] = $expense_category_name; return $this; @@ -303,7 +401,7 @@ public function setExpenseCategoryName($expense_category_name) /** * Gets ytd_amount * - * @return double + * @return float|null */ public function getYtdAmount() { @@ -313,12 +411,15 @@ public function getYtdAmount() /** * Sets ytd_amount * - * @param double $ytd_amount + * @param float|null $ytd_amount * - * @return $this + * @return self */ public function setYtdAmount($ytd_amount) { + if (is_null($ytd_amount)) { + throw new \InvalidArgumentException('non-nullable ytd_amount cannot be null'); + } $this->container['ytd_amount'] = $ytd_amount; return $this; @@ -327,7 +428,7 @@ public function setYtdAmount($ytd_amount) /** * Gets total_amount * - * @return double + * @return float|null */ public function getTotalAmount() { @@ -337,12 +438,15 @@ public function getTotalAmount() /** * Sets total_amount * - * @param double $total_amount + * @param float|null $total_amount * - * @return $this + * @return self */ public function setTotalAmount($total_amount) { + if (is_null($total_amount)) { + throw new \InvalidArgumentException('non-nullable total_amount cannot be null'); + } $this->container['total_amount'] = $total_amount; return $this; @@ -354,7 +458,7 @@ public function setTotalAmount($total_amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeGroupAccessModel.php b/src/lib/Model/EmployeeGroupAccessModel.php index 94f78fb..6390815 100644 --- a/src/lib/Model/EmployeeGroupAccessModel.php +++ b/src/lib/Model/EmployeeGroupAccessModel.php @@ -2,61 +2,61 @@ /** * EmployeeGroupAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeGroupAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeGroupAccessModel implements ModelInterface, ArrayAccess +class EmployeeGroupAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeGroupAccessModel'; + protected static $openAPIModelName = 'EmployeeGroupAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_group_id' => 'int', 'permissions' => 'string' ]; @@ -65,20 +65,39 @@ class EmployeeGroupAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_group_id' => 'int32', 'permissions' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_group_id' => false, + 'permissions' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,34 +231,32 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const PERMISSIONS_APPROVE_TIMESHEETS = 'ApproveTimesheets'; - const PERMISSIONS_APPROVE_LEAVE_REQUESTS = 'ApproveLeaveRequests'; - const PERMISSIONS_CREATE_TIMESHEETS = 'CreateTimesheets'; - const PERMISSIONS_CREATE_LEAVE_REQUESTS = 'CreateLeaveRequests'; - const PERMISSIONS_VIEW_LEAVE_REQUESTS = 'ViewLeaveRequests'; - const PERMISSIONS_MANAGE_ROSTERS = 'ManageRosters'; - const PERMISSIONS_VIEW_ROSTERS = 'ViewRosters'; - const PERMISSIONS_VIEW_SHIFT_COSTS = 'ViewShiftCosts'; - const PERMISSIONS_VIEW_EXPENSES = 'ViewExpenses'; - const PERMISSIONS_CREATE_EXPENSES = 'CreateExpenses'; - const PERMISSIONS_APPROVE_EXPENSES = 'ApproveExpenses'; - const PERMISSIONS_CREATE_TASKS = 'CreateTasks'; - const PERMISSIONS_VIEW_EMPLOYEE_DOCUMENTS = 'ViewEmployeeDocuments'; - const PERMISSIONS_MANAGE_EMPLOYEE_DOCUMENTS = 'ManageEmployeeDocuments'; - const PERMISSIONS_VIEW_EMPLOYEE_QUALIFICATIONS = 'ViewEmployeeQualifications'; - const PERMISSIONS_MANAGE_EMPLOYEE_QUALIFICATIONS = 'ManageEmployeeQualifications'; - const PERMISSIONS_INITIATE_EMPLOYEE_SELF_SETUP = 'InitiateEmployeeSelfSetup'; - const PERMISSIONS_ADD_EMPLOYEE_FROM_KIOSK = 'AddEmployeeFromKiosk'; - const PERMISSIONS_VIEW_EMPLOYEE_DETAILS = 'ViewEmployeeDetails'; - const PERMISSIONS_EDIT_BASIC_EMPLOYEE_DETAILS = 'EditBasicEmployeeDetails'; - const PERMISSIONS_EDIT_ALL_EMPLOYEE_DETAILS = 'EditAllEmployeeDetails'; - const PERMISSIONS_VIEW_TIMESHEET_REPORTS = 'ViewTimesheetReports'; - - - + public const PERMISSIONS_APPROVE_TIMESHEETS = 'ApproveTimesheets'; + public const PERMISSIONS_APPROVE_LEAVE_REQUESTS = 'ApproveLeaveRequests'; + public const PERMISSIONS_CREATE_TIMESHEETS = 'CreateTimesheets'; + public const PERMISSIONS_CREATE_LEAVE_REQUESTS = 'CreateLeaveRequests'; + public const PERMISSIONS_VIEW_LEAVE_REQUESTS = 'ViewLeaveRequests'; + public const PERMISSIONS_MANAGE_ROSTERS = 'ManageRosters'; + public const PERMISSIONS_VIEW_ROSTERS = 'ViewRosters'; + public const PERMISSIONS_VIEW_SHIFT_COSTS = 'ViewShiftCosts'; + public const PERMISSIONS_VIEW_EXPENSES = 'ViewExpenses'; + public const PERMISSIONS_CREATE_EXPENSES = 'CreateExpenses'; + public const PERMISSIONS_APPROVE_EXPENSES = 'ApproveExpenses'; + public const PERMISSIONS_CREATE_TASKS = 'CreateTasks'; + public const PERMISSIONS_VIEW_EMPLOYEE_DOCUMENTS = 'ViewEmployeeDocuments'; + public const PERMISSIONS_MANAGE_EMPLOYEE_DOCUMENTS = 'ManageEmployeeDocuments'; + public const PERMISSIONS_VIEW_EMPLOYEE_QUALIFICATIONS = 'ViewEmployeeQualifications'; + public const PERMISSIONS_MANAGE_EMPLOYEE_QUALIFICATIONS = 'ManageEmployeeQualifications'; + public const PERMISSIONS_INITIATE_EMPLOYEE_SELF_SETUP = 'InitiateEmployeeSelfSetup'; + public const PERMISSIONS_ADD_EMPLOYEE_FROM_KIOSK = 'AddEmployeeFromKiosk'; + public const PERMISSIONS_VIEW_EMPLOYEE_DETAILS = 'ViewEmployeeDetails'; + public const PERMISSIONS_EDIT_BASIC_EMPLOYEE_DETAILS = 'EditBasicEmployeeDetails'; + public const PERMISSIONS_EDIT_ALL_EMPLOYEE_DETAILS = 'EditAllEmployeeDetails'; + public const PERMISSIONS_VIEW_TIMESHEET_REPORTS = 'ViewTimesheetReports'; + /** * Gets allowable values of the enum * @@ -220,7 +289,6 @@ public function getPermissionsAllowableValues() self::PERMISSIONS_VIEW_TIMESHEET_REPORTS, ]; } - /** * Associative array for storing property values @@ -237,8 +305,26 @@ public function getPermissionsAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_group_id'] = isset($data['employee_group_id']) ? $data['employee_group_id'] : null; - $this->container['permissions'] = isset($data['permissions']) ? $data['permissions'] : null; + $this->setIfExists('employee_group_id', $data ?? [], null); + $this->setIfExists('permissions', $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; } /** @@ -253,7 +339,8 @@ public function listInvalidProperties() $allowedValues = $this->getPermissionsAllowableValues(); if (!is_null($this->container['permissions']) && !in_array($this->container['permissions'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'permissions', must be one of '%s'", + "invalid value '%s' for 'permissions', must be one of '%s'", + $this->container['permissions'], implode("', '", $allowedValues) ); } @@ -276,7 +363,7 @@ public function valid() /** * Gets employee_group_id * - * @return int + * @return int|null */ public function getEmployeeGroupId() { @@ -286,12 +373,15 @@ public function getEmployeeGroupId() /** * Sets employee_group_id * - * @param int $employee_group_id + * @param int|null $employee_group_id * - * @return $this + * @return self */ public function setEmployeeGroupId($employee_group_id) { + if (is_null($employee_group_id)) { + throw new \InvalidArgumentException('non-nullable employee_group_id cannot be null'); + } $this->container['employee_group_id'] = $employee_group_id; return $this; @@ -300,7 +390,7 @@ public function setEmployeeGroupId($employee_group_id) /** * Gets permissions * - * @return string + * @return string|null */ public function getPermissions() { @@ -310,17 +400,21 @@ public function getPermissions() /** * Sets permissions * - * @param string $permissions + * @param string|null $permissions * - * @return $this + * @return self */ public function setPermissions($permissions) { + if (is_null($permissions)) { + throw new \InvalidArgumentException('non-nullable permissions cannot be null'); + } $allowedValues = $this->getPermissionsAllowableValues(); - if (!is_null($permissions) && !in_array($permissions, $allowedValues, true)) { + if (!in_array($permissions, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'permissions', must be one of '%s'", + "Invalid value '%s' for 'permissions', must be one of '%s'", + $permissions, implode("', '", $allowedValues) ) ); @@ -336,7 +430,7 @@ public function setPermissions($permissions) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -346,22 +440,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -377,11 +472,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -389,13 +497,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeGroupItemModel.php b/src/lib/Model/EmployeeGroupItemModel.php index eb5246b..9ddfa50 100644 --- a/src/lib/Model/EmployeeGroupItemModel.php +++ b/src/lib/Model/EmployeeGroupItemModel.php @@ -2,61 +2,61 @@ /** * EmployeeGroupItemModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeGroupItemModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeGroupItemModel implements ModelInterface, ArrayAccess +class EmployeeGroupItemModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeGroupItemModel'; + protected static $openAPIModelName = 'EmployeeGroupItemModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class EmployeeGroupItemModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeGroupPermissionModel.php b/src/lib/Model/EmployeeGroupPermissionModel.php index 3f576c4..347651d 100644 --- a/src/lib/Model/EmployeeGroupPermissionModel.php +++ b/src/lib/Model/EmployeeGroupPermissionModel.php @@ -2,61 +2,61 @@ /** * EmployeeGroupPermissionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeGroupPermissionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeGroupPermissionModel implements ModelInterface, ArrayAccess +class EmployeeGroupPermissionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeGroupPermissionModel'; + protected static $openAPIModelName = 'EmployeeGroupPermissionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'can_approve_leave_requests' => 'bool', 'can_view_leave_requests' => 'bool', @@ -73,8 +73,10 @@ class EmployeeGroupPermissionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'can_approve_leave_requests' => null, 'can_view_leave_requests' => null, @@ -87,14 +89,39 @@ class EmployeeGroupPermissionModel implements ModelInterface, ArrayAccess 'can_manage_rosters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'can_approve_leave_requests' => false, + 'can_view_leave_requests' => false, + 'can_approve_timesheets' => false, + 'can_create_timesheets' => false, + 'can_approve_expenses' => false, + 'can_view_expenses' => false, + 'can_view_shift_costs' => false, + 'can_view_rosters' => false, + 'can_manage_rosters' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['can_approve_leave_requests'] = isset($data['can_approve_leave_requests']) ? $data['can_approve_leave_requests'] : null; - $this->container['can_view_leave_requests'] = isset($data['can_view_leave_requests']) ? $data['can_view_leave_requests'] : null; - $this->container['can_approve_timesheets'] = isset($data['can_approve_timesheets']) ? $data['can_approve_timesheets'] : null; - $this->container['can_create_timesheets'] = isset($data['can_create_timesheets']) ? $data['can_create_timesheets'] : null; - $this->container['can_approve_expenses'] = isset($data['can_approve_expenses']) ? $data['can_approve_expenses'] : null; - $this->container['can_view_expenses'] = isset($data['can_view_expenses']) ? $data['can_view_expenses'] : null; - $this->container['can_view_shift_costs'] = isset($data['can_view_shift_costs']) ? $data['can_view_shift_costs'] : null; - $this->container['can_view_rosters'] = isset($data['can_view_rosters']) ? $data['can_view_rosters'] : null; - $this->container['can_manage_rosters'] = isset($data['can_manage_rosters']) ? $data['can_manage_rosters'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('can_approve_leave_requests', $data ?? [], null); + $this->setIfExists('can_view_leave_requests', $data ?? [], null); + $this->setIfExists('can_approve_timesheets', $data ?? [], null); + $this->setIfExists('can_create_timesheets', $data ?? [], null); + $this->setIfExists('can_approve_expenses', $data ?? [], null); + $this->setIfExists('can_view_expenses', $data ?? [], null); + $this->setIfExists('can_view_shift_costs', $data ?? [], null); + $this->setIfExists('can_view_rosters', $data ?? [], null); + $this->setIfExists('can_manage_rosters', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets can_approve_leave_requests * - * @return bool + * @return bool|null */ public function getCanApproveLeaveRequests() { @@ -295,12 +392,15 @@ public function getCanApproveLeaveRequests() /** * Sets can_approve_leave_requests * - * @param bool $can_approve_leave_requests + * @param bool|null $can_approve_leave_requests * - * @return $this + * @return self */ public function setCanApproveLeaveRequests($can_approve_leave_requests) { + if (is_null($can_approve_leave_requests)) { + throw new \InvalidArgumentException('non-nullable can_approve_leave_requests cannot be null'); + } $this->container['can_approve_leave_requests'] = $can_approve_leave_requests; return $this; @@ -309,7 +409,7 @@ public function setCanApproveLeaveRequests($can_approve_leave_requests) /** * Gets can_view_leave_requests * - * @return bool + * @return bool|null */ public function getCanViewLeaveRequests() { @@ -319,12 +419,15 @@ public function getCanViewLeaveRequests() /** * Sets can_view_leave_requests * - * @param bool $can_view_leave_requests + * @param bool|null $can_view_leave_requests * - * @return $this + * @return self */ public function setCanViewLeaveRequests($can_view_leave_requests) { + if (is_null($can_view_leave_requests)) { + throw new \InvalidArgumentException('non-nullable can_view_leave_requests cannot be null'); + } $this->container['can_view_leave_requests'] = $can_view_leave_requests; return $this; @@ -333,7 +436,7 @@ public function setCanViewLeaveRequests($can_view_leave_requests) /** * Gets can_approve_timesheets * - * @return bool + * @return bool|null */ public function getCanApproveTimesheets() { @@ -343,12 +446,15 @@ public function getCanApproveTimesheets() /** * Sets can_approve_timesheets * - * @param bool $can_approve_timesheets + * @param bool|null $can_approve_timesheets * - * @return $this + * @return self */ public function setCanApproveTimesheets($can_approve_timesheets) { + if (is_null($can_approve_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_approve_timesheets cannot be null'); + } $this->container['can_approve_timesheets'] = $can_approve_timesheets; return $this; @@ -357,7 +463,7 @@ public function setCanApproveTimesheets($can_approve_timesheets) /** * Gets can_create_timesheets * - * @return bool + * @return bool|null */ public function getCanCreateTimesheets() { @@ -367,12 +473,15 @@ public function getCanCreateTimesheets() /** * Sets can_create_timesheets * - * @param bool $can_create_timesheets + * @param bool|null $can_create_timesheets * - * @return $this + * @return self */ public function setCanCreateTimesheets($can_create_timesheets) { + if (is_null($can_create_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_create_timesheets cannot be null'); + } $this->container['can_create_timesheets'] = $can_create_timesheets; return $this; @@ -381,7 +490,7 @@ public function setCanCreateTimesheets($can_create_timesheets) /** * Gets can_approve_expenses * - * @return bool + * @return bool|null */ public function getCanApproveExpenses() { @@ -391,12 +500,15 @@ public function getCanApproveExpenses() /** * Sets can_approve_expenses * - * @param bool $can_approve_expenses + * @param bool|null $can_approve_expenses * - * @return $this + * @return self */ public function setCanApproveExpenses($can_approve_expenses) { + if (is_null($can_approve_expenses)) { + throw new \InvalidArgumentException('non-nullable can_approve_expenses cannot be null'); + } $this->container['can_approve_expenses'] = $can_approve_expenses; return $this; @@ -405,7 +517,7 @@ public function setCanApproveExpenses($can_approve_expenses) /** * Gets can_view_expenses * - * @return bool + * @return bool|null */ public function getCanViewExpenses() { @@ -415,12 +527,15 @@ public function getCanViewExpenses() /** * Sets can_view_expenses * - * @param bool $can_view_expenses + * @param bool|null $can_view_expenses * - * @return $this + * @return self */ public function setCanViewExpenses($can_view_expenses) { + if (is_null($can_view_expenses)) { + throw new \InvalidArgumentException('non-nullable can_view_expenses cannot be null'); + } $this->container['can_view_expenses'] = $can_view_expenses; return $this; @@ -429,7 +544,7 @@ public function setCanViewExpenses($can_view_expenses) /** * Gets can_view_shift_costs * - * @return bool + * @return bool|null */ public function getCanViewShiftCosts() { @@ -439,12 +554,15 @@ public function getCanViewShiftCosts() /** * Sets can_view_shift_costs * - * @param bool $can_view_shift_costs + * @param bool|null $can_view_shift_costs * - * @return $this + * @return self */ public function setCanViewShiftCosts($can_view_shift_costs) { + if (is_null($can_view_shift_costs)) { + throw new \InvalidArgumentException('non-nullable can_view_shift_costs cannot be null'); + } $this->container['can_view_shift_costs'] = $can_view_shift_costs; return $this; @@ -453,7 +571,7 @@ public function setCanViewShiftCosts($can_view_shift_costs) /** * Gets can_view_rosters * - * @return bool + * @return bool|null */ public function getCanViewRosters() { @@ -463,12 +581,15 @@ public function getCanViewRosters() /** * Sets can_view_rosters * - * @param bool $can_view_rosters + * @param bool|null $can_view_rosters * - * @return $this + * @return self */ public function setCanViewRosters($can_view_rosters) { + if (is_null($can_view_rosters)) { + throw new \InvalidArgumentException('non-nullable can_view_rosters cannot be null'); + } $this->container['can_view_rosters'] = $can_view_rosters; return $this; @@ -477,7 +598,7 @@ public function setCanViewRosters($can_view_rosters) /** * Gets can_manage_rosters * - * @return bool + * @return bool|null */ public function getCanManageRosters() { @@ -487,12 +608,15 @@ public function getCanManageRosters() /** * Sets can_manage_rosters * - * @param bool $can_manage_rosters + * @param bool|null $can_manage_rosters * - * @return $this + * @return self */ public function setCanManageRosters($can_manage_rosters) { + if (is_null($can_manage_rosters)) { + throw new \InvalidArgumentException('non-nullable can_manage_rosters cannot be null'); + } $this->container['can_manage_rosters'] = $can_manage_rosters; return $this; @@ -504,7 +628,7 @@ public function setCanManageRosters($can_manage_rosters) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeItemCountModel.php b/src/lib/Model/EmployeeItemCountModel.php index e8766c2..6b99137 100644 --- a/src/lib/Model/EmployeeItemCountModel.php +++ b/src/lib/Model/EmployeeItemCountModel.php @@ -2,61 +2,61 @@ /** * EmployeeItemCountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeItemCountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeItemCountModel implements ModelInterface, ArrayAccess +class EmployeeItemCountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeItemCountModel'; + protected static $openAPIModelName = 'EmployeeItemCountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'item_count' => 'int' ]; @@ -65,20 +65,39 @@ class EmployeeItemCountModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'item_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'item_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['item_count'] = isset($data['item_count']) ? $data['item_count'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('item_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -223,12 +309,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -237,7 +326,7 @@ public function setEmployeeId($employee_id) /** * Gets item_count * - * @return int + * @return int|null */ public function getItemCount() { @@ -247,12 +336,15 @@ public function getItemCount() /** * Sets item_count * - * @param int $item_count + * @param int|null $item_count * - * @return $this + * @return self */ public function setItemCount($item_count) { + if (is_null($item_count)) { + throw new \InvalidArgumentException('non-nullable item_count cannot be null'); + } $this->container['item_count'] = $item_count; return $this; @@ -264,7 +356,7 @@ public function setItemCount($item_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeLeaveRequestFilter.php b/src/lib/Model/EmployeeLeaveRequestFilter.php index 1ac5cb7..aac4357 100644 --- a/src/lib/Model/EmployeeLeaveRequestFilter.php +++ b/src/lib/Model/EmployeeLeaveRequestFilter.php @@ -2,61 +2,61 @@ /** * EmployeeLeaveRequestFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeLeaveRequestFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeLeaveRequestFilter implements ModelInterface, ArrayAccess +class EmployeeLeaveRequestFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeLeaveRequestFilter'; + protected static $openAPIModelName = 'EmployeeLeaveRequestFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'show_other_employees' => 'bool', 'approved_only' => 'bool', 'from_date' => '\DateTime', @@ -67,22 +67,43 @@ class EmployeeLeaveRequestFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'show_other_employees' => null, 'approved_only' => null, 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'show_other_employees' => false, + 'approved_only' => false, + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['show_other_employees'] = isset($data['show_other_employees']) ? $data['show_other_employees'] : null; - $this->container['approved_only'] = isset($data['approved_only']) ? $data['approved_only'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('show_other_employees', $data ?? [], null); + $this->setIfExists('approved_only', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets show_other_employees * - * @return bool + * @return bool|null */ public function getShowOtherEmployees() { @@ -235,12 +323,15 @@ public function getShowOtherEmployees() /** * Sets show_other_employees * - * @param bool $show_other_employees + * @param bool|null $show_other_employees * - * @return $this + * @return self */ public function setShowOtherEmployees($show_other_employees) { + if (is_null($show_other_employees)) { + throw new \InvalidArgumentException('non-nullable show_other_employees cannot be null'); + } $this->container['show_other_employees'] = $show_other_employees; return $this; @@ -249,7 +340,7 @@ public function setShowOtherEmployees($show_other_employees) /** * Gets approved_only * - * @return bool + * @return bool|null */ public function getApprovedOnly() { @@ -259,12 +350,15 @@ public function getApprovedOnly() /** * Sets approved_only * - * @param bool $approved_only + * @param bool|null $approved_only * - * @return $this + * @return self */ public function setApprovedOnly($approved_only) { + if (is_null($approved_only)) { + throw new \InvalidArgumentException('non-nullable approved_only cannot be null'); + } $this->container['approved_only'] = $approved_only; return $this; @@ -273,7 +367,7 @@ public function setApprovedOnly($approved_only) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -283,12 +377,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -297,7 +394,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -307,12 +404,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -324,7 +424,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeNoteModel.php b/src/lib/Model/EmployeeNoteModel.php index dbd015a..983c67e 100644 --- a/src/lib/Model/EmployeeNoteModel.php +++ b/src/lib/Model/EmployeeNoteModel.php @@ -2,61 +2,61 @@ /** * EmployeeNoteModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeNoteModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeNoteModel implements ModelInterface, ArrayAccess +class EmployeeNoteModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeNoteModel'; + protected static $openAPIModelName = 'EmployeeNoteModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'user' => 'string', 'date_time' => '\DateTime', @@ -67,22 +67,43 @@ class EmployeeNoteModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'user' => null, 'date_time' => 'date-time', 'note' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'user' => false, + 'date_time' => false, + 'note' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['user'] = isset($data['user']) ? $data['user'] : null; - $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + $this->setIfExists('date_time', $data ?? [], null); + $this->setIfExists('note', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets user * - * @return string + * @return string|null */ public function getUser() { @@ -259,12 +350,15 @@ public function getUser() /** * Sets user * - * @param string $user + * @param string|null $user * - * @return $this + * @return self */ public function setUser($user) { + if (is_null($user)) { + throw new \InvalidArgumentException('non-nullable user cannot be null'); + } $this->container['user'] = $user; return $this; @@ -273,7 +367,7 @@ public function setUser($user) /** * Gets date_time * - * @return \DateTime + * @return \DateTime|null */ public function getDateTime() { @@ -283,12 +377,15 @@ public function getDateTime() /** * Sets date_time * - * @param \DateTime $date_time + * @param \DateTime|null $date_time * - * @return $this + * @return self */ public function setDateTime($date_time) { + if (is_null($date_time)) { + throw new \InvalidArgumentException('non-nullable date_time cannot be null'); + } $this->container['date_time'] = $date_time; return $this; @@ -297,7 +394,7 @@ public function setDateTime($date_time) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -307,12 +404,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -324,7 +424,7 @@ public function setNote($note) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeePartialEditModel.php b/src/lib/Model/EmployeePartialEditModel.php index a501342..dec7c97 100644 --- a/src/lib/Model/EmployeePartialEditModel.php +++ b/src/lib/Model/EmployeePartialEditModel.php @@ -2,61 +2,61 @@ /** * EmployeePartialEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeePartialEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeePartialEditModel implements ModelInterface, ArrayAccess +class EmployeePartialEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeePartialEditModel'; + protected static $openAPIModelName = 'EmployeePartialEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'anniversary_date' => '\DateTime', 'external_id' => 'string', @@ -65,7 +65,7 @@ class EmployeePartialEditModel implements ModelInterface, ArrayAccess 'business_id' => 'int', 'tax_file_number' => 'string', 'tax_file_number_masked' => 'string', - 'bank_accounts' => '\Swagger\Client\Model\BankAccountEditModel[]', + 'bank_accounts' => '\OpenAPI\Client\Model\BankAccountEditModel[]', 'external_reference_id' => 'string', 'payroll_id' => 'string', 'employee_starter_type' => 'string', @@ -123,8 +123,10 @@ class EmployeePartialEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'anniversary_date' => 'date-time', 'external_id' => null, @@ -187,14 +189,89 @@ class EmployeePartialEditModel implements ModelInterface, ArrayAccess 'mobile_phone' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'anniversary_date' => false, + 'external_id' => false, + 'start_date' => false, + 'end_date' => false, + 'business_id' => false, + 'tax_file_number' => false, + 'tax_file_number_masked' => false, + 'bank_accounts' => false, + 'external_reference_id' => false, + 'payroll_id' => false, + 'employee_starter_type' => false, + 'source' => false, + 'tags_string' => false, + 'timesheet_setting' => false, + 'termination_reason' => false, + 'title_id' => false, + 'first_name' => false, + 'other_name' => false, + 'middle_name' => false, + 'surname' => false, + 'previous_surname' => false, + 'legal_name' => false, + 'date_of_birth' => false, + 'gender' => false, + 'residential_street_address' => false, + 'residential_address_line2' => false, + 'residential_suburb_id' => false, + 'residential_suburb' => false, + 'residential_state' => false, + 'residential_postcode' => false, + 'residential_country' => false, + 'residential_country_id' => false, + 'is_overseas_residential_address' => false, + 'residential_address_type' => false, + 'residential_block_number' => false, + 'residential_level_number' => false, + 'residential_unit_number' => false, + 'residential_street_name' => false, + 'residential_address_line3' => false, + 'postal_street_address' => false, + 'postal_address_line2' => false, + 'postal_suburb_id' => false, + 'postal_suburb' => false, + 'postal_state' => false, + 'postal_postcode' => false, + 'postal_country' => false, + 'postal_country_id' => false, + 'is_overseas_postal_address' => false, + 'postal_address_type' => false, + 'postal_block_number' => false, + 'postal_level_number' => false, + 'postal_unit_number' => false, + 'postal_street_name' => false, + 'postal_address_line3' => false, + 'is_postal_address_same_as_residential' => false, + 'email' => false, + 'home_phone' => false, + 'work_phone' => false, + 'mobile_phone' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -202,9 +279,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -450,99 +579,97 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const EMPLOYEE_STARTER_TYPE_NEW_STARTER = 'NewStarter'; - const EMPLOYEE_STARTER_TYPE_REPORTED_HMRC = 'ReportedHmrc'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - const TIMESHEET_SETTING_DISABLED = 'Disabled'; - const TIMESHEET_SETTING_ENABLED = 'Enabled'; - const TIMESHEET_SETTING_ENABLED_FOR_EXCEPTIONS = 'EnabledForExceptions'; - const RESIDENTIAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; - const RESIDENTIAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; - const RESIDENTIAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; - const POSTAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; - const POSTAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; - const POSTAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; - - - + return self::$openAPIModelName; + } + + public const EMPLOYEE_STARTER_TYPE_NEW_STARTER = 'NewStarter'; + public const EMPLOYEE_STARTER_TYPE_REPORTED_HMRC = 'ReportedHmrc'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + public const TIMESHEET_SETTING_DISABLED = 'Disabled'; + public const TIMESHEET_SETTING_ENABLED = 'Enabled'; + public const TIMESHEET_SETTING_ENABLED_FOR_EXCEPTIONS = 'EnabledForExceptions'; + public const RESIDENTIAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; + public const RESIDENTIAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; + public const RESIDENTIAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; + public const POSTAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; + public const POSTAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; + public const POSTAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; + /** * Gets allowable values of the enum * @@ -555,7 +682,7 @@ public function getEmployeeStarterTypeAllowableValues() self::EMPLOYEE_STARTER_TYPE_REPORTED_HMRC, ]; } - + /** * Gets allowable values of the enum * @@ -642,7 +769,7 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - + /** * Gets allowable values of the enum * @@ -656,7 +783,7 @@ public function getTimesheetSettingAllowableValues() self::TIMESHEET_SETTING_ENABLED_FOR_EXCEPTIONS, ]; } - + /** * Gets allowable values of the enum * @@ -670,7 +797,7 @@ public function getResidentialAddressTypeAllowableValues() self::RESIDENTIAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS, ]; } - + /** * Gets allowable values of the enum * @@ -684,7 +811,6 @@ public function getPostalAddressTypeAllowableValues() self::POSTAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS, ]; } - /** * Associative array for storing property values @@ -701,66 +827,84 @@ public function getPostalAddressTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['anniversary_date'] = isset($data['anniversary_date']) ? $data['anniversary_date'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['business_id'] = isset($data['business_id']) ? $data['business_id'] : null; - $this->container['tax_file_number'] = isset($data['tax_file_number']) ? $data['tax_file_number'] : null; - $this->container['tax_file_number_masked'] = isset($data['tax_file_number_masked']) ? $data['tax_file_number_masked'] : null; - $this->container['bank_accounts'] = isset($data['bank_accounts']) ? $data['bank_accounts'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['payroll_id'] = isset($data['payroll_id']) ? $data['payroll_id'] : null; - $this->container['employee_starter_type'] = isset($data['employee_starter_type']) ? $data['employee_starter_type'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['tags_string'] = isset($data['tags_string']) ? $data['tags_string'] : null; - $this->container['timesheet_setting'] = isset($data['timesheet_setting']) ? $data['timesheet_setting'] : null; - $this->container['termination_reason'] = isset($data['termination_reason']) ? $data['termination_reason'] : null; - $this->container['title_id'] = isset($data['title_id']) ? $data['title_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['other_name'] = isset($data['other_name']) ? $data['other_name'] : null; - $this->container['middle_name'] = isset($data['middle_name']) ? $data['middle_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['previous_surname'] = isset($data['previous_surname']) ? $data['previous_surname'] : null; - $this->container['legal_name'] = isset($data['legal_name']) ? $data['legal_name'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null; - $this->container['residential_street_address'] = isset($data['residential_street_address']) ? $data['residential_street_address'] : null; - $this->container['residential_address_line2'] = isset($data['residential_address_line2']) ? $data['residential_address_line2'] : null; - $this->container['residential_suburb_id'] = isset($data['residential_suburb_id']) ? $data['residential_suburb_id'] : null; - $this->container['residential_suburb'] = isset($data['residential_suburb']) ? $data['residential_suburb'] : null; - $this->container['residential_state'] = isset($data['residential_state']) ? $data['residential_state'] : null; - $this->container['residential_postcode'] = isset($data['residential_postcode']) ? $data['residential_postcode'] : null; - $this->container['residential_country'] = isset($data['residential_country']) ? $data['residential_country'] : null; - $this->container['residential_country_id'] = isset($data['residential_country_id']) ? $data['residential_country_id'] : null; - $this->container['is_overseas_residential_address'] = isset($data['is_overseas_residential_address']) ? $data['is_overseas_residential_address'] : null; - $this->container['residential_address_type'] = isset($data['residential_address_type']) ? $data['residential_address_type'] : null; - $this->container['residential_block_number'] = isset($data['residential_block_number']) ? $data['residential_block_number'] : null; - $this->container['residential_level_number'] = isset($data['residential_level_number']) ? $data['residential_level_number'] : null; - $this->container['residential_unit_number'] = isset($data['residential_unit_number']) ? $data['residential_unit_number'] : null; - $this->container['residential_street_name'] = isset($data['residential_street_name']) ? $data['residential_street_name'] : null; - $this->container['residential_address_line3'] = isset($data['residential_address_line3']) ? $data['residential_address_line3'] : null; - $this->container['postal_street_address'] = isset($data['postal_street_address']) ? $data['postal_street_address'] : null; - $this->container['postal_address_line2'] = isset($data['postal_address_line2']) ? $data['postal_address_line2'] : null; - $this->container['postal_suburb_id'] = isset($data['postal_suburb_id']) ? $data['postal_suburb_id'] : null; - $this->container['postal_suburb'] = isset($data['postal_suburb']) ? $data['postal_suburb'] : null; - $this->container['postal_state'] = isset($data['postal_state']) ? $data['postal_state'] : null; - $this->container['postal_postcode'] = isset($data['postal_postcode']) ? $data['postal_postcode'] : null; - $this->container['postal_country'] = isset($data['postal_country']) ? $data['postal_country'] : null; - $this->container['postal_country_id'] = isset($data['postal_country_id']) ? $data['postal_country_id'] : null; - $this->container['is_overseas_postal_address'] = isset($data['is_overseas_postal_address']) ? $data['is_overseas_postal_address'] : null; - $this->container['postal_address_type'] = isset($data['postal_address_type']) ? $data['postal_address_type'] : null; - $this->container['postal_block_number'] = isset($data['postal_block_number']) ? $data['postal_block_number'] : null; - $this->container['postal_level_number'] = isset($data['postal_level_number']) ? $data['postal_level_number'] : null; - $this->container['postal_unit_number'] = isset($data['postal_unit_number']) ? $data['postal_unit_number'] : null; - $this->container['postal_street_name'] = isset($data['postal_street_name']) ? $data['postal_street_name'] : null; - $this->container['postal_address_line3'] = isset($data['postal_address_line3']) ? $data['postal_address_line3'] : null; - $this->container['is_postal_address_same_as_residential'] = isset($data['is_postal_address_same_as_residential']) ? $data['is_postal_address_same_as_residential'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['home_phone'] = isset($data['home_phone']) ? $data['home_phone'] : null; - $this->container['work_phone'] = isset($data['work_phone']) ? $data['work_phone'] : null; - $this->container['mobile_phone'] = isset($data['mobile_phone']) ? $data['mobile_phone'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('anniversary_date', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('tax_file_number', $data ?? [], null); + $this->setIfExists('tax_file_number_masked', $data ?? [], null); + $this->setIfExists('bank_accounts', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('payroll_id', $data ?? [], null); + $this->setIfExists('employee_starter_type', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('tags_string', $data ?? [], null); + $this->setIfExists('timesheet_setting', $data ?? [], null); + $this->setIfExists('termination_reason', $data ?? [], null); + $this->setIfExists('title_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('other_name', $data ?? [], null); + $this->setIfExists('middle_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('previous_surname', $data ?? [], null); + $this->setIfExists('legal_name', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('gender', $data ?? [], null); + $this->setIfExists('residential_street_address', $data ?? [], null); + $this->setIfExists('residential_address_line2', $data ?? [], null); + $this->setIfExists('residential_suburb_id', $data ?? [], null); + $this->setIfExists('residential_suburb', $data ?? [], null); + $this->setIfExists('residential_state', $data ?? [], null); + $this->setIfExists('residential_postcode', $data ?? [], null); + $this->setIfExists('residential_country', $data ?? [], null); + $this->setIfExists('residential_country_id', $data ?? [], null); + $this->setIfExists('is_overseas_residential_address', $data ?? [], null); + $this->setIfExists('residential_address_type', $data ?? [], null); + $this->setIfExists('residential_block_number', $data ?? [], null); + $this->setIfExists('residential_level_number', $data ?? [], null); + $this->setIfExists('residential_unit_number', $data ?? [], null); + $this->setIfExists('residential_street_name', $data ?? [], null); + $this->setIfExists('residential_address_line3', $data ?? [], null); + $this->setIfExists('postal_street_address', $data ?? [], null); + $this->setIfExists('postal_address_line2', $data ?? [], null); + $this->setIfExists('postal_suburb_id', $data ?? [], null); + $this->setIfExists('postal_suburb', $data ?? [], null); + $this->setIfExists('postal_state', $data ?? [], null); + $this->setIfExists('postal_postcode', $data ?? [], null); + $this->setIfExists('postal_country', $data ?? [], null); + $this->setIfExists('postal_country_id', $data ?? [], null); + $this->setIfExists('is_overseas_postal_address', $data ?? [], null); + $this->setIfExists('postal_address_type', $data ?? [], null); + $this->setIfExists('postal_block_number', $data ?? [], null); + $this->setIfExists('postal_level_number', $data ?? [], null); + $this->setIfExists('postal_unit_number', $data ?? [], null); + $this->setIfExists('postal_street_name', $data ?? [], null); + $this->setIfExists('postal_address_line3', $data ?? [], null); + $this->setIfExists('is_postal_address_same_as_residential', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('home_phone', $data ?? [], null); + $this->setIfExists('work_phone', $data ?? [], null); + $this->setIfExists('mobile_phone', $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; } /** @@ -775,7 +919,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeStarterTypeAllowableValues(); if (!is_null($this->container['employee_starter_type']) && !in_array($this->container['employee_starter_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_starter_type', must be one of '%s'", + "invalid value '%s' for 'employee_starter_type', must be one of '%s'", + $this->container['employee_starter_type'], implode("', '", $allowedValues) ); } @@ -783,7 +928,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -791,7 +937,8 @@ public function listInvalidProperties() $allowedValues = $this->getTimesheetSettingAllowableValues(); if (!is_null($this->container['timesheet_setting']) && !in_array($this->container['timesheet_setting'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'timesheet_setting', must be one of '%s'", + "invalid value '%s' for 'timesheet_setting', must be one of '%s'", + $this->container['timesheet_setting'], implode("', '", $allowedValues) ); } @@ -799,7 +946,8 @@ public function listInvalidProperties() $allowedValues = $this->getResidentialAddressTypeAllowableValues(); if (!is_null($this->container['residential_address_type']) && !in_array($this->container['residential_address_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'residential_address_type', must be one of '%s'", + "invalid value '%s' for 'residential_address_type', must be one of '%s'", + $this->container['residential_address_type'], implode("', '", $allowedValues) ); } @@ -807,7 +955,8 @@ public function listInvalidProperties() $allowedValues = $this->getPostalAddressTypeAllowableValues(); if (!is_null($this->container['postal_address_type']) && !in_array($this->container['postal_address_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'postal_address_type', must be one of '%s'", + "invalid value '%s' for 'postal_address_type', must be one of '%s'", + $this->container['postal_address_type'], implode("', '", $allowedValues) ); } @@ -830,7 +979,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -840,12 +989,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -854,7 +1006,7 @@ public function setId($id) /** * Gets anniversary_date * - * @return \DateTime + * @return \DateTime|null */ public function getAnniversaryDate() { @@ -864,12 +1016,15 @@ public function getAnniversaryDate() /** * Sets anniversary_date * - * @param \DateTime $anniversary_date + * @param \DateTime|null $anniversary_date * - * @return $this + * @return self */ public function setAnniversaryDate($anniversary_date) { + if (is_null($anniversary_date)) { + throw new \InvalidArgumentException('non-nullable anniversary_date cannot be null'); + } $this->container['anniversary_date'] = $anniversary_date; return $this; @@ -878,7 +1033,7 @@ public function setAnniversaryDate($anniversary_date) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -888,12 +1043,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -902,7 +1060,7 @@ public function setExternalId($external_id) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -912,12 +1070,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -926,7 +1087,7 @@ public function setStartDate($start_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -936,12 +1097,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -950,7 +1114,7 @@ public function setEndDate($end_date) /** * Gets business_id * - * @return int + * @return int|null */ public function getBusinessId() { @@ -960,12 +1124,15 @@ public function getBusinessId() /** * Sets business_id * - * @param int $business_id + * @param int|null $business_id * - * @return $this + * @return self */ public function setBusinessId($business_id) { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } $this->container['business_id'] = $business_id; return $this; @@ -974,7 +1141,7 @@ public function setBusinessId($business_id) /** * Gets tax_file_number * - * @return string + * @return string|null */ public function getTaxFileNumber() { @@ -984,12 +1151,15 @@ public function getTaxFileNumber() /** * Sets tax_file_number * - * @param string $tax_file_number + * @param string|null $tax_file_number * - * @return $this + * @return self */ public function setTaxFileNumber($tax_file_number) { + if (is_null($tax_file_number)) { + throw new \InvalidArgumentException('non-nullable tax_file_number cannot be null'); + } $this->container['tax_file_number'] = $tax_file_number; return $this; @@ -998,7 +1168,7 @@ public function setTaxFileNumber($tax_file_number) /** * Gets tax_file_number_masked * - * @return string + * @return string|null */ public function getTaxFileNumberMasked() { @@ -1008,12 +1178,15 @@ public function getTaxFileNumberMasked() /** * Sets tax_file_number_masked * - * @param string $tax_file_number_masked + * @param string|null $tax_file_number_masked * - * @return $this + * @return self */ public function setTaxFileNumberMasked($tax_file_number_masked) { + if (is_null($tax_file_number_masked)) { + throw new \InvalidArgumentException('non-nullable tax_file_number_masked cannot be null'); + } $this->container['tax_file_number_masked'] = $tax_file_number_masked; return $this; @@ -1022,7 +1195,7 @@ public function setTaxFileNumberMasked($tax_file_number_masked) /** * Gets bank_accounts * - * @return \Swagger\Client\Model\BankAccountEditModel[] + * @return \OpenAPI\Client\Model\BankAccountEditModel[]|null */ public function getBankAccounts() { @@ -1032,12 +1205,15 @@ public function getBankAccounts() /** * Sets bank_accounts * - * @param \Swagger\Client\Model\BankAccountEditModel[] $bank_accounts + * @param \OpenAPI\Client\Model\BankAccountEditModel[]|null $bank_accounts * - * @return $this + * @return self */ public function setBankAccounts($bank_accounts) { + if (is_null($bank_accounts)) { + throw new \InvalidArgumentException('non-nullable bank_accounts cannot be null'); + } $this->container['bank_accounts'] = $bank_accounts; return $this; @@ -1046,7 +1222,7 @@ public function setBankAccounts($bank_accounts) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -1056,12 +1232,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -1070,7 +1249,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets payroll_id * - * @return string + * @return string|null */ public function getPayrollId() { @@ -1080,12 +1259,15 @@ public function getPayrollId() /** * Sets payroll_id * - * @param string $payroll_id + * @param string|null $payroll_id * - * @return $this + * @return self */ public function setPayrollId($payroll_id) { + if (is_null($payroll_id)) { + throw new \InvalidArgumentException('non-nullable payroll_id cannot be null'); + } $this->container['payroll_id'] = $payroll_id; return $this; @@ -1094,7 +1276,7 @@ public function setPayrollId($payroll_id) /** * Gets employee_starter_type * - * @return string + * @return string|null */ public function getEmployeeStarterType() { @@ -1104,17 +1286,21 @@ public function getEmployeeStarterType() /** * Sets employee_starter_type * - * @param string $employee_starter_type + * @param string|null $employee_starter_type * - * @return $this + * @return self */ public function setEmployeeStarterType($employee_starter_type) { + if (is_null($employee_starter_type)) { + throw new \InvalidArgumentException('non-nullable employee_starter_type cannot be null'); + } $allowedValues = $this->getEmployeeStarterTypeAllowableValues(); - if (!is_null($employee_starter_type) && !in_array($employee_starter_type, $allowedValues, true)) { + if (!in_array($employee_starter_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_starter_type', must be one of '%s'", + "Invalid value '%s' for 'employee_starter_type', must be one of '%s'", + $employee_starter_type, implode("', '", $allowedValues) ) ); @@ -1127,7 +1313,7 @@ public function setEmployeeStarterType($employee_starter_type) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -1137,17 +1323,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -1160,7 +1350,7 @@ public function setSource($source) /** * Gets tags_string * - * @return string + * @return string|null */ public function getTagsString() { @@ -1170,12 +1360,15 @@ public function getTagsString() /** * Sets tags_string * - * @param string $tags_string + * @param string|null $tags_string * - * @return $this + * @return self */ public function setTagsString($tags_string) { + if (is_null($tags_string)) { + throw new \InvalidArgumentException('non-nullable tags_string cannot be null'); + } $this->container['tags_string'] = $tags_string; return $this; @@ -1184,7 +1377,7 @@ public function setTagsString($tags_string) /** * Gets timesheet_setting * - * @return string + * @return string|null */ public function getTimesheetSetting() { @@ -1194,17 +1387,21 @@ public function getTimesheetSetting() /** * Sets timesheet_setting * - * @param string $timesheet_setting + * @param string|null $timesheet_setting * - * @return $this + * @return self */ public function setTimesheetSetting($timesheet_setting) { + if (is_null($timesheet_setting)) { + throw new \InvalidArgumentException('non-nullable timesheet_setting cannot be null'); + } $allowedValues = $this->getTimesheetSettingAllowableValues(); - if (!is_null($timesheet_setting) && !in_array($timesheet_setting, $allowedValues, true)) { + if (!in_array($timesheet_setting, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'timesheet_setting', must be one of '%s'", + "Invalid value '%s' for 'timesheet_setting', must be one of '%s'", + $timesheet_setting, implode("', '", $allowedValues) ) ); @@ -1217,7 +1414,7 @@ public function setTimesheetSetting($timesheet_setting) /** * Gets termination_reason * - * @return string + * @return string|null */ public function getTerminationReason() { @@ -1227,12 +1424,15 @@ public function getTerminationReason() /** * Sets termination_reason * - * @param string $termination_reason + * @param string|null $termination_reason * - * @return $this + * @return self */ public function setTerminationReason($termination_reason) { + if (is_null($termination_reason)) { + throw new \InvalidArgumentException('non-nullable termination_reason cannot be null'); + } $this->container['termination_reason'] = $termination_reason; return $this; @@ -1241,7 +1441,7 @@ public function setTerminationReason($termination_reason) /** * Gets title_id * - * @return int + * @return int|null */ public function getTitleId() { @@ -1251,12 +1451,15 @@ public function getTitleId() /** * Sets title_id * - * @param int $title_id + * @param int|null $title_id * - * @return $this + * @return self */ public function setTitleId($title_id) { + if (is_null($title_id)) { + throw new \InvalidArgumentException('non-nullable title_id cannot be null'); + } $this->container['title_id'] = $title_id; return $this; @@ -1265,7 +1468,7 @@ public function setTitleId($title_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -1275,12 +1478,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -1289,7 +1495,7 @@ public function setFirstName($first_name) /** * Gets other_name * - * @return string + * @return string|null */ public function getOtherName() { @@ -1299,12 +1505,15 @@ public function getOtherName() /** * Sets other_name * - * @param string $other_name + * @param string|null $other_name * - * @return $this + * @return self */ public function setOtherName($other_name) { + if (is_null($other_name)) { + throw new \InvalidArgumentException('non-nullable other_name cannot be null'); + } $this->container['other_name'] = $other_name; return $this; @@ -1313,7 +1522,7 @@ public function setOtherName($other_name) /** * Gets middle_name * - * @return string + * @return string|null */ public function getMiddleName() { @@ -1323,12 +1532,15 @@ public function getMiddleName() /** * Sets middle_name * - * @param string $middle_name + * @param string|null $middle_name * - * @return $this + * @return self */ public function setMiddleName($middle_name) { + if (is_null($middle_name)) { + throw new \InvalidArgumentException('non-nullable middle_name cannot be null'); + } $this->container['middle_name'] = $middle_name; return $this; @@ -1337,7 +1549,7 @@ public function setMiddleName($middle_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -1347,12 +1559,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -1361,7 +1576,7 @@ public function setSurname($surname) /** * Gets previous_surname * - * @return string + * @return string|null */ public function getPreviousSurname() { @@ -1371,12 +1586,15 @@ public function getPreviousSurname() /** * Sets previous_surname * - * @param string $previous_surname + * @param string|null $previous_surname * - * @return $this + * @return self */ public function setPreviousSurname($previous_surname) { + if (is_null($previous_surname)) { + throw new \InvalidArgumentException('non-nullable previous_surname cannot be null'); + } $this->container['previous_surname'] = $previous_surname; return $this; @@ -1385,7 +1603,7 @@ public function setPreviousSurname($previous_surname) /** * Gets legal_name * - * @return string + * @return string|null */ public function getLegalName() { @@ -1395,12 +1613,15 @@ public function getLegalName() /** * Sets legal_name * - * @param string $legal_name + * @param string|null $legal_name * - * @return $this + * @return self */ public function setLegalName($legal_name) { + if (is_null($legal_name)) { + throw new \InvalidArgumentException('non-nullable legal_name cannot be null'); + } $this->container['legal_name'] = $legal_name; return $this; @@ -1409,7 +1630,7 @@ public function setLegalName($legal_name) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -1419,12 +1640,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -1433,7 +1657,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets gender * - * @return string + * @return string|null */ public function getGender() { @@ -1443,12 +1667,15 @@ public function getGender() /** * Sets gender * - * @param string $gender + * @param string|null $gender * - * @return $this + * @return self */ public function setGender($gender) { + if (is_null($gender)) { + throw new \InvalidArgumentException('non-nullable gender cannot be null'); + } $this->container['gender'] = $gender; return $this; @@ -1457,7 +1684,7 @@ public function setGender($gender) /** * Gets residential_street_address * - * @return string + * @return string|null */ public function getResidentialStreetAddress() { @@ -1467,12 +1694,15 @@ public function getResidentialStreetAddress() /** * Sets residential_street_address * - * @param string $residential_street_address + * @param string|null $residential_street_address * - * @return $this + * @return self */ public function setResidentialStreetAddress($residential_street_address) { + if (is_null($residential_street_address)) { + throw new \InvalidArgumentException('non-nullable residential_street_address cannot be null'); + } $this->container['residential_street_address'] = $residential_street_address; return $this; @@ -1481,7 +1711,7 @@ public function setResidentialStreetAddress($residential_street_address) /** * Gets residential_address_line2 * - * @return string + * @return string|null */ public function getResidentialAddressLine2() { @@ -1491,12 +1721,15 @@ public function getResidentialAddressLine2() /** * Sets residential_address_line2 * - * @param string $residential_address_line2 + * @param string|null $residential_address_line2 * - * @return $this + * @return self */ public function setResidentialAddressLine2($residential_address_line2) { + if (is_null($residential_address_line2)) { + throw new \InvalidArgumentException('non-nullable residential_address_line2 cannot be null'); + } $this->container['residential_address_line2'] = $residential_address_line2; return $this; @@ -1505,7 +1738,7 @@ public function setResidentialAddressLine2($residential_address_line2) /** * Gets residential_suburb_id * - * @return int + * @return int|null */ public function getResidentialSuburbId() { @@ -1515,12 +1748,15 @@ public function getResidentialSuburbId() /** * Sets residential_suburb_id * - * @param int $residential_suburb_id + * @param int|null $residential_suburb_id * - * @return $this + * @return self */ public function setResidentialSuburbId($residential_suburb_id) { + if (is_null($residential_suburb_id)) { + throw new \InvalidArgumentException('non-nullable residential_suburb_id cannot be null'); + } $this->container['residential_suburb_id'] = $residential_suburb_id; return $this; @@ -1529,7 +1765,7 @@ public function setResidentialSuburbId($residential_suburb_id) /** * Gets residential_suburb * - * @return string + * @return string|null */ public function getResidentialSuburb() { @@ -1539,12 +1775,15 @@ public function getResidentialSuburb() /** * Sets residential_suburb * - * @param string $residential_suburb + * @param string|null $residential_suburb * - * @return $this + * @return self */ public function setResidentialSuburb($residential_suburb) { + if (is_null($residential_suburb)) { + throw new \InvalidArgumentException('non-nullable residential_suburb cannot be null'); + } $this->container['residential_suburb'] = $residential_suburb; return $this; @@ -1553,7 +1792,7 @@ public function setResidentialSuburb($residential_suburb) /** * Gets residential_state * - * @return string + * @return string|null */ public function getResidentialState() { @@ -1563,12 +1802,15 @@ public function getResidentialState() /** * Sets residential_state * - * @param string $residential_state + * @param string|null $residential_state * - * @return $this + * @return self */ public function setResidentialState($residential_state) { + if (is_null($residential_state)) { + throw new \InvalidArgumentException('non-nullable residential_state cannot be null'); + } $this->container['residential_state'] = $residential_state; return $this; @@ -1577,7 +1819,7 @@ public function setResidentialState($residential_state) /** * Gets residential_postcode * - * @return string + * @return string|null */ public function getResidentialPostcode() { @@ -1587,12 +1829,15 @@ public function getResidentialPostcode() /** * Sets residential_postcode * - * @param string $residential_postcode + * @param string|null $residential_postcode * - * @return $this + * @return self */ public function setResidentialPostcode($residential_postcode) { + if (is_null($residential_postcode)) { + throw new \InvalidArgumentException('non-nullable residential_postcode cannot be null'); + } $this->container['residential_postcode'] = $residential_postcode; return $this; @@ -1601,7 +1846,7 @@ public function setResidentialPostcode($residential_postcode) /** * Gets residential_country * - * @return string + * @return string|null */ public function getResidentialCountry() { @@ -1611,12 +1856,15 @@ public function getResidentialCountry() /** * Sets residential_country * - * @param string $residential_country + * @param string|null $residential_country * - * @return $this + * @return self */ public function setResidentialCountry($residential_country) { + if (is_null($residential_country)) { + throw new \InvalidArgumentException('non-nullable residential_country cannot be null'); + } $this->container['residential_country'] = $residential_country; return $this; @@ -1625,7 +1873,7 @@ public function setResidentialCountry($residential_country) /** * Gets residential_country_id * - * @return string + * @return string|null */ public function getResidentialCountryId() { @@ -1635,12 +1883,15 @@ public function getResidentialCountryId() /** * Sets residential_country_id * - * @param string $residential_country_id + * @param string|null $residential_country_id * - * @return $this + * @return self */ public function setResidentialCountryId($residential_country_id) { + if (is_null($residential_country_id)) { + throw new \InvalidArgumentException('non-nullable residential_country_id cannot be null'); + } $this->container['residential_country_id'] = $residential_country_id; return $this; @@ -1649,7 +1900,7 @@ public function setResidentialCountryId($residential_country_id) /** * Gets is_overseas_residential_address * - * @return bool + * @return bool|null */ public function getIsOverseasResidentialAddress() { @@ -1659,12 +1910,15 @@ public function getIsOverseasResidentialAddress() /** * Sets is_overseas_residential_address * - * @param bool $is_overseas_residential_address + * @param bool|null $is_overseas_residential_address * - * @return $this + * @return self */ public function setIsOverseasResidentialAddress($is_overseas_residential_address) { + if (is_null($is_overseas_residential_address)) { + throw new \InvalidArgumentException('non-nullable is_overseas_residential_address cannot be null'); + } $this->container['is_overseas_residential_address'] = $is_overseas_residential_address; return $this; @@ -1673,7 +1927,7 @@ public function setIsOverseasResidentialAddress($is_overseas_residential_address /** * Gets residential_address_type * - * @return string + * @return string|null */ public function getResidentialAddressType() { @@ -1683,17 +1937,21 @@ public function getResidentialAddressType() /** * Sets residential_address_type * - * @param string $residential_address_type + * @param string|null $residential_address_type * - * @return $this + * @return self */ public function setResidentialAddressType($residential_address_type) { + if (is_null($residential_address_type)) { + throw new \InvalidArgumentException('non-nullable residential_address_type cannot be null'); + } $allowedValues = $this->getResidentialAddressTypeAllowableValues(); - if (!is_null($residential_address_type) && !in_array($residential_address_type, $allowedValues, true)) { + if (!in_array($residential_address_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'residential_address_type', must be one of '%s'", + "Invalid value '%s' for 'residential_address_type', must be one of '%s'", + $residential_address_type, implode("', '", $allowedValues) ) ); @@ -1706,7 +1964,7 @@ public function setResidentialAddressType($residential_address_type) /** * Gets residential_block_number * - * @return string + * @return string|null */ public function getResidentialBlockNumber() { @@ -1716,12 +1974,15 @@ public function getResidentialBlockNumber() /** * Sets residential_block_number * - * @param string $residential_block_number + * @param string|null $residential_block_number * - * @return $this + * @return self */ public function setResidentialBlockNumber($residential_block_number) { + if (is_null($residential_block_number)) { + throw new \InvalidArgumentException('non-nullable residential_block_number cannot be null'); + } $this->container['residential_block_number'] = $residential_block_number; return $this; @@ -1730,7 +1991,7 @@ public function setResidentialBlockNumber($residential_block_number) /** * Gets residential_level_number * - * @return string + * @return string|null */ public function getResidentialLevelNumber() { @@ -1740,12 +2001,15 @@ public function getResidentialLevelNumber() /** * Sets residential_level_number * - * @param string $residential_level_number + * @param string|null $residential_level_number * - * @return $this + * @return self */ public function setResidentialLevelNumber($residential_level_number) { + if (is_null($residential_level_number)) { + throw new \InvalidArgumentException('non-nullable residential_level_number cannot be null'); + } $this->container['residential_level_number'] = $residential_level_number; return $this; @@ -1754,7 +2018,7 @@ public function setResidentialLevelNumber($residential_level_number) /** * Gets residential_unit_number * - * @return string + * @return string|null */ public function getResidentialUnitNumber() { @@ -1764,12 +2028,15 @@ public function getResidentialUnitNumber() /** * Sets residential_unit_number * - * @param string $residential_unit_number + * @param string|null $residential_unit_number * - * @return $this + * @return self */ public function setResidentialUnitNumber($residential_unit_number) { + if (is_null($residential_unit_number)) { + throw new \InvalidArgumentException('non-nullable residential_unit_number cannot be null'); + } $this->container['residential_unit_number'] = $residential_unit_number; return $this; @@ -1778,7 +2045,7 @@ public function setResidentialUnitNumber($residential_unit_number) /** * Gets residential_street_name * - * @return string + * @return string|null */ public function getResidentialStreetName() { @@ -1788,12 +2055,15 @@ public function getResidentialStreetName() /** * Sets residential_street_name * - * @param string $residential_street_name + * @param string|null $residential_street_name * - * @return $this + * @return self */ public function setResidentialStreetName($residential_street_name) { + if (is_null($residential_street_name)) { + throw new \InvalidArgumentException('non-nullable residential_street_name cannot be null'); + } $this->container['residential_street_name'] = $residential_street_name; return $this; @@ -1802,7 +2072,7 @@ public function setResidentialStreetName($residential_street_name) /** * Gets residential_address_line3 * - * @return string + * @return string|null */ public function getResidentialAddressLine3() { @@ -1812,12 +2082,15 @@ public function getResidentialAddressLine3() /** * Sets residential_address_line3 * - * @param string $residential_address_line3 + * @param string|null $residential_address_line3 * - * @return $this + * @return self */ public function setResidentialAddressLine3($residential_address_line3) { + if (is_null($residential_address_line3)) { + throw new \InvalidArgumentException('non-nullable residential_address_line3 cannot be null'); + } $this->container['residential_address_line3'] = $residential_address_line3; return $this; @@ -1826,7 +2099,7 @@ public function setResidentialAddressLine3($residential_address_line3) /** * Gets postal_street_address * - * @return string + * @return string|null */ public function getPostalStreetAddress() { @@ -1836,12 +2109,15 @@ public function getPostalStreetAddress() /** * Sets postal_street_address * - * @param string $postal_street_address + * @param string|null $postal_street_address * - * @return $this + * @return self */ public function setPostalStreetAddress($postal_street_address) { + if (is_null($postal_street_address)) { + throw new \InvalidArgumentException('non-nullable postal_street_address cannot be null'); + } $this->container['postal_street_address'] = $postal_street_address; return $this; @@ -1850,7 +2126,7 @@ public function setPostalStreetAddress($postal_street_address) /** * Gets postal_address_line2 * - * @return string + * @return string|null */ public function getPostalAddressLine2() { @@ -1860,12 +2136,15 @@ public function getPostalAddressLine2() /** * Sets postal_address_line2 * - * @param string $postal_address_line2 + * @param string|null $postal_address_line2 * - * @return $this + * @return self */ public function setPostalAddressLine2($postal_address_line2) { + if (is_null($postal_address_line2)) { + throw new \InvalidArgumentException('non-nullable postal_address_line2 cannot be null'); + } $this->container['postal_address_line2'] = $postal_address_line2; return $this; @@ -1874,7 +2153,7 @@ public function setPostalAddressLine2($postal_address_line2) /** * Gets postal_suburb_id * - * @return int + * @return int|null */ public function getPostalSuburbId() { @@ -1884,12 +2163,15 @@ public function getPostalSuburbId() /** * Sets postal_suburb_id * - * @param int $postal_suburb_id + * @param int|null $postal_suburb_id * - * @return $this + * @return self */ public function setPostalSuburbId($postal_suburb_id) { + if (is_null($postal_suburb_id)) { + throw new \InvalidArgumentException('non-nullable postal_suburb_id cannot be null'); + } $this->container['postal_suburb_id'] = $postal_suburb_id; return $this; @@ -1898,7 +2180,7 @@ public function setPostalSuburbId($postal_suburb_id) /** * Gets postal_suburb * - * @return string + * @return string|null */ public function getPostalSuburb() { @@ -1908,12 +2190,15 @@ public function getPostalSuburb() /** * Sets postal_suburb * - * @param string $postal_suburb + * @param string|null $postal_suburb * - * @return $this + * @return self */ public function setPostalSuburb($postal_suburb) { + if (is_null($postal_suburb)) { + throw new \InvalidArgumentException('non-nullable postal_suburb cannot be null'); + } $this->container['postal_suburb'] = $postal_suburb; return $this; @@ -1922,7 +2207,7 @@ public function setPostalSuburb($postal_suburb) /** * Gets postal_state * - * @return string + * @return string|null */ public function getPostalState() { @@ -1932,12 +2217,15 @@ public function getPostalState() /** * Sets postal_state * - * @param string $postal_state + * @param string|null $postal_state * - * @return $this + * @return self */ public function setPostalState($postal_state) { + if (is_null($postal_state)) { + throw new \InvalidArgumentException('non-nullable postal_state cannot be null'); + } $this->container['postal_state'] = $postal_state; return $this; @@ -1946,7 +2234,7 @@ public function setPostalState($postal_state) /** * Gets postal_postcode * - * @return string + * @return string|null */ public function getPostalPostcode() { @@ -1956,12 +2244,15 @@ public function getPostalPostcode() /** * Sets postal_postcode * - * @param string $postal_postcode + * @param string|null $postal_postcode * - * @return $this + * @return self */ public function setPostalPostcode($postal_postcode) { + if (is_null($postal_postcode)) { + throw new \InvalidArgumentException('non-nullable postal_postcode cannot be null'); + } $this->container['postal_postcode'] = $postal_postcode; return $this; @@ -1970,7 +2261,7 @@ public function setPostalPostcode($postal_postcode) /** * Gets postal_country * - * @return string + * @return string|null */ public function getPostalCountry() { @@ -1980,12 +2271,15 @@ public function getPostalCountry() /** * Sets postal_country * - * @param string $postal_country + * @param string|null $postal_country * - * @return $this + * @return self */ public function setPostalCountry($postal_country) { + if (is_null($postal_country)) { + throw new \InvalidArgumentException('non-nullable postal_country cannot be null'); + } $this->container['postal_country'] = $postal_country; return $this; @@ -1994,7 +2288,7 @@ public function setPostalCountry($postal_country) /** * Gets postal_country_id * - * @return string + * @return string|null */ public function getPostalCountryId() { @@ -2004,12 +2298,15 @@ public function getPostalCountryId() /** * Sets postal_country_id * - * @param string $postal_country_id + * @param string|null $postal_country_id * - * @return $this + * @return self */ public function setPostalCountryId($postal_country_id) { + if (is_null($postal_country_id)) { + throw new \InvalidArgumentException('non-nullable postal_country_id cannot be null'); + } $this->container['postal_country_id'] = $postal_country_id; return $this; @@ -2018,7 +2315,7 @@ public function setPostalCountryId($postal_country_id) /** * Gets is_overseas_postal_address * - * @return bool + * @return bool|null */ public function getIsOverseasPostalAddress() { @@ -2028,12 +2325,15 @@ public function getIsOverseasPostalAddress() /** * Sets is_overseas_postal_address * - * @param bool $is_overseas_postal_address + * @param bool|null $is_overseas_postal_address * - * @return $this + * @return self */ public function setIsOverseasPostalAddress($is_overseas_postal_address) { + if (is_null($is_overseas_postal_address)) { + throw new \InvalidArgumentException('non-nullable is_overseas_postal_address cannot be null'); + } $this->container['is_overseas_postal_address'] = $is_overseas_postal_address; return $this; @@ -2042,7 +2342,7 @@ public function setIsOverseasPostalAddress($is_overseas_postal_address) /** * Gets postal_address_type * - * @return string + * @return string|null */ public function getPostalAddressType() { @@ -2052,17 +2352,21 @@ public function getPostalAddressType() /** * Sets postal_address_type * - * @param string $postal_address_type + * @param string|null $postal_address_type * - * @return $this + * @return self */ public function setPostalAddressType($postal_address_type) { + if (is_null($postal_address_type)) { + throw new \InvalidArgumentException('non-nullable postal_address_type cannot be null'); + } $allowedValues = $this->getPostalAddressTypeAllowableValues(); - if (!is_null($postal_address_type) && !in_array($postal_address_type, $allowedValues, true)) { + if (!in_array($postal_address_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'postal_address_type', must be one of '%s'", + "Invalid value '%s' for 'postal_address_type', must be one of '%s'", + $postal_address_type, implode("', '", $allowedValues) ) ); @@ -2075,7 +2379,7 @@ public function setPostalAddressType($postal_address_type) /** * Gets postal_block_number * - * @return string + * @return string|null */ public function getPostalBlockNumber() { @@ -2085,12 +2389,15 @@ public function getPostalBlockNumber() /** * Sets postal_block_number * - * @param string $postal_block_number + * @param string|null $postal_block_number * - * @return $this + * @return self */ public function setPostalBlockNumber($postal_block_number) { + if (is_null($postal_block_number)) { + throw new \InvalidArgumentException('non-nullable postal_block_number cannot be null'); + } $this->container['postal_block_number'] = $postal_block_number; return $this; @@ -2099,7 +2406,7 @@ public function setPostalBlockNumber($postal_block_number) /** * Gets postal_level_number * - * @return string + * @return string|null */ public function getPostalLevelNumber() { @@ -2109,12 +2416,15 @@ public function getPostalLevelNumber() /** * Sets postal_level_number * - * @param string $postal_level_number + * @param string|null $postal_level_number * - * @return $this + * @return self */ public function setPostalLevelNumber($postal_level_number) { + if (is_null($postal_level_number)) { + throw new \InvalidArgumentException('non-nullable postal_level_number cannot be null'); + } $this->container['postal_level_number'] = $postal_level_number; return $this; @@ -2123,7 +2433,7 @@ public function setPostalLevelNumber($postal_level_number) /** * Gets postal_unit_number * - * @return string + * @return string|null */ public function getPostalUnitNumber() { @@ -2133,12 +2443,15 @@ public function getPostalUnitNumber() /** * Sets postal_unit_number * - * @param string $postal_unit_number + * @param string|null $postal_unit_number * - * @return $this + * @return self */ public function setPostalUnitNumber($postal_unit_number) { + if (is_null($postal_unit_number)) { + throw new \InvalidArgumentException('non-nullable postal_unit_number cannot be null'); + } $this->container['postal_unit_number'] = $postal_unit_number; return $this; @@ -2147,7 +2460,7 @@ public function setPostalUnitNumber($postal_unit_number) /** * Gets postal_street_name * - * @return string + * @return string|null */ public function getPostalStreetName() { @@ -2157,12 +2470,15 @@ public function getPostalStreetName() /** * Sets postal_street_name * - * @param string $postal_street_name + * @param string|null $postal_street_name * - * @return $this + * @return self */ public function setPostalStreetName($postal_street_name) { + if (is_null($postal_street_name)) { + throw new \InvalidArgumentException('non-nullable postal_street_name cannot be null'); + } $this->container['postal_street_name'] = $postal_street_name; return $this; @@ -2171,7 +2487,7 @@ public function setPostalStreetName($postal_street_name) /** * Gets postal_address_line3 * - * @return string + * @return string|null */ public function getPostalAddressLine3() { @@ -2181,12 +2497,15 @@ public function getPostalAddressLine3() /** * Sets postal_address_line3 * - * @param string $postal_address_line3 + * @param string|null $postal_address_line3 * - * @return $this + * @return self */ public function setPostalAddressLine3($postal_address_line3) { + if (is_null($postal_address_line3)) { + throw new \InvalidArgumentException('non-nullable postal_address_line3 cannot be null'); + } $this->container['postal_address_line3'] = $postal_address_line3; return $this; @@ -2195,7 +2514,7 @@ public function setPostalAddressLine3($postal_address_line3) /** * Gets is_postal_address_same_as_residential * - * @return bool + * @return bool|null */ public function getIsPostalAddressSameAsResidential() { @@ -2205,12 +2524,15 @@ public function getIsPostalAddressSameAsResidential() /** * Sets is_postal_address_same_as_residential * - * @param bool $is_postal_address_same_as_residential + * @param bool|null $is_postal_address_same_as_residential * - * @return $this + * @return self */ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_residential) { + if (is_null($is_postal_address_same_as_residential)) { + throw new \InvalidArgumentException('non-nullable is_postal_address_same_as_residential cannot be null'); + } $this->container['is_postal_address_same_as_residential'] = $is_postal_address_same_as_residential; return $this; @@ -2219,7 +2541,7 @@ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_r /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -2229,12 +2551,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -2243,7 +2568,7 @@ public function setEmail($email) /** * Gets home_phone * - * @return string + * @return string|null */ public function getHomePhone() { @@ -2253,12 +2578,15 @@ public function getHomePhone() /** * Sets home_phone * - * @param string $home_phone + * @param string|null $home_phone * - * @return $this + * @return self */ public function setHomePhone($home_phone) { + if (is_null($home_phone)) { + throw new \InvalidArgumentException('non-nullable home_phone cannot be null'); + } $this->container['home_phone'] = $home_phone; return $this; @@ -2267,7 +2595,7 @@ public function setHomePhone($home_phone) /** * Gets work_phone * - * @return string + * @return string|null */ public function getWorkPhone() { @@ -2277,12 +2605,15 @@ public function getWorkPhone() /** * Sets work_phone * - * @param string $work_phone + * @param string|null $work_phone * - * @return $this + * @return self */ public function setWorkPhone($work_phone) { + if (is_null($work_phone)) { + throw new \InvalidArgumentException('non-nullable work_phone cannot be null'); + } $this->container['work_phone'] = $work_phone; return $this; @@ -2291,7 +2622,7 @@ public function setWorkPhone($work_phone) /** * Gets mobile_phone * - * @return string + * @return string|null */ public function getMobilePhone() { @@ -2301,12 +2632,15 @@ public function getMobilePhone() /** * Sets mobile_phone * - * @param string $mobile_phone + * @param string|null $mobile_phone * - * @return $this + * @return self */ public function setMobilePhone($mobile_phone) { + if (is_null($mobile_phone)) { + throw new \InvalidArgumentException('non-nullable mobile_phone cannot be null'); + } $this->container['mobile_phone'] = $mobile_phone; return $this; @@ -2318,7 +2652,7 @@ public function setMobilePhone($mobile_phone) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -2328,22 +2662,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -2359,11 +2694,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -2371,13 +2719,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeePublicHolidayFilter.php b/src/lib/Model/EmployeePublicHolidayFilter.php index 03ef872..e0f9d88 100644 --- a/src/lib/Model/EmployeePublicHolidayFilter.php +++ b/src/lib/Model/EmployeePublicHolidayFilter.php @@ -2,61 +2,61 @@ /** * EmployeePublicHolidayFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeePublicHolidayFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeePublicHolidayFilter implements ModelInterface, ArrayAccess +class EmployeePublicHolidayFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeePublicHolidayFilter'; + protected static $openAPIModelName = 'EmployeePublicHolidayFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime' ]; @@ -65,20 +65,39 @@ class EmployeePublicHolidayFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -231,10 +317,13 @@ public function getFromDate() * * @param \DateTime $from_date Required * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -255,10 +344,13 @@ public function getToDate() * * @param \DateTime $to_date Required * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -270,7 +362,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -280,22 +372,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,11 +404,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -323,13 +429,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeQualificationDocumentModel.php b/src/lib/Model/EmployeeQualificationDocumentModel.php index 1b38eb1..e368fd8 100644 --- a/src/lib/Model/EmployeeQualificationDocumentModel.php +++ b/src/lib/Model/EmployeeQualificationDocumentModel.php @@ -2,61 +2,61 @@ /** * EmployeeQualificationDocumentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeQualificationDocumentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeQualificationDocumentModel implements ModelInterface, ArrayAccess +class EmployeeQualificationDocumentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeQualificationDocumentModel'; + protected static $openAPIModelName = 'EmployeeQualificationDocumentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'date_created' => '\DateTime', @@ -67,22 +67,43 @@ class EmployeeQualificationDocumentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'date_created' => 'date-time', 'visible' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'date_created' => false, + 'visible' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['visible'] = isset($data['visible']) ? $data['visible'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('visible', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -259,12 +350,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -273,7 +367,7 @@ public function setName($name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -283,12 +377,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -297,7 +394,7 @@ public function setDateCreated($date_created) /** * Gets visible * - * @return bool + * @return bool|null */ public function getVisible() { @@ -307,12 +404,15 @@ public function getVisible() /** * Sets visible * - * @param bool $visible + * @param bool|null $visible * - * @return $this + * @return self */ public function setVisible($visible) { + if (is_null($visible)) { + throw new \InvalidArgumentException('non-nullable visible cannot be null'); + } $this->container['visible'] = $visible; return $this; @@ -324,7 +424,7 @@ public function setVisible($visible) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeQualificationModel.php b/src/lib/Model/EmployeeQualificationModel.php index 1e8b726..cb9b006 100644 --- a/src/lib/Model/EmployeeQualificationModel.php +++ b/src/lib/Model/EmployeeQualificationModel.php @@ -2,66 +2,66 @@ /** * EmployeeQualificationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeQualificationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeQualificationModel implements ModelInterface, ArrayAccess +class EmployeeQualificationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeQualificationModel'; + protected static $openAPIModelName = 'EmployeeQualificationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'qualification_id' => 'int', 'name' => 'string', 'expiry_date' => '\DateTime', 'issue_date' => '\DateTime', - 'documents' => '\Swagger\Client\Model\EmployeeQualificationDocumentModel[]', + 'documents' => '\OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]', 'reference_number' => 'string' ]; @@ -69,8 +69,10 @@ class EmployeeQualificationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'qualification_id' => 'int32', 'name' => null, 'expiry_date' => 'date-time', @@ -79,14 +81,35 @@ class EmployeeQualificationModel implements ModelInterface, ArrayAccess 'reference_number' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qualification_id' => false, + 'name' => false, + 'expiry_date' => false, + 'issue_date' => false, + 'documents' => false, + 'reference_number' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['qualification_id'] = isset($data['qualification_id']) ? $data['qualification_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['issue_date'] = isset($data['issue_date']) ? $data['issue_date'] : null; - $this->container['documents'] = isset($data['documents']) ? $data['documents'] : null; - $this->container['reference_number'] = isset($data['reference_number']) ? $data['reference_number'] : null; + $this->setIfExists('qualification_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('issue_date', $data ?? [], null); + $this->setIfExists('documents', $data ?? [], null); + $this->setIfExists('reference_number', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets qualification_id * - * @return int + * @return int|null */ public function getQualificationId() { @@ -247,12 +337,15 @@ public function getQualificationId() /** * Sets qualification_id * - * @param int $qualification_id + * @param int|null $qualification_id * - * @return $this + * @return self */ public function setQualificationId($qualification_id) { + if (is_null($qualification_id)) { + throw new \InvalidArgumentException('non-nullable qualification_id cannot be null'); + } $this->container['qualification_id'] = $qualification_id; return $this; @@ -261,7 +354,7 @@ public function setQualificationId($qualification_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -271,12 +364,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -285,7 +381,7 @@ public function setName($name) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -295,12 +391,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -309,7 +408,7 @@ public function setExpiryDate($expiry_date) /** * Gets issue_date * - * @return \DateTime + * @return \DateTime|null */ public function getIssueDate() { @@ -319,12 +418,15 @@ public function getIssueDate() /** * Sets issue_date * - * @param \DateTime $issue_date + * @param \DateTime|null $issue_date * - * @return $this + * @return self */ public function setIssueDate($issue_date) { + if (is_null($issue_date)) { + throw new \InvalidArgumentException('non-nullable issue_date cannot be null'); + } $this->container['issue_date'] = $issue_date; return $this; @@ -333,7 +435,7 @@ public function setIssueDate($issue_date) /** * Gets documents * - * @return \Swagger\Client\Model\EmployeeQualificationDocumentModel[] + * @return \OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]|null */ public function getDocuments() { @@ -343,12 +445,15 @@ public function getDocuments() /** * Sets documents * - * @param \Swagger\Client\Model\EmployeeQualificationDocumentModel[] $documents + * @param \OpenAPI\Client\Model\EmployeeQualificationDocumentModel[]|null $documents * - * @return $this + * @return self */ public function setDocuments($documents) { + if (is_null($documents)) { + throw new \InvalidArgumentException('non-nullable documents cannot be null'); + } $this->container['documents'] = $documents; return $this; @@ -357,7 +462,7 @@ public function setDocuments($documents) /** * Gets reference_number * - * @return string + * @return string|null */ public function getReferenceNumber() { @@ -367,12 +472,15 @@ public function getReferenceNumber() /** * Sets reference_number * - * @param string $reference_number + * @param string|null $reference_number * - * @return $this + * @return self */ public function setReferenceNumber($reference_number) { + if (is_null($reference_number)) { + throw new \InvalidArgumentException('non-nullable reference_number cannot be null'); + } $this->container['reference_number'] = $reference_number; return $this; @@ -384,7 +492,7 @@ public function setReferenceNumber($reference_number) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeRecurringExpenseModel.php b/src/lib/Model/EmployeeRecurringExpenseModel.php index e29b077..66d8424 100644 --- a/src/lib/Model/EmployeeRecurringExpenseModel.php +++ b/src/lib/Model/EmployeeRecurringExpenseModel.php @@ -2,74 +2,74 @@ /** * EmployeeRecurringExpenseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeRecurringExpenseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeRecurringExpenseModel implements ModelInterface, ArrayAccess +class EmployeeRecurringExpenseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeRecurringExpenseModel'; + protected static $openAPIModelName = 'EmployeeRecurringExpenseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', 'expense_category_id' => 'int', 'location_id' => 'int', 'tax_code' => 'string', 'tax_code_display_name' => 'string', - 'tax_rate' => 'double', + 'tax_rate' => 'float', 'id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'expiry_date' => '\DateTime', 'from_date' => '\DateTime', - 'maximum_amount_paid' => 'double', - 'total_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', + 'total_amount_paid' => 'float', 'is_active' => 'bool', 'notes' => 'string' ]; @@ -78,8 +78,10 @@ class EmployeeRecurringExpenseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'expense_category_id' => 'int32', 'location_id' => 'int32', @@ -97,14 +99,44 @@ class EmployeeRecurringExpenseModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'expense_category_id' => false, + 'location_id' => false, + 'tax_code' => false, + 'tax_code_display_name' => false, + 'tax_rate' => false, + 'id' => false, + 'employee_id' => false, + 'amount' => false, + 'expiry_date' => false, + 'from_date' => false, + 'maximum_amount_paid' => false, + 'total_amount_paid' => false, + 'is_active' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -225,12 +309,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -247,21 +328,39 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expense_category_id'] = isset($data['expense_category_id']) ? $data['expense_category_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_code_display_name'] = isset($data['tax_code_display_name']) ? $data['tax_code_display_name'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['total_amount_paid'] = isset($data['total_amount_paid']) ? $data['total_amount_paid'] : null; - $this->container['is_active'] = isset($data['is_active']) ? $data['is_active'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expense_category_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_code_display_name', $data ?? [], null); + $this->setIfExists('tax_rate', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('total_amount_paid', $data ?? [], null); + $this->setIfExists('is_active', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -291,7 +390,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -301,12 +400,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -315,7 +417,7 @@ public function setName($name) /** * Gets expense_category_id * - * @return int + * @return int|null */ public function getExpenseCategoryId() { @@ -325,12 +427,15 @@ public function getExpenseCategoryId() /** * Sets expense_category_id * - * @param int $expense_category_id + * @param int|null $expense_category_id * - * @return $this + * @return self */ public function setExpenseCategoryId($expense_category_id) { + if (is_null($expense_category_id)) { + throw new \InvalidArgumentException('non-nullable expense_category_id cannot be null'); + } $this->container['expense_category_id'] = $expense_category_id; return $this; @@ -339,7 +444,7 @@ public function setExpenseCategoryId($expense_category_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -349,12 +454,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -363,7 +471,7 @@ public function setLocationId($location_id) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -373,12 +481,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -387,7 +498,7 @@ public function setTaxCode($tax_code) /** * Gets tax_code_display_name * - * @return string + * @return string|null */ public function getTaxCodeDisplayName() { @@ -397,12 +508,15 @@ public function getTaxCodeDisplayName() /** * Sets tax_code_display_name * - * @param string $tax_code_display_name + * @param string|null $tax_code_display_name * - * @return $this + * @return self */ public function setTaxCodeDisplayName($tax_code_display_name) { + if (is_null($tax_code_display_name)) { + throw new \InvalidArgumentException('non-nullable tax_code_display_name cannot be null'); + } $this->container['tax_code_display_name'] = $tax_code_display_name; return $this; @@ -411,7 +525,7 @@ public function setTaxCodeDisplayName($tax_code_display_name) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -421,12 +535,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -435,7 +552,7 @@ public function setTaxRate($tax_rate) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -445,12 +562,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -459,7 +579,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -469,12 +589,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -483,7 +606,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -493,12 +616,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -507,7 +633,7 @@ public function setAmount($amount) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -517,12 +643,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -531,7 +660,7 @@ public function setExpiryDate($expiry_date) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -541,12 +670,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -555,7 +687,7 @@ public function setFromDate($from_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -565,12 +697,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -579,7 +714,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets total_amount_paid * - * @return double + * @return float|null */ public function getTotalAmountPaid() { @@ -589,12 +724,15 @@ public function getTotalAmountPaid() /** * Sets total_amount_paid * - * @param double $total_amount_paid + * @param float|null $total_amount_paid * - * @return $this + * @return self */ public function setTotalAmountPaid($total_amount_paid) { + if (is_null($total_amount_paid)) { + throw new \InvalidArgumentException('non-nullable total_amount_paid cannot be null'); + } $this->container['total_amount_paid'] = $total_amount_paid; return $this; @@ -603,7 +741,7 @@ public function setTotalAmountPaid($total_amount_paid) /** * Gets is_active * - * @return bool + * @return bool|null */ public function getIsActive() { @@ -613,12 +751,15 @@ public function getIsActive() /** * Sets is_active * - * @param bool $is_active + * @param bool|null $is_active * - * @return $this + * @return self */ public function setIsActive($is_active) { + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + } $this->container['is_active'] = $is_active; return $this; @@ -627,7 +768,7 @@ public function setIsActive($is_active) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -637,12 +778,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -654,7 +798,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -664,22 +808,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,11 +840,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -707,13 +865,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeRecurringSuperAdjustmentModel.php b/src/lib/Model/EmployeeRecurringSuperAdjustmentModel.php index b77ffe8..ea214ed 100644 --- a/src/lib/Model/EmployeeRecurringSuperAdjustmentModel.php +++ b/src/lib/Model/EmployeeRecurringSuperAdjustmentModel.php @@ -2,70 +2,70 @@ /** * EmployeeRecurringSuperAdjustmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeRecurringSuperAdjustmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeRecurringSuperAdjustmentModel implements ModelInterface, ArrayAccess +class EmployeeRecurringSuperAdjustmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeRecurringSuperAdjustmentModel'; + protected static $openAPIModelName = 'EmployeeRecurringSuperAdjustmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'contribution_type' => 'string', 'adjustment_type' => 'string', 'id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'expiry_date' => '\DateTime', 'from_date' => '\DateTime', - 'maximum_amount_paid' => 'double', - 'total_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', + 'total_amount_paid' => 'float', 'is_active' => 'bool', 'notes' => 'string' ]; @@ -74,8 +74,10 @@ class EmployeeRecurringSuperAdjustmentModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'contribution_type' => null, 'adjustment_type' => null, 'id' => 'int32', @@ -89,14 +91,40 @@ class EmployeeRecurringSuperAdjustmentModel implements ModelInterface, ArrayAcce 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contribution_type' => false, + 'adjustment_type' => false, + 'id' => false, + 'employee_id' => false, + 'amount' => false, + 'expiry_date' => false, + 'from_date' => false, + 'maximum_amount_paid' => false, + 'total_amount_paid' => false, + 'is_active' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,21 +285,19 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const CONTRIBUTION_TYPE_SUPER_GUARANTEE = 'SuperGuarantee'; - const CONTRIBUTION_TYPE_SALARY_SACRIFICE = 'SalarySacrifice'; - const CONTRIBUTION_TYPE_MEMBER_VOLUNTARY = 'MemberVoluntary'; - const CONTRIBUTION_TYPE_EMPLOYER_CONTRIBUTION = 'EmployerContribution'; - const CONTRIBUTION_TYPE_NON_RESC_EMPLOYER_CONTRIBUTION = 'NonRescEmployerContribution'; - const ADJUSTMENT_TYPE_FIXED = 'Fixed'; - const ADJUSTMENT_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; - const ADJUSTMENT_TYPE_PERCENTAGE_OTE = 'PercentageOTE'; - const ADJUSTMENT_TYPE_PERCENTAGE_TAXABLE_EARNINGS = 'PercentageTaxableEarnings'; - + public const CONTRIBUTION_TYPE_SUPER_GUARANTEE = 'SuperGuarantee'; + public const CONTRIBUTION_TYPE_SALARY_SACRIFICE = 'SalarySacrifice'; + public const CONTRIBUTION_TYPE_MEMBER_VOLUNTARY = 'MemberVoluntary'; + public const CONTRIBUTION_TYPE_EMPLOYER_CONTRIBUTION = 'EmployerContribution'; + public const CONTRIBUTION_TYPE_NON_RESC_EMPLOYER_CONTRIBUTION = 'NonRescEmployerContribution'; + public const ADJUSTMENT_TYPE_FIXED = 'Fixed'; + public const ADJUSTMENT_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; + public const ADJUSTMENT_TYPE_PERCENTAGE_OTE = 'PercentageOTE'; + public const ADJUSTMENT_TYPE_PERCENTAGE_TAXABLE_EARNINGS = 'PercentageTaxableEarnings'; - /** * Gets allowable values of the enum * @@ -235,7 +313,7 @@ public function getContributionTypeAllowableValues() self::CONTRIBUTION_TYPE_NON_RESC_EMPLOYER_CONTRIBUTION, ]; } - + /** * Gets allowable values of the enum * @@ -250,7 +328,6 @@ public function getAdjustmentTypeAllowableValues() self::ADJUSTMENT_TYPE_PERCENTAGE_TAXABLE_EARNINGS, ]; } - /** * Associative array for storing property values @@ -267,17 +344,35 @@ public function getAdjustmentTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['contribution_type'] = isset($data['contribution_type']) ? $data['contribution_type'] : null; - $this->container['adjustment_type'] = isset($data['adjustment_type']) ? $data['adjustment_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['total_amount_paid'] = isset($data['total_amount_paid']) ? $data['total_amount_paid'] : null; - $this->container['is_active'] = isset($data['is_active']) ? $data['is_active'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('contribution_type', $data ?? [], null); + $this->setIfExists('adjustment_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('total_amount_paid', $data ?? [], null); + $this->setIfExists('is_active', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -292,7 +387,8 @@ public function listInvalidProperties() $allowedValues = $this->getContributionTypeAllowableValues(); if (!is_null($this->container['contribution_type']) && !in_array($this->container['contribution_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'contribution_type', must be one of '%s'", + "invalid value '%s' for 'contribution_type', must be one of '%s'", + $this->container['contribution_type'], implode("', '", $allowedValues) ); } @@ -300,7 +396,8 @@ public function listInvalidProperties() $allowedValues = $this->getAdjustmentTypeAllowableValues(); if (!is_null($this->container['adjustment_type']) && !in_array($this->container['adjustment_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'adjustment_type', must be one of '%s'", + "invalid value '%s' for 'adjustment_type', must be one of '%s'", + $this->container['adjustment_type'], implode("', '", $allowedValues) ); } @@ -323,7 +420,7 @@ public function valid() /** * Gets contribution_type * - * @return string + * @return string|null */ public function getContributionType() { @@ -333,17 +430,21 @@ public function getContributionType() /** * Sets contribution_type * - * @param string $contribution_type + * @param string|null $contribution_type * - * @return $this + * @return self */ public function setContributionType($contribution_type) { + if (is_null($contribution_type)) { + throw new \InvalidArgumentException('non-nullable contribution_type cannot be null'); + } $allowedValues = $this->getContributionTypeAllowableValues(); - if (!is_null($contribution_type) && !in_array($contribution_type, $allowedValues, true)) { + if (!in_array($contribution_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'contribution_type', must be one of '%s'", + "Invalid value '%s' for 'contribution_type', must be one of '%s'", + $contribution_type, implode("', '", $allowedValues) ) ); @@ -356,7 +457,7 @@ public function setContributionType($contribution_type) /** * Gets adjustment_type * - * @return string + * @return string|null */ public function getAdjustmentType() { @@ -366,17 +467,21 @@ public function getAdjustmentType() /** * Sets adjustment_type * - * @param string $adjustment_type + * @param string|null $adjustment_type * - * @return $this + * @return self */ public function setAdjustmentType($adjustment_type) { + if (is_null($adjustment_type)) { + throw new \InvalidArgumentException('non-nullable adjustment_type cannot be null'); + } $allowedValues = $this->getAdjustmentTypeAllowableValues(); - if (!is_null($adjustment_type) && !in_array($adjustment_type, $allowedValues, true)) { + if (!in_array($adjustment_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'adjustment_type', must be one of '%s'", + "Invalid value '%s' for 'adjustment_type', must be one of '%s'", + $adjustment_type, implode("', '", $allowedValues) ) ); @@ -389,7 +494,7 @@ public function setAdjustmentType($adjustment_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -399,12 +504,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -413,7 +521,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -423,12 +531,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -437,7 +548,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -447,12 +558,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -461,7 +575,7 @@ public function setAmount($amount) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -471,12 +585,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -485,7 +602,7 @@ public function setExpiryDate($expiry_date) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -495,12 +612,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -509,7 +629,7 @@ public function setFromDate($from_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -519,12 +639,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -533,7 +656,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets total_amount_paid * - * @return double + * @return float|null */ public function getTotalAmountPaid() { @@ -543,12 +666,15 @@ public function getTotalAmountPaid() /** * Sets total_amount_paid * - * @param double $total_amount_paid + * @param float|null $total_amount_paid * - * @return $this + * @return self */ public function setTotalAmountPaid($total_amount_paid) { + if (is_null($total_amount_paid)) { + throw new \InvalidArgumentException('non-nullable total_amount_paid cannot be null'); + } $this->container['total_amount_paid'] = $total_amount_paid; return $this; @@ -557,7 +683,7 @@ public function setTotalAmountPaid($total_amount_paid) /** * Gets is_active * - * @return bool + * @return bool|null */ public function getIsActive() { @@ -567,12 +693,15 @@ public function getIsActive() /** * Sets is_active * - * @param bool $is_active + * @param bool|null $is_active * - * @return $this + * @return self */ public function setIsActive($is_active) { + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + } $this->container['is_active'] = $is_active; return $this; @@ -581,7 +710,7 @@ public function setIsActive($is_active) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -591,12 +720,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -608,7 +740,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -618,22 +750,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -649,11 +782,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -661,13 +807,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeRecurringTaxAdjustmentModel.php b/src/lib/Model/EmployeeRecurringTaxAdjustmentModel.php index 64f346d..02daf9b 100644 --- a/src/lib/Model/EmployeeRecurringTaxAdjustmentModel.php +++ b/src/lib/Model/EmployeeRecurringTaxAdjustmentModel.php @@ -2,69 +2,69 @@ /** * EmployeeRecurringTaxAdjustmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeRecurringTaxAdjustmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeRecurringTaxAdjustmentModel implements ModelInterface, ArrayAccess +class EmployeeRecurringTaxAdjustmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeRecurringTaxAdjustmentModel'; + protected static $openAPIModelName = 'EmployeeRecurringTaxAdjustmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'adjustment_type' => 'string', 'id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'expiry_date' => '\DateTime', 'from_date' => '\DateTime', - 'maximum_amount_paid' => 'double', - 'total_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', + 'total_amount_paid' => 'float', 'is_active' => 'bool', 'notes' => 'string' ]; @@ -73,8 +73,10 @@ class EmployeeRecurringTaxAdjustmentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'adjustment_type' => null, 'id' => 'int32', 'employee_id' => 'int32', @@ -87,14 +89,39 @@ class EmployeeRecurringTaxAdjustmentModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'adjustment_type' => false, + 'id' => false, + 'employee_id' => false, + 'amount' => false, + 'expiry_date' => false, + 'from_date' => false, + 'maximum_amount_paid' => false, + 'total_amount_paid' => false, + 'is_active' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -200,15 +279,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ADJUSTMENT_TYPE_FIXED = 'Fixed'; - const ADJUSTMENT_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; - const ADJUSTMENT_TYPE_PERCENTAGE_TAXABLE_EARNINGS = 'PercentageTaxableEarnings'; - + public const ADJUSTMENT_TYPE_FIXED = 'Fixed'; + public const ADJUSTMENT_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; + public const ADJUSTMENT_TYPE_PERCENTAGE_TAXABLE_EARNINGS = 'PercentageTaxableEarnings'; - /** * Gets allowable values of the enum * @@ -222,7 +299,6 @@ public function getAdjustmentTypeAllowableValues() self::ADJUSTMENT_TYPE_PERCENTAGE_TAXABLE_EARNINGS, ]; } - /** * Associative array for storing property values @@ -239,16 +315,34 @@ public function getAdjustmentTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['adjustment_type'] = isset($data['adjustment_type']) ? $data['adjustment_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['total_amount_paid'] = isset($data['total_amount_paid']) ? $data['total_amount_paid'] : null; - $this->container['is_active'] = isset($data['is_active']) ? $data['is_active'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('adjustment_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('total_amount_paid', $data ?? [], null); + $this->setIfExists('is_active', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -263,7 +357,8 @@ public function listInvalidProperties() $allowedValues = $this->getAdjustmentTypeAllowableValues(); if (!is_null($this->container['adjustment_type']) && !in_array($this->container['adjustment_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'adjustment_type', must be one of '%s'", + "invalid value '%s' for 'adjustment_type', must be one of '%s'", + $this->container['adjustment_type'], implode("', '", $allowedValues) ); } @@ -286,7 +381,7 @@ public function valid() /** * Gets adjustment_type * - * @return string + * @return string|null */ public function getAdjustmentType() { @@ -296,17 +391,21 @@ public function getAdjustmentType() /** * Sets adjustment_type * - * @param string $adjustment_type + * @param string|null $adjustment_type * - * @return $this + * @return self */ public function setAdjustmentType($adjustment_type) { + if (is_null($adjustment_type)) { + throw new \InvalidArgumentException('non-nullable adjustment_type cannot be null'); + } $allowedValues = $this->getAdjustmentTypeAllowableValues(); - if (!is_null($adjustment_type) && !in_array($adjustment_type, $allowedValues, true)) { + if (!in_array($adjustment_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'adjustment_type', must be one of '%s'", + "Invalid value '%s' for 'adjustment_type', must be one of '%s'", + $adjustment_type, implode("', '", $allowedValues) ) ); @@ -319,7 +418,7 @@ public function setAdjustmentType($adjustment_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -329,12 +428,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -343,7 +445,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -353,12 +455,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -367,7 +472,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -377,12 +482,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -391,7 +499,7 @@ public function setAmount($amount) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -401,12 +509,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -415,7 +526,7 @@ public function setExpiryDate($expiry_date) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -425,12 +536,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -439,7 +553,7 @@ public function setFromDate($from_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -449,12 +563,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -463,7 +580,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets total_amount_paid * - * @return double + * @return float|null */ public function getTotalAmountPaid() { @@ -473,12 +590,15 @@ public function getTotalAmountPaid() /** * Sets total_amount_paid * - * @param double $total_amount_paid + * @param float|null $total_amount_paid * - * @return $this + * @return self */ public function setTotalAmountPaid($total_amount_paid) { + if (is_null($total_amount_paid)) { + throw new \InvalidArgumentException('non-nullable total_amount_paid cannot be null'); + } $this->container['total_amount_paid'] = $total_amount_paid; return $this; @@ -487,7 +607,7 @@ public function setTotalAmountPaid($total_amount_paid) /** * Gets is_active * - * @return bool + * @return bool|null */ public function getIsActive() { @@ -497,12 +617,15 @@ public function getIsActive() /** * Sets is_active * - * @param bool $is_active + * @param bool|null $is_active * - * @return $this + * @return self */ public function setIsActive($is_active) { + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + } $this->container['is_active'] = $is_active; return $this; @@ -511,7 +634,7 @@ public function setIsActive($is_active) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -521,12 +644,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -538,7 +664,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -548,22 +674,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -579,11 +706,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -591,13 +731,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeTimesheetFilter.php b/src/lib/Model/EmployeeTimesheetFilter.php index 9780ae6..1e02ffc 100644 --- a/src/lib/Model/EmployeeTimesheetFilter.php +++ b/src/lib/Model/EmployeeTimesheetFilter.php @@ -2,61 +2,61 @@ /** * EmployeeTimesheetFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeTimesheetFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeTimesheetFilter implements ModelInterface, ArrayAccess +class EmployeeTimesheetFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeTimesheetFilter'; + protected static $openAPIModelName = 'EmployeeTimesheetFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime' ]; @@ -65,20 +65,39 @@ class EmployeeTimesheetFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -231,10 +317,13 @@ public function getFromDate() * * @param \DateTime $from_date Required * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -255,10 +344,13 @@ public function getToDate() * * @param \DateTime $to_date Required * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -270,7 +362,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -280,22 +372,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,11 +404,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -323,13 +429,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeUnavailabilityFilter.php b/src/lib/Model/EmployeeUnavailabilityFilter.php index 86475eb..7e9e20a 100644 --- a/src/lib/Model/EmployeeUnavailabilityFilter.php +++ b/src/lib/Model/EmployeeUnavailabilityFilter.php @@ -2,61 +2,61 @@ /** * EmployeeUnavailabilityFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeUnavailabilityFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeUnavailabilityFilter implements ModelInterface, ArrayAccess +class EmployeeUnavailabilityFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeUnavailabilityFilter'; + protected static $openAPIModelName = 'EmployeeUnavailabilityFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime' ]; @@ -65,20 +65,39 @@ class EmployeeUnavailabilityFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -223,12 +309,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -237,7 +326,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -247,12 +336,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -264,7 +356,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeUpdateResponseModel.php b/src/lib/Model/EmployeeUpdateResponseModel.php index 074a85d..4b8b52d 100644 --- a/src/lib/Model/EmployeeUpdateResponseModel.php +++ b/src/lib/Model/EmployeeUpdateResponseModel.php @@ -2,61 +2,61 @@ /** * EmployeeUpdateResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeUpdateResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeUpdateResponseModel implements ModelInterface, ArrayAccess +class EmployeeUpdateResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeUpdateResponseModel'; + protected static $openAPIModelName = 'EmployeeUpdateResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'status' => 'string', 'detailed_status' => 'string' @@ -66,21 +66,41 @@ class EmployeeUpdateResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'status' => null, 'detailed_status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'detailed_status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['detailed_status'] = isset($data['detailed_status']) ? $data['detailed_status'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('detailed_status', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -253,12 +343,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -267,7 +360,7 @@ public function setStatus($status) /** * Gets detailed_status * - * @return string + * @return string|null */ public function getDetailedStatus() { @@ -277,12 +370,15 @@ public function getDetailedStatus() /** * Sets detailed_status * - * @param string $detailed_status + * @param string|null $detailed_status * - * @return $this + * @return self */ public function setDetailedStatus($detailed_status) { + if (is_null($detailed_status)) { + throw new \InvalidArgumentException('non-nullable detailed_status cannot be null'); + } $this->container['detailed_status'] = $detailed_status; return $this; @@ -294,7 +390,7 @@ public function setDetailedStatus($detailed_status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeeViewModel.php b/src/lib/Model/EmployeeViewModel.php index 04426c3..3181313 100644 --- a/src/lib/Model/EmployeeViewModel.php +++ b/src/lib/Model/EmployeeViewModel.php @@ -2,61 +2,61 @@ /** * EmployeeViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeeViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeeViewModel implements ModelInterface, ArrayAccess +class EmployeeViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeeViewModel'; + protected static $openAPIModelName = 'EmployeeViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'first_name' => 'string', 'surname' => 'string', @@ -68,8 +68,10 @@ class EmployeeViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'first_name' => null, 'surname' => null, @@ -77,14 +79,34 @@ class EmployeeViewModel implements ModelInterface, ArrayAccess 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'first_name' => false, + 'surname' => false, + 'profile_image_url' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['profile_image_url'] = isset($data['profile_image_url']) ? $data['profile_image_url'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('profile_image_url', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -241,12 +330,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setId($id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -265,12 +357,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -279,7 +374,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -289,12 +384,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -303,7 +401,7 @@ public function setSurname($surname) /** * Gets profile_image_url * - * @return string + * @return string|null */ public function getProfileImageUrl() { @@ -313,12 +411,15 @@ public function getProfileImageUrl() /** * Sets profile_image_url * - * @param string $profile_image_url + * @param string|null $profile_image_url * - * @return $this + * @return self */ public function setProfileImageUrl($profile_image_url) { + if (is_null($profile_image_url)) { + throw new \InvalidArgumentException('non-nullable profile_image_url cannot be null'); + } $this->container['profile_image_url'] = $profile_image_url; return $this; @@ -327,7 +428,7 @@ public function setProfileImageUrl($profile_image_url) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -337,12 +438,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -354,7 +458,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployeesFilter.php b/src/lib/Model/EmployeesFilter.php index 33db036..fcc0186 100644 --- a/src/lib/Model/EmployeesFilter.php +++ b/src/lib/Model/EmployeesFilter.php @@ -2,61 +2,61 @@ /** * EmployeesFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployeesFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployeesFilter implements ModelInterface, ArrayAccess +class EmployeesFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployeesFilter'; + protected static $openAPIModelName = 'EmployeesFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_schedule_id' => 'int', 'location_id' => 'int' ]; @@ -65,20 +65,39 @@ class EmployeesFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_schedule_id' => 'int32', 'location_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_schedule_id' => false, + 'location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('location_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -223,12 +309,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -237,7 +326,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -247,12 +336,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -264,7 +356,7 @@ public function setLocationId($location_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployerLiabilityCategoryModel.php b/src/lib/Model/EmployerLiabilityCategoryModel.php index 06a5fbc..1ee1411 100644 --- a/src/lib/Model/EmployerLiabilityCategoryModel.php +++ b/src/lib/Model/EmployerLiabilityCategoryModel.php @@ -2,61 +2,61 @@ /** * EmployerLiabilityCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployerLiabilityCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployerLiabilityCategoryModel implements ModelInterface, ArrayAccess +class EmployerLiabilityCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployerLiabilityCategoryModel'; + protected static $openAPIModelName = 'EmployerLiabilityCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'external_reference_id' => 'string', @@ -70,8 +70,10 @@ class EmployerLiabilityCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'external_reference_id' => null, @@ -81,14 +83,36 @@ class EmployerLiabilityCategoryModel implements ModelInterface, ArrayAccess 'include_in_shift_costs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'external_reference_id' => false, + 'can_be_deleted' => false, + 'hide_from_pay_slips' => false, + 'show_total_payments' => false, + 'include_in_shift_costs' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['can_be_deleted'] = isset($data['can_be_deleted']) ? $data['can_be_deleted'] : null; - $this->container['hide_from_pay_slips'] = isset($data['hide_from_pay_slips']) ? $data['hide_from_pay_slips'] : null; - $this->container['show_total_payments'] = isset($data['show_total_payments']) ? $data['show_total_payments'] : null; - $this->container['include_in_shift_costs'] = isset($data['include_in_shift_costs']) ? $data['include_in_shift_costs'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('can_be_deleted', $data ?? [], null); + $this->setIfExists('hide_from_pay_slips', $data ?? [], null); + $this->setIfExists('show_total_payments', $data ?? [], null); + $this->setIfExists('include_in_shift_costs', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -253,12 +344,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -267,7 +361,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -277,12 +371,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -291,7 +388,7 @@ public function setName($name) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -301,12 +398,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -315,7 +415,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets can_be_deleted * - * @return bool + * @return bool|null */ public function getCanBeDeleted() { @@ -325,12 +425,15 @@ public function getCanBeDeleted() /** * Sets can_be_deleted * - * @param bool $can_be_deleted + * @param bool|null $can_be_deleted * - * @return $this + * @return self */ public function setCanBeDeleted($can_be_deleted) { + if (is_null($can_be_deleted)) { + throw new \InvalidArgumentException('non-nullable can_be_deleted cannot be null'); + } $this->container['can_be_deleted'] = $can_be_deleted; return $this; @@ -339,7 +442,7 @@ public function setCanBeDeleted($can_be_deleted) /** * Gets hide_from_pay_slips * - * @return bool + * @return bool|null */ public function getHideFromPaySlips() { @@ -349,12 +452,15 @@ public function getHideFromPaySlips() /** * Sets hide_from_pay_slips * - * @param bool $hide_from_pay_slips + * @param bool|null $hide_from_pay_slips * - * @return $this + * @return self */ public function setHideFromPaySlips($hide_from_pay_slips) { + if (is_null($hide_from_pay_slips)) { + throw new \InvalidArgumentException('non-nullable hide_from_pay_slips cannot be null'); + } $this->container['hide_from_pay_slips'] = $hide_from_pay_slips; return $this; @@ -363,7 +469,7 @@ public function setHideFromPaySlips($hide_from_pay_slips) /** * Gets show_total_payments * - * @return bool + * @return bool|null */ public function getShowTotalPayments() { @@ -373,12 +479,15 @@ public function getShowTotalPayments() /** * Sets show_total_payments * - * @param bool $show_total_payments + * @param bool|null $show_total_payments * - * @return $this + * @return self */ public function setShowTotalPayments($show_total_payments) { + if (is_null($show_total_payments)) { + throw new \InvalidArgumentException('non-nullable show_total_payments cannot be null'); + } $this->container['show_total_payments'] = $show_total_payments; return $this; @@ -387,7 +496,7 @@ public function setShowTotalPayments($show_total_payments) /** * Gets include_in_shift_costs * - * @return bool + * @return bool|null */ public function getIncludeInShiftCosts() { @@ -397,12 +506,15 @@ public function getIncludeInShiftCosts() /** * Sets include_in_shift_costs * - * @param bool $include_in_shift_costs + * @param bool|null $include_in_shift_costs * - * @return $this + * @return self */ public function setIncludeInShiftCosts($include_in_shift_costs) { + if (is_null($include_in_shift_costs)) { + throw new \InvalidArgumentException('non-nullable include_in_shift_costs cannot be null'); + } $this->container['include_in_shift_costs'] = $include_in_shift_costs; return $this; @@ -414,7 +526,7 @@ public function setIncludeInShiftCosts($include_in_shift_costs) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployerLiabilityModel.php b/src/lib/Model/EmployerLiabilityModel.php index e5509cd..d14101f 100644 --- a/src/lib/Model/EmployerLiabilityModel.php +++ b/src/lib/Model/EmployerLiabilityModel.php @@ -2,65 +2,65 @@ /** * EmployerLiabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployerLiabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployerLiabilityModel implements ModelInterface, ArrayAccess +class EmployerLiabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployerLiabilityModel'; + protected static $openAPIModelName = 'EmployerLiabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employer_liability_category_id' => 'string', 'employer_liability_category_name' => 'string', 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'id' => 'int', 'external_id' => 'string', 'location_id' => 'string', @@ -74,8 +74,10 @@ class EmployerLiabilityModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employer_liability_category_id' => null, 'employer_liability_category_name' => null, 'notes' => null, @@ -89,14 +91,40 @@ class EmployerLiabilityModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employer_liability_category_id' => false, + 'employer_liability_category_name' => false, + 'notes' => false, + 'amount' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employer_liability_category_id'] = isset($data['employer_liability_category_id']) ? $data['employer_liability_category_id'] : null; - $this->container['employer_liability_category_name'] = isset($data['employer_liability_category_name']) ? $data['employer_liability_category_name'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('employer_liability_category_id', $data ?? [], null); + $this->setIfExists('employer_liability_category_name', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets employer_liability_category_id * - * @return string + * @return string|null */ public function getEmployerLiabilityCategoryId() { @@ -277,12 +372,15 @@ public function getEmployerLiabilityCategoryId() /** * Sets employer_liability_category_id * - * @param string $employer_liability_category_id + * @param string|null $employer_liability_category_id * - * @return $this + * @return self */ public function setEmployerLiabilityCategoryId($employer_liability_category_id) { + if (is_null($employer_liability_category_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category_id cannot be null'); + } $this->container['employer_liability_category_id'] = $employer_liability_category_id; return $this; @@ -291,7 +389,7 @@ public function setEmployerLiabilityCategoryId($employer_liability_category_id) /** * Gets employer_liability_category_name * - * @return string + * @return string|null */ public function getEmployerLiabilityCategoryName() { @@ -301,12 +399,15 @@ public function getEmployerLiabilityCategoryName() /** * Sets employer_liability_category_name * - * @param string $employer_liability_category_name + * @param string|null $employer_liability_category_name * - * @return $this + * @return self */ public function setEmployerLiabilityCategoryName($employer_liability_category_name) { + if (is_null($employer_liability_category_name)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category_name cannot be null'); + } $this->container['employer_liability_category_name'] = $employer_liability_category_name; return $this; @@ -315,7 +416,7 @@ public function setEmployerLiabilityCategoryName($employer_liability_category_na /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -325,12 +426,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -339,7 +443,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -349,12 +453,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -363,7 +470,7 @@ public function setAmount($amount) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -373,12 +480,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -387,7 +497,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -397,12 +507,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -411,7 +524,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -421,12 +534,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -435,7 +551,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -445,12 +561,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -459,7 +578,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -469,12 +588,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -483,7 +605,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -493,12 +615,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -507,7 +632,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -517,12 +642,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -534,7 +662,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmployerRecurringLiabilityModel.php b/src/lib/Model/EmployerRecurringLiabilityModel.php index baaa3dd..11bc3b6 100644 --- a/src/lib/Model/EmployerRecurringLiabilityModel.php +++ b/src/lib/Model/EmployerRecurringLiabilityModel.php @@ -2,61 +2,61 @@ /** * EmployerRecurringLiabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmployerRecurringLiabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmployerRecurringLiabilityModel implements ModelInterface, ArrayAccess +class EmployerRecurringLiabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmployerRecurringLiabilityModel'; + protected static $openAPIModelName = 'EmployerRecurringLiabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employer_liability_category_name' => 'string', 'employer_liability_category_id' => 'int', 'liability_type' => 'string', @@ -64,11 +64,11 @@ class EmployerRecurringLiabilityModel implements ModelInterface, ArrayAccess 'source' => 'string', 'id' => 'int', 'employee_id' => 'int', - 'amount' => 'double', + 'amount' => 'float', 'expiry_date' => '\DateTime', 'from_date' => '\DateTime', - 'maximum_amount_paid' => 'double', - 'total_amount_paid' => 'double', + 'maximum_amount_paid' => 'float', + 'total_amount_paid' => 'float', 'is_active' => 'bool', 'notes' => 'string' ]; @@ -77,8 +77,10 @@ class EmployerRecurringLiabilityModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employer_liability_category_name' => null, 'employer_liability_category_id' => 'int32', 'liability_type' => null, @@ -95,14 +97,43 @@ class EmployerRecurringLiabilityModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employer_liability_category_name' => false, + 'employer_liability_category_id' => false, + 'liability_type' => false, + 'external_reference_id' => false, + 'source' => false, + 'id' => false, + 'employee_id' => false, + 'amount' => false, + 'expiry_date' => false, + 'from_date' => false, + 'maximum_amount_paid' => false, + 'total_amount_paid' => false, + 'is_active' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,91 +303,89 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const LIABILITY_TYPE_FIXED = 'Fixed'; - const LIABILITY_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; - const LIABILITY_TYPE_PERCENTAGE_OTE = 'PercentageOTE'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const LIABILITY_TYPE_FIXED = 'Fixed'; + public const LIABILITY_TYPE_PERCENTAGE_GROSS = 'PercentageGross'; + public const LIABILITY_TYPE_PERCENTAGE_OTE = 'PercentageOTE'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -318,7 +399,7 @@ public function getLiabilityTypeAllowableValues() self::LIABILITY_TYPE_PERCENTAGE_OTE, ]; } - + /** * Gets allowable values of the enum * @@ -405,7 +486,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -422,20 +502,38 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['employer_liability_category_name'] = isset($data['employer_liability_category_name']) ? $data['employer_liability_category_name'] : null; - $this->container['employer_liability_category_id'] = isset($data['employer_liability_category_id']) ? $data['employer_liability_category_id'] : null; - $this->container['liability_type'] = isset($data['liability_type']) ? $data['liability_type'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['maximum_amount_paid'] = isset($data['maximum_amount_paid']) ? $data['maximum_amount_paid'] : null; - $this->container['total_amount_paid'] = isset($data['total_amount_paid']) ? $data['total_amount_paid'] : null; - $this->container['is_active'] = isset($data['is_active']) ? $data['is_active'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('employer_liability_category_name', $data ?? [], null); + $this->setIfExists('employer_liability_category_id', $data ?? [], null); + $this->setIfExists('liability_type', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('maximum_amount_paid', $data ?? [], null); + $this->setIfExists('total_amount_paid', $data ?? [], null); + $this->setIfExists('is_active', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -450,7 +548,8 @@ public function listInvalidProperties() $allowedValues = $this->getLiabilityTypeAllowableValues(); if (!is_null($this->container['liability_type']) && !in_array($this->container['liability_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'liability_type', must be one of '%s'", + "invalid value '%s' for 'liability_type', must be one of '%s'", + $this->container['liability_type'], implode("', '", $allowedValues) ); } @@ -458,7 +557,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -481,7 +581,7 @@ public function valid() /** * Gets employer_liability_category_name * - * @return string + * @return string|null */ public function getEmployerLiabilityCategoryName() { @@ -491,12 +591,15 @@ public function getEmployerLiabilityCategoryName() /** * Sets employer_liability_category_name * - * @param string $employer_liability_category_name + * @param string|null $employer_liability_category_name * - * @return $this + * @return self */ public function setEmployerLiabilityCategoryName($employer_liability_category_name) { + if (is_null($employer_liability_category_name)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category_name cannot be null'); + } $this->container['employer_liability_category_name'] = $employer_liability_category_name; return $this; @@ -505,7 +608,7 @@ public function setEmployerLiabilityCategoryName($employer_liability_category_na /** * Gets employer_liability_category_id * - * @return int + * @return int|null */ public function getEmployerLiabilityCategoryId() { @@ -515,12 +618,15 @@ public function getEmployerLiabilityCategoryId() /** * Sets employer_liability_category_id * - * @param int $employer_liability_category_id + * @param int|null $employer_liability_category_id * - * @return $this + * @return self */ public function setEmployerLiabilityCategoryId($employer_liability_category_id) { + if (is_null($employer_liability_category_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category_id cannot be null'); + } $this->container['employer_liability_category_id'] = $employer_liability_category_id; return $this; @@ -529,7 +635,7 @@ public function setEmployerLiabilityCategoryId($employer_liability_category_id) /** * Gets liability_type * - * @return string + * @return string|null */ public function getLiabilityType() { @@ -539,17 +645,21 @@ public function getLiabilityType() /** * Sets liability_type * - * @param string $liability_type + * @param string|null $liability_type * - * @return $this + * @return self */ public function setLiabilityType($liability_type) { + if (is_null($liability_type)) { + throw new \InvalidArgumentException('non-nullable liability_type cannot be null'); + } $allowedValues = $this->getLiabilityTypeAllowableValues(); - if (!is_null($liability_type) && !in_array($liability_type, $allowedValues, true)) { + if (!in_array($liability_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'liability_type', must be one of '%s'", + "Invalid value '%s' for 'liability_type', must be one of '%s'", + $liability_type, implode("', '", $allowedValues) ) ); @@ -562,7 +672,7 @@ public function setLiabilityType($liability_type) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -572,12 +682,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -586,7 +699,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -596,17 +709,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -619,7 +736,7 @@ public function setSource($source) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -629,12 +746,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -643,7 +763,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -653,12 +773,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -667,7 +790,7 @@ public function setEmployeeId($employee_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -677,12 +800,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -691,7 +817,7 @@ public function setAmount($amount) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -701,12 +827,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -715,7 +844,7 @@ public function setExpiryDate($expiry_date) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -725,12 +854,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -739,7 +871,7 @@ public function setFromDate($from_date) /** * Gets maximum_amount_paid * - * @return double + * @return float|null */ public function getMaximumAmountPaid() { @@ -749,12 +881,15 @@ public function getMaximumAmountPaid() /** * Sets maximum_amount_paid * - * @param double $maximum_amount_paid + * @param float|null $maximum_amount_paid * - * @return $this + * @return self */ public function setMaximumAmountPaid($maximum_amount_paid) { + if (is_null($maximum_amount_paid)) { + throw new \InvalidArgumentException('non-nullable maximum_amount_paid cannot be null'); + } $this->container['maximum_amount_paid'] = $maximum_amount_paid; return $this; @@ -763,7 +898,7 @@ public function setMaximumAmountPaid($maximum_amount_paid) /** * Gets total_amount_paid * - * @return double + * @return float|null */ public function getTotalAmountPaid() { @@ -773,12 +908,15 @@ public function getTotalAmountPaid() /** * Sets total_amount_paid * - * @param double $total_amount_paid + * @param float|null $total_amount_paid * - * @return $this + * @return self */ public function setTotalAmountPaid($total_amount_paid) { + if (is_null($total_amount_paid)) { + throw new \InvalidArgumentException('non-nullable total_amount_paid cannot be null'); + } $this->container['total_amount_paid'] = $total_amount_paid; return $this; @@ -787,7 +925,7 @@ public function setTotalAmountPaid($total_amount_paid) /** * Gets is_active * - * @return bool + * @return bool|null */ public function getIsActive() { @@ -797,12 +935,15 @@ public function getIsActive() /** * Sets is_active * - * @param bool $is_active + * @param bool|null $is_active * - * @return $this + * @return self */ public function setIsActive($is_active) { + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + } $this->container['is_active'] = $is_active; return $this; @@ -811,7 +952,7 @@ public function setIsActive($is_active) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -821,12 +962,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -838,7 +982,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -848,22 +992,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -879,11 +1024,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -891,13 +1049,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmploymentAgreementModel.php b/src/lib/Model/EmploymentAgreementModel.php index 207f12a..a884c5f 100644 --- a/src/lib/Model/EmploymentAgreementModel.php +++ b/src/lib/Model/EmploymentAgreementModel.php @@ -2,70 +2,70 @@ /** * EmploymentAgreementModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmploymentAgreementModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmploymentAgreementModel implements ModelInterface, ArrayAccess +class EmploymentAgreementModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmploymentAgreementModel'; + protected static $openAPIModelName = 'EmploymentAgreementModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'classification' => 'string', 'employment_type' => 'string', 'pay_rate_template_type' => 'string', 'pay_condition_rule_set_id' => 'int', - 'pay_condition_rule_set' => '\Swagger\Client\Model\PayConditionRuleSetModel', - 'leave_allowance_templates' => '\Swagger\Client\Model\LeaveAllowanceTemplateModel[]', + 'pay_condition_rule_set' => '\OpenAPI\Client\Model\PayConditionRuleSetModel', + 'leave_allowance_templates' => '\OpenAPI\Client\Model\LeaveAllowanceTemplateModel[]', 'leave_allowance_template_ids' => 'int[]', - 'age_pay_rate_templates' => '\Swagger\Client\Model\EmploymentAgreementPayRateTemplateModel[]', + 'age_pay_rate_templates' => '\OpenAPI\Client\Model\EmploymentAgreementPayRateTemplateModel[]', 'external_id' => 'string', 'source' => 'string', 'rank' => 'int' @@ -75,8 +75,10 @@ class EmploymentAgreementModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'classification' => null, 'employment_type' => null, @@ -91,14 +93,41 @@ class EmploymentAgreementModel implements ModelInterface, ArrayAccess 'rank' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'classification' => false, + 'employment_type' => false, + 'pay_rate_template_type' => false, + 'pay_condition_rule_set_id' => false, + 'pay_condition_rule_set' => false, + 'leave_allowance_templates' => false, + 'leave_allowance_template_ids' => false, + 'age_pay_rate_templates' => false, + 'external_id' => false, + 'source' => false, + 'rank' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -210,100 +291,98 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const EMPLOYMENT_TYPE_UNKNOWN = 'Unknown'; - const EMPLOYMENT_TYPE_FULL_TIME = 'FullTime'; - const EMPLOYMENT_TYPE_PART_TIME = 'PartTime'; - const EMPLOYMENT_TYPE_LABOUR_HIRE = 'LabourHire'; - const EMPLOYMENT_TYPE_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; - const EMPLOYMENT_TYPE_CASUAL = 'Casual'; - const EMPLOYMENT_TYPE_NOT_APPLICABLE = 'NotApplicable'; - const EMPLOYMENT_TYPE_INDEPENDENT_CONTRACTOR = 'IndependentContractor'; - const PAY_RATE_TEMPLATE_TYPE_DATE_OF_BIRTH = 'DateOfBirth'; - const PAY_RATE_TEMPLATE_TYPE_ANNIVERSARY = 'Anniversary'; - const PAY_RATE_TEMPLATE_TYPE_ANNIVERSARY_IN_MONTHS = 'AnniversaryInMonths'; - const PAY_RATE_TEMPLATE_TYPE_DATE_OF_BIRTH_AND_ANNIVERSARY_IN_MONTHS = 'DateOfBirthAndAnniversaryInMonths'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const EMPLOYMENT_TYPE_UNKNOWN = 'Unknown'; + public const EMPLOYMENT_TYPE_FULL_TIME = 'FullTime'; + public const EMPLOYMENT_TYPE_PART_TIME = 'PartTime'; + public const EMPLOYMENT_TYPE_LABOUR_HIRE = 'LabourHire'; + public const EMPLOYMENT_TYPE_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; + public const EMPLOYMENT_TYPE_CASUAL = 'Casual'; + public const EMPLOYMENT_TYPE_NOT_APPLICABLE = 'NotApplicable'; + public const EMPLOYMENT_TYPE_INDEPENDENT_CONTRACTOR = 'IndependentContractor'; + public const PAY_RATE_TEMPLATE_TYPE_DATE_OF_BIRTH = 'DateOfBirth'; + public const PAY_RATE_TEMPLATE_TYPE_ANNIVERSARY = 'Anniversary'; + public const PAY_RATE_TEMPLATE_TYPE_ANNIVERSARY_IN_MONTHS = 'AnniversaryInMonths'; + public const PAY_RATE_TEMPLATE_TYPE_DATE_OF_BIRTH_AND_ANNIVERSARY_IN_MONTHS = 'DateOfBirthAndAnniversaryInMonths'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -322,7 +401,7 @@ public function getEmploymentTypeAllowableValues() self::EMPLOYMENT_TYPE_INDEPENDENT_CONTRACTOR, ]; } - + /** * Gets allowable values of the enum * @@ -337,7 +416,7 @@ public function getPayRateTemplateTypeAllowableValues() self::PAY_RATE_TEMPLATE_TYPE_DATE_OF_BIRTH_AND_ANNIVERSARY_IN_MONTHS, ]; } - + /** * Gets allowable values of the enum * @@ -424,7 +503,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -441,18 +519,36 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['employment_type'] = isset($data['employment_type']) ? $data['employment_type'] : null; - $this->container['pay_rate_template_type'] = isset($data['pay_rate_template_type']) ? $data['pay_rate_template_type'] : null; - $this->container['pay_condition_rule_set_id'] = isset($data['pay_condition_rule_set_id']) ? $data['pay_condition_rule_set_id'] : null; - $this->container['pay_condition_rule_set'] = isset($data['pay_condition_rule_set']) ? $data['pay_condition_rule_set'] : null; - $this->container['leave_allowance_templates'] = isset($data['leave_allowance_templates']) ? $data['leave_allowance_templates'] : null; - $this->container['leave_allowance_template_ids'] = isset($data['leave_allowance_template_ids']) ? $data['leave_allowance_template_ids'] : null; - $this->container['age_pay_rate_templates'] = isset($data['age_pay_rate_templates']) ? $data['age_pay_rate_templates'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['rank'] = isset($data['rank']) ? $data['rank'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('employment_type', $data ?? [], null); + $this->setIfExists('pay_rate_template_type', $data ?? [], null); + $this->setIfExists('pay_condition_rule_set_id', $data ?? [], null); + $this->setIfExists('pay_condition_rule_set', $data ?? [], null); + $this->setIfExists('leave_allowance_templates', $data ?? [], null); + $this->setIfExists('leave_allowance_template_ids', $data ?? [], null); + $this->setIfExists('age_pay_rate_templates', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('rank', $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; } /** @@ -467,7 +563,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmploymentTypeAllowableValues(); if (!is_null($this->container['employment_type']) && !in_array($this->container['employment_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employment_type', must be one of '%s'", + "invalid value '%s' for 'employment_type', must be one of '%s'", + $this->container['employment_type'], implode("', '", $allowedValues) ); } @@ -475,7 +572,8 @@ public function listInvalidProperties() $allowedValues = $this->getPayRateTemplateTypeAllowableValues(); if (!is_null($this->container['pay_rate_template_type']) && !in_array($this->container['pay_rate_template_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'pay_rate_template_type', must be one of '%s'", + "invalid value '%s' for 'pay_rate_template_type', must be one of '%s'", + $this->container['pay_rate_template_type'], implode("', '", $allowedValues) ); } @@ -483,7 +581,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -506,7 +605,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -516,12 +615,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -530,7 +632,7 @@ public function setId($id) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -540,12 +642,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -554,7 +659,7 @@ public function setClassification($classification) /** * Gets employment_type * - * @return string + * @return string|null */ public function getEmploymentType() { @@ -564,17 +669,21 @@ public function getEmploymentType() /** * Sets employment_type * - * @param string $employment_type + * @param string|null $employment_type * - * @return $this + * @return self */ public function setEmploymentType($employment_type) { + if (is_null($employment_type)) { + throw new \InvalidArgumentException('non-nullable employment_type cannot be null'); + } $allowedValues = $this->getEmploymentTypeAllowableValues(); - if (!is_null($employment_type) && !in_array($employment_type, $allowedValues, true)) { + if (!in_array($employment_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employment_type', must be one of '%s'", + "Invalid value '%s' for 'employment_type', must be one of '%s'", + $employment_type, implode("', '", $allowedValues) ) ); @@ -587,7 +696,7 @@ public function setEmploymentType($employment_type) /** * Gets pay_rate_template_type * - * @return string + * @return string|null */ public function getPayRateTemplateType() { @@ -597,17 +706,21 @@ public function getPayRateTemplateType() /** * Sets pay_rate_template_type * - * @param string $pay_rate_template_type + * @param string|null $pay_rate_template_type * - * @return $this + * @return self */ public function setPayRateTemplateType($pay_rate_template_type) { + if (is_null($pay_rate_template_type)) { + throw new \InvalidArgumentException('non-nullable pay_rate_template_type cannot be null'); + } $allowedValues = $this->getPayRateTemplateTypeAllowableValues(); - if (!is_null($pay_rate_template_type) && !in_array($pay_rate_template_type, $allowedValues, true)) { + if (!in_array($pay_rate_template_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'pay_rate_template_type', must be one of '%s'", + "Invalid value '%s' for 'pay_rate_template_type', must be one of '%s'", + $pay_rate_template_type, implode("', '", $allowedValues) ) ); @@ -620,7 +733,7 @@ public function setPayRateTemplateType($pay_rate_template_type) /** * Gets pay_condition_rule_set_id * - * @return int + * @return int|null */ public function getPayConditionRuleSetId() { @@ -630,12 +743,15 @@ public function getPayConditionRuleSetId() /** * Sets pay_condition_rule_set_id * - * @param int $pay_condition_rule_set_id + * @param int|null $pay_condition_rule_set_id * - * @return $this + * @return self */ public function setPayConditionRuleSetId($pay_condition_rule_set_id) { + if (is_null($pay_condition_rule_set_id)) { + throw new \InvalidArgumentException('non-nullable pay_condition_rule_set_id cannot be null'); + } $this->container['pay_condition_rule_set_id'] = $pay_condition_rule_set_id; return $this; @@ -644,7 +760,7 @@ public function setPayConditionRuleSetId($pay_condition_rule_set_id) /** * Gets pay_condition_rule_set * - * @return \Swagger\Client\Model\PayConditionRuleSetModel + * @return \OpenAPI\Client\Model\PayConditionRuleSetModel|null */ public function getPayConditionRuleSet() { @@ -654,12 +770,15 @@ public function getPayConditionRuleSet() /** * Sets pay_condition_rule_set * - * @param \Swagger\Client\Model\PayConditionRuleSetModel $pay_condition_rule_set + * @param \OpenAPI\Client\Model\PayConditionRuleSetModel|null $pay_condition_rule_set pay_condition_rule_set * - * @return $this + * @return self */ public function setPayConditionRuleSet($pay_condition_rule_set) { + if (is_null($pay_condition_rule_set)) { + throw new \InvalidArgumentException('non-nullable pay_condition_rule_set cannot be null'); + } $this->container['pay_condition_rule_set'] = $pay_condition_rule_set; return $this; @@ -668,7 +787,7 @@ public function setPayConditionRuleSet($pay_condition_rule_set) /** * Gets leave_allowance_templates * - * @return \Swagger\Client\Model\LeaveAllowanceTemplateModel[] + * @return \OpenAPI\Client\Model\LeaveAllowanceTemplateModel[]|null */ public function getLeaveAllowanceTemplates() { @@ -678,12 +797,15 @@ public function getLeaveAllowanceTemplates() /** * Sets leave_allowance_templates * - * @param \Swagger\Client\Model\LeaveAllowanceTemplateModel[] $leave_allowance_templates + * @param \OpenAPI\Client\Model\LeaveAllowanceTemplateModel[]|null $leave_allowance_templates * - * @return $this + * @return self */ public function setLeaveAllowanceTemplates($leave_allowance_templates) { + if (is_null($leave_allowance_templates)) { + throw new \InvalidArgumentException('non-nullable leave_allowance_templates cannot be null'); + } $this->container['leave_allowance_templates'] = $leave_allowance_templates; return $this; @@ -692,7 +814,7 @@ public function setLeaveAllowanceTemplates($leave_allowance_templates) /** * Gets leave_allowance_template_ids * - * @return int[] + * @return int[]|null */ public function getLeaveAllowanceTemplateIds() { @@ -702,12 +824,15 @@ public function getLeaveAllowanceTemplateIds() /** * Sets leave_allowance_template_ids * - * @param int[] $leave_allowance_template_ids + * @param int[]|null $leave_allowance_template_ids * - * @return $this + * @return self */ public function setLeaveAllowanceTemplateIds($leave_allowance_template_ids) { + if (is_null($leave_allowance_template_ids)) { + throw new \InvalidArgumentException('non-nullable leave_allowance_template_ids cannot be null'); + } $this->container['leave_allowance_template_ids'] = $leave_allowance_template_ids; return $this; @@ -716,7 +841,7 @@ public function setLeaveAllowanceTemplateIds($leave_allowance_template_ids) /** * Gets age_pay_rate_templates * - * @return \Swagger\Client\Model\EmploymentAgreementPayRateTemplateModel[] + * @return \OpenAPI\Client\Model\EmploymentAgreementPayRateTemplateModel[]|null */ public function getAgePayRateTemplates() { @@ -726,12 +851,15 @@ public function getAgePayRateTemplates() /** * Sets age_pay_rate_templates * - * @param \Swagger\Client\Model\EmploymentAgreementPayRateTemplateModel[] $age_pay_rate_templates + * @param \OpenAPI\Client\Model\EmploymentAgreementPayRateTemplateModel[]|null $age_pay_rate_templates * - * @return $this + * @return self */ public function setAgePayRateTemplates($age_pay_rate_templates) { + if (is_null($age_pay_rate_templates)) { + throw new \InvalidArgumentException('non-nullable age_pay_rate_templates cannot be null'); + } $this->container['age_pay_rate_templates'] = $age_pay_rate_templates; return $this; @@ -740,7 +868,7 @@ public function setAgePayRateTemplates($age_pay_rate_templates) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -750,12 +878,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -764,7 +895,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -774,17 +905,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -797,7 +932,7 @@ public function setSource($source) /** * Gets rank * - * @return int + * @return int|null */ public function getRank() { @@ -807,12 +942,15 @@ public function getRank() /** * Sets rank * - * @param int $rank + * @param int|null $rank * - * @return $this + * @return self */ public function setRank($rank) { + if (is_null($rank)) { + throw new \InvalidArgumentException('non-nullable rank cannot be null'); + } $this->container['rank'] = $rank; return $this; @@ -824,7 +962,7 @@ public function setRank($rank) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -834,22 +972,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -865,11 +1004,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -877,13 +1029,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EmploymentAgreementPayRateTemplateModel.php b/src/lib/Model/EmploymentAgreementPayRateTemplateModel.php index 1d3fbdf..4757a59 100644 --- a/src/lib/Model/EmploymentAgreementPayRateTemplateModel.php +++ b/src/lib/Model/EmploymentAgreementPayRateTemplateModel.php @@ -2,63 +2,63 @@ /** * EmploymentAgreementPayRateTemplateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EmploymentAgreementPayRateTemplateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EmploymentAgreementPayRateTemplateModel implements ModelInterface, ArrayAccess +class EmploymentAgreementPayRateTemplateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EmploymentAgreementPayRateTemplateModel'; + protected static $openAPIModelName = 'EmploymentAgreementPayRateTemplateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_rate_template_id' => 'int', - 'pay_rate_template' => '\Swagger\Client\Model\PayRateTemplateModel', + 'pay_rate_template' => '\OpenAPI\Client\Model\PayRateTemplateModel', 'min_age' => 'int', 'max_age' => 'int', 'min_anniversary_months' => 'int', @@ -69,8 +69,10 @@ class EmploymentAgreementPayRateTemplateModel implements ModelInterface, ArrayAc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_rate_template_id' => 'int32', 'pay_rate_template' => null, 'min_age' => 'int32', @@ -79,14 +81,35 @@ class EmploymentAgreementPayRateTemplateModel implements ModelInterface, ArrayAc 'max_anniversary_months' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_rate_template_id' => false, + 'pay_rate_template' => false, + 'min_age' => false, + 'max_age' => false, + 'min_anniversary_months' => false, + 'max_anniversary_months' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_rate_template_id'] = isset($data['pay_rate_template_id']) ? $data['pay_rate_template_id'] : null; - $this->container['pay_rate_template'] = isset($data['pay_rate_template']) ? $data['pay_rate_template'] : null; - $this->container['min_age'] = isset($data['min_age']) ? $data['min_age'] : null; - $this->container['max_age'] = isset($data['max_age']) ? $data['max_age'] : null; - $this->container['min_anniversary_months'] = isset($data['min_anniversary_months']) ? $data['min_anniversary_months'] : null; - $this->container['max_anniversary_months'] = isset($data['max_anniversary_months']) ? $data['max_anniversary_months'] : null; + $this->setIfExists('pay_rate_template_id', $data ?? [], null); + $this->setIfExists('pay_rate_template', $data ?? [], null); + $this->setIfExists('min_age', $data ?? [], null); + $this->setIfExists('max_age', $data ?? [], null); + $this->setIfExists('min_anniversary_months', $data ?? [], null); + $this->setIfExists('max_anniversary_months', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets pay_rate_template_id * - * @return int + * @return int|null */ public function getPayRateTemplateId() { @@ -247,12 +337,15 @@ public function getPayRateTemplateId() /** * Sets pay_rate_template_id * - * @param int $pay_rate_template_id + * @param int|null $pay_rate_template_id * - * @return $this + * @return self */ public function setPayRateTemplateId($pay_rate_template_id) { + if (is_null($pay_rate_template_id)) { + throw new \InvalidArgumentException('non-nullable pay_rate_template_id cannot be null'); + } $this->container['pay_rate_template_id'] = $pay_rate_template_id; return $this; @@ -261,7 +354,7 @@ public function setPayRateTemplateId($pay_rate_template_id) /** * Gets pay_rate_template * - * @return \Swagger\Client\Model\PayRateTemplateModel + * @return \OpenAPI\Client\Model\PayRateTemplateModel|null */ public function getPayRateTemplate() { @@ -271,12 +364,15 @@ public function getPayRateTemplate() /** * Sets pay_rate_template * - * @param \Swagger\Client\Model\PayRateTemplateModel $pay_rate_template + * @param \OpenAPI\Client\Model\PayRateTemplateModel|null $pay_rate_template pay_rate_template * - * @return $this + * @return self */ public function setPayRateTemplate($pay_rate_template) { + if (is_null($pay_rate_template)) { + throw new \InvalidArgumentException('non-nullable pay_rate_template cannot be null'); + } $this->container['pay_rate_template'] = $pay_rate_template; return $this; @@ -285,7 +381,7 @@ public function setPayRateTemplate($pay_rate_template) /** * Gets min_age * - * @return int + * @return int|null */ public function getMinAge() { @@ -295,12 +391,15 @@ public function getMinAge() /** * Sets min_age * - * @param int $min_age + * @param int|null $min_age * - * @return $this + * @return self */ public function setMinAge($min_age) { + if (is_null($min_age)) { + throw new \InvalidArgumentException('non-nullable min_age cannot be null'); + } $this->container['min_age'] = $min_age; return $this; @@ -309,7 +408,7 @@ public function setMinAge($min_age) /** * Gets max_age * - * @return int + * @return int|null */ public function getMaxAge() { @@ -319,12 +418,15 @@ public function getMaxAge() /** * Sets max_age * - * @param int $max_age + * @param int|null $max_age * - * @return $this + * @return self */ public function setMaxAge($max_age) { + if (is_null($max_age)) { + throw new \InvalidArgumentException('non-nullable max_age cannot be null'); + } $this->container['max_age'] = $max_age; return $this; @@ -333,7 +435,7 @@ public function setMaxAge($max_age) /** * Gets min_anniversary_months * - * @return int + * @return int|null */ public function getMinAnniversaryMonths() { @@ -343,12 +445,15 @@ public function getMinAnniversaryMonths() /** * Sets min_anniversary_months * - * @param int $min_anniversary_months + * @param int|null $min_anniversary_months * - * @return $this + * @return self */ public function setMinAnniversaryMonths($min_anniversary_months) { + if (is_null($min_anniversary_months)) { + throw new \InvalidArgumentException('non-nullable min_anniversary_months cannot be null'); + } $this->container['min_anniversary_months'] = $min_anniversary_months; return $this; @@ -357,7 +462,7 @@ public function setMinAnniversaryMonths($min_anniversary_months) /** * Gets max_anniversary_months * - * @return int + * @return int|null */ public function getMaxAnniversaryMonths() { @@ -367,12 +472,15 @@ public function getMaxAnniversaryMonths() /** * Sets max_anniversary_months * - * @param int $max_anniversary_months + * @param int|null $max_anniversary_months * - * @return $this + * @return self */ public function setMaxAnniversaryMonths($max_anniversary_months) { + if (is_null($max_anniversary_months)) { + throw new \InvalidArgumentException('non-nullable max_anniversary_months cannot be null'); + } $this->container['max_anniversary_months'] = $max_anniversary_months; return $this; @@ -384,7 +492,7 @@ public function setMaxAnniversaryMonths($max_anniversary_months) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EndBreakModel.php b/src/lib/Model/EndBreakModel.php index e0ff0d2..97d600c 100644 --- a/src/lib/Model/EndBreakModel.php +++ b/src/lib/Model/EndBreakModel.php @@ -2,65 +2,65 @@ /** * EndBreakModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EndBreakModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EndBreakModel implements ModelInterface, ArrayAccess +class EndBreakModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EndBreakModel'; + protected static $openAPIModelName = 'EndBreakModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_paid_break' => 'bool', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -74,8 +74,10 @@ class EndBreakModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_paid_break' => null, 'employee_id' => 'int32', 'latitude' => 'double', @@ -89,14 +91,40 @@ class EndBreakModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_paid_break' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,14 +285,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -225,7 +303,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -242,17 +319,35 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('is_paid_break', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -271,7 +366,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -294,7 +390,7 @@ public function valid() /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -304,12 +400,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -318,7 +417,7 @@ public function setIsPaidBreak($is_paid_break) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -328,12 +427,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -342,7 +444,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -352,12 +454,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -366,7 +471,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -376,12 +481,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -390,7 +498,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -400,12 +508,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -414,7 +525,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -424,12 +535,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -438,7 +552,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -448,15 +562,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling EndBreakModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling EndBreakModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -467,7 +584,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -477,12 +594,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -491,7 +611,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -501,12 +621,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -515,7 +638,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -525,12 +648,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -539,7 +665,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -549,17 +675,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -575,7 +705,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -585,22 +715,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -616,11 +747,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -628,13 +772,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EntitlementFeatureModel.php b/src/lib/Model/EntitlementFeatureModel.php index a6c07ce..74b7529 100644 --- a/src/lib/Model/EntitlementFeatureModel.php +++ b/src/lib/Model/EntitlementFeatureModel.php @@ -2,61 +2,61 @@ /** * EntitlementFeatureModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EntitlementFeatureModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EntitlementFeatureModel implements ModelInterface, ArrayAccess +class EntitlementFeatureModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EntitlementFeatureModel'; + protected static $openAPIModelName = 'EntitlementFeatureModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string' ]; @@ -64,19 +64,37 @@ class EntitlementFeatureModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : 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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -217,12 +302,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -234,7 +322,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EntitlementsModel.php b/src/lib/Model/EntitlementsModel.php index 9478ee2..5557157 100644 --- a/src/lib/Model/EntitlementsModel.php +++ b/src/lib/Model/EntitlementsModel.php @@ -2,85 +2,105 @@ /** * EntitlementsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EntitlementsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EntitlementsModel implements ModelInterface, ArrayAccess +class EntitlementsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EntitlementsModel'; + protected static $openAPIModelName = 'EntitlementsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'plan_name' => 'string', 'trial_expiry_date' => '\DateTime', - 'features' => '\Swagger\Client\Model\EntitlementFeatureModel[]' + 'features' => '\OpenAPI\Client\Model\EntitlementFeatureModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'plan_name' => null, 'trial_expiry_date' => 'date-time', 'features' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'plan_name' => false, + 'trial_expiry_date' => false, + 'features' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['plan_name'] = isset($data['plan_name']) ? $data['plan_name'] : null; - $this->container['trial_expiry_date'] = isset($data['trial_expiry_date']) ? $data['trial_expiry_date'] : null; - $this->container['features'] = isset($data['features']) ? $data['features'] : null; + $this->setIfExists('plan_name', $data ?? [], null); + $this->setIfExists('trial_expiry_date', $data ?? [], null); + $this->setIfExists('features', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets plan_name * - * @return string + * @return string|null */ public function getPlanName() { @@ -229,12 +316,15 @@ public function getPlanName() /** * Sets plan_name * - * @param string $plan_name + * @param string|null $plan_name * - * @return $this + * @return self */ public function setPlanName($plan_name) { + if (is_null($plan_name)) { + throw new \InvalidArgumentException('non-nullable plan_name cannot be null'); + } $this->container['plan_name'] = $plan_name; return $this; @@ -243,7 +333,7 @@ public function setPlanName($plan_name) /** * Gets trial_expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getTrialExpiryDate() { @@ -253,12 +343,15 @@ public function getTrialExpiryDate() /** * Sets trial_expiry_date * - * @param \DateTime $trial_expiry_date + * @param \DateTime|null $trial_expiry_date * - * @return $this + * @return self */ public function setTrialExpiryDate($trial_expiry_date) { + if (is_null($trial_expiry_date)) { + throw new \InvalidArgumentException('non-nullable trial_expiry_date cannot be null'); + } $this->container['trial_expiry_date'] = $trial_expiry_date; return $this; @@ -267,7 +360,7 @@ public function setTrialExpiryDate($trial_expiry_date) /** * Gets features * - * @return \Swagger\Client\Model\EntitlementFeatureModel[] + * @return \OpenAPI\Client\Model\EntitlementFeatureModel[]|null */ public function getFeatures() { @@ -277,12 +370,15 @@ public function getFeatures() /** * Sets features * - * @param \Swagger\Client\Model\EntitlementFeatureModel[] $features + * @param \OpenAPI\Client\Model\EntitlementFeatureModel[]|null $features * - * @return $this + * @return self */ public function setFeatures($features) { + if (is_null($features)) { + throw new \InvalidArgumentException('non-nullable features cannot be null'); + } $this->container['features'] = $features; return $this; @@ -294,7 +390,7 @@ public function setFeatures($features) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssBulkAcceptRosterShiftsModel.php b/src/lib/Model/EssBulkAcceptRosterShiftsModel.php index 2cb1149..f9fd283 100644 --- a/src/lib/Model/EssBulkAcceptRosterShiftsModel.php +++ b/src/lib/Model/EssBulkAcceptRosterShiftsModel.php @@ -2,61 +2,61 @@ /** * EssBulkAcceptRosterShiftsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssBulkAcceptRosterShiftsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssBulkAcceptRosterShiftsModel implements ModelInterface, ArrayAccess +class EssBulkAcceptRosterShiftsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssBulkAcceptRosterShiftsModel'; + protected static $openAPIModelName = 'EssBulkAcceptRosterShiftsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'shifts' => 'int[]' ]; @@ -64,19 +64,37 @@ class EssBulkAcceptRosterShiftsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shifts' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shifts' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; + $this->setIfExists('shifts', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets shifts * - * @return int[] + * @return int[]|null */ public function getShifts() { @@ -217,12 +302,15 @@ public function getShifts() /** * Sets shifts * - * @param int[] $shifts + * @param int[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -234,7 +322,7 @@ public function setShifts($shifts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssBulkDeclineRosterShiftsModel.php b/src/lib/Model/EssBulkDeclineRosterShiftsModel.php index 35dd290..01fa148 100644 --- a/src/lib/Model/EssBulkDeclineRosterShiftsModel.php +++ b/src/lib/Model/EssBulkDeclineRosterShiftsModel.php @@ -2,61 +2,61 @@ /** * EssBulkDeclineRosterShiftsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssBulkDeclineRosterShiftsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssBulkDeclineRosterShiftsModel implements ModelInterface, ArrayAccess +class EssBulkDeclineRosterShiftsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssBulkDeclineRosterShiftsModel'; + protected static $openAPIModelName = 'EssBulkDeclineRosterShiftsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'reason' => 'string', 'shifts' => 'int[]' ]; @@ -65,20 +65,39 @@ class EssBulkDeclineRosterShiftsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'reason' => null, 'shifts' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => false, + 'shifts' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('shifts', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -223,12 +309,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -237,7 +326,7 @@ public function setReason($reason) /** * Gets shifts * - * @return int[] + * @return int[]|null */ public function getShifts() { @@ -247,12 +336,15 @@ public function getShifts() /** * Sets shifts * - * @param int[] $shifts + * @param int[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -264,7 +356,7 @@ public function setShifts($shifts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssBulkRosterShiftSwapModel.php b/src/lib/Model/EssBulkRosterShiftSwapModel.php index 64dfcb3..886e8c4 100644 --- a/src/lib/Model/EssBulkRosterShiftSwapModel.php +++ b/src/lib/Model/EssBulkRosterShiftSwapModel.php @@ -2,61 +2,61 @@ /** * EssBulkRosterShiftSwapModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssBulkRosterShiftSwapModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssBulkRosterShiftSwapModel implements ModelInterface, ArrayAccess +class EssBulkRosterShiftSwapModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssBulkRosterShiftSwapModel'; + protected static $openAPIModelName = 'EssBulkRosterShiftSwapModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'shifts' => 'int[]' ]; @@ -64,19 +64,37 @@ class EssBulkRosterShiftSwapModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shifts' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shifts' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; + $this->setIfExists('shifts', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets shifts * - * @return int[] + * @return int[]|null */ public function getShifts() { @@ -217,12 +302,15 @@ public function getShifts() /** * Sets shifts * - * @param int[] $shifts + * @param int[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -234,7 +322,7 @@ public function setShifts($shifts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssCurrentExpensesModel.php b/src/lib/Model/EssCurrentExpensesModel.php index 204020e..56407c4 100644 --- a/src/lib/Model/EssCurrentExpensesModel.php +++ b/src/lib/Model/EssCurrentExpensesModel.php @@ -2,61 +2,61 @@ /** * EssCurrentExpensesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssCurrentExpensesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssCurrentExpensesModel implements ModelInterface, ArrayAccess +class EssCurrentExpensesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssCurrentExpensesModel'; + protected static $openAPIModelName = 'EssCurrentExpensesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'period_starting' => '\DateTime', 'period_ending' => '\DateTime', 'submitted_count' => 'int', @@ -69,8 +69,10 @@ class EssCurrentExpensesModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'period_starting' => 'date-time', 'period_ending' => 'date-time', 'submitted_count' => 'int32', @@ -79,14 +81,35 @@ class EssCurrentExpensesModel implements ModelInterface, ArrayAccess 'processed_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'period_starting' => false, + 'period_ending' => false, + 'submitted_count' => false, + 'approved_count' => false, + 'rejected_count' => false, + 'processed_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['period_starting'] = isset($data['period_starting']) ? $data['period_starting'] : null; - $this->container['period_ending'] = isset($data['period_ending']) ? $data['period_ending'] : null; - $this->container['submitted_count'] = isset($data['submitted_count']) ? $data['submitted_count'] : null; - $this->container['approved_count'] = isset($data['approved_count']) ? $data['approved_count'] : null; - $this->container['rejected_count'] = isset($data['rejected_count']) ? $data['rejected_count'] : null; - $this->container['processed_count'] = isset($data['processed_count']) ? $data['processed_count'] : null; + $this->setIfExists('period_starting', $data ?? [], null); + $this->setIfExists('period_ending', $data ?? [], null); + $this->setIfExists('submitted_count', $data ?? [], null); + $this->setIfExists('approved_count', $data ?? [], null); + $this->setIfExists('rejected_count', $data ?? [], null); + $this->setIfExists('processed_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets period_starting * - * @return \DateTime + * @return \DateTime|null */ public function getPeriodStarting() { @@ -247,12 +337,15 @@ public function getPeriodStarting() /** * Sets period_starting * - * @param \DateTime $period_starting + * @param \DateTime|null $period_starting * - * @return $this + * @return self */ public function setPeriodStarting($period_starting) { + if (is_null($period_starting)) { + throw new \InvalidArgumentException('non-nullable period_starting cannot be null'); + } $this->container['period_starting'] = $period_starting; return $this; @@ -261,7 +354,7 @@ public function setPeriodStarting($period_starting) /** * Gets period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPeriodEnding() { @@ -271,12 +364,15 @@ public function getPeriodEnding() /** * Sets period_ending * - * @param \DateTime $period_ending + * @param \DateTime|null $period_ending * - * @return $this + * @return self */ public function setPeriodEnding($period_ending) { + if (is_null($period_ending)) { + throw new \InvalidArgumentException('non-nullable period_ending cannot be null'); + } $this->container['period_ending'] = $period_ending; return $this; @@ -285,7 +381,7 @@ public function setPeriodEnding($period_ending) /** * Gets submitted_count * - * @return int + * @return int|null */ public function getSubmittedCount() { @@ -295,12 +391,15 @@ public function getSubmittedCount() /** * Sets submitted_count * - * @param int $submitted_count + * @param int|null $submitted_count * - * @return $this + * @return self */ public function setSubmittedCount($submitted_count) { + if (is_null($submitted_count)) { + throw new \InvalidArgumentException('non-nullable submitted_count cannot be null'); + } $this->container['submitted_count'] = $submitted_count; return $this; @@ -309,7 +408,7 @@ public function setSubmittedCount($submitted_count) /** * Gets approved_count * - * @return int + * @return int|null */ public function getApprovedCount() { @@ -319,12 +418,15 @@ public function getApprovedCount() /** * Sets approved_count * - * @param int $approved_count + * @param int|null $approved_count * - * @return $this + * @return self */ public function setApprovedCount($approved_count) { + if (is_null($approved_count)) { + throw new \InvalidArgumentException('non-nullable approved_count cannot be null'); + } $this->container['approved_count'] = $approved_count; return $this; @@ -333,7 +435,7 @@ public function setApprovedCount($approved_count) /** * Gets rejected_count * - * @return int + * @return int|null */ public function getRejectedCount() { @@ -343,12 +445,15 @@ public function getRejectedCount() /** * Sets rejected_count * - * @param int $rejected_count + * @param int|null $rejected_count * - * @return $this + * @return self */ public function setRejectedCount($rejected_count) { + if (is_null($rejected_count)) { + throw new \InvalidArgumentException('non-nullable rejected_count cannot be null'); + } $this->container['rejected_count'] = $rejected_count; return $this; @@ -357,7 +462,7 @@ public function setRejectedCount($rejected_count) /** * Gets processed_count * - * @return int + * @return int|null */ public function getProcessedCount() { @@ -367,12 +472,15 @@ public function getProcessedCount() /** * Sets processed_count * - * @param int $processed_count + * @param int|null $processed_count * - * @return $this + * @return self */ public function setProcessedCount($processed_count) { + if (is_null($processed_count)) { + throw new \InvalidArgumentException('non-nullable processed_count cannot be null'); + } $this->container['processed_count'] = $processed_count; return $this; @@ -384,7 +492,7 @@ public function setProcessedCount($processed_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssCurrentShiftModel.php b/src/lib/Model/EssCurrentShiftModel.php index c74cda3..8638b0e 100644 --- a/src/lib/Model/EssCurrentShiftModel.php +++ b/src/lib/Model/EssCurrentShiftModel.php @@ -2,61 +2,61 @@ /** * EssCurrentShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssCurrentShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssCurrentShiftModel implements ModelInterface, ArrayAccess +class EssCurrentShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssCurrentShiftModel'; + protected static $openAPIModelName = 'EssCurrentShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'shift_id' => 'int', 'clock_on_time_utc' => '\DateTime', 'break_start_time_utc' => '\DateTime', @@ -69,8 +69,10 @@ class EssCurrentShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shift_id' => 'int32', 'clock_on_time_utc' => 'date-time', 'break_start_time_utc' => 'date-time', @@ -79,14 +81,35 @@ class EssCurrentShiftModel implements ModelInterface, ArrayAccess 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shift_id' => false, + 'clock_on_time_utc' => false, + 'break_start_time_utc' => false, + 'status' => false, + 'long_shift' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,16 +255,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; - const STATUS_CLOCKED_ON = 'ClockedOn'; - const STATUS_ON_BREAK = 'OnBreak'; - const STATUS_CLOCKED_OFF = 'ClockedOff'; - + public const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; + public const STATUS_CLOCKED_ON = 'ClockedOn'; + public const STATUS_ON_BREAK = 'OnBreak'; + public const STATUS_CLOCKED_OFF = 'ClockedOff'; - /** * Gets allowable values of the enum * @@ -204,7 +277,6 @@ public function getStatusAllowableValues() self::STATUS_CLOCKED_OFF, ]; } - /** * Associative array for storing property values @@ -221,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['shift_id'] = isset($data['shift_id']) ? $data['shift_id'] : null; - $this->container['clock_on_time_utc'] = isset($data['clock_on_time_utc']) ? $data['clock_on_time_utc'] : null; - $this->container['break_start_time_utc'] = isset($data['break_start_time_utc']) ? $data['break_start_time_utc'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['long_shift'] = isset($data['long_shift']) ? $data['long_shift'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('shift_id', $data ?? [], null); + $this->setIfExists('clock_on_time_utc', $data ?? [], null); + $this->setIfExists('break_start_time_utc', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('long_shift', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -241,7 +331,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -264,7 +355,7 @@ public function valid() /** * Gets shift_id * - * @return int + * @return int|null */ public function getShiftId() { @@ -274,12 +365,15 @@ public function getShiftId() /** * Sets shift_id * - * @param int $shift_id + * @param int|null $shift_id * - * @return $this + * @return self */ public function setShiftId($shift_id) { + if (is_null($shift_id)) { + throw new \InvalidArgumentException('non-nullable shift_id cannot be null'); + } $this->container['shift_id'] = $shift_id; return $this; @@ -288,7 +382,7 @@ public function setShiftId($shift_id) /** * Gets clock_on_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getClockOnTimeUtc() { @@ -298,12 +392,15 @@ public function getClockOnTimeUtc() /** * Sets clock_on_time_utc * - * @param \DateTime $clock_on_time_utc + * @param \DateTime|null $clock_on_time_utc * - * @return $this + * @return self */ public function setClockOnTimeUtc($clock_on_time_utc) { + if (is_null($clock_on_time_utc)) { + throw new \InvalidArgumentException('non-nullable clock_on_time_utc cannot be null'); + } $this->container['clock_on_time_utc'] = $clock_on_time_utc; return $this; @@ -312,7 +409,7 @@ public function setClockOnTimeUtc($clock_on_time_utc) /** * Gets break_start_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getBreakStartTimeUtc() { @@ -322,12 +419,15 @@ public function getBreakStartTimeUtc() /** * Sets break_start_time_utc * - * @param \DateTime $break_start_time_utc + * @param \DateTime|null $break_start_time_utc * - * @return $this + * @return self */ public function setBreakStartTimeUtc($break_start_time_utc) { + if (is_null($break_start_time_utc)) { + throw new \InvalidArgumentException('non-nullable break_start_time_utc cannot be null'); + } $this->container['break_start_time_utc'] = $break_start_time_utc; return $this; @@ -336,7 +436,7 @@ public function setBreakStartTimeUtc($break_start_time_utc) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -346,17 +446,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -369,7 +473,7 @@ public function setStatus($status) /** * Gets long_shift * - * @return bool + * @return bool|null */ public function getLongShift() { @@ -379,12 +483,15 @@ public function getLongShift() /** * Sets long_shift * - * @param bool $long_shift + * @param bool|null $long_shift * - * @return $this + * @return self */ public function setLongShift($long_shift) { + if (is_null($long_shift)) { + throw new \InvalidArgumentException('non-nullable long_shift cannot be null'); + } $this->container['long_shift'] = $long_shift; return $this; @@ -393,7 +500,7 @@ public function setLongShift($long_shift) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -403,12 +510,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -420,7 +530,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -430,22 +540,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -461,11 +572,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -473,13 +597,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssCurrentTimesheetsModel.php b/src/lib/Model/EssCurrentTimesheetsModel.php index 26f268d..dd9eb47 100644 --- a/src/lib/Model/EssCurrentTimesheetsModel.php +++ b/src/lib/Model/EssCurrentTimesheetsModel.php @@ -2,76 +2,78 @@ /** * EssCurrentTimesheetsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssCurrentTimesheetsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssCurrentTimesheetsModel implements ModelInterface, ArrayAccess +class EssCurrentTimesheetsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssCurrentTimesheetsModel'; + protected static $openAPIModelName = 'EssCurrentTimesheetsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'period_starting' => '\DateTime', 'period_ending' => '\DateTime', 'submitted_count' => 'int', 'approved_count' => 'int', 'rejected_count' => 'int', 'processed_count' => 'int', - 'duration_in_minutes' => 'double' + 'duration_in_minutes' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'period_starting' => 'date-time', 'period_ending' => 'date-time', 'submitted_count' => 'int32', @@ -81,14 +83,36 @@ class EssCurrentTimesheetsModel implements ModelInterface, ArrayAccess 'duration_in_minutes' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'period_starting' => false, + 'period_ending' => false, + 'submitted_count' => false, + 'approved_count' => false, + 'rejected_count' => false, + 'processed_count' => false, + 'duration_in_minutes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['period_starting'] = isset($data['period_starting']) ? $data['period_starting'] : null; - $this->container['period_ending'] = isset($data['period_ending']) ? $data['period_ending'] : null; - $this->container['submitted_count'] = isset($data['submitted_count']) ? $data['submitted_count'] : null; - $this->container['approved_count'] = isset($data['approved_count']) ? $data['approved_count'] : null; - $this->container['rejected_count'] = isset($data['rejected_count']) ? $data['rejected_count'] : null; - $this->container['processed_count'] = isset($data['processed_count']) ? $data['processed_count'] : null; - $this->container['duration_in_minutes'] = isset($data['duration_in_minutes']) ? $data['duration_in_minutes'] : null; + $this->setIfExists('period_starting', $data ?? [], null); + $this->setIfExists('period_ending', $data ?? [], null); + $this->setIfExists('submitted_count', $data ?? [], null); + $this->setIfExists('approved_count', $data ?? [], null); + $this->setIfExists('rejected_count', $data ?? [], null); + $this->setIfExists('processed_count', $data ?? [], null); + $this->setIfExists('duration_in_minutes', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets period_starting * - * @return \DateTime + * @return \DateTime|null */ public function getPeriodStarting() { @@ -253,12 +344,15 @@ public function getPeriodStarting() /** * Sets period_starting * - * @param \DateTime $period_starting + * @param \DateTime|null $period_starting * - * @return $this + * @return self */ public function setPeriodStarting($period_starting) { + if (is_null($period_starting)) { + throw new \InvalidArgumentException('non-nullable period_starting cannot be null'); + } $this->container['period_starting'] = $period_starting; return $this; @@ -267,7 +361,7 @@ public function setPeriodStarting($period_starting) /** * Gets period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPeriodEnding() { @@ -277,12 +371,15 @@ public function getPeriodEnding() /** * Sets period_ending * - * @param \DateTime $period_ending + * @param \DateTime|null $period_ending * - * @return $this + * @return self */ public function setPeriodEnding($period_ending) { + if (is_null($period_ending)) { + throw new \InvalidArgumentException('non-nullable period_ending cannot be null'); + } $this->container['period_ending'] = $period_ending; return $this; @@ -291,7 +388,7 @@ public function setPeriodEnding($period_ending) /** * Gets submitted_count * - * @return int + * @return int|null */ public function getSubmittedCount() { @@ -301,12 +398,15 @@ public function getSubmittedCount() /** * Sets submitted_count * - * @param int $submitted_count + * @param int|null $submitted_count * - * @return $this + * @return self */ public function setSubmittedCount($submitted_count) { + if (is_null($submitted_count)) { + throw new \InvalidArgumentException('non-nullable submitted_count cannot be null'); + } $this->container['submitted_count'] = $submitted_count; return $this; @@ -315,7 +415,7 @@ public function setSubmittedCount($submitted_count) /** * Gets approved_count * - * @return int + * @return int|null */ public function getApprovedCount() { @@ -325,12 +425,15 @@ public function getApprovedCount() /** * Sets approved_count * - * @param int $approved_count + * @param int|null $approved_count * - * @return $this + * @return self */ public function setApprovedCount($approved_count) { + if (is_null($approved_count)) { + throw new \InvalidArgumentException('non-nullable approved_count cannot be null'); + } $this->container['approved_count'] = $approved_count; return $this; @@ -339,7 +442,7 @@ public function setApprovedCount($approved_count) /** * Gets rejected_count * - * @return int + * @return int|null */ public function getRejectedCount() { @@ -349,12 +452,15 @@ public function getRejectedCount() /** * Sets rejected_count * - * @param int $rejected_count + * @param int|null $rejected_count * - * @return $this + * @return self */ public function setRejectedCount($rejected_count) { + if (is_null($rejected_count)) { + throw new \InvalidArgumentException('non-nullable rejected_count cannot be null'); + } $this->container['rejected_count'] = $rejected_count; return $this; @@ -363,7 +469,7 @@ public function setRejectedCount($rejected_count) /** * Gets processed_count * - * @return int + * @return int|null */ public function getProcessedCount() { @@ -373,12 +479,15 @@ public function getProcessedCount() /** * Sets processed_count * - * @param int $processed_count + * @param int|null $processed_count * - * @return $this + * @return self */ public function setProcessedCount($processed_count) { + if (is_null($processed_count)) { + throw new \InvalidArgumentException('non-nullable processed_count cannot be null'); + } $this->container['processed_count'] = $processed_count; return $this; @@ -387,7 +496,7 @@ public function setProcessedCount($processed_count) /** * Gets duration_in_minutes * - * @return double + * @return float|null */ public function getDurationInMinutes() { @@ -397,12 +506,15 @@ public function getDurationInMinutes() /** * Sets duration_in_minutes * - * @param double $duration_in_minutes + * @param float|null $duration_in_minutes * - * @return $this + * @return self */ public function setDurationInMinutes($duration_in_minutes) { + if (is_null($duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable duration_in_minutes cannot be null'); + } $this->container['duration_in_minutes'] = $duration_in_minutes; return $this; @@ -414,7 +526,7 @@ public function setDurationInMinutes($duration_in_minutes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssDeclineRosterShiftModel.php b/src/lib/Model/EssDeclineRosterShiftModel.php index 3db2250..cc5a408 100644 --- a/src/lib/Model/EssDeclineRosterShiftModel.php +++ b/src/lib/Model/EssDeclineRosterShiftModel.php @@ -2,61 +2,61 @@ /** * EssDeclineRosterShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssDeclineRosterShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssDeclineRosterShiftModel implements ModelInterface, ArrayAccess +class EssDeclineRosterShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssDeclineRosterShiftModel'; + protected static $openAPIModelName = 'EssDeclineRosterShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'reason' => 'string' ]; @@ -64,19 +64,37 @@ class EssDeclineRosterShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'reason' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; + $this->setIfExists('reason', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -217,12 +302,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -234,7 +322,7 @@ public function setReason($reason) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssDocumentModel.php b/src/lib/Model/EssDocumentModel.php index 383bb60..5bedc8f 100644 --- a/src/lib/Model/EssDocumentModel.php +++ b/src/lib/Model/EssDocumentModel.php @@ -2,61 +2,61 @@ /** * EssDocumentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssDocumentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssDocumentModel implements ModelInterface, ArrayAccess +class EssDocumentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssDocumentModel'; + protected static $openAPIModelName = 'EssDocumentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'string', 'friendly_name' => 'string', 'date_created' => '\DateTime', @@ -68,8 +68,10 @@ class EssDocumentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => null, 'friendly_name' => null, 'date_created' => 'date-time', @@ -77,14 +79,34 @@ class EssDocumentModel implements ModelInterface, ArrayAccess 'date_acknowledged' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'friendly_name' => false, + 'date_created' => false, + 'requires_employee_acknowledgement' => false, + 'date_acknowledged' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['friendly_name'] = isset($data['friendly_name']) ? $data['friendly_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['requires_employee_acknowledgement'] = isset($data['requires_employee_acknowledgement']) ? $data['requires_employee_acknowledgement'] : null; - $this->container['date_acknowledged'] = isset($data['date_acknowledged']) ? $data['date_acknowledged'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('friendly_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('requires_employee_acknowledgement', $data ?? [], null); + $this->setIfExists('date_acknowledged', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -241,12 +330,15 @@ public function getId() /** * Sets id * - * @param string $id + * @param string|null $id * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setId($id) /** * Gets friendly_name * - * @return string + * @return string|null */ public function getFriendlyName() { @@ -265,12 +357,15 @@ public function getFriendlyName() /** * Sets friendly_name * - * @param string $friendly_name + * @param string|null $friendly_name * - * @return $this + * @return self */ public function setFriendlyName($friendly_name) { + if (is_null($friendly_name)) { + throw new \InvalidArgumentException('non-nullable friendly_name cannot be null'); + } $this->container['friendly_name'] = $friendly_name; return $this; @@ -279,7 +374,7 @@ public function setFriendlyName($friendly_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -289,12 +384,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -303,7 +401,7 @@ public function setDateCreated($date_created) /** * Gets requires_employee_acknowledgement * - * @return bool + * @return bool|null */ public function getRequiresEmployeeAcknowledgement() { @@ -313,12 +411,15 @@ public function getRequiresEmployeeAcknowledgement() /** * Sets requires_employee_acknowledgement * - * @param bool $requires_employee_acknowledgement + * @param bool|null $requires_employee_acknowledgement * - * @return $this + * @return self */ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledgement) { + if (is_null($requires_employee_acknowledgement)) { + throw new \InvalidArgumentException('non-nullable requires_employee_acknowledgement cannot be null'); + } $this->container['requires_employee_acknowledgement'] = $requires_employee_acknowledgement; return $this; @@ -327,7 +428,7 @@ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledg /** * Gets date_acknowledged * - * @return \DateTime + * @return \DateTime|null */ public function getDateAcknowledged() { @@ -337,12 +438,15 @@ public function getDateAcknowledged() /** * Sets date_acknowledged * - * @param \DateTime $date_acknowledged + * @param \DateTime|null $date_acknowledged * - * @return $this + * @return self */ public function setDateAcknowledged($date_acknowledged) { + if (is_null($date_acknowledged)) { + throw new \InvalidArgumentException('non-nullable date_acknowledged cannot be null'); + } $this->container['date_acknowledged'] = $date_acknowledged; return $this; @@ -354,7 +458,7 @@ public function setDateAcknowledged($date_acknowledged) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssEmployeeDetailsModel.php b/src/lib/Model/EssEmployeeDetailsModel.php index 4c8d970..d39774f 100644 --- a/src/lib/Model/EssEmployeeDetailsModel.php +++ b/src/lib/Model/EssEmployeeDetailsModel.php @@ -2,62 +2,62 @@ /** * EssEmployeeDetailsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssEmployeeDetailsModel Class Doc Comment * * @category Class * @description this exists to give it a separate name from the API EmployeeeDetailsModel. As an aside, we should have had an api specific model for this - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess +class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssEmployeeDetailsModel'; + protected static $openAPIModelName = 'EssEmployeeDetailsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'timesheets_read_only' => 'bool', 'id' => 'int', 'title_id' => 'int', @@ -100,7 +100,7 @@ class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess 'external_reference_id' => 'string', 'source' => 'int', 'is_postal_address_same_as_residential' => 'bool', - 'titles' => '\Swagger\Client\Model\TitleViewModel[]', + 'titles' => '\OpenAPI\Client\Model\TitleViewModel[]', 'edit_mode' => 'string', 'can_edit' => 'bool', 'tags_string' => 'string', @@ -113,7 +113,7 @@ class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess 'ird_details_current' => 'bool', 'ird_settings_enabled' => 'bool', 'has_connected_devices' => 'bool', - 'address_types' => '\Swagger\Client\Model\SelectListItem[]', + 'address_types' => '\OpenAPI\Client\Model\SelectListItem[]', 'residential_address_type' => 'string', 'postal_address_type' => 'string', 'residential_block_number' => 'string', @@ -128,9 +128,9 @@ class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess 'postal_address_line3' => 'string', 'termination_reason' => 'string', 'termination_description' => 'string', - 'termination_reasons' => '\Swagger\Client\Model\NumericSelectListItem[]', + 'termination_reasons' => '\OpenAPI\Client\Model\NumericSelectListItem[]', 'has_sole_user' => 'bool', - 'fields' => '\Swagger\Client\Model\EmployeeDetailsFields', + 'fields' => '\OpenAPI\Client\Model\EmployeeDetailsFields', 'pending_email_update' => 'bool', 'new_email' => 'string' ]; @@ -139,8 +139,10 @@ class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'timesheets_read_only' => null, 'id' => 'int32', 'title_id' => 'int32', @@ -218,14 +220,104 @@ class EssEmployeeDetailsModel implements ModelInterface, ArrayAccess 'new_email' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'timesheets_read_only' => false, + 'id' => false, + 'title_id' => false, + 'first_name' => false, + 'other_name' => false, + 'middle_name' => false, + 'surname' => false, + 'previous_surname' => false, + 'legal_name' => false, + 'gender' => false, + 'date_of_birth' => false, + 'anniversary_date' => false, + 'external_id' => false, + 'residential_street_address' => false, + 'residential_address_line2' => false, + 'residential_suburb_id' => false, + 'residential_suburb' => false, + 'residential_state' => false, + 'residential_postcode' => false, + 'residential_country' => false, + 'residential_country_id' => false, + 'is_overseas_residential_address' => false, + 'postal_street_address' => false, + 'postal_address_line2' => false, + 'postal_suburb_id' => false, + 'postal_suburb' => false, + 'postal_state' => false, + 'postal_postcode' => false, + 'postal_country' => false, + 'postal_country_id' => false, + 'is_overseas_postal_address' => false, + 'email' => false, + 'home_phone' => false, + 'work_phone' => false, + 'mobile_phone' => false, + 'start_date' => false, + 'end_date' => false, + 'is_terminated' => false, + 'is_anonymised' => false, + 'external_reference_id' => false, + 'source' => false, + 'is_postal_address_same_as_residential' => false, + 'titles' => false, + 'edit_mode' => false, + 'can_edit' => false, + 'tags_string' => false, + 'all_tags' => false, + 'timesheet_setting' => false, + 'can_delete' => false, + 'has_profile_image' => false, + 'can_edit_profile_image' => false, + 'bounced_email' => false, + 'ird_details_current' => false, + 'ird_settings_enabled' => false, + 'has_connected_devices' => false, + 'address_types' => false, + 'residential_address_type' => false, + 'postal_address_type' => false, + 'residential_block_number' => false, + 'postal_block_number' => false, + 'residential_level_number' => false, + 'postal_level_number' => false, + 'residential_unit_number' => false, + 'postal_unit_number' => false, + 'residential_street_name' => false, + 'postal_street_name' => false, + 'residential_address_line3' => false, + 'postal_address_line3' => false, + 'termination_reason' => false, + 'termination_description' => false, + 'termination_reasons' => false, + 'has_sole_user' => false, + 'fields' => false, + 'pending_email_update' => false, + 'new_email' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -233,9 +325,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -526,32 +670,30 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const EDIT_MODE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const EDIT_MODE_EMPLOYEE_PORTAL_READ_ONLY = 'EmployeePortalReadOnly'; - const EDIT_MODE_BUSINESS_PORTAL = 'BusinessPortal'; - const TIMESHEET_SETTING_DISABLED = 'Disabled'; - const TIMESHEET_SETTING_ENABLED = 'Enabled'; - const TIMESHEET_SETTING_ENABLED_FOR_EXCEPTIONS = 'EnabledForExceptions'; - const RESIDENTIAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; - const RESIDENTIAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; - const RESIDENTIAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; - const POSTAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; - const POSTAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; - const POSTAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; - const TERMINATION_REASON_VOLUNTARY_CESSATION = 'VoluntaryCessation'; - const TERMINATION_REASON_ILL_HEALTH = 'IllHealth'; - const TERMINATION_REASON_DECEASED = 'Deceased'; - const TERMINATION_REASON_REDUNDANCY = 'Redundancy'; - const TERMINATION_REASON_DISMISSAL = 'Dismissal'; - const TERMINATION_REASON_CONTRACT_CESSATION = 'ContractCessation'; - const TERMINATION_REASON_TRANSFER = 'Transfer'; - const TERMINATION_REASON_OTHER = 'Other'; - - - + return self::$openAPIModelName; + } + + public const EDIT_MODE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const EDIT_MODE_EMPLOYEE_PORTAL_READ_ONLY = 'EmployeePortalReadOnly'; + public const EDIT_MODE_BUSINESS_PORTAL = 'BusinessPortal'; + public const TIMESHEET_SETTING_DISABLED = 'Disabled'; + public const TIMESHEET_SETTING_ENABLED = 'Enabled'; + public const TIMESHEET_SETTING_ENABLED_FOR_EXCEPTIONS = 'EnabledForExceptions'; + public const RESIDENTIAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; + public const RESIDENTIAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; + public const RESIDENTIAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; + public const POSTAL_ADDRESS_TYPE_LOCAL_ADDRESS = 'LocalAddress'; + public const POSTAL_ADDRESS_TYPE_FOREIGN_ADDRESS = 'ForeignAddress'; + public const POSTAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS = 'LocalCareOfAddress'; + public const TERMINATION_REASON_VOLUNTARY_CESSATION = 'VoluntaryCessation'; + public const TERMINATION_REASON_ILL_HEALTH = 'IllHealth'; + public const TERMINATION_REASON_DECEASED = 'Deceased'; + public const TERMINATION_REASON_REDUNDANCY = 'Redundancy'; + public const TERMINATION_REASON_DISMISSAL = 'Dismissal'; + public const TERMINATION_REASON_CONTRACT_CESSATION = 'ContractCessation'; + public const TERMINATION_REASON_TRANSFER = 'Transfer'; + public const TERMINATION_REASON_OTHER = 'Other'; + /** * Gets allowable values of the enum * @@ -565,7 +707,7 @@ public function getEditModeAllowableValues() self::EDIT_MODE_BUSINESS_PORTAL, ]; } - + /** * Gets allowable values of the enum * @@ -579,7 +721,7 @@ public function getTimesheetSettingAllowableValues() self::TIMESHEET_SETTING_ENABLED_FOR_EXCEPTIONS, ]; } - + /** * Gets allowable values of the enum * @@ -593,7 +735,7 @@ public function getResidentialAddressTypeAllowableValues() self::RESIDENTIAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS, ]; } - + /** * Gets allowable values of the enum * @@ -607,7 +749,7 @@ public function getPostalAddressTypeAllowableValues() self::POSTAL_ADDRESS_TYPE_LOCAL_CARE_OF_ADDRESS, ]; } - + /** * Gets allowable values of the enum * @@ -626,7 +768,6 @@ public function getTerminationReasonAllowableValues() self::TERMINATION_REASON_OTHER, ]; } - /** * Associative array for storing property values @@ -643,81 +784,99 @@ public function getTerminationReasonAllowableValues() */ public function __construct(array $data = null) { - $this->container['timesheets_read_only'] = isset($data['timesheets_read_only']) ? $data['timesheets_read_only'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['title_id'] = isset($data['title_id']) ? $data['title_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['other_name'] = isset($data['other_name']) ? $data['other_name'] : null; - $this->container['middle_name'] = isset($data['middle_name']) ? $data['middle_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['previous_surname'] = isset($data['previous_surname']) ? $data['previous_surname'] : null; - $this->container['legal_name'] = isset($data['legal_name']) ? $data['legal_name'] : null; - $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['anniversary_date'] = isset($data['anniversary_date']) ? $data['anniversary_date'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['residential_street_address'] = isset($data['residential_street_address']) ? $data['residential_street_address'] : null; - $this->container['residential_address_line2'] = isset($data['residential_address_line2']) ? $data['residential_address_line2'] : null; - $this->container['residential_suburb_id'] = isset($data['residential_suburb_id']) ? $data['residential_suburb_id'] : null; - $this->container['residential_suburb'] = isset($data['residential_suburb']) ? $data['residential_suburb'] : null; - $this->container['residential_state'] = isset($data['residential_state']) ? $data['residential_state'] : null; - $this->container['residential_postcode'] = isset($data['residential_postcode']) ? $data['residential_postcode'] : null; - $this->container['residential_country'] = isset($data['residential_country']) ? $data['residential_country'] : null; - $this->container['residential_country_id'] = isset($data['residential_country_id']) ? $data['residential_country_id'] : null; - $this->container['is_overseas_residential_address'] = isset($data['is_overseas_residential_address']) ? $data['is_overseas_residential_address'] : null; - $this->container['postal_street_address'] = isset($data['postal_street_address']) ? $data['postal_street_address'] : null; - $this->container['postal_address_line2'] = isset($data['postal_address_line2']) ? $data['postal_address_line2'] : null; - $this->container['postal_suburb_id'] = isset($data['postal_suburb_id']) ? $data['postal_suburb_id'] : null; - $this->container['postal_suburb'] = isset($data['postal_suburb']) ? $data['postal_suburb'] : null; - $this->container['postal_state'] = isset($data['postal_state']) ? $data['postal_state'] : null; - $this->container['postal_postcode'] = isset($data['postal_postcode']) ? $data['postal_postcode'] : null; - $this->container['postal_country'] = isset($data['postal_country']) ? $data['postal_country'] : null; - $this->container['postal_country_id'] = isset($data['postal_country_id']) ? $data['postal_country_id'] : null; - $this->container['is_overseas_postal_address'] = isset($data['is_overseas_postal_address']) ? $data['is_overseas_postal_address'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['home_phone'] = isset($data['home_phone']) ? $data['home_phone'] : null; - $this->container['work_phone'] = isset($data['work_phone']) ? $data['work_phone'] : null; - $this->container['mobile_phone'] = isset($data['mobile_phone']) ? $data['mobile_phone'] : null; - $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['is_terminated'] = isset($data['is_terminated']) ? $data['is_terminated'] : null; - $this->container['is_anonymised'] = isset($data['is_anonymised']) ? $data['is_anonymised'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['is_postal_address_same_as_residential'] = isset($data['is_postal_address_same_as_residential']) ? $data['is_postal_address_same_as_residential'] : null; - $this->container['titles'] = isset($data['titles']) ? $data['titles'] : null; - $this->container['edit_mode'] = isset($data['edit_mode']) ? $data['edit_mode'] : null; - $this->container['can_edit'] = isset($data['can_edit']) ? $data['can_edit'] : null; - $this->container['tags_string'] = isset($data['tags_string']) ? $data['tags_string'] : null; - $this->container['all_tags'] = isset($data['all_tags']) ? $data['all_tags'] : null; - $this->container['timesheet_setting'] = isset($data['timesheet_setting']) ? $data['timesheet_setting'] : null; - $this->container['can_delete'] = isset($data['can_delete']) ? $data['can_delete'] : null; - $this->container['has_profile_image'] = isset($data['has_profile_image']) ? $data['has_profile_image'] : null; - $this->container['can_edit_profile_image'] = isset($data['can_edit_profile_image']) ? $data['can_edit_profile_image'] : null; - $this->container['bounced_email'] = isset($data['bounced_email']) ? $data['bounced_email'] : null; - $this->container['ird_details_current'] = isset($data['ird_details_current']) ? $data['ird_details_current'] : null; - $this->container['ird_settings_enabled'] = isset($data['ird_settings_enabled']) ? $data['ird_settings_enabled'] : null; - $this->container['has_connected_devices'] = isset($data['has_connected_devices']) ? $data['has_connected_devices'] : null; - $this->container['address_types'] = isset($data['address_types']) ? $data['address_types'] : null; - $this->container['residential_address_type'] = isset($data['residential_address_type']) ? $data['residential_address_type'] : null; - $this->container['postal_address_type'] = isset($data['postal_address_type']) ? $data['postal_address_type'] : null; - $this->container['residential_block_number'] = isset($data['residential_block_number']) ? $data['residential_block_number'] : null; - $this->container['postal_block_number'] = isset($data['postal_block_number']) ? $data['postal_block_number'] : null; - $this->container['residential_level_number'] = isset($data['residential_level_number']) ? $data['residential_level_number'] : null; - $this->container['postal_level_number'] = isset($data['postal_level_number']) ? $data['postal_level_number'] : null; - $this->container['residential_unit_number'] = isset($data['residential_unit_number']) ? $data['residential_unit_number'] : null; - $this->container['postal_unit_number'] = isset($data['postal_unit_number']) ? $data['postal_unit_number'] : null; - $this->container['residential_street_name'] = isset($data['residential_street_name']) ? $data['residential_street_name'] : null; - $this->container['postal_street_name'] = isset($data['postal_street_name']) ? $data['postal_street_name'] : null; - $this->container['residential_address_line3'] = isset($data['residential_address_line3']) ? $data['residential_address_line3'] : null; - $this->container['postal_address_line3'] = isset($data['postal_address_line3']) ? $data['postal_address_line3'] : null; - $this->container['termination_reason'] = isset($data['termination_reason']) ? $data['termination_reason'] : null; - $this->container['termination_description'] = isset($data['termination_description']) ? $data['termination_description'] : null; - $this->container['termination_reasons'] = isset($data['termination_reasons']) ? $data['termination_reasons'] : null; - $this->container['has_sole_user'] = isset($data['has_sole_user']) ? $data['has_sole_user'] : null; - $this->container['fields'] = isset($data['fields']) ? $data['fields'] : null; - $this->container['pending_email_update'] = isset($data['pending_email_update']) ? $data['pending_email_update'] : null; - $this->container['new_email'] = isset($data['new_email']) ? $data['new_email'] : null; + $this->setIfExists('timesheets_read_only', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('title_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('other_name', $data ?? [], null); + $this->setIfExists('middle_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('previous_surname', $data ?? [], null); + $this->setIfExists('legal_name', $data ?? [], null); + $this->setIfExists('gender', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('anniversary_date', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('residential_street_address', $data ?? [], null); + $this->setIfExists('residential_address_line2', $data ?? [], null); + $this->setIfExists('residential_suburb_id', $data ?? [], null); + $this->setIfExists('residential_suburb', $data ?? [], null); + $this->setIfExists('residential_state', $data ?? [], null); + $this->setIfExists('residential_postcode', $data ?? [], null); + $this->setIfExists('residential_country', $data ?? [], null); + $this->setIfExists('residential_country_id', $data ?? [], null); + $this->setIfExists('is_overseas_residential_address', $data ?? [], null); + $this->setIfExists('postal_street_address', $data ?? [], null); + $this->setIfExists('postal_address_line2', $data ?? [], null); + $this->setIfExists('postal_suburb_id', $data ?? [], null); + $this->setIfExists('postal_suburb', $data ?? [], null); + $this->setIfExists('postal_state', $data ?? [], null); + $this->setIfExists('postal_postcode', $data ?? [], null); + $this->setIfExists('postal_country', $data ?? [], null); + $this->setIfExists('postal_country_id', $data ?? [], null); + $this->setIfExists('is_overseas_postal_address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('home_phone', $data ?? [], null); + $this->setIfExists('work_phone', $data ?? [], null); + $this->setIfExists('mobile_phone', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('is_terminated', $data ?? [], null); + $this->setIfExists('is_anonymised', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('is_postal_address_same_as_residential', $data ?? [], null); + $this->setIfExists('titles', $data ?? [], null); + $this->setIfExists('edit_mode', $data ?? [], null); + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('tags_string', $data ?? [], null); + $this->setIfExists('all_tags', $data ?? [], null); + $this->setIfExists('timesheet_setting', $data ?? [], null); + $this->setIfExists('can_delete', $data ?? [], null); + $this->setIfExists('has_profile_image', $data ?? [], null); + $this->setIfExists('can_edit_profile_image', $data ?? [], null); + $this->setIfExists('bounced_email', $data ?? [], null); + $this->setIfExists('ird_details_current', $data ?? [], null); + $this->setIfExists('ird_settings_enabled', $data ?? [], null); + $this->setIfExists('has_connected_devices', $data ?? [], null); + $this->setIfExists('address_types', $data ?? [], null); + $this->setIfExists('residential_address_type', $data ?? [], null); + $this->setIfExists('postal_address_type', $data ?? [], null); + $this->setIfExists('residential_block_number', $data ?? [], null); + $this->setIfExists('postal_block_number', $data ?? [], null); + $this->setIfExists('residential_level_number', $data ?? [], null); + $this->setIfExists('postal_level_number', $data ?? [], null); + $this->setIfExists('residential_unit_number', $data ?? [], null); + $this->setIfExists('postal_unit_number', $data ?? [], null); + $this->setIfExists('residential_street_name', $data ?? [], null); + $this->setIfExists('postal_street_name', $data ?? [], null); + $this->setIfExists('residential_address_line3', $data ?? [], null); + $this->setIfExists('postal_address_line3', $data ?? [], null); + $this->setIfExists('termination_reason', $data ?? [], null); + $this->setIfExists('termination_description', $data ?? [], null); + $this->setIfExists('termination_reasons', $data ?? [], null); + $this->setIfExists('has_sole_user', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('pending_email_update', $data ?? [], null); + $this->setIfExists('new_email', $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; } /** @@ -732,7 +891,8 @@ public function listInvalidProperties() $allowedValues = $this->getEditModeAllowableValues(); if (!is_null($this->container['edit_mode']) && !in_array($this->container['edit_mode'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'edit_mode', must be one of '%s'", + "invalid value '%s' for 'edit_mode', must be one of '%s'", + $this->container['edit_mode'], implode("', '", $allowedValues) ); } @@ -740,7 +900,8 @@ public function listInvalidProperties() $allowedValues = $this->getTimesheetSettingAllowableValues(); if (!is_null($this->container['timesheet_setting']) && !in_array($this->container['timesheet_setting'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'timesheet_setting', must be one of '%s'", + "invalid value '%s' for 'timesheet_setting', must be one of '%s'", + $this->container['timesheet_setting'], implode("', '", $allowedValues) ); } @@ -748,7 +909,8 @@ public function listInvalidProperties() $allowedValues = $this->getResidentialAddressTypeAllowableValues(); if (!is_null($this->container['residential_address_type']) && !in_array($this->container['residential_address_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'residential_address_type', must be one of '%s'", + "invalid value '%s' for 'residential_address_type', must be one of '%s'", + $this->container['residential_address_type'], implode("', '", $allowedValues) ); } @@ -756,7 +918,8 @@ public function listInvalidProperties() $allowedValues = $this->getPostalAddressTypeAllowableValues(); if (!is_null($this->container['postal_address_type']) && !in_array($this->container['postal_address_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'postal_address_type', must be one of '%s'", + "invalid value '%s' for 'postal_address_type', must be one of '%s'", + $this->container['postal_address_type'], implode("', '", $allowedValues) ); } @@ -764,7 +927,8 @@ public function listInvalidProperties() $allowedValues = $this->getTerminationReasonAllowableValues(); if (!is_null($this->container['termination_reason']) && !in_array($this->container['termination_reason'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'termination_reason', must be one of '%s'", + "invalid value '%s' for 'termination_reason', must be one of '%s'", + $this->container['termination_reason'], implode("', '", $allowedValues) ); } @@ -787,7 +951,7 @@ public function valid() /** * Gets timesheets_read_only * - * @return bool + * @return bool|null */ public function getTimesheetsReadOnly() { @@ -797,12 +961,15 @@ public function getTimesheetsReadOnly() /** * Sets timesheets_read_only * - * @param bool $timesheets_read_only + * @param bool|null $timesheets_read_only * - * @return $this + * @return self */ public function setTimesheetsReadOnly($timesheets_read_only) { + if (is_null($timesheets_read_only)) { + throw new \InvalidArgumentException('non-nullable timesheets_read_only cannot be null'); + } $this->container['timesheets_read_only'] = $timesheets_read_only; return $this; @@ -811,7 +978,7 @@ public function setTimesheetsReadOnly($timesheets_read_only) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -821,12 +988,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -835,7 +1005,7 @@ public function setId($id) /** * Gets title_id * - * @return int + * @return int|null */ public function getTitleId() { @@ -845,12 +1015,15 @@ public function getTitleId() /** * Sets title_id * - * @param int $title_id + * @param int|null $title_id * - * @return $this + * @return self */ public function setTitleId($title_id) { + if (is_null($title_id)) { + throw new \InvalidArgumentException('non-nullable title_id cannot be null'); + } $this->container['title_id'] = $title_id; return $this; @@ -859,7 +1032,7 @@ public function setTitleId($title_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -869,12 +1042,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -883,7 +1059,7 @@ public function setFirstName($first_name) /** * Gets other_name * - * @return string + * @return string|null */ public function getOtherName() { @@ -893,12 +1069,15 @@ public function getOtherName() /** * Sets other_name * - * @param string $other_name + * @param string|null $other_name * - * @return $this + * @return self */ public function setOtherName($other_name) { + if (is_null($other_name)) { + throw new \InvalidArgumentException('non-nullable other_name cannot be null'); + } $this->container['other_name'] = $other_name; return $this; @@ -907,7 +1086,7 @@ public function setOtherName($other_name) /** * Gets middle_name * - * @return string + * @return string|null */ public function getMiddleName() { @@ -917,12 +1096,15 @@ public function getMiddleName() /** * Sets middle_name * - * @param string $middle_name + * @param string|null $middle_name * - * @return $this + * @return self */ public function setMiddleName($middle_name) { + if (is_null($middle_name)) { + throw new \InvalidArgumentException('non-nullable middle_name cannot be null'); + } $this->container['middle_name'] = $middle_name; return $this; @@ -931,7 +1113,7 @@ public function setMiddleName($middle_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -941,12 +1123,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -955,7 +1140,7 @@ public function setSurname($surname) /** * Gets previous_surname * - * @return string + * @return string|null */ public function getPreviousSurname() { @@ -965,12 +1150,15 @@ public function getPreviousSurname() /** * Sets previous_surname * - * @param string $previous_surname + * @param string|null $previous_surname * - * @return $this + * @return self */ public function setPreviousSurname($previous_surname) { + if (is_null($previous_surname)) { + throw new \InvalidArgumentException('non-nullable previous_surname cannot be null'); + } $this->container['previous_surname'] = $previous_surname; return $this; @@ -979,7 +1167,7 @@ public function setPreviousSurname($previous_surname) /** * Gets legal_name * - * @return string + * @return string|null */ public function getLegalName() { @@ -989,12 +1177,15 @@ public function getLegalName() /** * Sets legal_name * - * @param string $legal_name + * @param string|null $legal_name * - * @return $this + * @return self */ public function setLegalName($legal_name) { + if (is_null($legal_name)) { + throw new \InvalidArgumentException('non-nullable legal_name cannot be null'); + } $this->container['legal_name'] = $legal_name; return $this; @@ -1003,7 +1194,7 @@ public function setLegalName($legal_name) /** * Gets gender * - * @return string + * @return string|null */ public function getGender() { @@ -1013,12 +1204,15 @@ public function getGender() /** * Sets gender * - * @param string $gender + * @param string|null $gender * - * @return $this + * @return self */ public function setGender($gender) { + if (is_null($gender)) { + throw new \InvalidArgumentException('non-nullable gender cannot be null'); + } $this->container['gender'] = $gender; return $this; @@ -1027,7 +1221,7 @@ public function setGender($gender) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -1037,12 +1231,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -1051,7 +1248,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets anniversary_date * - * @return \DateTime + * @return \DateTime|null */ public function getAnniversaryDate() { @@ -1061,12 +1258,15 @@ public function getAnniversaryDate() /** * Sets anniversary_date * - * @param \DateTime $anniversary_date + * @param \DateTime|null $anniversary_date * - * @return $this + * @return self */ public function setAnniversaryDate($anniversary_date) { + if (is_null($anniversary_date)) { + throw new \InvalidArgumentException('non-nullable anniversary_date cannot be null'); + } $this->container['anniversary_date'] = $anniversary_date; return $this; @@ -1075,7 +1275,7 @@ public function setAnniversaryDate($anniversary_date) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -1085,12 +1285,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -1099,7 +1302,7 @@ public function setExternalId($external_id) /** * Gets residential_street_address * - * @return string + * @return string|null */ public function getResidentialStreetAddress() { @@ -1109,12 +1312,15 @@ public function getResidentialStreetAddress() /** * Sets residential_street_address * - * @param string $residential_street_address + * @param string|null $residential_street_address * - * @return $this + * @return self */ public function setResidentialStreetAddress($residential_street_address) { + if (is_null($residential_street_address)) { + throw new \InvalidArgumentException('non-nullable residential_street_address cannot be null'); + } $this->container['residential_street_address'] = $residential_street_address; return $this; @@ -1123,7 +1329,7 @@ public function setResidentialStreetAddress($residential_street_address) /** * Gets residential_address_line2 * - * @return string + * @return string|null */ public function getResidentialAddressLine2() { @@ -1133,12 +1339,15 @@ public function getResidentialAddressLine2() /** * Sets residential_address_line2 * - * @param string $residential_address_line2 + * @param string|null $residential_address_line2 * - * @return $this + * @return self */ public function setResidentialAddressLine2($residential_address_line2) { + if (is_null($residential_address_line2)) { + throw new \InvalidArgumentException('non-nullable residential_address_line2 cannot be null'); + } $this->container['residential_address_line2'] = $residential_address_line2; return $this; @@ -1147,7 +1356,7 @@ public function setResidentialAddressLine2($residential_address_line2) /** * Gets residential_suburb_id * - * @return int + * @return int|null */ public function getResidentialSuburbId() { @@ -1157,12 +1366,15 @@ public function getResidentialSuburbId() /** * Sets residential_suburb_id * - * @param int $residential_suburb_id + * @param int|null $residential_suburb_id * - * @return $this + * @return self */ public function setResidentialSuburbId($residential_suburb_id) { + if (is_null($residential_suburb_id)) { + throw new \InvalidArgumentException('non-nullable residential_suburb_id cannot be null'); + } $this->container['residential_suburb_id'] = $residential_suburb_id; return $this; @@ -1171,7 +1383,7 @@ public function setResidentialSuburbId($residential_suburb_id) /** * Gets residential_suburb * - * @return string + * @return string|null */ public function getResidentialSuburb() { @@ -1181,12 +1393,15 @@ public function getResidentialSuburb() /** * Sets residential_suburb * - * @param string $residential_suburb + * @param string|null $residential_suburb * - * @return $this + * @return self */ public function setResidentialSuburb($residential_suburb) { + if (is_null($residential_suburb)) { + throw new \InvalidArgumentException('non-nullable residential_suburb cannot be null'); + } $this->container['residential_suburb'] = $residential_suburb; return $this; @@ -1195,7 +1410,7 @@ public function setResidentialSuburb($residential_suburb) /** * Gets residential_state * - * @return string + * @return string|null */ public function getResidentialState() { @@ -1205,12 +1420,15 @@ public function getResidentialState() /** * Sets residential_state * - * @param string $residential_state + * @param string|null $residential_state * - * @return $this + * @return self */ public function setResidentialState($residential_state) { + if (is_null($residential_state)) { + throw new \InvalidArgumentException('non-nullable residential_state cannot be null'); + } $this->container['residential_state'] = $residential_state; return $this; @@ -1219,7 +1437,7 @@ public function setResidentialState($residential_state) /** * Gets residential_postcode * - * @return string + * @return string|null */ public function getResidentialPostcode() { @@ -1229,12 +1447,15 @@ public function getResidentialPostcode() /** * Sets residential_postcode * - * @param string $residential_postcode + * @param string|null $residential_postcode * - * @return $this + * @return self */ public function setResidentialPostcode($residential_postcode) { + if (is_null($residential_postcode)) { + throw new \InvalidArgumentException('non-nullable residential_postcode cannot be null'); + } $this->container['residential_postcode'] = $residential_postcode; return $this; @@ -1243,7 +1464,7 @@ public function setResidentialPostcode($residential_postcode) /** * Gets residential_country * - * @return string + * @return string|null */ public function getResidentialCountry() { @@ -1253,12 +1474,15 @@ public function getResidentialCountry() /** * Sets residential_country * - * @param string $residential_country + * @param string|null $residential_country * - * @return $this + * @return self */ public function setResidentialCountry($residential_country) { + if (is_null($residential_country)) { + throw new \InvalidArgumentException('non-nullable residential_country cannot be null'); + } $this->container['residential_country'] = $residential_country; return $this; @@ -1267,7 +1491,7 @@ public function setResidentialCountry($residential_country) /** * Gets residential_country_id * - * @return string + * @return string|null */ public function getResidentialCountryId() { @@ -1277,12 +1501,15 @@ public function getResidentialCountryId() /** * Sets residential_country_id * - * @param string $residential_country_id + * @param string|null $residential_country_id * - * @return $this + * @return self */ public function setResidentialCountryId($residential_country_id) { + if (is_null($residential_country_id)) { + throw new \InvalidArgumentException('non-nullable residential_country_id cannot be null'); + } $this->container['residential_country_id'] = $residential_country_id; return $this; @@ -1291,7 +1518,7 @@ public function setResidentialCountryId($residential_country_id) /** * Gets is_overseas_residential_address * - * @return bool + * @return bool|null */ public function getIsOverseasResidentialAddress() { @@ -1301,12 +1528,15 @@ public function getIsOverseasResidentialAddress() /** * Sets is_overseas_residential_address * - * @param bool $is_overseas_residential_address + * @param bool|null $is_overseas_residential_address * - * @return $this + * @return self */ public function setIsOverseasResidentialAddress($is_overseas_residential_address) { + if (is_null($is_overseas_residential_address)) { + throw new \InvalidArgumentException('non-nullable is_overseas_residential_address cannot be null'); + } $this->container['is_overseas_residential_address'] = $is_overseas_residential_address; return $this; @@ -1315,7 +1545,7 @@ public function setIsOverseasResidentialAddress($is_overseas_residential_address /** * Gets postal_street_address * - * @return string + * @return string|null */ public function getPostalStreetAddress() { @@ -1325,12 +1555,15 @@ public function getPostalStreetAddress() /** * Sets postal_street_address * - * @param string $postal_street_address + * @param string|null $postal_street_address * - * @return $this + * @return self */ public function setPostalStreetAddress($postal_street_address) { + if (is_null($postal_street_address)) { + throw new \InvalidArgumentException('non-nullable postal_street_address cannot be null'); + } $this->container['postal_street_address'] = $postal_street_address; return $this; @@ -1339,7 +1572,7 @@ public function setPostalStreetAddress($postal_street_address) /** * Gets postal_address_line2 * - * @return string + * @return string|null */ public function getPostalAddressLine2() { @@ -1349,12 +1582,15 @@ public function getPostalAddressLine2() /** * Sets postal_address_line2 * - * @param string $postal_address_line2 + * @param string|null $postal_address_line2 * - * @return $this + * @return self */ public function setPostalAddressLine2($postal_address_line2) { + if (is_null($postal_address_line2)) { + throw new \InvalidArgumentException('non-nullable postal_address_line2 cannot be null'); + } $this->container['postal_address_line2'] = $postal_address_line2; return $this; @@ -1363,7 +1599,7 @@ public function setPostalAddressLine2($postal_address_line2) /** * Gets postal_suburb_id * - * @return int + * @return int|null */ public function getPostalSuburbId() { @@ -1373,12 +1609,15 @@ public function getPostalSuburbId() /** * Sets postal_suburb_id * - * @param int $postal_suburb_id + * @param int|null $postal_suburb_id * - * @return $this + * @return self */ public function setPostalSuburbId($postal_suburb_id) { + if (is_null($postal_suburb_id)) { + throw new \InvalidArgumentException('non-nullable postal_suburb_id cannot be null'); + } $this->container['postal_suburb_id'] = $postal_suburb_id; return $this; @@ -1387,7 +1626,7 @@ public function setPostalSuburbId($postal_suburb_id) /** * Gets postal_suburb * - * @return string + * @return string|null */ public function getPostalSuburb() { @@ -1397,12 +1636,15 @@ public function getPostalSuburb() /** * Sets postal_suburb * - * @param string $postal_suburb + * @param string|null $postal_suburb * - * @return $this + * @return self */ public function setPostalSuburb($postal_suburb) { + if (is_null($postal_suburb)) { + throw new \InvalidArgumentException('non-nullable postal_suburb cannot be null'); + } $this->container['postal_suburb'] = $postal_suburb; return $this; @@ -1411,7 +1653,7 @@ public function setPostalSuburb($postal_suburb) /** * Gets postal_state * - * @return string + * @return string|null */ public function getPostalState() { @@ -1421,12 +1663,15 @@ public function getPostalState() /** * Sets postal_state * - * @param string $postal_state + * @param string|null $postal_state * - * @return $this + * @return self */ public function setPostalState($postal_state) { + if (is_null($postal_state)) { + throw new \InvalidArgumentException('non-nullable postal_state cannot be null'); + } $this->container['postal_state'] = $postal_state; return $this; @@ -1435,7 +1680,7 @@ public function setPostalState($postal_state) /** * Gets postal_postcode * - * @return string + * @return string|null */ public function getPostalPostcode() { @@ -1445,12 +1690,15 @@ public function getPostalPostcode() /** * Sets postal_postcode * - * @param string $postal_postcode + * @param string|null $postal_postcode * - * @return $this + * @return self */ public function setPostalPostcode($postal_postcode) { + if (is_null($postal_postcode)) { + throw new \InvalidArgumentException('non-nullable postal_postcode cannot be null'); + } $this->container['postal_postcode'] = $postal_postcode; return $this; @@ -1459,7 +1707,7 @@ public function setPostalPostcode($postal_postcode) /** * Gets postal_country * - * @return string + * @return string|null */ public function getPostalCountry() { @@ -1469,12 +1717,15 @@ public function getPostalCountry() /** * Sets postal_country * - * @param string $postal_country + * @param string|null $postal_country * - * @return $this + * @return self */ public function setPostalCountry($postal_country) { + if (is_null($postal_country)) { + throw new \InvalidArgumentException('non-nullable postal_country cannot be null'); + } $this->container['postal_country'] = $postal_country; return $this; @@ -1483,7 +1734,7 @@ public function setPostalCountry($postal_country) /** * Gets postal_country_id * - * @return string + * @return string|null */ public function getPostalCountryId() { @@ -1493,12 +1744,15 @@ public function getPostalCountryId() /** * Sets postal_country_id * - * @param string $postal_country_id + * @param string|null $postal_country_id * - * @return $this + * @return self */ public function setPostalCountryId($postal_country_id) { + if (is_null($postal_country_id)) { + throw new \InvalidArgumentException('non-nullable postal_country_id cannot be null'); + } $this->container['postal_country_id'] = $postal_country_id; return $this; @@ -1507,7 +1761,7 @@ public function setPostalCountryId($postal_country_id) /** * Gets is_overseas_postal_address * - * @return bool + * @return bool|null */ public function getIsOverseasPostalAddress() { @@ -1517,12 +1771,15 @@ public function getIsOverseasPostalAddress() /** * Sets is_overseas_postal_address * - * @param bool $is_overseas_postal_address + * @param bool|null $is_overseas_postal_address * - * @return $this + * @return self */ public function setIsOverseasPostalAddress($is_overseas_postal_address) { + if (is_null($is_overseas_postal_address)) { + throw new \InvalidArgumentException('non-nullable is_overseas_postal_address cannot be null'); + } $this->container['is_overseas_postal_address'] = $is_overseas_postal_address; return $this; @@ -1531,7 +1788,7 @@ public function setIsOverseasPostalAddress($is_overseas_postal_address) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -1541,12 +1798,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -1555,7 +1815,7 @@ public function setEmail($email) /** * Gets home_phone * - * @return string + * @return string|null */ public function getHomePhone() { @@ -1565,12 +1825,15 @@ public function getHomePhone() /** * Sets home_phone * - * @param string $home_phone + * @param string|null $home_phone * - * @return $this + * @return self */ public function setHomePhone($home_phone) { + if (is_null($home_phone)) { + throw new \InvalidArgumentException('non-nullable home_phone cannot be null'); + } $this->container['home_phone'] = $home_phone; return $this; @@ -1579,7 +1842,7 @@ public function setHomePhone($home_phone) /** * Gets work_phone * - * @return string + * @return string|null */ public function getWorkPhone() { @@ -1589,12 +1852,15 @@ public function getWorkPhone() /** * Sets work_phone * - * @param string $work_phone + * @param string|null $work_phone * - * @return $this + * @return self */ public function setWorkPhone($work_phone) { + if (is_null($work_phone)) { + throw new \InvalidArgumentException('non-nullable work_phone cannot be null'); + } $this->container['work_phone'] = $work_phone; return $this; @@ -1603,7 +1869,7 @@ public function setWorkPhone($work_phone) /** * Gets mobile_phone * - * @return string + * @return string|null */ public function getMobilePhone() { @@ -1613,12 +1879,15 @@ public function getMobilePhone() /** * Sets mobile_phone * - * @param string $mobile_phone + * @param string|null $mobile_phone * - * @return $this + * @return self */ public function setMobilePhone($mobile_phone) { + if (is_null($mobile_phone)) { + throw new \InvalidArgumentException('non-nullable mobile_phone cannot be null'); + } $this->container['mobile_phone'] = $mobile_phone; return $this; @@ -1627,7 +1896,7 @@ public function setMobilePhone($mobile_phone) /** * Gets start_date * - * @return \DateTime + * @return \DateTime|null */ public function getStartDate() { @@ -1637,12 +1906,15 @@ public function getStartDate() /** * Sets start_date * - * @param \DateTime $start_date + * @param \DateTime|null $start_date * - * @return $this + * @return self */ public function setStartDate($start_date) { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -1651,7 +1923,7 @@ public function setStartDate($start_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -1661,12 +1933,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -1675,7 +1950,7 @@ public function setEndDate($end_date) /** * Gets is_terminated * - * @return bool + * @return bool|null */ public function getIsTerminated() { @@ -1685,12 +1960,15 @@ public function getIsTerminated() /** * Sets is_terminated * - * @param bool $is_terminated + * @param bool|null $is_terminated * - * @return $this + * @return self */ public function setIsTerminated($is_terminated) { + if (is_null($is_terminated)) { + throw new \InvalidArgumentException('non-nullable is_terminated cannot be null'); + } $this->container['is_terminated'] = $is_terminated; return $this; @@ -1699,7 +1977,7 @@ public function setIsTerminated($is_terminated) /** * Gets is_anonymised * - * @return bool + * @return bool|null */ public function getIsAnonymised() { @@ -1709,12 +1987,15 @@ public function getIsAnonymised() /** * Sets is_anonymised * - * @param bool $is_anonymised + * @param bool|null $is_anonymised * - * @return $this + * @return self */ public function setIsAnonymised($is_anonymised) { + if (is_null($is_anonymised)) { + throw new \InvalidArgumentException('non-nullable is_anonymised cannot be null'); + } $this->container['is_anonymised'] = $is_anonymised; return $this; @@ -1723,7 +2004,7 @@ public function setIsAnonymised($is_anonymised) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -1733,12 +2014,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -1747,7 +2031,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets source * - * @return int + * @return int|null */ public function getSource() { @@ -1757,12 +2041,15 @@ public function getSource() /** * Sets source * - * @param int $source + * @param int|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -1771,7 +2058,7 @@ public function setSource($source) /** * Gets is_postal_address_same_as_residential * - * @return bool + * @return bool|null */ public function getIsPostalAddressSameAsResidential() { @@ -1781,12 +2068,15 @@ public function getIsPostalAddressSameAsResidential() /** * Sets is_postal_address_same_as_residential * - * @param bool $is_postal_address_same_as_residential + * @param bool|null $is_postal_address_same_as_residential * - * @return $this + * @return self */ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_residential) { + if (is_null($is_postal_address_same_as_residential)) { + throw new \InvalidArgumentException('non-nullable is_postal_address_same_as_residential cannot be null'); + } $this->container['is_postal_address_same_as_residential'] = $is_postal_address_same_as_residential; return $this; @@ -1795,7 +2085,7 @@ public function setIsPostalAddressSameAsResidential($is_postal_address_same_as_r /** * Gets titles * - * @return \Swagger\Client\Model\TitleViewModel[] + * @return \OpenAPI\Client\Model\TitleViewModel[]|null */ public function getTitles() { @@ -1805,12 +2095,15 @@ public function getTitles() /** * Sets titles * - * @param \Swagger\Client\Model\TitleViewModel[] $titles + * @param \OpenAPI\Client\Model\TitleViewModel[]|null $titles * - * @return $this + * @return self */ public function setTitles($titles) { + if (is_null($titles)) { + throw new \InvalidArgumentException('non-nullable titles cannot be null'); + } $this->container['titles'] = $titles; return $this; @@ -1819,7 +2112,7 @@ public function setTitles($titles) /** * Gets edit_mode * - * @return string + * @return string|null */ public function getEditMode() { @@ -1829,17 +2122,21 @@ public function getEditMode() /** * Sets edit_mode * - * @param string $edit_mode + * @param string|null $edit_mode * - * @return $this + * @return self */ public function setEditMode($edit_mode) { + if (is_null($edit_mode)) { + throw new \InvalidArgumentException('non-nullable edit_mode cannot be null'); + } $allowedValues = $this->getEditModeAllowableValues(); - if (!is_null($edit_mode) && !in_array($edit_mode, $allowedValues, true)) { + if (!in_array($edit_mode, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'edit_mode', must be one of '%s'", + "Invalid value '%s' for 'edit_mode', must be one of '%s'", + $edit_mode, implode("', '", $allowedValues) ) ); @@ -1852,7 +2149,7 @@ public function setEditMode($edit_mode) /** * Gets can_edit * - * @return bool + * @return bool|null */ public function getCanEdit() { @@ -1862,12 +2159,15 @@ public function getCanEdit() /** * Sets can_edit * - * @param bool $can_edit + * @param bool|null $can_edit * - * @return $this + * @return self */ public function setCanEdit($can_edit) { + if (is_null($can_edit)) { + throw new \InvalidArgumentException('non-nullable can_edit cannot be null'); + } $this->container['can_edit'] = $can_edit; return $this; @@ -1876,7 +2176,7 @@ public function setCanEdit($can_edit) /** * Gets tags_string * - * @return string + * @return string|null */ public function getTagsString() { @@ -1886,12 +2186,15 @@ public function getTagsString() /** * Sets tags_string * - * @param string $tags_string + * @param string|null $tags_string * - * @return $this + * @return self */ public function setTagsString($tags_string) { + if (is_null($tags_string)) { + throw new \InvalidArgumentException('non-nullable tags_string cannot be null'); + } $this->container['tags_string'] = $tags_string; return $this; @@ -1900,7 +2203,7 @@ public function setTagsString($tags_string) /** * Gets all_tags * - * @return string[] + * @return string[]|null */ public function getAllTags() { @@ -1910,12 +2213,15 @@ public function getAllTags() /** * Sets all_tags * - * @param string[] $all_tags + * @param string[]|null $all_tags * - * @return $this + * @return self */ public function setAllTags($all_tags) { + if (is_null($all_tags)) { + throw new \InvalidArgumentException('non-nullable all_tags cannot be null'); + } $this->container['all_tags'] = $all_tags; return $this; @@ -1924,7 +2230,7 @@ public function setAllTags($all_tags) /** * Gets timesheet_setting * - * @return string + * @return string|null */ public function getTimesheetSetting() { @@ -1934,17 +2240,21 @@ public function getTimesheetSetting() /** * Sets timesheet_setting * - * @param string $timesheet_setting + * @param string|null $timesheet_setting * - * @return $this + * @return self */ public function setTimesheetSetting($timesheet_setting) { + if (is_null($timesheet_setting)) { + throw new \InvalidArgumentException('non-nullable timesheet_setting cannot be null'); + } $allowedValues = $this->getTimesheetSettingAllowableValues(); - if (!is_null($timesheet_setting) && !in_array($timesheet_setting, $allowedValues, true)) { + if (!in_array($timesheet_setting, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'timesheet_setting', must be one of '%s'", + "Invalid value '%s' for 'timesheet_setting', must be one of '%s'", + $timesheet_setting, implode("', '", $allowedValues) ) ); @@ -1957,7 +2267,7 @@ public function setTimesheetSetting($timesheet_setting) /** * Gets can_delete * - * @return bool + * @return bool|null */ public function getCanDelete() { @@ -1967,12 +2277,15 @@ public function getCanDelete() /** * Sets can_delete * - * @param bool $can_delete + * @param bool|null $can_delete * - * @return $this + * @return self */ public function setCanDelete($can_delete) { + if (is_null($can_delete)) { + throw new \InvalidArgumentException('non-nullable can_delete cannot be null'); + } $this->container['can_delete'] = $can_delete; return $this; @@ -1981,7 +2294,7 @@ public function setCanDelete($can_delete) /** * Gets has_profile_image * - * @return bool + * @return bool|null */ public function getHasProfileImage() { @@ -1991,12 +2304,15 @@ public function getHasProfileImage() /** * Sets has_profile_image * - * @param bool $has_profile_image + * @param bool|null $has_profile_image * - * @return $this + * @return self */ public function setHasProfileImage($has_profile_image) { + if (is_null($has_profile_image)) { + throw new \InvalidArgumentException('non-nullable has_profile_image cannot be null'); + } $this->container['has_profile_image'] = $has_profile_image; return $this; @@ -2005,7 +2321,7 @@ public function setHasProfileImage($has_profile_image) /** * Gets can_edit_profile_image * - * @return bool + * @return bool|null */ public function getCanEditProfileImage() { @@ -2015,12 +2331,15 @@ public function getCanEditProfileImage() /** * Sets can_edit_profile_image * - * @param bool $can_edit_profile_image + * @param bool|null $can_edit_profile_image * - * @return $this + * @return self */ public function setCanEditProfileImage($can_edit_profile_image) { + if (is_null($can_edit_profile_image)) { + throw new \InvalidArgumentException('non-nullable can_edit_profile_image cannot be null'); + } $this->container['can_edit_profile_image'] = $can_edit_profile_image; return $this; @@ -2029,7 +2348,7 @@ public function setCanEditProfileImage($can_edit_profile_image) /** * Gets bounced_email * - * @return bool + * @return bool|null */ public function getBouncedEmail() { @@ -2039,12 +2358,15 @@ public function getBouncedEmail() /** * Sets bounced_email * - * @param bool $bounced_email + * @param bool|null $bounced_email * - * @return $this + * @return self */ public function setBouncedEmail($bounced_email) { + if (is_null($bounced_email)) { + throw new \InvalidArgumentException('non-nullable bounced_email cannot be null'); + } $this->container['bounced_email'] = $bounced_email; return $this; @@ -2053,7 +2375,7 @@ public function setBouncedEmail($bounced_email) /** * Gets ird_details_current * - * @return bool + * @return bool|null */ public function getIrdDetailsCurrent() { @@ -2063,12 +2385,15 @@ public function getIrdDetailsCurrent() /** * Sets ird_details_current * - * @param bool $ird_details_current + * @param bool|null $ird_details_current * - * @return $this + * @return self */ public function setIrdDetailsCurrent($ird_details_current) { + if (is_null($ird_details_current)) { + throw new \InvalidArgumentException('non-nullable ird_details_current cannot be null'); + } $this->container['ird_details_current'] = $ird_details_current; return $this; @@ -2077,7 +2402,7 @@ public function setIrdDetailsCurrent($ird_details_current) /** * Gets ird_settings_enabled * - * @return bool + * @return bool|null */ public function getIrdSettingsEnabled() { @@ -2087,12 +2412,15 @@ public function getIrdSettingsEnabled() /** * Sets ird_settings_enabled * - * @param bool $ird_settings_enabled + * @param bool|null $ird_settings_enabled * - * @return $this + * @return self */ public function setIrdSettingsEnabled($ird_settings_enabled) { + if (is_null($ird_settings_enabled)) { + throw new \InvalidArgumentException('non-nullable ird_settings_enabled cannot be null'); + } $this->container['ird_settings_enabled'] = $ird_settings_enabled; return $this; @@ -2101,7 +2429,7 @@ public function setIrdSettingsEnabled($ird_settings_enabled) /** * Gets has_connected_devices * - * @return bool + * @return bool|null */ public function getHasConnectedDevices() { @@ -2111,12 +2439,15 @@ public function getHasConnectedDevices() /** * Sets has_connected_devices * - * @param bool $has_connected_devices + * @param bool|null $has_connected_devices * - * @return $this + * @return self */ public function setHasConnectedDevices($has_connected_devices) { + if (is_null($has_connected_devices)) { + throw new \InvalidArgumentException('non-nullable has_connected_devices cannot be null'); + } $this->container['has_connected_devices'] = $has_connected_devices; return $this; @@ -2125,7 +2456,7 @@ public function setHasConnectedDevices($has_connected_devices) /** * Gets address_types * - * @return \Swagger\Client\Model\SelectListItem[] + * @return \OpenAPI\Client\Model\SelectListItem[]|null */ public function getAddressTypes() { @@ -2135,12 +2466,15 @@ public function getAddressTypes() /** * Sets address_types * - * @param \Swagger\Client\Model\SelectListItem[] $address_types + * @param \OpenAPI\Client\Model\SelectListItem[]|null $address_types * - * @return $this + * @return self */ public function setAddressTypes($address_types) { + if (is_null($address_types)) { + throw new \InvalidArgumentException('non-nullable address_types cannot be null'); + } $this->container['address_types'] = $address_types; return $this; @@ -2149,7 +2483,7 @@ public function setAddressTypes($address_types) /** * Gets residential_address_type * - * @return string + * @return string|null */ public function getResidentialAddressType() { @@ -2159,17 +2493,21 @@ public function getResidentialAddressType() /** * Sets residential_address_type * - * @param string $residential_address_type + * @param string|null $residential_address_type * - * @return $this + * @return self */ public function setResidentialAddressType($residential_address_type) { + if (is_null($residential_address_type)) { + throw new \InvalidArgumentException('non-nullable residential_address_type cannot be null'); + } $allowedValues = $this->getResidentialAddressTypeAllowableValues(); - if (!is_null($residential_address_type) && !in_array($residential_address_type, $allowedValues, true)) { + if (!in_array($residential_address_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'residential_address_type', must be one of '%s'", + "Invalid value '%s' for 'residential_address_type', must be one of '%s'", + $residential_address_type, implode("', '", $allowedValues) ) ); @@ -2182,7 +2520,7 @@ public function setResidentialAddressType($residential_address_type) /** * Gets postal_address_type * - * @return string + * @return string|null */ public function getPostalAddressType() { @@ -2192,17 +2530,21 @@ public function getPostalAddressType() /** * Sets postal_address_type * - * @param string $postal_address_type + * @param string|null $postal_address_type * - * @return $this + * @return self */ public function setPostalAddressType($postal_address_type) { + if (is_null($postal_address_type)) { + throw new \InvalidArgumentException('non-nullable postal_address_type cannot be null'); + } $allowedValues = $this->getPostalAddressTypeAllowableValues(); - if (!is_null($postal_address_type) && !in_array($postal_address_type, $allowedValues, true)) { + if (!in_array($postal_address_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'postal_address_type', must be one of '%s'", + "Invalid value '%s' for 'postal_address_type', must be one of '%s'", + $postal_address_type, implode("', '", $allowedValues) ) ); @@ -2215,7 +2557,7 @@ public function setPostalAddressType($postal_address_type) /** * Gets residential_block_number * - * @return string + * @return string|null */ public function getResidentialBlockNumber() { @@ -2225,12 +2567,15 @@ public function getResidentialBlockNumber() /** * Sets residential_block_number * - * @param string $residential_block_number + * @param string|null $residential_block_number * - * @return $this + * @return self */ public function setResidentialBlockNumber($residential_block_number) { + if (is_null($residential_block_number)) { + throw new \InvalidArgumentException('non-nullable residential_block_number cannot be null'); + } $this->container['residential_block_number'] = $residential_block_number; return $this; @@ -2239,7 +2584,7 @@ public function setResidentialBlockNumber($residential_block_number) /** * Gets postal_block_number * - * @return string + * @return string|null */ public function getPostalBlockNumber() { @@ -2249,12 +2594,15 @@ public function getPostalBlockNumber() /** * Sets postal_block_number * - * @param string $postal_block_number + * @param string|null $postal_block_number * - * @return $this + * @return self */ public function setPostalBlockNumber($postal_block_number) { + if (is_null($postal_block_number)) { + throw new \InvalidArgumentException('non-nullable postal_block_number cannot be null'); + } $this->container['postal_block_number'] = $postal_block_number; return $this; @@ -2263,7 +2611,7 @@ public function setPostalBlockNumber($postal_block_number) /** * Gets residential_level_number * - * @return string + * @return string|null */ public function getResidentialLevelNumber() { @@ -2273,12 +2621,15 @@ public function getResidentialLevelNumber() /** * Sets residential_level_number * - * @param string $residential_level_number + * @param string|null $residential_level_number * - * @return $this + * @return self */ public function setResidentialLevelNumber($residential_level_number) { + if (is_null($residential_level_number)) { + throw new \InvalidArgumentException('non-nullable residential_level_number cannot be null'); + } $this->container['residential_level_number'] = $residential_level_number; return $this; @@ -2287,7 +2638,7 @@ public function setResidentialLevelNumber($residential_level_number) /** * Gets postal_level_number * - * @return string + * @return string|null */ public function getPostalLevelNumber() { @@ -2297,12 +2648,15 @@ public function getPostalLevelNumber() /** * Sets postal_level_number * - * @param string $postal_level_number + * @param string|null $postal_level_number * - * @return $this + * @return self */ public function setPostalLevelNumber($postal_level_number) { + if (is_null($postal_level_number)) { + throw new \InvalidArgumentException('non-nullable postal_level_number cannot be null'); + } $this->container['postal_level_number'] = $postal_level_number; return $this; @@ -2311,7 +2665,7 @@ public function setPostalLevelNumber($postal_level_number) /** * Gets residential_unit_number * - * @return string + * @return string|null */ public function getResidentialUnitNumber() { @@ -2321,12 +2675,15 @@ public function getResidentialUnitNumber() /** * Sets residential_unit_number * - * @param string $residential_unit_number + * @param string|null $residential_unit_number * - * @return $this + * @return self */ public function setResidentialUnitNumber($residential_unit_number) { + if (is_null($residential_unit_number)) { + throw new \InvalidArgumentException('non-nullable residential_unit_number cannot be null'); + } $this->container['residential_unit_number'] = $residential_unit_number; return $this; @@ -2335,7 +2692,7 @@ public function setResidentialUnitNumber($residential_unit_number) /** * Gets postal_unit_number * - * @return string + * @return string|null */ public function getPostalUnitNumber() { @@ -2345,12 +2702,15 @@ public function getPostalUnitNumber() /** * Sets postal_unit_number * - * @param string $postal_unit_number + * @param string|null $postal_unit_number * - * @return $this + * @return self */ public function setPostalUnitNumber($postal_unit_number) { + if (is_null($postal_unit_number)) { + throw new \InvalidArgumentException('non-nullable postal_unit_number cannot be null'); + } $this->container['postal_unit_number'] = $postal_unit_number; return $this; @@ -2359,7 +2719,7 @@ public function setPostalUnitNumber($postal_unit_number) /** * Gets residential_street_name * - * @return string + * @return string|null */ public function getResidentialStreetName() { @@ -2369,12 +2729,15 @@ public function getResidentialStreetName() /** * Sets residential_street_name * - * @param string $residential_street_name + * @param string|null $residential_street_name * - * @return $this + * @return self */ public function setResidentialStreetName($residential_street_name) { + if (is_null($residential_street_name)) { + throw new \InvalidArgumentException('non-nullable residential_street_name cannot be null'); + } $this->container['residential_street_name'] = $residential_street_name; return $this; @@ -2383,7 +2746,7 @@ public function setResidentialStreetName($residential_street_name) /** * Gets postal_street_name * - * @return string + * @return string|null */ public function getPostalStreetName() { @@ -2393,12 +2756,15 @@ public function getPostalStreetName() /** * Sets postal_street_name * - * @param string $postal_street_name + * @param string|null $postal_street_name * - * @return $this + * @return self */ public function setPostalStreetName($postal_street_name) { + if (is_null($postal_street_name)) { + throw new \InvalidArgumentException('non-nullable postal_street_name cannot be null'); + } $this->container['postal_street_name'] = $postal_street_name; return $this; @@ -2407,7 +2773,7 @@ public function setPostalStreetName($postal_street_name) /** * Gets residential_address_line3 * - * @return string + * @return string|null */ public function getResidentialAddressLine3() { @@ -2417,12 +2783,15 @@ public function getResidentialAddressLine3() /** * Sets residential_address_line3 * - * @param string $residential_address_line3 + * @param string|null $residential_address_line3 * - * @return $this + * @return self */ public function setResidentialAddressLine3($residential_address_line3) { + if (is_null($residential_address_line3)) { + throw new \InvalidArgumentException('non-nullable residential_address_line3 cannot be null'); + } $this->container['residential_address_line3'] = $residential_address_line3; return $this; @@ -2431,7 +2800,7 @@ public function setResidentialAddressLine3($residential_address_line3) /** * Gets postal_address_line3 * - * @return string + * @return string|null */ public function getPostalAddressLine3() { @@ -2441,12 +2810,15 @@ public function getPostalAddressLine3() /** * Sets postal_address_line3 * - * @param string $postal_address_line3 + * @param string|null $postal_address_line3 * - * @return $this + * @return self */ public function setPostalAddressLine3($postal_address_line3) { + if (is_null($postal_address_line3)) { + throw new \InvalidArgumentException('non-nullable postal_address_line3 cannot be null'); + } $this->container['postal_address_line3'] = $postal_address_line3; return $this; @@ -2455,7 +2827,7 @@ public function setPostalAddressLine3($postal_address_line3) /** * Gets termination_reason * - * @return string + * @return string|null */ public function getTerminationReason() { @@ -2465,17 +2837,21 @@ public function getTerminationReason() /** * Sets termination_reason * - * @param string $termination_reason + * @param string|null $termination_reason * - * @return $this + * @return self */ public function setTerminationReason($termination_reason) { + if (is_null($termination_reason)) { + throw new \InvalidArgumentException('non-nullable termination_reason cannot be null'); + } $allowedValues = $this->getTerminationReasonAllowableValues(); - if (!is_null($termination_reason) && !in_array($termination_reason, $allowedValues, true)) { + if (!in_array($termination_reason, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'termination_reason', must be one of '%s'", + "Invalid value '%s' for 'termination_reason', must be one of '%s'", + $termination_reason, implode("', '", $allowedValues) ) ); @@ -2488,7 +2864,7 @@ public function setTerminationReason($termination_reason) /** * Gets termination_description * - * @return string + * @return string|null */ public function getTerminationDescription() { @@ -2498,12 +2874,15 @@ public function getTerminationDescription() /** * Sets termination_description * - * @param string $termination_description + * @param string|null $termination_description * - * @return $this + * @return self */ public function setTerminationDescription($termination_description) { + if (is_null($termination_description)) { + throw new \InvalidArgumentException('non-nullable termination_description cannot be null'); + } $this->container['termination_description'] = $termination_description; return $this; @@ -2512,7 +2891,7 @@ public function setTerminationDescription($termination_description) /** * Gets termination_reasons * - * @return \Swagger\Client\Model\NumericSelectListItem[] + * @return \OpenAPI\Client\Model\NumericSelectListItem[]|null */ public function getTerminationReasons() { @@ -2522,12 +2901,15 @@ public function getTerminationReasons() /** * Sets termination_reasons * - * @param \Swagger\Client\Model\NumericSelectListItem[] $termination_reasons + * @param \OpenAPI\Client\Model\NumericSelectListItem[]|null $termination_reasons * - * @return $this + * @return self */ public function setTerminationReasons($termination_reasons) { + if (is_null($termination_reasons)) { + throw new \InvalidArgumentException('non-nullable termination_reasons cannot be null'); + } $this->container['termination_reasons'] = $termination_reasons; return $this; @@ -2536,7 +2918,7 @@ public function setTerminationReasons($termination_reasons) /** * Gets has_sole_user * - * @return bool + * @return bool|null */ public function getHasSoleUser() { @@ -2546,12 +2928,15 @@ public function getHasSoleUser() /** * Sets has_sole_user * - * @param bool $has_sole_user + * @param bool|null $has_sole_user * - * @return $this + * @return self */ public function setHasSoleUser($has_sole_user) { + if (is_null($has_sole_user)) { + throw new \InvalidArgumentException('non-nullable has_sole_user cannot be null'); + } $this->container['has_sole_user'] = $has_sole_user; return $this; @@ -2560,7 +2945,7 @@ public function setHasSoleUser($has_sole_user) /** * Gets fields * - * @return \Swagger\Client\Model\EmployeeDetailsFields + * @return \OpenAPI\Client\Model\EmployeeDetailsFields|null */ public function getFields() { @@ -2570,12 +2955,15 @@ public function getFields() /** * Sets fields * - * @param \Swagger\Client\Model\EmployeeDetailsFields $fields + * @param \OpenAPI\Client\Model\EmployeeDetailsFields|null $fields fields * - * @return $this + * @return self */ public function setFields($fields) { + if (is_null($fields)) { + throw new \InvalidArgumentException('non-nullable fields cannot be null'); + } $this->container['fields'] = $fields; return $this; @@ -2584,7 +2972,7 @@ public function setFields($fields) /** * Gets pending_email_update * - * @return bool + * @return bool|null */ public function getPendingEmailUpdate() { @@ -2594,12 +2982,15 @@ public function getPendingEmailUpdate() /** * Sets pending_email_update * - * @param bool $pending_email_update + * @param bool|null $pending_email_update * - * @return $this + * @return self */ public function setPendingEmailUpdate($pending_email_update) { + if (is_null($pending_email_update)) { + throw new \InvalidArgumentException('non-nullable pending_email_update cannot be null'); + } $this->container['pending_email_update'] = $pending_email_update; return $this; @@ -2608,7 +2999,7 @@ public function setPendingEmailUpdate($pending_email_update) /** * Gets new_email * - * @return string + * @return string|null */ public function getNewEmail() { @@ -2618,12 +3009,15 @@ public function getNewEmail() /** * Sets new_email * - * @param string $new_email + * @param string|null $new_email * - * @return $this + * @return self */ public function setNewEmail($new_email) { + if (is_null($new_email)) { + throw new \InvalidArgumentException('non-nullable new_email cannot be null'); + } $this->container['new_email'] = $new_email; return $this; @@ -2635,7 +3029,7 @@ public function setNewEmail($new_email) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -2645,22 +3039,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -2676,11 +3071,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -2688,13 +3096,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssEmployeeQualificationDocumentModel.php b/src/lib/Model/EssEmployeeQualificationDocumentModel.php index 5b2c92a..a34c3f3 100644 --- a/src/lib/Model/EssEmployeeQualificationDocumentModel.php +++ b/src/lib/Model/EssEmployeeQualificationDocumentModel.php @@ -2,61 +2,61 @@ /** * EssEmployeeQualificationDocumentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssEmployeeQualificationDocumentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssEmployeeQualificationDocumentModel implements ModelInterface, ArrayAccess +class EssEmployeeQualificationDocumentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssEmployeeQualificationDocumentModel'; + protected static $openAPIModelName = 'EssEmployeeQualificationDocumentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'date_created' => '\DateTime', @@ -68,8 +68,10 @@ class EssEmployeeQualificationDocumentModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'date_created' => 'date-time', @@ -77,14 +79,34 @@ class EssEmployeeQualificationDocumentModel implements ModelInterface, ArrayAcce 'url' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'date_created' => false, + 'visible' => false, + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['visible'] = isset($data['visible']) ? $data['visible'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('visible', $data ?? [], null); + $this->setIfExists('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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -241,12 +330,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -265,12 +357,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -279,7 +374,7 @@ public function setName($name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -289,12 +384,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -303,7 +401,7 @@ public function setDateCreated($date_created) /** * Gets visible * - * @return bool + * @return bool|null */ public function getVisible() { @@ -313,12 +411,15 @@ public function getVisible() /** * Sets visible * - * @param bool $visible + * @param bool|null $visible * - * @return $this + * @return self */ public function setVisible($visible) { + if (is_null($visible)) { + throw new \InvalidArgumentException('non-nullable visible cannot be null'); + } $this->container['visible'] = $visible; return $this; @@ -327,7 +428,7 @@ public function setVisible($visible) /** * Gets url * - * @return string + * @return string|null */ public function getUrl() { @@ -337,12 +438,15 @@ public function getUrl() /** * Sets url * - * @param string $url + * @param string|null $url * - * @return $this + * @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; @@ -354,7 +458,7 @@ public function setUrl($url) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssEmployeeQualificationModel.php b/src/lib/Model/EssEmployeeQualificationModel.php index 10dcda3..e8c87ea 100644 --- a/src/lib/Model/EssEmployeeQualificationModel.php +++ b/src/lib/Model/EssEmployeeQualificationModel.php @@ -2,67 +2,67 @@ /** * EssEmployeeQualificationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssEmployeeQualificationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssEmployeeQualificationModel implements ModelInterface, ArrayAccess +class EssEmployeeQualificationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssEmployeeQualificationModel'; + protected static $openAPIModelName = 'EssEmployeeQualificationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'qualification_id' => 'int', 'name' => 'string', 'expiry_date' => '\DateTime', 'issue_date' => '\DateTime', - 'documents' => '\Swagger\Client\Model\EssEmployeeQualificationDocumentModel[]', + 'documents' => '\OpenAPI\Client\Model\EssEmployeeQualificationDocumentModel[]', 'reference_number' => 'string', 'has_qualification' => 'bool', 'is_expired' => 'bool', @@ -73,8 +73,10 @@ class EssEmployeeQualificationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'qualification_id' => 'int32', 'name' => null, @@ -87,14 +89,39 @@ class EssEmployeeQualificationModel implements ModelInterface, ArrayAccess 'is_expiring' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'qualification_id' => false, + 'name' => false, + 'expiry_date' => false, + 'issue_date' => false, + 'documents' => false, + 'reference_number' => false, + 'has_qualification' => false, + 'is_expired' => false, + 'is_expiring' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['qualification_id'] = isset($data['qualification_id']) ? $data['qualification_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['expiry_date'] = isset($data['expiry_date']) ? $data['expiry_date'] : null; - $this->container['issue_date'] = isset($data['issue_date']) ? $data['issue_date'] : null; - $this->container['documents'] = isset($data['documents']) ? $data['documents'] : null; - $this->container['reference_number'] = isset($data['reference_number']) ? $data['reference_number'] : null; - $this->container['has_qualification'] = isset($data['has_qualification']) ? $data['has_qualification'] : null; - $this->container['is_expired'] = isset($data['is_expired']) ? $data['is_expired'] : null; - $this->container['is_expiring'] = isset($data['is_expiring']) ? $data['is_expiring'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('qualification_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expiry_date', $data ?? [], null); + $this->setIfExists('issue_date', $data ?? [], null); + $this->setIfExists('documents', $data ?? [], null); + $this->setIfExists('reference_number', $data ?? [], null); + $this->setIfExists('has_qualification', $data ?? [], null); + $this->setIfExists('is_expired', $data ?? [], null); + $this->setIfExists('is_expiring', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets qualification_id * - * @return int + * @return int|null */ public function getQualificationId() { @@ -295,12 +392,15 @@ public function getQualificationId() /** * Sets qualification_id * - * @param int $qualification_id + * @param int|null $qualification_id * - * @return $this + * @return self */ public function setQualificationId($qualification_id) { + if (is_null($qualification_id)) { + throw new \InvalidArgumentException('non-nullable qualification_id cannot be null'); + } $this->container['qualification_id'] = $qualification_id; return $this; @@ -309,7 +409,7 @@ public function setQualificationId($qualification_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -319,12 +419,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -333,7 +436,7 @@ public function setName($name) /** * Gets expiry_date * - * @return \DateTime + * @return \DateTime|null */ public function getExpiryDate() { @@ -343,12 +446,15 @@ public function getExpiryDate() /** * Sets expiry_date * - * @param \DateTime $expiry_date + * @param \DateTime|null $expiry_date * - * @return $this + * @return self */ public function setExpiryDate($expiry_date) { + if (is_null($expiry_date)) { + throw new \InvalidArgumentException('non-nullable expiry_date cannot be null'); + } $this->container['expiry_date'] = $expiry_date; return $this; @@ -357,7 +463,7 @@ public function setExpiryDate($expiry_date) /** * Gets issue_date * - * @return \DateTime + * @return \DateTime|null */ public function getIssueDate() { @@ -367,12 +473,15 @@ public function getIssueDate() /** * Sets issue_date * - * @param \DateTime $issue_date + * @param \DateTime|null $issue_date * - * @return $this + * @return self */ public function setIssueDate($issue_date) { + if (is_null($issue_date)) { + throw new \InvalidArgumentException('non-nullable issue_date cannot be null'); + } $this->container['issue_date'] = $issue_date; return $this; @@ -381,7 +490,7 @@ public function setIssueDate($issue_date) /** * Gets documents * - * @return \Swagger\Client\Model\EssEmployeeQualificationDocumentModel[] + * @return \OpenAPI\Client\Model\EssEmployeeQualificationDocumentModel[]|null */ public function getDocuments() { @@ -391,12 +500,15 @@ public function getDocuments() /** * Sets documents * - * @param \Swagger\Client\Model\EssEmployeeQualificationDocumentModel[] $documents + * @param \OpenAPI\Client\Model\EssEmployeeQualificationDocumentModel[]|null $documents * - * @return $this + * @return self */ public function setDocuments($documents) { + if (is_null($documents)) { + throw new \InvalidArgumentException('non-nullable documents cannot be null'); + } $this->container['documents'] = $documents; return $this; @@ -405,7 +517,7 @@ public function setDocuments($documents) /** * Gets reference_number * - * @return string + * @return string|null */ public function getReferenceNumber() { @@ -415,12 +527,15 @@ public function getReferenceNumber() /** * Sets reference_number * - * @param string $reference_number + * @param string|null $reference_number * - * @return $this + * @return self */ public function setReferenceNumber($reference_number) { + if (is_null($reference_number)) { + throw new \InvalidArgumentException('non-nullable reference_number cannot be null'); + } $this->container['reference_number'] = $reference_number; return $this; @@ -429,7 +544,7 @@ public function setReferenceNumber($reference_number) /** * Gets has_qualification * - * @return bool + * @return bool|null */ public function getHasQualification() { @@ -439,12 +554,15 @@ public function getHasQualification() /** * Sets has_qualification * - * @param bool $has_qualification + * @param bool|null $has_qualification * - * @return $this + * @return self */ public function setHasQualification($has_qualification) { + if (is_null($has_qualification)) { + throw new \InvalidArgumentException('non-nullable has_qualification cannot be null'); + } $this->container['has_qualification'] = $has_qualification; return $this; @@ -453,7 +571,7 @@ public function setHasQualification($has_qualification) /** * Gets is_expired * - * @return bool + * @return bool|null */ public function getIsExpired() { @@ -463,12 +581,15 @@ public function getIsExpired() /** * Sets is_expired * - * @param bool $is_expired + * @param bool|null $is_expired * - * @return $this + * @return self */ public function setIsExpired($is_expired) { + if (is_null($is_expired)) { + throw new \InvalidArgumentException('non-nullable is_expired cannot be null'); + } $this->container['is_expired'] = $is_expired; return $this; @@ -477,7 +598,7 @@ public function setIsExpired($is_expired) /** * Gets is_expiring * - * @return bool + * @return bool|null */ public function getIsExpiring() { @@ -487,12 +608,15 @@ public function getIsExpiring() /** * Sets is_expiring * - * @param bool $is_expiring + * @param bool|null $is_expiring * - * @return $this + * @return self */ public function setIsExpiring($is_expiring) { + if (is_null($is_expiring)) { + throw new \InvalidArgumentException('non-nullable is_expiring cannot be null'); + } $this->container['is_expiring'] = $is_expiring; return $this; @@ -504,7 +628,7 @@ public function setIsExpiring($is_expiring) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssExpenseRequestResponseModel.php b/src/lib/Model/EssExpenseRequestResponseModel.php index d50dd33..a2c8a04 100644 --- a/src/lib/Model/EssExpenseRequestResponseModel.php +++ b/src/lib/Model/EssExpenseRequestResponseModel.php @@ -2,61 +2,61 @@ /** * EssExpenseRequestResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssExpenseRequestResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssExpenseRequestResponseModel implements ModelInterface, ArrayAccess +class EssExpenseRequestResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssExpenseRequestResponseModel'; + protected static $openAPIModelName = 'EssExpenseRequestResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_cancel' => 'bool', 'can_modify' => 'bool', 'id' => 'int', @@ -64,8 +64,8 @@ class EssExpenseRequestResponseModel implements ModelInterface, ArrayAccess 'employee_name' => 'string', 'status' => 'string', 'description' => 'string', - 'line_items' => '\Swagger\Client\Model\ExpenseRequestLineItemModel[]', - 'attachments' => '\Swagger\Client\Model\AttachmentModel[]', + 'line_items' => '\OpenAPI\Client\Model\ExpenseRequestLineItemModel[]', + 'attachments' => '\OpenAPI\Client\Model\AttachmentModel[]', 'status_updated_by_user' => 'string', 'status_update_notes' => 'string', 'date_status_updated' => '\DateTime', @@ -76,8 +76,10 @@ class EssExpenseRequestResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_cancel' => null, 'can_modify' => null, 'id' => 'int32', @@ -93,14 +95,42 @@ class EssExpenseRequestResponseModel implements ModelInterface, ArrayAccess 'date_created' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_cancel' => false, + 'can_modify' => false, + 'id' => false, + 'employee_id' => false, + 'employee_name' => false, + 'status' => false, + 'description' => false, + 'line_items' => false, + 'attachments' => false, + 'status_updated_by_user' => false, + 'status_update_notes' => false, + 'date_status_updated' => false, + 'date_created' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -215,12 +297,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -237,19 +316,37 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['can_cancel'] = isset($data['can_cancel']) ? $data['can_cancel'] : null; - $this->container['can_modify'] = isset($data['can_modify']) ? $data['can_modify'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['line_items'] = isset($data['line_items']) ? $data['line_items'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['status_updated_by_user'] = isset($data['status_updated_by_user']) ? $data['status_updated_by_user'] : null; - $this->container['status_update_notes'] = isset($data['status_update_notes']) ? $data['status_update_notes'] : null; - $this->container['date_status_updated'] = isset($data['date_status_updated']) ? $data['date_status_updated'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; + $this->setIfExists('can_cancel', $data ?? [], null); + $this->setIfExists('can_modify', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('line_items', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('status_updated_by_user', $data ?? [], null); + $this->setIfExists('status_update_notes', $data ?? [], null); + $this->setIfExists('date_status_updated', $data ?? [], null); + $this->setIfExists('date_created', $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; } /** @@ -279,7 +376,7 @@ public function valid() /** * Gets can_cancel * - * @return bool + * @return bool|null */ public function getCanCancel() { @@ -289,12 +386,15 @@ public function getCanCancel() /** * Sets can_cancel * - * @param bool $can_cancel + * @param bool|null $can_cancel * - * @return $this + * @return self */ public function setCanCancel($can_cancel) { + if (is_null($can_cancel)) { + throw new \InvalidArgumentException('non-nullable can_cancel cannot be null'); + } $this->container['can_cancel'] = $can_cancel; return $this; @@ -303,7 +403,7 @@ public function setCanCancel($can_cancel) /** * Gets can_modify * - * @return bool + * @return bool|null */ public function getCanModify() { @@ -313,12 +413,15 @@ public function getCanModify() /** * Sets can_modify * - * @param bool $can_modify + * @param bool|null $can_modify * - * @return $this + * @return self */ public function setCanModify($can_modify) { + if (is_null($can_modify)) { + throw new \InvalidArgumentException('non-nullable can_modify cannot be null'); + } $this->container['can_modify'] = $can_modify; return $this; @@ -327,7 +430,7 @@ public function setCanModify($can_modify) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -337,12 +440,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -351,7 +457,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -361,12 +467,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -375,7 +484,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -385,12 +494,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -399,7 +511,7 @@ public function setEmployeeName($employee_name) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -409,12 +521,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -423,7 +538,7 @@ public function setStatus($status) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -433,12 +548,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -447,7 +565,7 @@ public function setDescription($description) /** * Gets line_items * - * @return \Swagger\Client\Model\ExpenseRequestLineItemModel[] + * @return \OpenAPI\Client\Model\ExpenseRequestLineItemModel[]|null */ public function getLineItems() { @@ -457,12 +575,15 @@ public function getLineItems() /** * Sets line_items * - * @param \Swagger\Client\Model\ExpenseRequestLineItemModel[] $line_items + * @param \OpenAPI\Client\Model\ExpenseRequestLineItemModel[]|null $line_items * - * @return $this + * @return self */ public function setLineItems($line_items) { + if (is_null($line_items)) { + throw new \InvalidArgumentException('non-nullable line_items cannot be null'); + } $this->container['line_items'] = $line_items; return $this; @@ -471,7 +592,7 @@ public function setLineItems($line_items) /** * Gets attachments * - * @return \Swagger\Client\Model\AttachmentModel[] + * @return \OpenAPI\Client\Model\AttachmentModel[]|null */ public function getAttachments() { @@ -481,12 +602,15 @@ public function getAttachments() /** * Sets attachments * - * @param \Swagger\Client\Model\AttachmentModel[] $attachments + * @param \OpenAPI\Client\Model\AttachmentModel[]|null $attachments * - * @return $this + * @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; @@ -495,7 +619,7 @@ public function setAttachments($attachments) /** * Gets status_updated_by_user * - * @return string + * @return string|null */ public function getStatusUpdatedByUser() { @@ -505,12 +629,15 @@ public function getStatusUpdatedByUser() /** * Sets status_updated_by_user * - * @param string $status_updated_by_user + * @param string|null $status_updated_by_user * - * @return $this + * @return self */ public function setStatusUpdatedByUser($status_updated_by_user) { + if (is_null($status_updated_by_user)) { + throw new \InvalidArgumentException('non-nullable status_updated_by_user cannot be null'); + } $this->container['status_updated_by_user'] = $status_updated_by_user; return $this; @@ -519,7 +646,7 @@ public function setStatusUpdatedByUser($status_updated_by_user) /** * Gets status_update_notes * - * @return string + * @return string|null */ public function getStatusUpdateNotes() { @@ -529,12 +656,15 @@ public function getStatusUpdateNotes() /** * Sets status_update_notes * - * @param string $status_update_notes + * @param string|null $status_update_notes * - * @return $this + * @return self */ public function setStatusUpdateNotes($status_update_notes) { + if (is_null($status_update_notes)) { + throw new \InvalidArgumentException('non-nullable status_update_notes cannot be null'); + } $this->container['status_update_notes'] = $status_update_notes; return $this; @@ -543,7 +673,7 @@ public function setStatusUpdateNotes($status_update_notes) /** * Gets date_status_updated * - * @return \DateTime + * @return \DateTime|null */ public function getDateStatusUpdated() { @@ -553,12 +683,15 @@ public function getDateStatusUpdated() /** * Sets date_status_updated * - * @param \DateTime $date_status_updated + * @param \DateTime|null $date_status_updated * - * @return $this + * @return self */ public function setDateStatusUpdated($date_status_updated) { + if (is_null($date_status_updated)) { + throw new \InvalidArgumentException('non-nullable date_status_updated cannot be null'); + } $this->container['date_status_updated'] = $date_status_updated; return $this; @@ -567,7 +700,7 @@ public function setDateStatusUpdated($date_status_updated) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -577,12 +710,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -594,7 +730,7 @@ public function setDateCreated($date_created) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -604,22 +740,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -635,11 +772,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -647,13 +797,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssLeaveCategoryModel.php b/src/lib/Model/EssLeaveCategoryModel.php index 911ba01..3ad122a 100644 --- a/src/lib/Model/EssLeaveCategoryModel.php +++ b/src/lib/Model/EssLeaveCategoryModel.php @@ -2,61 +2,61 @@ /** * EssLeaveCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssLeaveCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssLeaveCategoryModel implements ModelInterface, ArrayAccess +class EssLeaveCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssLeaveCategoryModel'; + protected static $openAPIModelName = 'EssLeaveCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'unit_type' => 'string', 'id' => 'int', 'name' => 'string' @@ -66,21 +66,41 @@ class EssLeaveCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'unit_type' => null, 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'unit_type' => false, + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,15 +237,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -187,7 +257,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -204,9 +273,27 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('id', $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; } /** @@ -221,7 +308,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -244,7 +332,7 @@ public function valid() /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -254,17 +342,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -277,7 +369,7 @@ public function setUnitType($unit_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -287,12 +379,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -301,7 +396,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -311,12 +406,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -328,7 +426,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -338,22 +436,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -369,11 +468,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -381,13 +493,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssLeaveEstimate.php b/src/lib/Model/EssLeaveEstimate.php index 51fca38..a353ed9 100644 --- a/src/lib/Model/EssLeaveEstimate.php +++ b/src/lib/Model/EssLeaveEstimate.php @@ -2,87 +2,108 @@ /** * EssLeaveEstimate * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssLeaveEstimate Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssLeaveEstimate implements ModelInterface, ArrayAccess +class EssLeaveEstimate implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssLeaveEstimate'; + protected static $openAPIModelName = 'EssLeaveEstimate'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'leave_balance' => 'double', - 'approved_leave' => 'double', - 'available_balance' => 'double', - 'leave_required' => '\Swagger\Client\Model\UnitAndHourLeaveEstimateModel' + protected static $openAPITypes = [ + 'leave_balance' => 'float', + 'approved_leave' => 'float', + 'available_balance' => 'float', + 'leave_required' => '\OpenAPI\Client\Model\UnitAndHourLeaveEstimateModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_balance' => 'double', 'approved_leave' => 'double', 'available_balance' => 'double', 'leave_required' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_balance' => false, + 'approved_leave' => false, + 'available_balance' => false, + 'leave_required' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['leave_balance'] = isset($data['leave_balance']) ? $data['leave_balance'] : null; - $this->container['approved_leave'] = isset($data['approved_leave']) ? $data['approved_leave'] : null; - $this->container['available_balance'] = isset($data['available_balance']) ? $data['available_balance'] : null; - $this->container['leave_required'] = isset($data['leave_required']) ? $data['leave_required'] : null; + $this->setIfExists('leave_balance', $data ?? [], null); + $this->setIfExists('approved_leave', $data ?? [], null); + $this->setIfExists('available_balance', $data ?? [], null); + $this->setIfExists('leave_required', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets leave_balance * - * @return double + * @return float|null */ public function getLeaveBalance() { @@ -235,12 +323,15 @@ public function getLeaveBalance() /** * Sets leave_balance * - * @param double $leave_balance + * @param float|null $leave_balance * - * @return $this + * @return self */ public function setLeaveBalance($leave_balance) { + if (is_null($leave_balance)) { + throw new \InvalidArgumentException('non-nullable leave_balance cannot be null'); + } $this->container['leave_balance'] = $leave_balance; return $this; @@ -249,7 +340,7 @@ public function setLeaveBalance($leave_balance) /** * Gets approved_leave * - * @return double + * @return float|null */ public function getApprovedLeave() { @@ -259,12 +350,15 @@ public function getApprovedLeave() /** * Sets approved_leave * - * @param double $approved_leave + * @param float|null $approved_leave * - * @return $this + * @return self */ public function setApprovedLeave($approved_leave) { + if (is_null($approved_leave)) { + throw new \InvalidArgumentException('non-nullable approved_leave cannot be null'); + } $this->container['approved_leave'] = $approved_leave; return $this; @@ -273,7 +367,7 @@ public function setApprovedLeave($approved_leave) /** * Gets available_balance * - * @return double + * @return float|null */ public function getAvailableBalance() { @@ -283,12 +377,15 @@ public function getAvailableBalance() /** * Sets available_balance * - * @param double $available_balance + * @param float|null $available_balance * - * @return $this + * @return self */ public function setAvailableBalance($available_balance) { + if (is_null($available_balance)) { + throw new \InvalidArgumentException('non-nullable available_balance cannot be null'); + } $this->container['available_balance'] = $available_balance; return $this; @@ -297,7 +394,7 @@ public function setAvailableBalance($available_balance) /** * Gets leave_required * - * @return \Swagger\Client\Model\UnitAndHourLeaveEstimateModel + * @return \OpenAPI\Client\Model\UnitAndHourLeaveEstimateModel|null */ public function getLeaveRequired() { @@ -307,12 +404,15 @@ public function getLeaveRequired() /** * Sets leave_required * - * @param \Swagger\Client\Model\UnitAndHourLeaveEstimateModel $leave_required + * @param \OpenAPI\Client\Model\UnitAndHourLeaveEstimateModel|null $leave_required leave_required * - * @return $this + * @return self */ public function setLeaveRequired($leave_required) { + if (is_null($leave_required)) { + throw new \InvalidArgumentException('non-nullable leave_required cannot be null'); + } $this->container['leave_required'] = $leave_required; return $this; @@ -324,7 +424,7 @@ public function setLeaveRequired($leave_required) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssLeaveRequestModel.php b/src/lib/Model/EssLeaveRequestModel.php index 05096f3..c7f0035 100644 --- a/src/lib/Model/EssLeaveRequestModel.php +++ b/src/lib/Model/EssLeaveRequestModel.php @@ -2,62 +2,62 @@ /** * EssLeaveRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssLeaveRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssLeaveRequestModel implements ModelInterface, ArrayAccess +class EssLeaveRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssLeaveRequestModel'; + protected static $openAPIModelName = 'EssLeaveRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'total_hours' => 'double', + protected static $openAPITypes = [ + 'total_hours' => 'float', 'leave_category_id' => 'int', 'work_type_id' => 'int', 'work_type_name' => 'string', @@ -70,21 +70,21 @@ class EssLeaveRequestModel implements ModelInterface, ArrayAccess 'to_date' => '\DateTime', 'requested_date' => '\DateTime', 'leave_category_name' => 'string', - 'hours_per_day' => 'double', - 'total_units' => 'double', - 'previously_applied_units' => 'double', + 'hours_per_day' => 'float', + 'total_units' => 'float', + 'previously_applied_units' => 'float', 'can_partially_edit' => 'bool', 'notes' => 'string', - 'total_days' => 'double', + 'total_days' => 'float', 'amount' => 'string', 'status' => 'string', 'status_update_notes' => 'string', 'can_cancel' => 'bool', 'can_modify' => 'bool', 'require_notes_for_leave_requests' => 'bool', - 'attachment' => '\Swagger\Client\Model\AttachmentModel', + 'attachment' => '\OpenAPI\Client\Model\AttachmentModel', 'unit_type' => 'string', - 'banner' => '\Swagger\Client\Model\PartiallyAppliedLeaveRequestBannerModel', + 'banner' => '\OpenAPI\Client\Model\PartiallyAppliedLeaveRequestBannerModel', 'manually_applied' => 'bool', 'applied_leave_unit_type_description' => 'string' ]; @@ -93,8 +93,10 @@ class EssLeaveRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'total_hours' => 'double', 'leave_category_id' => 'int32', 'work_type_id' => 'int32', @@ -127,14 +129,59 @@ class EssLeaveRequestModel implements ModelInterface, ArrayAccess 'applied_leave_unit_type_description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total_hours' => false, + 'leave_category_id' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'is_approved' => false, + 'is_declined' => false, + 'is_cancelled' => false, + 'is_pending' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'requested_date' => false, + 'leave_category_name' => false, + 'hours_per_day' => false, + 'total_units' => false, + 'previously_applied_units' => false, + 'can_partially_edit' => false, + 'notes' => false, + 'total_days' => false, + 'amount' => false, + 'status' => false, + 'status_update_notes' => false, + 'can_cancel' => false, + 'can_modify' => false, + 'require_notes_for_leave_requests' => false, + 'attachment' => false, + 'unit_type' => false, + 'banner' => false, + 'manually_applied' => false, + 'applied_leave_unit_type_description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -142,9 +189,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -300,15 +399,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -322,7 +419,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -339,36 +435,54 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['is_approved'] = isset($data['is_approved']) ? $data['is_approved'] : null; - $this->container['is_declined'] = isset($data['is_declined']) ? $data['is_declined'] : null; - $this->container['is_cancelled'] = isset($data['is_cancelled']) ? $data['is_cancelled'] : null; - $this->container['is_pending'] = isset($data['is_pending']) ? $data['is_pending'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['requested_date'] = isset($data['requested_date']) ? $data['requested_date'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['hours_per_day'] = isset($data['hours_per_day']) ? $data['hours_per_day'] : null; - $this->container['total_units'] = isset($data['total_units']) ? $data['total_units'] : null; - $this->container['previously_applied_units'] = isset($data['previously_applied_units']) ? $data['previously_applied_units'] : null; - $this->container['can_partially_edit'] = isset($data['can_partially_edit']) ? $data['can_partially_edit'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['total_days'] = isset($data['total_days']) ? $data['total_days'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['status_update_notes'] = isset($data['status_update_notes']) ? $data['status_update_notes'] : null; - $this->container['can_cancel'] = isset($data['can_cancel']) ? $data['can_cancel'] : null; - $this->container['can_modify'] = isset($data['can_modify']) ? $data['can_modify'] : null; - $this->container['require_notes_for_leave_requests'] = isset($data['require_notes_for_leave_requests']) ? $data['require_notes_for_leave_requests'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['banner'] = isset($data['banner']) ? $data['banner'] : null; - $this->container['manually_applied'] = isset($data['manually_applied']) ? $data['manually_applied'] : null; - $this->container['applied_leave_unit_type_description'] = isset($data['applied_leave_unit_type_description']) ? $data['applied_leave_unit_type_description'] : null; + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('is_approved', $data ?? [], null); + $this->setIfExists('is_declined', $data ?? [], null); + $this->setIfExists('is_cancelled', $data ?? [], null); + $this->setIfExists('is_pending', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('requested_date', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('hours_per_day', $data ?? [], null); + $this->setIfExists('total_units', $data ?? [], null); + $this->setIfExists('previously_applied_units', $data ?? [], null); + $this->setIfExists('can_partially_edit', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('total_days', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('status_update_notes', $data ?? [], null); + $this->setIfExists('can_cancel', $data ?? [], null); + $this->setIfExists('can_modify', $data ?? [], null); + $this->setIfExists('require_notes_for_leave_requests', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('manually_applied', $data ?? [], null); + $this->setIfExists('applied_leave_unit_type_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; } /** @@ -383,7 +497,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -406,7 +521,7 @@ public function valid() /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -416,12 +531,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -430,7 +548,7 @@ public function setTotalHours($total_hours) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -440,12 +558,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -454,7 +575,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -464,12 +585,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -478,7 +602,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -488,12 +612,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -502,7 +629,7 @@ public function setWorkTypeName($work_type_name) /** * Gets is_approved * - * @return bool + * @return bool|null */ public function getIsApproved() { @@ -512,12 +639,15 @@ public function getIsApproved() /** * Sets is_approved * - * @param bool $is_approved + * @param bool|null $is_approved * - * @return $this + * @return self */ public function setIsApproved($is_approved) { + if (is_null($is_approved)) { + throw new \InvalidArgumentException('non-nullable is_approved cannot be null'); + } $this->container['is_approved'] = $is_approved; return $this; @@ -526,7 +656,7 @@ public function setIsApproved($is_approved) /** * Gets is_declined * - * @return bool + * @return bool|null */ public function getIsDeclined() { @@ -536,12 +666,15 @@ public function getIsDeclined() /** * Sets is_declined * - * @param bool $is_declined + * @param bool|null $is_declined * - * @return $this + * @return self */ public function setIsDeclined($is_declined) { + if (is_null($is_declined)) { + throw new \InvalidArgumentException('non-nullable is_declined cannot be null'); + } $this->container['is_declined'] = $is_declined; return $this; @@ -550,7 +683,7 @@ public function setIsDeclined($is_declined) /** * Gets is_cancelled * - * @return bool + * @return bool|null */ public function getIsCancelled() { @@ -560,12 +693,15 @@ public function getIsCancelled() /** * Sets is_cancelled * - * @param bool $is_cancelled + * @param bool|null $is_cancelled * - * @return $this + * @return self */ public function setIsCancelled($is_cancelled) { + if (is_null($is_cancelled)) { + throw new \InvalidArgumentException('non-nullable is_cancelled cannot be null'); + } $this->container['is_cancelled'] = $is_cancelled; return $this; @@ -574,7 +710,7 @@ public function setIsCancelled($is_cancelled) /** * Gets is_pending * - * @return bool + * @return bool|null */ public function getIsPending() { @@ -584,12 +720,15 @@ public function getIsPending() /** * Sets is_pending * - * @param bool $is_pending + * @param bool|null $is_pending * - * @return $this + * @return self */ public function setIsPending($is_pending) { + if (is_null($is_pending)) { + throw new \InvalidArgumentException('non-nullable is_pending cannot be null'); + } $this->container['is_pending'] = $is_pending; return $this; @@ -598,7 +737,7 @@ public function setIsPending($is_pending) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -608,12 +747,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -622,7 +764,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -632,12 +774,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -646,7 +791,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -656,12 +801,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -670,7 +818,7 @@ public function setToDate($to_date) /** * Gets requested_date * - * @return \DateTime + * @return \DateTime|null */ public function getRequestedDate() { @@ -680,12 +828,15 @@ public function getRequestedDate() /** * Sets requested_date * - * @param \DateTime $requested_date + * @param \DateTime|null $requested_date * - * @return $this + * @return self */ public function setRequestedDate($requested_date) { + if (is_null($requested_date)) { + throw new \InvalidArgumentException('non-nullable requested_date cannot be null'); + } $this->container['requested_date'] = $requested_date; return $this; @@ -694,7 +845,7 @@ public function setRequestedDate($requested_date) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -704,12 +855,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -718,7 +872,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets hours_per_day * - * @return double + * @return float|null */ public function getHoursPerDay() { @@ -728,12 +882,15 @@ public function getHoursPerDay() /** * Sets hours_per_day * - * @param double $hours_per_day + * @param float|null $hours_per_day * - * @return $this + * @return self */ public function setHoursPerDay($hours_per_day) { + if (is_null($hours_per_day)) { + throw new \InvalidArgumentException('non-nullable hours_per_day cannot be null'); + } $this->container['hours_per_day'] = $hours_per_day; return $this; @@ -742,7 +899,7 @@ public function setHoursPerDay($hours_per_day) /** * Gets total_units * - * @return double + * @return float|null */ public function getTotalUnits() { @@ -752,12 +909,15 @@ public function getTotalUnits() /** * Sets total_units * - * @param double $total_units + * @param float|null $total_units * - * @return $this + * @return self */ public function setTotalUnits($total_units) { + if (is_null($total_units)) { + throw new \InvalidArgumentException('non-nullable total_units cannot be null'); + } $this->container['total_units'] = $total_units; return $this; @@ -766,7 +926,7 @@ public function setTotalUnits($total_units) /** * Gets previously_applied_units * - * @return double + * @return float|null */ public function getPreviouslyAppliedUnits() { @@ -776,12 +936,15 @@ public function getPreviouslyAppliedUnits() /** * Sets previously_applied_units * - * @param double $previously_applied_units + * @param float|null $previously_applied_units * - * @return $this + * @return self */ public function setPreviouslyAppliedUnits($previously_applied_units) { + if (is_null($previously_applied_units)) { + throw new \InvalidArgumentException('non-nullable previously_applied_units cannot be null'); + } $this->container['previously_applied_units'] = $previously_applied_units; return $this; @@ -790,7 +953,7 @@ public function setPreviouslyAppliedUnits($previously_applied_units) /** * Gets can_partially_edit * - * @return bool + * @return bool|null */ public function getCanPartiallyEdit() { @@ -800,12 +963,15 @@ public function getCanPartiallyEdit() /** * Sets can_partially_edit * - * @param bool $can_partially_edit + * @param bool|null $can_partially_edit * - * @return $this + * @return self */ public function setCanPartiallyEdit($can_partially_edit) { + if (is_null($can_partially_edit)) { + throw new \InvalidArgumentException('non-nullable can_partially_edit cannot be null'); + } $this->container['can_partially_edit'] = $can_partially_edit; return $this; @@ -814,7 +980,7 @@ public function setCanPartiallyEdit($can_partially_edit) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -824,12 +990,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -838,7 +1007,7 @@ public function setNotes($notes) /** * Gets total_days * - * @return double + * @return float|null */ public function getTotalDays() { @@ -848,12 +1017,15 @@ public function getTotalDays() /** * Sets total_days * - * @param double $total_days + * @param float|null $total_days * - * @return $this + * @return self */ public function setTotalDays($total_days) { + if (is_null($total_days)) { + throw new \InvalidArgumentException('non-nullable total_days cannot be null'); + } $this->container['total_days'] = $total_days; return $this; @@ -862,7 +1034,7 @@ public function setTotalDays($total_days) /** * Gets amount * - * @return string + * @return string|null */ public function getAmount() { @@ -872,12 +1044,15 @@ public function getAmount() /** * Sets amount * - * @param string $amount + * @param string|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -886,7 +1061,7 @@ public function setAmount($amount) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -896,12 +1071,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -910,7 +1088,7 @@ public function setStatus($status) /** * Gets status_update_notes * - * @return string + * @return string|null */ public function getStatusUpdateNotes() { @@ -920,12 +1098,15 @@ public function getStatusUpdateNotes() /** * Sets status_update_notes * - * @param string $status_update_notes + * @param string|null $status_update_notes * - * @return $this + * @return self */ public function setStatusUpdateNotes($status_update_notes) { + if (is_null($status_update_notes)) { + throw new \InvalidArgumentException('non-nullable status_update_notes cannot be null'); + } $this->container['status_update_notes'] = $status_update_notes; return $this; @@ -934,7 +1115,7 @@ public function setStatusUpdateNotes($status_update_notes) /** * Gets can_cancel * - * @return bool + * @return bool|null */ public function getCanCancel() { @@ -944,12 +1125,15 @@ public function getCanCancel() /** * Sets can_cancel * - * @param bool $can_cancel + * @param bool|null $can_cancel * - * @return $this + * @return self */ public function setCanCancel($can_cancel) { + if (is_null($can_cancel)) { + throw new \InvalidArgumentException('non-nullable can_cancel cannot be null'); + } $this->container['can_cancel'] = $can_cancel; return $this; @@ -958,7 +1142,7 @@ public function setCanCancel($can_cancel) /** * Gets can_modify * - * @return bool + * @return bool|null */ public function getCanModify() { @@ -968,12 +1152,15 @@ public function getCanModify() /** * Sets can_modify * - * @param bool $can_modify + * @param bool|null $can_modify * - * @return $this + * @return self */ public function setCanModify($can_modify) { + if (is_null($can_modify)) { + throw new \InvalidArgumentException('non-nullable can_modify cannot be null'); + } $this->container['can_modify'] = $can_modify; return $this; @@ -982,7 +1169,7 @@ public function setCanModify($can_modify) /** * Gets require_notes_for_leave_requests * - * @return bool + * @return bool|null */ public function getRequireNotesForLeaveRequests() { @@ -992,12 +1179,15 @@ public function getRequireNotesForLeaveRequests() /** * Sets require_notes_for_leave_requests * - * @param bool $require_notes_for_leave_requests + * @param bool|null $require_notes_for_leave_requests * - * @return $this + * @return self */ public function setRequireNotesForLeaveRequests($require_notes_for_leave_requests) { + if (is_null($require_notes_for_leave_requests)) { + throw new \InvalidArgumentException('non-nullable require_notes_for_leave_requests cannot be null'); + } $this->container['require_notes_for_leave_requests'] = $require_notes_for_leave_requests; return $this; @@ -1006,7 +1196,7 @@ public function setRequireNotesForLeaveRequests($require_notes_for_leave_request /** * Gets attachment * - * @return \Swagger\Client\Model\AttachmentModel + * @return \OpenAPI\Client\Model\AttachmentModel|null */ public function getAttachment() { @@ -1016,12 +1206,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\AttachmentModel $attachment + * @param \OpenAPI\Client\Model\AttachmentModel|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -1030,7 +1223,7 @@ public function setAttachment($attachment) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -1040,17 +1233,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -1063,7 +1260,7 @@ public function setUnitType($unit_type) /** * Gets banner * - * @return \Swagger\Client\Model\PartiallyAppliedLeaveRequestBannerModel + * @return \OpenAPI\Client\Model\PartiallyAppliedLeaveRequestBannerModel|null */ public function getBanner() { @@ -1073,12 +1270,15 @@ public function getBanner() /** * Sets banner * - * @param \Swagger\Client\Model\PartiallyAppliedLeaveRequestBannerModel $banner + * @param \OpenAPI\Client\Model\PartiallyAppliedLeaveRequestBannerModel|null $banner banner * - * @return $this + * @return self */ public function setBanner($banner) { + if (is_null($banner)) { + throw new \InvalidArgumentException('non-nullable banner cannot be null'); + } $this->container['banner'] = $banner; return $this; @@ -1087,7 +1287,7 @@ public function setBanner($banner) /** * Gets manually_applied * - * @return bool + * @return bool|null */ public function getManuallyApplied() { @@ -1097,12 +1297,15 @@ public function getManuallyApplied() /** * Sets manually_applied * - * @param bool $manually_applied + * @param bool|null $manually_applied * - * @return $this + * @return self */ public function setManuallyApplied($manually_applied) { + if (is_null($manually_applied)) { + throw new \InvalidArgumentException('non-nullable manually_applied cannot be null'); + } $this->container['manually_applied'] = $manually_applied; return $this; @@ -1111,7 +1314,7 @@ public function setManuallyApplied($manually_applied) /** * Gets applied_leave_unit_type_description * - * @return string + * @return string|null */ public function getAppliedLeaveUnitTypeDescription() { @@ -1121,12 +1324,15 @@ public function getAppliedLeaveUnitTypeDescription() /** * Sets applied_leave_unit_type_description * - * @param string $applied_leave_unit_type_description + * @param string|null $applied_leave_unit_type_description * - * @return $this + * @return self */ public function setAppliedLeaveUnitTypeDescription($applied_leave_unit_type_description) { + if (is_null($applied_leave_unit_type_description)) { + throw new \InvalidArgumentException('non-nullable applied_leave_unit_type_description cannot be null'); + } $this->container['applied_leave_unit_type_description'] = $applied_leave_unit_type_description; return $this; @@ -1138,7 +1344,7 @@ public function setAppliedLeaveUnitTypeDescription($applied_leave_unit_type_desc * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1148,22 +1354,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1179,11 +1386,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1191,13 +1411,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssPaymentSummaryModel.php b/src/lib/Model/EssPaymentSummaryModel.php index db5aa6c..309b6e2 100644 --- a/src/lib/Model/EssPaymentSummaryModel.php +++ b/src/lib/Model/EssPaymentSummaryModel.php @@ -2,61 +2,61 @@ /** * EssPaymentSummaryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssPaymentSummaryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssPaymentSummaryModel implements ModelInterface, ArrayAccess +class EssPaymentSummaryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssPaymentSummaryModel'; + protected static $openAPIModelName = 'EssPaymentSummaryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'period' => 'string', 'is_etp' => 'bool', @@ -67,22 +67,43 @@ class EssPaymentSummaryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'period' => null, 'is_etp' => null, 'etp_code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'period' => false, + 'is_etp' => false, + 'etp_code' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['period'] = isset($data['period']) ? $data['period'] : null; - $this->container['is_etp'] = isset($data['is_etp']) ? $data['is_etp'] : null; - $this->container['etp_code'] = isset($data['etp_code']) ? $data['etp_code'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('period', $data ?? [], null); + $this->setIfExists('is_etp', $data ?? [], null); + $this->setIfExists('etp_code', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets period * - * @return string + * @return string|null */ public function getPeriod() { @@ -259,12 +350,15 @@ public function getPeriod() /** * Sets period * - * @param string $period + * @param string|null $period * - * @return $this + * @return self */ public function setPeriod($period) { + if (is_null($period)) { + throw new \InvalidArgumentException('non-nullable period cannot be null'); + } $this->container['period'] = $period; return $this; @@ -273,7 +367,7 @@ public function setPeriod($period) /** * Gets is_etp * - * @return bool + * @return bool|null */ public function getIsEtp() { @@ -283,12 +377,15 @@ public function getIsEtp() /** * Sets is_etp * - * @param bool $is_etp + * @param bool|null $is_etp * - * @return $this + * @return self */ public function setIsEtp($is_etp) { + if (is_null($is_etp)) { + throw new \InvalidArgumentException('non-nullable is_etp cannot be null'); + } $this->container['is_etp'] = $is_etp; return $this; @@ -297,7 +394,7 @@ public function setIsEtp($is_etp) /** * Gets etp_code * - * @return string + * @return string|null */ public function getEtpCode() { @@ -307,12 +404,15 @@ public function getEtpCode() /** * Sets etp_code * - * @param string $etp_code + * @param string|null $etp_code * - * @return $this + * @return self */ public function setEtpCode($etp_code) { + if (is_null($etp_code)) { + throw new \InvalidArgumentException('non-nullable etp_code cannot be null'); + } $this->container['etp_code'] = $etp_code; return $this; @@ -324,7 +424,7 @@ public function setEtpCode($etp_code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssPayslipModel.php b/src/lib/Model/EssPayslipModel.php index 941047d..5de8a5b 100644 --- a/src/lib/Model/EssPayslipModel.php +++ b/src/lib/Model/EssPayslipModel.php @@ -2,68 +2,68 @@ /** * EssPayslipModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssPayslipModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssPayslipModel implements ModelInterface, ArrayAccess +class EssPayslipModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssPayslipModel'; + protected static $openAPIModelName = 'EssPayslipModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', 'pay_schedule' => 'string', 'date_paid' => '\DateTime', 'pay_period_start' => '\DateTime', 'pay_period_end' => '\DateTime', - 'net_pay' => 'double', + 'net_pay' => 'float', 'payer_name' => 'string', 'payer_abn' => 'string', 'payer_business_number' => 'string' @@ -73,8 +73,10 @@ class EssPayslipModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'pay_schedule' => null, @@ -87,14 +89,39 @@ class EssPayslipModel implements ModelInterface, ArrayAccess 'payer_business_number' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'pay_schedule' => false, + 'date_paid' => false, + 'pay_period_start' => false, + 'pay_period_end' => false, + 'net_pay' => false, + 'payer_name' => false, + 'payer_abn' => false, + 'payer_business_number' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['pay_schedule'] = isset($data['pay_schedule']) ? $data['pay_schedule'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['pay_period_start'] = isset($data['pay_period_start']) ? $data['pay_period_start'] : null; - $this->container['pay_period_end'] = isset($data['pay_period_end']) ? $data['pay_period_end'] : null; - $this->container['net_pay'] = isset($data['net_pay']) ? $data['net_pay'] : null; - $this->container['payer_name'] = isset($data['payer_name']) ? $data['payer_name'] : null; - $this->container['payer_abn'] = isset($data['payer_abn']) ? $data['payer_abn'] : null; - $this->container['payer_business_number'] = isset($data['payer_business_number']) ? $data['payer_business_number'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('pay_schedule', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('pay_period_start', $data ?? [], null); + $this->setIfExists('pay_period_end', $data ?? [], null); + $this->setIfExists('net_pay', $data ?? [], null); + $this->setIfExists('payer_name', $data ?? [], null); + $this->setIfExists('payer_abn', $data ?? [], null); + $this->setIfExists('payer_business_number', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -295,12 +392,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -309,7 +409,7 @@ public function setEmployeeId($employee_id) /** * Gets pay_schedule * - * @return string + * @return string|null */ public function getPaySchedule() { @@ -319,12 +419,15 @@ public function getPaySchedule() /** * Sets pay_schedule * - * @param string $pay_schedule + * @param string|null $pay_schedule * - * @return $this + * @return self */ public function setPaySchedule($pay_schedule) { + if (is_null($pay_schedule)) { + throw new \InvalidArgumentException('non-nullable pay_schedule cannot be null'); + } $this->container['pay_schedule'] = $pay_schedule; return $this; @@ -333,7 +436,7 @@ public function setPaySchedule($pay_schedule) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -343,12 +446,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -357,7 +463,7 @@ public function setDatePaid($date_paid) /** * Gets pay_period_start * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodStart() { @@ -367,12 +473,15 @@ public function getPayPeriodStart() /** * Sets pay_period_start * - * @param \DateTime $pay_period_start + * @param \DateTime|null $pay_period_start * - * @return $this + * @return self */ public function setPayPeriodStart($pay_period_start) { + if (is_null($pay_period_start)) { + throw new \InvalidArgumentException('non-nullable pay_period_start cannot be null'); + } $this->container['pay_period_start'] = $pay_period_start; return $this; @@ -381,7 +490,7 @@ public function setPayPeriodStart($pay_period_start) /** * Gets pay_period_end * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodEnd() { @@ -391,12 +500,15 @@ public function getPayPeriodEnd() /** * Sets pay_period_end * - * @param \DateTime $pay_period_end + * @param \DateTime|null $pay_period_end * - * @return $this + * @return self */ public function setPayPeriodEnd($pay_period_end) { + if (is_null($pay_period_end)) { + throw new \InvalidArgumentException('non-nullable pay_period_end cannot be null'); + } $this->container['pay_period_end'] = $pay_period_end; return $this; @@ -405,7 +517,7 @@ public function setPayPeriodEnd($pay_period_end) /** * Gets net_pay * - * @return double + * @return float|null */ public function getNetPay() { @@ -415,12 +527,15 @@ public function getNetPay() /** * Sets net_pay * - * @param double $net_pay + * @param float|null $net_pay * - * @return $this + * @return self */ public function setNetPay($net_pay) { + if (is_null($net_pay)) { + throw new \InvalidArgumentException('non-nullable net_pay cannot be null'); + } $this->container['net_pay'] = $net_pay; return $this; @@ -429,7 +544,7 @@ public function setNetPay($net_pay) /** * Gets payer_name * - * @return string + * @return string|null */ public function getPayerName() { @@ -439,12 +554,15 @@ public function getPayerName() /** * Sets payer_name * - * @param string $payer_name + * @param string|null $payer_name * - * @return $this + * @return self */ public function setPayerName($payer_name) { + if (is_null($payer_name)) { + throw new \InvalidArgumentException('non-nullable payer_name cannot be null'); + } $this->container['payer_name'] = $payer_name; return $this; @@ -453,7 +571,7 @@ public function setPayerName($payer_name) /** * Gets payer_abn * - * @return string + * @return string|null */ public function getPayerAbn() { @@ -463,12 +581,15 @@ public function getPayerAbn() /** * Sets payer_abn * - * @param string $payer_abn + * @param string|null $payer_abn * - * @return $this + * @return self */ public function setPayerAbn($payer_abn) { + if (is_null($payer_abn)) { + throw new \InvalidArgumentException('non-nullable payer_abn cannot be null'); + } $this->container['payer_abn'] = $payer_abn; return $this; @@ -477,7 +598,7 @@ public function setPayerAbn($payer_abn) /** * Gets payer_business_number * - * @return string + * @return string|null */ public function getPayerBusinessNumber() { @@ -487,12 +608,15 @@ public function getPayerBusinessNumber() /** * Sets payer_business_number * - * @param string $payer_business_number + * @param string|null $payer_business_number * - * @return $this + * @return self */ public function setPayerBusinessNumber($payer_business_number) { + if (is_null($payer_business_number)) { + throw new \InvalidArgumentException('non-nullable payer_business_number cannot be null'); + } $this->container['payer_business_number'] = $payer_business_number; return $this; @@ -504,7 +628,7 @@ public function setPayerBusinessNumber($payer_business_number) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssRosterShiftCountModel.php b/src/lib/Model/EssRosterShiftCountModel.php index 394a49c..ede9fc6 100644 --- a/src/lib/Model/EssRosterShiftCountModel.php +++ b/src/lib/Model/EssRosterShiftCountModel.php @@ -2,61 +2,61 @@ /** * EssRosterShiftCountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssRosterShiftCountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssRosterShiftCountModel implements ModelInterface, ArrayAccess +class EssRosterShiftCountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssRosterShiftCountModel'; + protected static $openAPIModelName = 'EssRosterShiftCountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'proposed_swap_count' => 'int', 'pending_shift_count' => 'int', 'biddable_shift_count' => 'int', @@ -67,22 +67,43 @@ class EssRosterShiftCountModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'proposed_swap_count' => 'int32', 'pending_shift_count' => 'int32', 'biddable_shift_count' => 'int32', 'not_accepted_shifts_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'proposed_swap_count' => false, + 'pending_shift_count' => false, + 'biddable_shift_count' => false, + 'not_accepted_shifts_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['proposed_swap_count'] = isset($data['proposed_swap_count']) ? $data['proposed_swap_count'] : null; - $this->container['pending_shift_count'] = isset($data['pending_shift_count']) ? $data['pending_shift_count'] : null; - $this->container['biddable_shift_count'] = isset($data['biddable_shift_count']) ? $data['biddable_shift_count'] : null; - $this->container['not_accepted_shifts_count'] = isset($data['not_accepted_shifts_count']) ? $data['not_accepted_shifts_count'] : null; + $this->setIfExists('proposed_swap_count', $data ?? [], null); + $this->setIfExists('pending_shift_count', $data ?? [], null); + $this->setIfExists('biddable_shift_count', $data ?? [], null); + $this->setIfExists('not_accepted_shifts_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets proposed_swap_count * - * @return int + * @return int|null */ public function getProposedSwapCount() { @@ -235,12 +323,15 @@ public function getProposedSwapCount() /** * Sets proposed_swap_count * - * @param int $proposed_swap_count + * @param int|null $proposed_swap_count * - * @return $this + * @return self */ public function setProposedSwapCount($proposed_swap_count) { + if (is_null($proposed_swap_count)) { + throw new \InvalidArgumentException('non-nullable proposed_swap_count cannot be null'); + } $this->container['proposed_swap_count'] = $proposed_swap_count; return $this; @@ -249,7 +340,7 @@ public function setProposedSwapCount($proposed_swap_count) /** * Gets pending_shift_count * - * @return int + * @return int|null */ public function getPendingShiftCount() { @@ -259,12 +350,15 @@ public function getPendingShiftCount() /** * Sets pending_shift_count * - * @param int $pending_shift_count + * @param int|null $pending_shift_count * - * @return $this + * @return self */ public function setPendingShiftCount($pending_shift_count) { + if (is_null($pending_shift_count)) { + throw new \InvalidArgumentException('non-nullable pending_shift_count cannot be null'); + } $this->container['pending_shift_count'] = $pending_shift_count; return $this; @@ -273,7 +367,7 @@ public function setPendingShiftCount($pending_shift_count) /** * Gets biddable_shift_count * - * @return int + * @return int|null */ public function getBiddableShiftCount() { @@ -283,12 +377,15 @@ public function getBiddableShiftCount() /** * Sets biddable_shift_count * - * @param int $biddable_shift_count + * @param int|null $biddable_shift_count * - * @return $this + * @return self */ public function setBiddableShiftCount($biddable_shift_count) { + if (is_null($biddable_shift_count)) { + throw new \InvalidArgumentException('non-nullable biddable_shift_count cannot be null'); + } $this->container['biddable_shift_count'] = $biddable_shift_count; return $this; @@ -297,7 +394,7 @@ public function setBiddableShiftCount($biddable_shift_count) /** * Gets not_accepted_shifts_count * - * @return int + * @return int|null */ public function getNotAcceptedShiftsCount() { @@ -307,12 +404,15 @@ public function getNotAcceptedShiftsCount() /** * Sets not_accepted_shifts_count * - * @param int $not_accepted_shifts_count + * @param int|null $not_accepted_shifts_count * - * @return $this + * @return self */ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) { + if (is_null($not_accepted_shifts_count)) { + throw new \InvalidArgumentException('non-nullable not_accepted_shifts_count cannot be null'); + } $this->container['not_accepted_shifts_count'] = $not_accepted_shifts_count; return $this; @@ -324,7 +424,7 @@ public function setNotAcceptedShiftsCount($not_accepted_shifts_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssSatisfactionSurvey.php b/src/lib/Model/EssSatisfactionSurvey.php index 807762e..3fa386f 100644 --- a/src/lib/Model/EssSatisfactionSurvey.php +++ b/src/lib/Model/EssSatisfactionSurvey.php @@ -2,61 +2,61 @@ /** * EssSatisfactionSurvey * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssSatisfactionSurvey Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssSatisfactionSurvey implements ModelInterface, ArrayAccess +class EssSatisfactionSurvey implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssSatisfactionSurvey'; + protected static $openAPIModelName = 'EssSatisfactionSurvey'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'value' => 'string', 'week_start_date' => '\DateTime' ]; @@ -65,20 +65,39 @@ class EssSatisfactionSurvey implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'value' => null, 'week_start_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'value' => false, + 'week_start_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,16 +231,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const VALUE_NOT_SET = 'NotSet'; - const VALUE_HAPPY = 'Happy'; - const VALUE_NEUTRAL = 'Neutral'; - const VALUE_SAD = 'Sad'; - + public const VALUE_NOT_SET = 'NotSet'; + public const VALUE_HAPPY = 'Happy'; + public const VALUE_NEUTRAL = 'Neutral'; + public const VALUE_SAD = 'Sad'; - /** * Gets allowable values of the enum * @@ -184,7 +253,6 @@ public function getValueAllowableValues() self::VALUE_SAD, ]; } - /** * Associative array for storing property values @@ -201,8 +269,26 @@ public function getValueAllowableValues() */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['week_start_date'] = isset($data['week_start_date']) ? $data['week_start_date'] : null; + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('week_start_date', $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; } /** @@ -217,7 +303,8 @@ public function listInvalidProperties() $allowedValues = $this->getValueAllowableValues(); if (!is_null($this->container['value']) && !in_array($this->container['value'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'value', must be one of '%s'", + "invalid value '%s' for 'value', must be one of '%s'", + $this->container['value'], implode("', '", $allowedValues) ); } @@ -240,7 +327,7 @@ public function valid() /** * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -250,17 +337,21 @@ public function getValue() /** * Sets value * - * @param string $value + * @param string|null $value * - * @return $this + * @return self */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $allowedValues = $this->getValueAllowableValues(); - if (!is_null($value) && !in_array($value, $allowedValues, true)) { + if (!in_array($value, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'value', must be one of '%s'", + "Invalid value '%s' for 'value', must be one of '%s'", + $value, implode("', '", $allowedValues) ) ); @@ -273,7 +364,7 @@ public function setValue($value) /** * Gets week_start_date * - * @return \DateTime + * @return \DateTime|null */ public function getWeekStartDate() { @@ -283,12 +374,15 @@ public function getWeekStartDate() /** * Sets week_start_date * - * @param \DateTime $week_start_date + * @param \DateTime|null $week_start_date * - * @return $this + * @return self */ public function setWeekStartDate($week_start_date) { + if (is_null($week_start_date)) { + throw new \InvalidArgumentException('non-nullable week_start_date cannot be null'); + } $this->container['week_start_date'] = $week_start_date; return $this; @@ -300,7 +394,7 @@ public function setWeekStartDate($week_start_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -310,22 +404,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -341,11 +436,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -353,13 +461,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssShiftSwapCandidate.php b/src/lib/Model/EssShiftSwapCandidate.php index ab8a8a7..a0e0cd9 100644 --- a/src/lib/Model/EssShiftSwapCandidate.php +++ b/src/lib/Model/EssShiftSwapCandidate.php @@ -2,61 +2,61 @@ /** * EssShiftSwapCandidate * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssShiftSwapCandidate Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssShiftSwapCandidate implements ModelInterface, ArrayAccess +class EssShiftSwapCandidate implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssShiftSwapCandidate'; + protected static $openAPIModelName = 'EssShiftSwapCandidate'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'profile_image_url' => 'string' @@ -66,21 +66,41 @@ class EssShiftSwapCandidate implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'profile_image_url' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'profile_image_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['profile_image_url'] = isset($data['profile_image_url']) ? $data['profile_image_url'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('profile_image_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets profile_image_url * - * @return string + * @return string|null */ public function getProfileImageUrl() { @@ -277,12 +370,15 @@ public function getProfileImageUrl() /** * Sets profile_image_url * - * @param string $profile_image_url + * @param string|null $profile_image_url * - * @return $this + * @return self */ public function setProfileImageUrl($profile_image_url) { + if (is_null($profile_image_url)) { + throw new \InvalidArgumentException('non-nullable profile_image_url cannot be null'); + } $this->container['profile_image_url'] = $profile_image_url; return $this; @@ -294,7 +390,7 @@ public function setProfileImageUrl($profile_image_url) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssTimesheetModel.php b/src/lib/Model/EssTimesheetModel.php index 80abcca..34b4d98 100644 --- a/src/lib/Model/EssTimesheetModel.php +++ b/src/lib/Model/EssTimesheetModel.php @@ -2,65 +2,65 @@ /** * EssTimesheetModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssTimesheetModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssTimesheetModel implements ModelInterface, ArrayAccess +class EssTimesheetModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssTimesheetModel'; + protected static $openAPIModelName = 'EssTimesheetModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_delete' => 'bool', 'can_edit' => 'bool', 'status_id' => 'int', - 'attachment' => '\Swagger\Client\Model\Attachment', + 'attachment' => '\OpenAPI\Client\Model\Attachment', 'work_duration_in_minutes' => 'int', 'breaks_duration_in_minutes' => 'int', 'total_duration_in_minutes' => 'int', @@ -82,22 +82,22 @@ class EssTimesheetModel implements ModelInterface, ArrayAccess 'end' => '\DateTime', 'submitted_start' => '\DateTime', 'submitted_end' => '\DateTime', - 'units' => 'double', + 'units' => 'float', 'status' => 'string', 'pay_slip_url' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakViewModel[]', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakViewModel[]', 'comments' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'external_reference_id' => 'string', 'source' => 'string', 'pay_category_id' => 'int', 'leave_category_id' => 'int', 'leave_request_id' => 'int', 'is_locked' => 'bool', - 'cost' => 'double', - 'costing_data' => '\Swagger\Client\Model\ShiftCostingData', - 'cost_by_location' => 'double', - 'costing_data_by_location' => '\Swagger\Client\Model\ShiftCostingData', + 'cost' => 'float', + 'costing_data' => '\OpenAPI\Client\Model\ShiftCostingData', + 'cost_by_location' => 'float', + 'costing_data_by_location' => '\OpenAPI\Client\Model\ShiftCostingData', 'discard' => 'bool', 'shift_condition_ids' => 'int[]', 'is_overlapping' => 'bool', @@ -113,8 +113,10 @@ class EssTimesheetModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_delete' => null, 'can_edit' => null, 'status_id' => 'int32', @@ -167,14 +169,79 @@ class EssTimesheetModel implements ModelInterface, ArrayAccess 'ignore_rounding' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_delete' => false, + 'can_edit' => false, + 'status_id' => false, + 'attachment' => false, + 'work_duration_in_minutes' => false, + 'breaks_duration_in_minutes' => false, + 'total_duration_in_minutes' => false, + 'auto_approved_by_roster_shift_id' => false, + 'location_is_deleted' => false, + 'employee_name' => false, + 'id' => false, + 'employee_id' => false, + 'location_id' => false, + 'work_type_id' => false, + 'classification_id' => false, + 'classification_name' => false, + 'work_type_name' => false, + 'location_name' => false, + 'unit_type' => false, + 'is_unit_based_work_type' => false, + 'pay_run_id' => false, + 'start' => false, + 'end' => false, + 'submitted_start' => false, + 'submitted_end' => false, + 'units' => false, + 'status' => false, + 'pay_slip_url' => false, + 'breaks' => false, + 'comments' => false, + 'rate' => false, + 'external_reference_id' => false, + 'source' => false, + 'pay_category_id' => false, + 'leave_category_id' => false, + 'leave_request_id' => false, + 'is_locked' => false, + 'cost' => false, + 'costing_data' => false, + 'cost_by_location' => false, + 'costing_data_by_location' => false, + 'discard' => false, + 'shift_condition_ids' => false, + 'is_overlapping' => false, + 'overdraws_leave' => false, + 'reviewed_by' => false, + 'duration_override' => false, + 'hidden_comments' => false, + 'read_only' => false, + 'ignore_rounding' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -182,9 +249,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -400,93 +519,91 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const STATUS_MISSING = 'Missing'; - const STATUS_SUBMITTED = 'Submitted'; - const STATUS_APPROVED = 'Approved'; - const STATUS_REJECTED = 'Rejected'; - const STATUS_PROCESSED = 'Processed'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const STATUS_MISSING = 'Missing'; + public const STATUS_SUBMITTED = 'Submitted'; + public const STATUS_APPROVED = 'Approved'; + public const STATUS_REJECTED = 'Rejected'; + public const STATUS_PROCESSED = 'Processed'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -502,7 +619,7 @@ public function getStatusAllowableValues() self::STATUS_PROCESSED, ]; } - + /** * Gets allowable values of the enum * @@ -589,7 +706,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -606,56 +722,74 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['can_delete'] = isset($data['can_delete']) ? $data['can_delete'] : null; - $this->container['can_edit'] = isset($data['can_edit']) ? $data['can_edit'] : null; - $this->container['status_id'] = isset($data['status_id']) ? $data['status_id'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['work_duration_in_minutes'] = isset($data['work_duration_in_minutes']) ? $data['work_duration_in_minutes'] : null; - $this->container['breaks_duration_in_minutes'] = isset($data['breaks_duration_in_minutes']) ? $data['breaks_duration_in_minutes'] : null; - $this->container['total_duration_in_minutes'] = isset($data['total_duration_in_minutes']) ? $data['total_duration_in_minutes'] : null; - $this->container['auto_approved_by_roster_shift_id'] = isset($data['auto_approved_by_roster_shift_id']) ? $data['auto_approved_by_roster_shift_id'] : null; - $this->container['location_is_deleted'] = isset($data['location_is_deleted']) ? $data['location_is_deleted'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification_name'] = isset($data['classification_name']) ? $data['classification_name'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['is_unit_based_work_type'] = isset($data['is_unit_based_work_type']) ? $data['is_unit_based_work_type'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['submitted_start'] = isset($data['submitted_start']) ? $data['submitted_start'] : null; - $this->container['submitted_end'] = isset($data['submitted_end']) ? $data['submitted_end'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['pay_slip_url'] = isset($data['pay_slip_url']) ? $data['pay_slip_url'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['leave_request_id'] = isset($data['leave_request_id']) ? $data['leave_request_id'] : null; - $this->container['is_locked'] = isset($data['is_locked']) ? $data['is_locked'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['costing_data'] = isset($data['costing_data']) ? $data['costing_data'] : null; - $this->container['cost_by_location'] = isset($data['cost_by_location']) ? $data['cost_by_location'] : null; - $this->container['costing_data_by_location'] = isset($data['costing_data_by_location']) ? $data['costing_data_by_location'] : null; - $this->container['discard'] = isset($data['discard']) ? $data['discard'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['is_overlapping'] = isset($data['is_overlapping']) ? $data['is_overlapping'] : null; - $this->container['overdraws_leave'] = isset($data['overdraws_leave']) ? $data['overdraws_leave'] : null; - $this->container['reviewed_by'] = isset($data['reviewed_by']) ? $data['reviewed_by'] : null; - $this->container['duration_override'] = isset($data['duration_override']) ? $data['duration_override'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['read_only'] = isset($data['read_only']) ? $data['read_only'] : null; - $this->container['ignore_rounding'] = isset($data['ignore_rounding']) ? $data['ignore_rounding'] : null; + $this->setIfExists('can_delete', $data ?? [], null); + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('status_id', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('work_duration_in_minutes', $data ?? [], null); + $this->setIfExists('breaks_duration_in_minutes', $data ?? [], null); + $this->setIfExists('total_duration_in_minutes', $data ?? [], null); + $this->setIfExists('auto_approved_by_roster_shift_id', $data ?? [], null); + $this->setIfExists('location_is_deleted', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification_name', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('is_unit_based_work_type', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('submitted_start', $data ?? [], null); + $this->setIfExists('submitted_end', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('pay_slip_url', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('leave_request_id', $data ?? [], null); + $this->setIfExists('is_locked', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('costing_data', $data ?? [], null); + $this->setIfExists('cost_by_location', $data ?? [], null); + $this->setIfExists('costing_data_by_location', $data ?? [], null); + $this->setIfExists('discard', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('is_overlapping', $data ?? [], null); + $this->setIfExists('overdraws_leave', $data ?? [], null); + $this->setIfExists('reviewed_by', $data ?? [], null); + $this->setIfExists('duration_override', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + $this->setIfExists('ignore_rounding', $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; } /** @@ -670,7 +804,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -678,7 +813,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -701,7 +837,7 @@ public function valid() /** * Gets can_delete * - * @return bool + * @return bool|null */ public function getCanDelete() { @@ -711,12 +847,15 @@ public function getCanDelete() /** * Sets can_delete * - * @param bool $can_delete + * @param bool|null $can_delete * - * @return $this + * @return self */ public function setCanDelete($can_delete) { + if (is_null($can_delete)) { + throw new \InvalidArgumentException('non-nullable can_delete cannot be null'); + } $this->container['can_delete'] = $can_delete; return $this; @@ -725,7 +864,7 @@ public function setCanDelete($can_delete) /** * Gets can_edit * - * @return bool + * @return bool|null */ public function getCanEdit() { @@ -735,12 +874,15 @@ public function getCanEdit() /** * Sets can_edit * - * @param bool $can_edit + * @param bool|null $can_edit * - * @return $this + * @return self */ public function setCanEdit($can_edit) { + if (is_null($can_edit)) { + throw new \InvalidArgumentException('non-nullable can_edit cannot be null'); + } $this->container['can_edit'] = $can_edit; return $this; @@ -749,7 +891,7 @@ public function setCanEdit($can_edit) /** * Gets status_id * - * @return int + * @return int|null */ public function getStatusId() { @@ -759,12 +901,15 @@ public function getStatusId() /** * Sets status_id * - * @param int $status_id + * @param int|null $status_id * - * @return $this + * @return self */ public function setStatusId($status_id) { + if (is_null($status_id)) { + throw new \InvalidArgumentException('non-nullable status_id cannot be null'); + } $this->container['status_id'] = $status_id; return $this; @@ -773,7 +918,7 @@ public function setStatusId($status_id) /** * Gets attachment * - * @return \Swagger\Client\Model\Attachment + * @return \OpenAPI\Client\Model\Attachment|null */ public function getAttachment() { @@ -783,12 +928,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\Attachment $attachment + * @param \OpenAPI\Client\Model\Attachment|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -797,7 +945,7 @@ public function setAttachment($attachment) /** * Gets work_duration_in_minutes * - * @return int + * @return int|null */ public function getWorkDurationInMinutes() { @@ -807,12 +955,15 @@ public function getWorkDurationInMinutes() /** * Sets work_duration_in_minutes * - * @param int $work_duration_in_minutes + * @param int|null $work_duration_in_minutes * - * @return $this + * @return self */ public function setWorkDurationInMinutes($work_duration_in_minutes) { + if (is_null($work_duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable work_duration_in_minutes cannot be null'); + } $this->container['work_duration_in_minutes'] = $work_duration_in_minutes; return $this; @@ -821,7 +972,7 @@ public function setWorkDurationInMinutes($work_duration_in_minutes) /** * Gets breaks_duration_in_minutes * - * @return int + * @return int|null */ public function getBreaksDurationInMinutes() { @@ -831,12 +982,15 @@ public function getBreaksDurationInMinutes() /** * Sets breaks_duration_in_minutes * - * @param int $breaks_duration_in_minutes + * @param int|null $breaks_duration_in_minutes * - * @return $this + * @return self */ public function setBreaksDurationInMinutes($breaks_duration_in_minutes) { + if (is_null($breaks_duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable breaks_duration_in_minutes cannot be null'); + } $this->container['breaks_duration_in_minutes'] = $breaks_duration_in_minutes; return $this; @@ -845,7 +999,7 @@ public function setBreaksDurationInMinutes($breaks_duration_in_minutes) /** * Gets total_duration_in_minutes * - * @return int + * @return int|null */ public function getTotalDurationInMinutes() { @@ -855,12 +1009,15 @@ public function getTotalDurationInMinutes() /** * Sets total_duration_in_minutes * - * @param int $total_duration_in_minutes + * @param int|null $total_duration_in_minutes * - * @return $this + * @return self */ public function setTotalDurationInMinutes($total_duration_in_minutes) { + if (is_null($total_duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable total_duration_in_minutes cannot be null'); + } $this->container['total_duration_in_minutes'] = $total_duration_in_minutes; return $this; @@ -869,7 +1026,7 @@ public function setTotalDurationInMinutes($total_duration_in_minutes) /** * Gets auto_approved_by_roster_shift_id * - * @return int + * @return int|null */ public function getAutoApprovedByRosterShiftId() { @@ -879,12 +1036,15 @@ public function getAutoApprovedByRosterShiftId() /** * Sets auto_approved_by_roster_shift_id * - * @param int $auto_approved_by_roster_shift_id + * @param int|null $auto_approved_by_roster_shift_id * - * @return $this + * @return self */ public function setAutoApprovedByRosterShiftId($auto_approved_by_roster_shift_id) { + if (is_null($auto_approved_by_roster_shift_id)) { + throw new \InvalidArgumentException('non-nullable auto_approved_by_roster_shift_id cannot be null'); + } $this->container['auto_approved_by_roster_shift_id'] = $auto_approved_by_roster_shift_id; return $this; @@ -893,7 +1053,7 @@ public function setAutoApprovedByRosterShiftId($auto_approved_by_roster_shift_id /** * Gets location_is_deleted * - * @return bool + * @return bool|null */ public function getLocationIsDeleted() { @@ -903,12 +1063,15 @@ public function getLocationIsDeleted() /** * Sets location_is_deleted * - * @param bool $location_is_deleted + * @param bool|null $location_is_deleted * - * @return $this + * @return self */ public function setLocationIsDeleted($location_is_deleted) { + if (is_null($location_is_deleted)) { + throw new \InvalidArgumentException('non-nullable location_is_deleted cannot be null'); + } $this->container['location_is_deleted'] = $location_is_deleted; return $this; @@ -917,7 +1080,7 @@ public function setLocationIsDeleted($location_is_deleted) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -927,12 +1090,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -941,7 +1107,7 @@ public function setEmployeeName($employee_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -951,12 +1117,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -965,7 +1134,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -975,12 +1144,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -989,7 +1161,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -999,12 +1171,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -1013,7 +1188,7 @@ public function setLocationId($location_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -1023,12 +1198,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -1037,7 +1215,7 @@ public function setWorkTypeId($work_type_id) /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -1047,12 +1225,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -1061,7 +1242,7 @@ public function setClassificationId($classification_id) /** * Gets classification_name * - * @return string + * @return string|null */ public function getClassificationName() { @@ -1071,12 +1252,15 @@ public function getClassificationName() /** * Sets classification_name * - * @param string $classification_name + * @param string|null $classification_name * - * @return $this + * @return self */ public function setClassificationName($classification_name) { + if (is_null($classification_name)) { + throw new \InvalidArgumentException('non-nullable classification_name cannot be null'); + } $this->container['classification_name'] = $classification_name; return $this; @@ -1085,7 +1269,7 @@ public function setClassificationName($classification_name) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -1095,12 +1279,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -1109,7 +1296,7 @@ public function setWorkTypeName($work_type_name) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -1119,12 +1306,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -1133,7 +1323,7 @@ public function setLocationName($location_name) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -1143,12 +1333,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -1157,7 +1350,7 @@ public function setUnitType($unit_type) /** * Gets is_unit_based_work_type * - * @return bool + * @return bool|null */ public function getIsUnitBasedWorkType() { @@ -1167,12 +1360,15 @@ public function getIsUnitBasedWorkType() /** * Sets is_unit_based_work_type * - * @param bool $is_unit_based_work_type + * @param bool|null $is_unit_based_work_type * - * @return $this + * @return self */ public function setIsUnitBasedWorkType($is_unit_based_work_type) { + if (is_null($is_unit_based_work_type)) { + throw new \InvalidArgumentException('non-nullable is_unit_based_work_type cannot be null'); + } $this->container['is_unit_based_work_type'] = $is_unit_based_work_type; return $this; @@ -1181,7 +1377,7 @@ public function setIsUnitBasedWorkType($is_unit_based_work_type) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -1191,12 +1387,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -1205,7 +1404,7 @@ public function setPayRunId($pay_run_id) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -1215,12 +1414,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -1229,7 +1431,7 @@ public function setStart($start) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -1239,12 +1441,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -1253,7 +1458,7 @@ public function setEnd($end) /** * Gets submitted_start * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedStart() { @@ -1263,12 +1468,15 @@ public function getSubmittedStart() /** * Sets submitted_start * - * @param \DateTime $submitted_start + * @param \DateTime|null $submitted_start * - * @return $this + * @return self */ public function setSubmittedStart($submitted_start) { + if (is_null($submitted_start)) { + throw new \InvalidArgumentException('non-nullable submitted_start cannot be null'); + } $this->container['submitted_start'] = $submitted_start; return $this; @@ -1277,7 +1485,7 @@ public function setSubmittedStart($submitted_start) /** * Gets submitted_end * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedEnd() { @@ -1287,12 +1495,15 @@ public function getSubmittedEnd() /** * Sets submitted_end * - * @param \DateTime $submitted_end + * @param \DateTime|null $submitted_end * - * @return $this + * @return self */ public function setSubmittedEnd($submitted_end) { + if (is_null($submitted_end)) { + throw new \InvalidArgumentException('non-nullable submitted_end cannot be null'); + } $this->container['submitted_end'] = $submitted_end; return $this; @@ -1301,7 +1512,7 @@ public function setSubmittedEnd($submitted_end) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -1311,12 +1522,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -1325,7 +1539,7 @@ public function setUnits($units) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -1335,17 +1549,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -1358,7 +1576,7 @@ public function setStatus($status) /** * Gets pay_slip_url * - * @return string + * @return string|null */ public function getPaySlipUrl() { @@ -1368,12 +1586,15 @@ public function getPaySlipUrl() /** * Sets pay_slip_url * - * @param string $pay_slip_url + * @param string|null $pay_slip_url * - * @return $this + * @return self */ public function setPaySlipUrl($pay_slip_url) { + if (is_null($pay_slip_url)) { + throw new \InvalidArgumentException('non-nullable pay_slip_url cannot be null'); + } $this->container['pay_slip_url'] = $pay_slip_url; return $this; @@ -1382,7 +1603,7 @@ public function setPaySlipUrl($pay_slip_url) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakViewModel[] + * @return \OpenAPI\Client\Model\TimesheetBreakViewModel[]|null */ public function getBreaks() { @@ -1392,12 +1613,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakViewModel[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakViewModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -1406,7 +1630,7 @@ public function setBreaks($breaks) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -1416,12 +1640,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -1430,7 +1657,7 @@ public function setComments($comments) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -1440,12 +1667,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -1454,7 +1684,7 @@ public function setRate($rate) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -1464,12 +1694,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -1478,7 +1711,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -1488,17 +1721,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -1511,7 +1748,7 @@ public function setSource($source) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -1521,12 +1758,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -1535,7 +1775,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -1545,12 +1785,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -1559,7 +1802,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets leave_request_id * - * @return int + * @return int|null */ public function getLeaveRequestId() { @@ -1569,12 +1812,15 @@ public function getLeaveRequestId() /** * Sets leave_request_id * - * @param int $leave_request_id + * @param int|null $leave_request_id * - * @return $this + * @return self */ public function setLeaveRequestId($leave_request_id) { + if (is_null($leave_request_id)) { + throw new \InvalidArgumentException('non-nullable leave_request_id cannot be null'); + } $this->container['leave_request_id'] = $leave_request_id; return $this; @@ -1583,7 +1829,7 @@ public function setLeaveRequestId($leave_request_id) /** * Gets is_locked * - * @return bool + * @return bool|null */ public function getIsLocked() { @@ -1593,12 +1839,15 @@ public function getIsLocked() /** * Sets is_locked * - * @param bool $is_locked + * @param bool|null $is_locked * - * @return $this + * @return self */ public function setIsLocked($is_locked) { + if (is_null($is_locked)) { + throw new \InvalidArgumentException('non-nullable is_locked cannot be null'); + } $this->container['is_locked'] = $is_locked; return $this; @@ -1607,7 +1856,7 @@ public function setIsLocked($is_locked) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -1617,12 +1866,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -1631,7 +1883,7 @@ public function setCost($cost) /** * Gets costing_data * - * @return \Swagger\Client\Model\ShiftCostingData + * @return \OpenAPI\Client\Model\ShiftCostingData|null */ public function getCostingData() { @@ -1641,12 +1893,15 @@ public function getCostingData() /** * Sets costing_data * - * @param \Swagger\Client\Model\ShiftCostingData $costing_data + * @param \OpenAPI\Client\Model\ShiftCostingData|null $costing_data costing_data * - * @return $this + * @return self */ public function setCostingData($costing_data) { + if (is_null($costing_data)) { + throw new \InvalidArgumentException('non-nullable costing_data cannot be null'); + } $this->container['costing_data'] = $costing_data; return $this; @@ -1655,7 +1910,7 @@ public function setCostingData($costing_data) /** * Gets cost_by_location * - * @return double + * @return float|null */ public function getCostByLocation() { @@ -1665,12 +1920,15 @@ public function getCostByLocation() /** * Sets cost_by_location * - * @param double $cost_by_location + * @param float|null $cost_by_location * - * @return $this + * @return self */ public function setCostByLocation($cost_by_location) { + if (is_null($cost_by_location)) { + throw new \InvalidArgumentException('non-nullable cost_by_location cannot be null'); + } $this->container['cost_by_location'] = $cost_by_location; return $this; @@ -1679,7 +1937,7 @@ public function setCostByLocation($cost_by_location) /** * Gets costing_data_by_location * - * @return \Swagger\Client\Model\ShiftCostingData + * @return \OpenAPI\Client\Model\ShiftCostingData|null */ public function getCostingDataByLocation() { @@ -1689,12 +1947,15 @@ public function getCostingDataByLocation() /** * Sets costing_data_by_location * - * @param \Swagger\Client\Model\ShiftCostingData $costing_data_by_location + * @param \OpenAPI\Client\Model\ShiftCostingData|null $costing_data_by_location costing_data_by_location * - * @return $this + * @return self */ public function setCostingDataByLocation($costing_data_by_location) { + if (is_null($costing_data_by_location)) { + throw new \InvalidArgumentException('non-nullable costing_data_by_location cannot be null'); + } $this->container['costing_data_by_location'] = $costing_data_by_location; return $this; @@ -1703,7 +1964,7 @@ public function setCostingDataByLocation($costing_data_by_location) /** * Gets discard * - * @return bool + * @return bool|null */ public function getDiscard() { @@ -1713,12 +1974,15 @@ public function getDiscard() /** * Sets discard * - * @param bool $discard + * @param bool|null $discard * - * @return $this + * @return self */ public function setDiscard($discard) { + if (is_null($discard)) { + throw new \InvalidArgumentException('non-nullable discard cannot be null'); + } $this->container['discard'] = $discard; return $this; @@ -1727,7 +1991,7 @@ public function setDiscard($discard) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -1737,12 +2001,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -1751,7 +2018,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets is_overlapping * - * @return bool + * @return bool|null */ public function getIsOverlapping() { @@ -1761,12 +2028,15 @@ public function getIsOverlapping() /** * Sets is_overlapping * - * @param bool $is_overlapping + * @param bool|null $is_overlapping * - * @return $this + * @return self */ public function setIsOverlapping($is_overlapping) { + if (is_null($is_overlapping)) { + throw new \InvalidArgumentException('non-nullable is_overlapping cannot be null'); + } $this->container['is_overlapping'] = $is_overlapping; return $this; @@ -1775,7 +2045,7 @@ public function setIsOverlapping($is_overlapping) /** * Gets overdraws_leave * - * @return bool + * @return bool|null */ public function getOverdrawsLeave() { @@ -1785,12 +2055,15 @@ public function getOverdrawsLeave() /** * Sets overdraws_leave * - * @param bool $overdraws_leave + * @param bool|null $overdraws_leave * - * @return $this + * @return self */ public function setOverdrawsLeave($overdraws_leave) { + if (is_null($overdraws_leave)) { + throw new \InvalidArgumentException('non-nullable overdraws_leave cannot be null'); + } $this->container['overdraws_leave'] = $overdraws_leave; return $this; @@ -1799,7 +2072,7 @@ public function setOverdrawsLeave($overdraws_leave) /** * Gets reviewed_by * - * @return string + * @return string|null */ public function getReviewedBy() { @@ -1809,12 +2082,15 @@ public function getReviewedBy() /** * Sets reviewed_by * - * @param string $reviewed_by + * @param string|null $reviewed_by * - * @return $this + * @return self */ public function setReviewedBy($reviewed_by) { + if (is_null($reviewed_by)) { + throw new \InvalidArgumentException('non-nullable reviewed_by cannot be null'); + } $this->container['reviewed_by'] = $reviewed_by; return $this; @@ -1823,7 +2099,7 @@ public function setReviewedBy($reviewed_by) /** * Gets duration_override * - * @return string + * @return string|null */ public function getDurationOverride() { @@ -1833,12 +2109,15 @@ public function getDurationOverride() /** * Sets duration_override * - * @param string $duration_override + * @param string|null $duration_override * - * @return $this + * @return self */ public function setDurationOverride($duration_override) { + if (is_null($duration_override)) { + throw new \InvalidArgumentException('non-nullable duration_override cannot be null'); + } $this->container['duration_override'] = $duration_override; return $this; @@ -1847,7 +2126,7 @@ public function setDurationOverride($duration_override) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -1857,12 +2136,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -1871,7 +2153,7 @@ public function setHiddenComments($hidden_comments) /** * Gets read_only * - * @return bool + * @return bool|null */ public function getReadOnly() { @@ -1881,12 +2163,15 @@ public function getReadOnly() /** * Sets read_only * - * @param bool $read_only + * @param bool|null $read_only * - * @return $this + * @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; @@ -1895,7 +2180,7 @@ public function setReadOnly($read_only) /** * Gets ignore_rounding * - * @return bool + * @return bool|null */ public function getIgnoreRounding() { @@ -1905,12 +2190,15 @@ public function getIgnoreRounding() /** * Sets ignore_rounding * - * @param bool $ignore_rounding + * @param bool|null $ignore_rounding * - * @return $this + * @return self */ public function setIgnoreRounding($ignore_rounding) { + if (is_null($ignore_rounding)) { + throw new \InvalidArgumentException('non-nullable ignore_rounding cannot be null'); + } $this->container['ignore_rounding'] = $ignore_rounding; return $this; @@ -1922,7 +2210,7 @@ public function setIgnoreRounding($ignore_rounding) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1932,22 +2220,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1963,11 +2252,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1975,13 +2277,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssUnavailabilityModel.php b/src/lib/Model/EssUnavailabilityModel.php index c94c15e..85a0bd3 100644 --- a/src/lib/Model/EssUnavailabilityModel.php +++ b/src/lib/Model/EssUnavailabilityModel.php @@ -2,61 +2,61 @@ /** * EssUnavailabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssUnavailabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssUnavailabilityModel implements ModelInterface, ArrayAccess +class EssUnavailabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssUnavailabilityModel'; + protected static $openAPIModelName = 'EssUnavailabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -74,8 +74,10 @@ class EssUnavailabilityModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -89,14 +91,40 @@ class EssUnavailabilityModel implements ModelInterface, ArrayAccess 'view_only' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'end_date' => false, + 'reason' => false, + 'recurring' => false, + 'recurring_day' => false, + 'recurring_days' => false, + 'recurring_days_csv' => false, + 'is_all_day' => false, + 'view_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,26 +285,24 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const RECURRING_DAY_SUNDAY = 'Sunday'; - const RECURRING_DAY_MONDAY = 'Monday'; - const RECURRING_DAY_TUESDAY = 'Tuesday'; - const RECURRING_DAY_WEDNESDAY = 'Wednesday'; - const RECURRING_DAY_THURSDAY = 'Thursday'; - const RECURRING_DAY_FRIDAY = 'Friday'; - const RECURRING_DAY_SATURDAY = 'Saturday'; - const RECURRING_DAYS_SUNDAY = 'Sunday'; - const RECURRING_DAYS_MONDAY = 'Monday'; - const RECURRING_DAYS_TUESDAY = 'Tuesday'; - const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; - const RECURRING_DAYS_THURSDAY = 'Thursday'; - const RECURRING_DAYS_FRIDAY = 'Friday'; - const RECURRING_DAYS_SATURDAY = 'Saturday'; - + public const RECURRING_DAY_SUNDAY = 'Sunday'; + public const RECURRING_DAY_MONDAY = 'Monday'; + public const RECURRING_DAY_TUESDAY = 'Tuesday'; + public const RECURRING_DAY_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAY_THURSDAY = 'Thursday'; + public const RECURRING_DAY_FRIDAY = 'Friday'; + public const RECURRING_DAY_SATURDAY = 'Saturday'; + public const RECURRING_DAYS_SUNDAY = 'Sunday'; + public const RECURRING_DAYS_MONDAY = 'Monday'; + public const RECURRING_DAYS_TUESDAY = 'Tuesday'; + public const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAYS_THURSDAY = 'Thursday'; + public const RECURRING_DAYS_FRIDAY = 'Friday'; + public const RECURRING_DAYS_SATURDAY = 'Saturday'; - /** * Gets allowable values of the enum * @@ -242,7 +320,7 @@ public function getRecurringDayAllowableValues() self::RECURRING_DAY_SATURDAY, ]; } - + /** * Gets allowable values of the enum * @@ -260,7 +338,6 @@ public function getRecurringDaysAllowableValues() self::RECURRING_DAYS_SATURDAY, ]; } - /** * Associative array for storing property values @@ -277,17 +354,35 @@ public function getRecurringDaysAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['recurring_day'] = isset($data['recurring_day']) ? $data['recurring_day'] : null; - $this->container['recurring_days'] = isset($data['recurring_days']) ? $data['recurring_days'] : null; - $this->container['recurring_days_csv'] = isset($data['recurring_days_csv']) ? $data['recurring_days_csv'] : null; - $this->container['is_all_day'] = isset($data['is_all_day']) ? $data['is_all_day'] : null; - $this->container['view_only'] = isset($data['view_only']) ? $data['view_only'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('recurring_day', $data ?? [], null); + $this->setIfExists('recurring_days', $data ?? [], null); + $this->setIfExists('recurring_days_csv', $data ?? [], null); + $this->setIfExists('is_all_day', $data ?? [], null); + $this->setIfExists('view_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; } /** @@ -302,7 +397,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDayAllowableValues(); if (!is_null($this->container['recurring_day']) && !in_array($this->container['recurring_day'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_day', must be one of '%s'", + "invalid value '%s' for 'recurring_day', must be one of '%s'", + $this->container['recurring_day'], implode("', '", $allowedValues) ); } @@ -310,7 +406,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDaysAllowableValues(); if (!is_null($this->container['recurring_days']) && !in_array($this->container['recurring_days'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_days', must be one of '%s'", + "invalid value '%s' for 'recurring_days', must be one of '%s'", + $this->container['recurring_days'], implode("', '", $allowedValues) ); } @@ -333,7 +430,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +440,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +457,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -367,12 +467,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -381,7 +484,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -391,12 +494,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -405,7 +511,7 @@ public function setToDate($to_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -415,12 +521,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -429,7 +538,7 @@ public function setEndDate($end_date) /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -439,12 +548,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -453,7 +565,7 @@ public function setReason($reason) /** * Gets recurring * - * @return bool + * @return bool|null */ public function getRecurring() { @@ -463,12 +575,15 @@ public function getRecurring() /** * Sets recurring * - * @param bool $recurring + * @param bool|null $recurring * - * @return $this + * @return self */ public function setRecurring($recurring) { + if (is_null($recurring)) { + throw new \InvalidArgumentException('non-nullable recurring cannot be null'); + } $this->container['recurring'] = $recurring; return $this; @@ -477,7 +592,7 @@ public function setRecurring($recurring) /** * Gets recurring_day * - * @return string + * @return string|null */ public function getRecurringDay() { @@ -487,17 +602,21 @@ public function getRecurringDay() /** * Sets recurring_day * - * @param string $recurring_day + * @param string|null $recurring_day * - * @return $this + * @return self */ public function setRecurringDay($recurring_day) { + if (is_null($recurring_day)) { + throw new \InvalidArgumentException('non-nullable recurring_day cannot be null'); + } $allowedValues = $this->getRecurringDayAllowableValues(); - if (!is_null($recurring_day) && !in_array($recurring_day, $allowedValues, true)) { + if (!in_array($recurring_day, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_day', must be one of '%s'", + "Invalid value '%s' for 'recurring_day', must be one of '%s'", + $recurring_day, implode("', '", $allowedValues) ) ); @@ -510,7 +629,7 @@ public function setRecurringDay($recurring_day) /** * Gets recurring_days * - * @return string + * @return string|null */ public function getRecurringDays() { @@ -520,17 +639,21 @@ public function getRecurringDays() /** * Sets recurring_days * - * @param string $recurring_days + * @param string|null $recurring_days * - * @return $this + * @return self */ public function setRecurringDays($recurring_days) { + if (is_null($recurring_days)) { + throw new \InvalidArgumentException('non-nullable recurring_days cannot be null'); + } $allowedValues = $this->getRecurringDaysAllowableValues(); - if (!is_null($recurring_days) && !in_array($recurring_days, $allowedValues, true)) { + if (!in_array($recurring_days, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_days', must be one of '%s'", + "Invalid value '%s' for 'recurring_days', must be one of '%s'", + $recurring_days, implode("', '", $allowedValues) ) ); @@ -543,7 +666,7 @@ public function setRecurringDays($recurring_days) /** * Gets recurring_days_csv * - * @return string + * @return string|null */ public function getRecurringDaysCsv() { @@ -553,12 +676,15 @@ public function getRecurringDaysCsv() /** * Sets recurring_days_csv * - * @param string $recurring_days_csv + * @param string|null $recurring_days_csv * - * @return $this + * @return self */ public function setRecurringDaysCsv($recurring_days_csv) { + if (is_null($recurring_days_csv)) { + throw new \InvalidArgumentException('non-nullable recurring_days_csv cannot be null'); + } $this->container['recurring_days_csv'] = $recurring_days_csv; return $this; @@ -567,7 +693,7 @@ public function setRecurringDaysCsv($recurring_days_csv) /** * Gets is_all_day * - * @return bool + * @return bool|null */ public function getIsAllDay() { @@ -577,12 +703,15 @@ public function getIsAllDay() /** * Sets is_all_day * - * @param bool $is_all_day + * @param bool|null $is_all_day * - * @return $this + * @return self */ public function setIsAllDay($is_all_day) { + if (is_null($is_all_day)) { + throw new \InvalidArgumentException('non-nullable is_all_day cannot be null'); + } $this->container['is_all_day'] = $is_all_day; return $this; @@ -591,7 +720,7 @@ public function setIsAllDay($is_all_day) /** * Gets view_only * - * @return bool + * @return bool|null */ public function getViewOnly() { @@ -601,12 +730,15 @@ public function getViewOnly() /** * Sets view_only * - * @param bool $view_only + * @param bool|null $view_only * - * @return $this + * @return self */ public function setViewOnly($view_only) { + if (is_null($view_only)) { + throw new \InvalidArgumentException('non-nullable view_only cannot be null'); + } $this->container['view_only'] = $view_only; return $this; @@ -618,7 +750,7 @@ public function setViewOnly($view_only) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -628,22 +760,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -659,11 +792,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -671,13 +817,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/EssWorkTypeModel.php b/src/lib/Model/EssWorkTypeModel.php index 5a3d524..4087eb4 100644 --- a/src/lib/Model/EssWorkTypeModel.php +++ b/src/lib/Model/EssWorkTypeModel.php @@ -2,61 +2,61 @@ /** * EssWorkTypeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * EssWorkTypeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class EssWorkTypeModel implements ModelInterface, ArrayAccess +class EssWorkTypeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'EssWorkTypeModel'; + protected static $openAPIModelName = 'EssWorkTypeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_unit_based_work_type' => 'bool', 'unit_type' => 'string', 'id' => 'int', @@ -77,8 +77,10 @@ class EssWorkTypeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_unit_based_work_type' => null, 'unit_type' => null, 'id' => 'int32', @@ -95,14 +97,43 @@ class EssWorkTypeModel implements ModelInterface, ArrayAccess 'award_package_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_unit_based_work_type' => false, + 'unit_type' => false, + 'id' => false, + 'name' => false, + 'pay_category_id' => false, + 'leave_category_id' => false, + 'external_id' => false, + 'source' => false, + 'accrues_leave' => false, + 'employment_types' => false, + 'mapping_type' => false, + 'short_code' => false, + 'award_package_id' => false, + 'award_package_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,24 +303,22 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYMENT_TYPES_UNKNOWN = 'Unknown'; - const EMPLOYMENT_TYPES_FULL_TIME = 'FullTime'; - const EMPLOYMENT_TYPES_PART_TIME = 'PartTime'; - const EMPLOYMENT_TYPES_LABOUR_HIRE = 'LabourHire'; - const EMPLOYMENT_TYPES_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; - const EMPLOYMENT_TYPES_CASUAL = 'Casual'; - const EMPLOYMENT_TYPES_NOT_APPLICABLE = 'NotApplicable'; - const EMPLOYMENT_TYPES_INDEPENDENT_CONTRACTOR = 'IndependentContractor'; - const MAPPING_TYPE_PAY_CATEGORY = 'PayCategory'; - const MAPPING_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; - const MAPPING_TYPE_PRIMARY_PAY_CATEGORY = 'PrimaryPayCategory'; - const MAPPING_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - + public const EMPLOYMENT_TYPES_UNKNOWN = 'Unknown'; + public const EMPLOYMENT_TYPES_FULL_TIME = 'FullTime'; + public const EMPLOYMENT_TYPES_PART_TIME = 'PartTime'; + public const EMPLOYMENT_TYPES_LABOUR_HIRE = 'LabourHire'; + public const EMPLOYMENT_TYPES_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; + public const EMPLOYMENT_TYPES_CASUAL = 'Casual'; + public const EMPLOYMENT_TYPES_NOT_APPLICABLE = 'NotApplicable'; + public const EMPLOYMENT_TYPES_INDEPENDENT_CONTRACTOR = 'IndependentContractor'; + public const MAPPING_TYPE_PAY_CATEGORY = 'PayCategory'; + public const MAPPING_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; + public const MAPPING_TYPE_PRIMARY_PAY_CATEGORY = 'PrimaryPayCategory'; + public const MAPPING_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - /** * Gets allowable values of the enum * @@ -256,7 +337,7 @@ public function getEmploymentTypesAllowableValues() self::EMPLOYMENT_TYPES_INDEPENDENT_CONTRACTOR, ]; } - + /** * Gets allowable values of the enum * @@ -271,7 +352,6 @@ public function getMappingTypeAllowableValues() self::MAPPING_TYPE_SHIFT_CONDITION, ]; } - /** * Associative array for storing property values @@ -288,20 +368,38 @@ public function getMappingTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['is_unit_based_work_type'] = isset($data['is_unit_based_work_type']) ? $data['is_unit_based_work_type'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['accrues_leave'] = isset($data['accrues_leave']) ? $data['accrues_leave'] : null; - $this->container['employment_types'] = isset($data['employment_types']) ? $data['employment_types'] : null; - $this->container['mapping_type'] = isset($data['mapping_type']) ? $data['mapping_type'] : null; - $this->container['short_code'] = isset($data['short_code']) ? $data['short_code'] : null; - $this->container['award_package_id'] = isset($data['award_package_id']) ? $data['award_package_id'] : null; - $this->container['award_package_name'] = isset($data['award_package_name']) ? $data['award_package_name'] : null; + $this->setIfExists('is_unit_based_work_type', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('accrues_leave', $data ?? [], null); + $this->setIfExists('employment_types', $data ?? [], null); + $this->setIfExists('mapping_type', $data ?? [], null); + $this->setIfExists('short_code', $data ?? [], null); + $this->setIfExists('award_package_id', $data ?? [], null); + $this->setIfExists('award_package_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; } /** @@ -316,7 +414,8 @@ public function listInvalidProperties() $allowedValues = $this->getMappingTypeAllowableValues(); if (!is_null($this->container['mapping_type']) && !in_array($this->container['mapping_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'mapping_type', must be one of '%s'", + "invalid value '%s' for 'mapping_type', must be one of '%s'", + $this->container['mapping_type'], implode("', '", $allowedValues) ); } @@ -339,7 +438,7 @@ public function valid() /** * Gets is_unit_based_work_type * - * @return bool + * @return bool|null */ public function getIsUnitBasedWorkType() { @@ -349,12 +448,15 @@ public function getIsUnitBasedWorkType() /** * Sets is_unit_based_work_type * - * @param bool $is_unit_based_work_type + * @param bool|null $is_unit_based_work_type * - * @return $this + * @return self */ public function setIsUnitBasedWorkType($is_unit_based_work_type) { + if (is_null($is_unit_based_work_type)) { + throw new \InvalidArgumentException('non-nullable is_unit_based_work_type cannot be null'); + } $this->container['is_unit_based_work_type'] = $is_unit_based_work_type; return $this; @@ -363,7 +465,7 @@ public function setIsUnitBasedWorkType($is_unit_based_work_type) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -373,12 +475,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -387,7 +492,7 @@ public function setUnitType($unit_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -397,12 +502,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -411,7 +519,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -421,12 +529,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -435,7 +546,7 @@ public function setName($name) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -445,12 +556,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -459,7 +573,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -469,12 +583,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -483,7 +600,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -493,12 +610,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -507,7 +627,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -517,12 +637,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -531,7 +654,7 @@ public function setSource($source) /** * Gets accrues_leave * - * @return bool + * @return bool|null */ public function getAccruesLeave() { @@ -541,12 +664,15 @@ public function getAccruesLeave() /** * Sets accrues_leave * - * @param bool $accrues_leave + * @param bool|null $accrues_leave * - * @return $this + * @return self */ public function setAccruesLeave($accrues_leave) { + if (is_null($accrues_leave)) { + throw new \InvalidArgumentException('non-nullable accrues_leave cannot be null'); + } $this->container['accrues_leave'] = $accrues_leave; return $this; @@ -555,7 +681,7 @@ public function setAccruesLeave($accrues_leave) /** * Gets employment_types * - * @return string[] + * @return string[]|null */ public function getEmploymentTypes() { @@ -565,14 +691,17 @@ public function getEmploymentTypes() /** * Sets employment_types * - * @param string[] $employment_types + * @param string[]|null $employment_types * - * @return $this + * @return self */ public function setEmploymentTypes($employment_types) { + if (is_null($employment_types)) { + throw new \InvalidArgumentException('non-nullable employment_types cannot be null'); + } $allowedValues = $this->getEmploymentTypesAllowableValues(); - if (!is_null($employment_types) && array_diff($employment_types, $allowedValues)) { + if (array_diff($employment_types, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'employment_types', must be one of '%s'", @@ -588,7 +717,7 @@ public function setEmploymentTypes($employment_types) /** * Gets mapping_type * - * @return string + * @return string|null */ public function getMappingType() { @@ -598,17 +727,21 @@ public function getMappingType() /** * Sets mapping_type * - * @param string $mapping_type + * @param string|null $mapping_type * - * @return $this + * @return self */ public function setMappingType($mapping_type) { + if (is_null($mapping_type)) { + throw new \InvalidArgumentException('non-nullable mapping_type cannot be null'); + } $allowedValues = $this->getMappingTypeAllowableValues(); - if (!is_null($mapping_type) && !in_array($mapping_type, $allowedValues, true)) { + if (!in_array($mapping_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'mapping_type', must be one of '%s'", + "Invalid value '%s' for 'mapping_type', must be one of '%s'", + $mapping_type, implode("', '", $allowedValues) ) ); @@ -621,7 +754,7 @@ public function setMappingType($mapping_type) /** * Gets short_code * - * @return string + * @return string|null */ public function getShortCode() { @@ -631,12 +764,15 @@ public function getShortCode() /** * Sets short_code * - * @param string $short_code + * @param string|null $short_code * - * @return $this + * @return self */ public function setShortCode($short_code) { + if (is_null($short_code)) { + throw new \InvalidArgumentException('non-nullable short_code cannot be null'); + } $this->container['short_code'] = $short_code; return $this; @@ -645,7 +781,7 @@ public function setShortCode($short_code) /** * Gets award_package_id * - * @return int + * @return int|null */ public function getAwardPackageId() { @@ -655,12 +791,15 @@ public function getAwardPackageId() /** * Sets award_package_id * - * @param int $award_package_id + * @param int|null $award_package_id * - * @return $this + * @return self */ public function setAwardPackageId($award_package_id) { + if (is_null($award_package_id)) { + throw new \InvalidArgumentException('non-nullable award_package_id cannot be null'); + } $this->container['award_package_id'] = $award_package_id; return $this; @@ -669,7 +808,7 @@ public function setAwardPackageId($award_package_id) /** * Gets award_package_name * - * @return string + * @return string|null */ public function getAwardPackageName() { @@ -679,12 +818,15 @@ public function getAwardPackageName() /** * Sets award_package_name * - * @param string $award_package_name + * @param string|null $award_package_name * - * @return $this + * @return self */ public function setAwardPackageName($award_package_name) { + if (is_null($award_package_name)) { + throw new \InvalidArgumentException('non-nullable award_package_name cannot be null'); + } $this->container['award_package_name'] = $award_package_name; return $this; @@ -696,7 +838,7 @@ public function setAwardPackageName($award_package_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -706,22 +848,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -737,11 +880,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -749,13 +905,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseCategoryResponseModel.php b/src/lib/Model/ExpenseCategoryResponseModel.php index a155503..fee19b2 100644 --- a/src/lib/Model/ExpenseCategoryResponseModel.php +++ b/src/lib/Model/ExpenseCategoryResponseModel.php @@ -2,74 +2,76 @@ /** * ExpenseCategoryResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseCategoryResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseCategoryResponseModel implements ModelInterface, ArrayAccess +class ExpenseCategoryResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseCategoryResponseModel'; + protected static $openAPIModelName = 'ExpenseCategoryResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'external_tax_code_id' => 'string', 'tax_code' => 'string', - 'tax_rate' => 'double' + 'tax_rate' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'external_tax_code_id' => null, @@ -77,14 +79,34 @@ class ExpenseCategoryResponseModel implements ModelInterface, ArrayAccess 'tax_rate' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'external_tax_code_id' => false, + 'tax_code' => false, + 'tax_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_tax_code_id'] = isset($data['external_tax_code_id']) ? $data['external_tax_code_id'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_tax_code_id', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_rate', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -241,12 +330,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -265,12 +357,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -279,7 +374,7 @@ public function setName($name) /** * Gets external_tax_code_id * - * @return string + * @return string|null */ public function getExternalTaxCodeId() { @@ -289,12 +384,15 @@ public function getExternalTaxCodeId() /** * Sets external_tax_code_id * - * @param string $external_tax_code_id + * @param string|null $external_tax_code_id * - * @return $this + * @return self */ public function setExternalTaxCodeId($external_tax_code_id) { + if (is_null($external_tax_code_id)) { + throw new \InvalidArgumentException('non-nullable external_tax_code_id cannot be null'); + } $this->container['external_tax_code_id'] = $external_tax_code_id; return $this; @@ -303,7 +401,7 @@ public function setExternalTaxCodeId($external_tax_code_id) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -313,12 +411,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -327,7 +428,7 @@ public function setTaxCode($tax_code) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -337,12 +438,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -354,7 +458,7 @@ public function setTaxRate($tax_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseManagementFilterModel.php b/src/lib/Model/ExpenseManagementFilterModel.php index 2b3da88..768df9a 100644 --- a/src/lib/Model/ExpenseManagementFilterModel.php +++ b/src/lib/Model/ExpenseManagementFilterModel.php @@ -2,61 +2,61 @@ /** * ExpenseManagementFilterModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseManagementFilterModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseManagementFilterModel implements ModelInterface, ArrayAccess +class ExpenseManagementFilterModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseManagementFilterModel'; + protected static $openAPIModelName = 'ExpenseManagementFilterModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'status' => 'string', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -72,8 +72,10 @@ class ExpenseManagementFilterModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'status' => null, 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -85,14 +87,38 @@ class ExpenseManagementFilterModel implements ModelInterface, ArrayAccess 'page_size' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'from_date' => false, + 'to_date' => false, + 'employee_id' => false, + 'location_id' => false, + 'expense_category_id' => false, + 'group_by' => false, + 'current_page' => false, + 'page_size' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -195,19 +273,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_PENDING = 'Pending'; - const STATUS_APPROVED = 'Approved'; - const STATUS_CANCELLED = 'Cancelled'; - const STATUS_DECLINED = 'Declined'; - const STATUS_PROCESSED = 'Processed'; - const GROUP_BY_EMPLOYEE = 'Employee'; - const GROUP_BY_EXPENSE_CATEGORY = 'ExpenseCategory'; - + public const STATUS_PENDING = 'Pending'; + public const STATUS_APPROVED = 'Approved'; + public const STATUS_CANCELLED = 'Cancelled'; + public const STATUS_DECLINED = 'Declined'; + public const STATUS_PROCESSED = 'Processed'; + public const GROUP_BY_EMPLOYEE = 'Employee'; + public const GROUP_BY_EXPENSE_CATEGORY = 'ExpenseCategory'; - /** * Gets allowable values of the enum * @@ -223,7 +299,7 @@ public function getStatusAllowableValues() self::STATUS_PROCESSED, ]; } - + /** * Gets allowable values of the enum * @@ -236,7 +312,6 @@ public function getGroupByAllowableValues() self::GROUP_BY_EXPENSE_CATEGORY, ]; } - /** * Associative array for storing property values @@ -253,15 +328,33 @@ public function getGroupByAllowableValues() */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['expense_category_id'] = isset($data['expense_category_id']) ? $data['expense_category_id'] : null; - $this->container['group_by'] = isset($data['group_by']) ? $data['group_by'] : null; - $this->container['current_page'] = isset($data['current_page']) ? $data['current_page'] : null; - $this->container['page_size'] = isset($data['page_size']) ? $data['page_size'] : null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('expense_category_id', $data ?? [], null); + $this->setIfExists('group_by', $data ?? [], null); + $this->setIfExists('current_page', $data ?? [], null); + $this->setIfExists('page_size', $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; } /** @@ -276,7 +369,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -284,7 +378,8 @@ public function listInvalidProperties() $allowedValues = $this->getGroupByAllowableValues(); if (!is_null($this->container['group_by']) && !in_array($this->container['group_by'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'group_by', must be one of '%s'", + "invalid value '%s' for 'group_by', must be one of '%s'", + $this->container['group_by'], implode("', '", $allowedValues) ); } @@ -307,7 +402,7 @@ public function valid() /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -317,17 +412,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -340,7 +439,7 @@ public function setStatus($status) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -350,12 +449,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -364,7 +466,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -374,12 +476,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -388,7 +493,7 @@ public function setToDate($to_date) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -398,12 +503,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -412,7 +520,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -422,12 +530,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -436,7 +547,7 @@ public function setLocationId($location_id) /** * Gets expense_category_id * - * @return int + * @return int|null */ public function getExpenseCategoryId() { @@ -446,12 +557,15 @@ public function getExpenseCategoryId() /** * Sets expense_category_id * - * @param int $expense_category_id + * @param int|null $expense_category_id * - * @return $this + * @return self */ public function setExpenseCategoryId($expense_category_id) { + if (is_null($expense_category_id)) { + throw new \InvalidArgumentException('non-nullable expense_category_id cannot be null'); + } $this->container['expense_category_id'] = $expense_category_id; return $this; @@ -460,7 +574,7 @@ public function setExpenseCategoryId($expense_category_id) /** * Gets group_by * - * @return string + * @return string|null */ public function getGroupBy() { @@ -470,17 +584,21 @@ public function getGroupBy() /** * Sets group_by * - * @param string $group_by + * @param string|null $group_by * - * @return $this + * @return self */ public function setGroupBy($group_by) { + if (is_null($group_by)) { + throw new \InvalidArgumentException('non-nullable group_by cannot be null'); + } $allowedValues = $this->getGroupByAllowableValues(); - if (!is_null($group_by) && !in_array($group_by, $allowedValues, true)) { + if (!in_array($group_by, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'group_by', must be one of '%s'", + "Invalid value '%s' for 'group_by', must be one of '%s'", + $group_by, implode("', '", $allowedValues) ) ); @@ -493,7 +611,7 @@ public function setGroupBy($group_by) /** * Gets current_page * - * @return int + * @return int|null */ public function getCurrentPage() { @@ -503,12 +621,15 @@ public function getCurrentPage() /** * Sets current_page * - * @param int $current_page + * @param int|null $current_page * - * @return $this + * @return self */ public function setCurrentPage($current_page) { + if (is_null($current_page)) { + throw new \InvalidArgumentException('non-nullable current_page cannot be null'); + } $this->container['current_page'] = $current_page; return $this; @@ -517,7 +638,7 @@ public function setCurrentPage($current_page) /** * Gets page_size * - * @return int + * @return int|null */ public function getPageSize() { @@ -527,12 +648,15 @@ public function getPageSize() /** * Sets page_size * - * @param int $page_size + * @param int|null $page_size * - * @return $this + * @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; @@ -544,7 +668,7 @@ public function setPageSize($page_size) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -554,22 +678,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -585,11 +710,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -597,13 +735,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseReferenceData.php b/src/lib/Model/ExpenseReferenceData.php index 77d0332..aea9ea4 100644 --- a/src/lib/Model/ExpenseReferenceData.php +++ b/src/lib/Model/ExpenseReferenceData.php @@ -2,64 +2,64 @@ /** * ExpenseReferenceData * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseReferenceData Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseReferenceData implements ModelInterface, ArrayAccess +class ExpenseReferenceData implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseReferenceData'; + protected static $openAPIModelName = 'ExpenseReferenceData'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'expense_categories' => '\Swagger\Client\Model\ExpenseCategoryResponseModel[]', - 'tax_codes' => '\Swagger\Client\Model\ExpenseTaxCode[]', - 'locations' => '\Swagger\Client\Model\LocationModel[]', + protected static $openAPITypes = [ + 'expense_categories' => '\OpenAPI\Client\Model\ExpenseCategoryResponseModel[]', + 'tax_codes' => '\OpenAPI\Client\Model\ExpenseTaxCode[]', + 'locations' => '\OpenAPI\Client\Model\LocationModel[]', 'default_location_id' => 'int' ]; @@ -67,22 +67,43 @@ class ExpenseReferenceData implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'expense_categories' => null, 'tax_codes' => null, 'locations' => null, 'default_location_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expense_categories' => false, + 'tax_codes' => false, + 'locations' => false, + 'default_location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['expense_categories'] = isset($data['expense_categories']) ? $data['expense_categories'] : null; - $this->container['tax_codes'] = isset($data['tax_codes']) ? $data['tax_codes'] : null; - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; - $this->container['default_location_id'] = isset($data['default_location_id']) ? $data['default_location_id'] : null; + $this->setIfExists('expense_categories', $data ?? [], null); + $this->setIfExists('tax_codes', $data ?? [], null); + $this->setIfExists('locations', $data ?? [], null); + $this->setIfExists('default_location_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets expense_categories * - * @return \Swagger\Client\Model\ExpenseCategoryResponseModel[] + * @return \OpenAPI\Client\Model\ExpenseCategoryResponseModel[]|null */ public function getExpenseCategories() { @@ -235,12 +323,15 @@ public function getExpenseCategories() /** * Sets expense_categories * - * @param \Swagger\Client\Model\ExpenseCategoryResponseModel[] $expense_categories + * @param \OpenAPI\Client\Model\ExpenseCategoryResponseModel[]|null $expense_categories * - * @return $this + * @return self */ public function setExpenseCategories($expense_categories) { + if (is_null($expense_categories)) { + throw new \InvalidArgumentException('non-nullable expense_categories cannot be null'); + } $this->container['expense_categories'] = $expense_categories; return $this; @@ -249,7 +340,7 @@ public function setExpenseCategories($expense_categories) /** * Gets tax_codes * - * @return \Swagger\Client\Model\ExpenseTaxCode[] + * @return \OpenAPI\Client\Model\ExpenseTaxCode[]|null */ public function getTaxCodes() { @@ -259,12 +350,15 @@ public function getTaxCodes() /** * Sets tax_codes * - * @param \Swagger\Client\Model\ExpenseTaxCode[] $tax_codes + * @param \OpenAPI\Client\Model\ExpenseTaxCode[]|null $tax_codes * - * @return $this + * @return self */ public function setTaxCodes($tax_codes) { + if (is_null($tax_codes)) { + throw new \InvalidArgumentException('non-nullable tax_codes cannot be null'); + } $this->container['tax_codes'] = $tax_codes; return $this; @@ -273,7 +367,7 @@ public function setTaxCodes($tax_codes) /** * Gets locations * - * @return \Swagger\Client\Model\LocationModel[] + * @return \OpenAPI\Client\Model\LocationModel[]|null */ public function getLocations() { @@ -283,12 +377,15 @@ public function getLocations() /** * Sets locations * - * @param \Swagger\Client\Model\LocationModel[] $locations + * @param \OpenAPI\Client\Model\LocationModel[]|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -297,7 +394,7 @@ public function setLocations($locations) /** * Gets default_location_id * - * @return int + * @return int|null */ public function getDefaultLocationId() { @@ -307,12 +404,15 @@ public function getDefaultLocationId() /** * Sets default_location_id * - * @param int $default_location_id + * @param int|null $default_location_id * - * @return $this + * @return self */ public function setDefaultLocationId($default_location_id) { + if (is_null($default_location_id)) { + throw new \InvalidArgumentException('non-nullable default_location_id cannot be null'); + } $this->container['default_location_id'] = $default_location_id; return $this; @@ -324,7 +424,7 @@ public function setDefaultLocationId($default_location_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseRequestEditLineItemModel.php b/src/lib/Model/ExpenseRequestEditLineItemModel.php index dbf7f45..e0bbf88 100644 --- a/src/lib/Model/ExpenseRequestEditLineItemModel.php +++ b/src/lib/Model/ExpenseRequestEditLineItemModel.php @@ -2,69 +2,69 @@ /** * ExpenseRequestEditLineItemModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseRequestEditLineItemModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseRequestEditLineItemModel implements ModelInterface, ArrayAccess +class ExpenseRequestEditLineItemModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseRequestEditLineItemModel'; + protected static $openAPIModelName = 'ExpenseRequestEditLineItemModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'expense_category_id' => 'int', 'location_id' => 'int', 'notes' => 'string', 'tax_code' => 'string', 'tax_code_display_name' => 'string', - 'tax_rate' => 'double', - 'amount' => 'double', + 'tax_rate' => 'float', + 'amount' => 'float', 'date_incurred' => '\DateTime' ]; @@ -72,8 +72,10 @@ class ExpenseRequestEditLineItemModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'expense_category_id' => 'int32', 'location_id' => 'int32', @@ -85,14 +87,38 @@ class ExpenseRequestEditLineItemModel implements ModelInterface, ArrayAccess 'date_incurred' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'expense_category_id' => false, + 'location_id' => false, + 'notes' => false, + 'tax_code' => false, + 'tax_code_display_name' => false, + 'tax_rate' => false, + 'amount' => false, + 'date_incurred' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['expense_category_id'] = isset($data['expense_category_id']) ? $data['expense_category_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_code_display_name'] = isset($data['tax_code_display_name']) ? $data['tax_code_display_name'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['date_incurred'] = isset($data['date_incurred']) ? $data['date_incurred'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('expense_category_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_code_display_name', $data ?? [], null); + $this->setIfExists('tax_rate', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('date_incurred', $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; } /** @@ -259,7 +352,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -269,12 +362,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -283,7 +379,7 @@ public function setId($id) /** * Gets expense_category_id * - * @return int + * @return int|null */ public function getExpenseCategoryId() { @@ -293,12 +389,15 @@ public function getExpenseCategoryId() /** * Sets expense_category_id * - * @param int $expense_category_id + * @param int|null $expense_category_id * - * @return $this + * @return self */ public function setExpenseCategoryId($expense_category_id) { + if (is_null($expense_category_id)) { + throw new \InvalidArgumentException('non-nullable expense_category_id cannot be null'); + } $this->container['expense_category_id'] = $expense_category_id; return $this; @@ -307,7 +406,7 @@ public function setExpenseCategoryId($expense_category_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -317,12 +416,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -331,7 +433,7 @@ public function setLocationId($location_id) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -341,13 +443,16 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { - if (!is_null($notes) && (mb_strlen($notes) > 255)) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } + if ((mb_strlen($notes) > 255)) { throw new \InvalidArgumentException('invalid length for $notes when calling ExpenseRequestEditLineItemModel., must be smaller than or equal to 255.'); } @@ -359,7 +464,7 @@ public function setNotes($notes) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -369,12 +474,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -383,7 +491,7 @@ public function setTaxCode($tax_code) /** * Gets tax_code_display_name * - * @return string + * @return string|null */ public function getTaxCodeDisplayName() { @@ -393,12 +501,15 @@ public function getTaxCodeDisplayName() /** * Sets tax_code_display_name * - * @param string $tax_code_display_name + * @param string|null $tax_code_display_name * - * @return $this + * @return self */ public function setTaxCodeDisplayName($tax_code_display_name) { + if (is_null($tax_code_display_name)) { + throw new \InvalidArgumentException('non-nullable tax_code_display_name cannot be null'); + } $this->container['tax_code_display_name'] = $tax_code_display_name; return $this; @@ -407,7 +518,7 @@ public function setTaxCodeDisplayName($tax_code_display_name) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -417,12 +528,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -431,7 +545,7 @@ public function setTaxRate($tax_rate) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -441,12 +555,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -455,7 +572,7 @@ public function setAmount($amount) /** * Gets date_incurred * - * @return \DateTime + * @return \DateTime|null */ public function getDateIncurred() { @@ -465,12 +582,15 @@ public function getDateIncurred() /** * Sets date_incurred * - * @param \DateTime $date_incurred + * @param \DateTime|null $date_incurred * - * @return $this + * @return self */ public function setDateIncurred($date_incurred) { + if (is_null($date_incurred)) { + throw new \InvalidArgumentException('non-nullable date_incurred cannot be null'); + } $this->container['date_incurred'] = $date_incurred; return $this; @@ -482,7 +602,7 @@ public function setDateIncurred($date_incurred) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -492,22 +612,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -523,11 +644,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -535,13 +669,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseRequestEditModel.php b/src/lib/Model/ExpenseRequestEditModel.php index 09fe02b..2fadc56 100644 --- a/src/lib/Model/ExpenseRequestEditModel.php +++ b/src/lib/Model/ExpenseRequestEditModel.php @@ -2,74 +2,76 @@ /** * ExpenseRequestEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseRequestEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseRequestEditModel implements ModelInterface, ArrayAccess +class ExpenseRequestEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseRequestEditModel'; + protected static $openAPIModelName = 'ExpenseRequestEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'attachments' => '\Swagger\Client\Model\AttachmentModel[]', + protected static $openAPITypes = [ + 'attachments' => '\OpenAPI\Client\Model\AttachmentModel[]', 'id' => 'int', 'employee_id' => 'int', 'description' => 'string', - 'line_items' => '\Swagger\Client\Model\ExpenseRequestEditLineItemModel[]' + 'line_items' => '\OpenAPI\Client\Model\ExpenseRequestEditLineItemModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'attachments' => null, 'id' => 'int32', 'employee_id' => 'int32', @@ -77,14 +79,34 @@ class ExpenseRequestEditModel implements ModelInterface, ArrayAccess 'line_items' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'attachments' => false, + 'id' => false, + 'employee_id' => false, + 'description' => false, + 'line_items' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['line_items'] = isset($data['line_items']) ? $data['line_items'] : null; + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('line_items', $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; } /** @@ -238,7 +327,7 @@ public function valid() /** * Gets attachments * - * @return \Swagger\Client\Model\AttachmentModel[] + * @return \OpenAPI\Client\Model\AttachmentModel[]|null */ public function getAttachments() { @@ -248,12 +337,15 @@ public function getAttachments() /** * Sets attachments * - * @param \Swagger\Client\Model\AttachmentModel[] $attachments + * @param \OpenAPI\Client\Model\AttachmentModel[]|null $attachments * - * @return $this + * @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; @@ -262,7 +354,7 @@ public function setAttachments($attachments) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -272,12 +364,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -298,10 +393,13 @@ public function getEmployeeId() * * @param int $employee_id Required * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -310,7 +408,7 @@ public function setEmployeeId($employee_id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -320,13 +418,16 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { - if (!is_null($description) && (mb_strlen($description) > 255)) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + if ((mb_strlen($description) > 255)) { throw new \InvalidArgumentException('invalid length for $description when calling ExpenseRequestEditModel., must be smaller than or equal to 255.'); } @@ -338,7 +439,7 @@ public function setDescription($description) /** * Gets line_items * - * @return \Swagger\Client\Model\ExpenseRequestEditLineItemModel[] + * @return \OpenAPI\Client\Model\ExpenseRequestEditLineItemModel[]|null */ public function getLineItems() { @@ -348,12 +449,15 @@ public function getLineItems() /** * Sets line_items * - * @param \Swagger\Client\Model\ExpenseRequestEditLineItemModel[] $line_items + * @param \OpenAPI\Client\Model\ExpenseRequestEditLineItemModel[]|null $line_items * - * @return $this + * @return self */ public function setLineItems($line_items) { + if (is_null($line_items)) { + throw new \InvalidArgumentException('non-nullable line_items cannot be null'); + } $this->container['line_items'] = $line_items; return $this; @@ -365,7 +469,7 @@ public function setLineItems($line_items) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -375,22 +479,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -406,11 +511,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -418,13 +536,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseRequestLineItemModel.php b/src/lib/Model/ExpenseRequestLineItemModel.php index ca46823..7d6f476 100644 --- a/src/lib/Model/ExpenseRequestLineItemModel.php +++ b/src/lib/Model/ExpenseRequestLineItemModel.php @@ -2,61 +2,61 @@ /** * ExpenseRequestLineItemModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseRequestLineItemModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseRequestLineItemModel implements ModelInterface, ArrayAccess +class ExpenseRequestLineItemModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseRequestLineItemModel'; + protected static $openAPIModelName = 'ExpenseRequestLineItemModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'expense_category_name' => 'string', 'location_name' => 'string', 'id' => 'int', @@ -65,8 +65,8 @@ class ExpenseRequestLineItemModel implements ModelInterface, ArrayAccess 'notes' => 'string', 'tax_code' => 'string', 'tax_code_display_name' => 'string', - 'tax_rate' => 'double', - 'amount' => 'double', + 'tax_rate' => 'float', + 'amount' => 'float', 'date_incurred' => '\DateTime' ]; @@ -74,8 +74,10 @@ class ExpenseRequestLineItemModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'expense_category_name' => null, 'location_name' => null, 'id' => 'int32', @@ -89,14 +91,40 @@ class ExpenseRequestLineItemModel implements ModelInterface, ArrayAccess 'date_incurred' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expense_category_name' => false, + 'location_name' => false, + 'id' => false, + 'expense_category_id' => false, + 'location_id' => false, + 'notes' => false, + 'tax_code' => false, + 'tax_code_display_name' => false, + 'tax_rate' => false, + 'amount' => false, + 'date_incurred' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['expense_category_name'] = isset($data['expense_category_name']) ? $data['expense_category_name'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['expense_category_id'] = isset($data['expense_category_id']) ? $data['expense_category_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_code_display_name'] = isset($data['tax_code_display_name']) ? $data['tax_code_display_name'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['date_incurred'] = isset($data['date_incurred']) ? $data['date_incurred'] : null; + $this->setIfExists('expense_category_name', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('expense_category_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_code_display_name', $data ?? [], null); + $this->setIfExists('tax_rate', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('date_incurred', $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; } /** @@ -271,7 +366,7 @@ public function valid() /** * Gets expense_category_name * - * @return string + * @return string|null */ public function getExpenseCategoryName() { @@ -281,12 +376,15 @@ public function getExpenseCategoryName() /** * Sets expense_category_name * - * @param string $expense_category_name + * @param string|null $expense_category_name * - * @return $this + * @return self */ public function setExpenseCategoryName($expense_category_name) { + if (is_null($expense_category_name)) { + throw new \InvalidArgumentException('non-nullable expense_category_name cannot be null'); + } $this->container['expense_category_name'] = $expense_category_name; return $this; @@ -295,7 +393,7 @@ public function setExpenseCategoryName($expense_category_name) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -305,12 +403,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -319,7 +420,7 @@ public function setLocationName($location_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -329,12 +430,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -343,7 +447,7 @@ public function setId($id) /** * Gets expense_category_id * - * @return int + * @return int|null */ public function getExpenseCategoryId() { @@ -353,12 +457,15 @@ public function getExpenseCategoryId() /** * Sets expense_category_id * - * @param int $expense_category_id + * @param int|null $expense_category_id * - * @return $this + * @return self */ public function setExpenseCategoryId($expense_category_id) { + if (is_null($expense_category_id)) { + throw new \InvalidArgumentException('non-nullable expense_category_id cannot be null'); + } $this->container['expense_category_id'] = $expense_category_id; return $this; @@ -367,7 +474,7 @@ public function setExpenseCategoryId($expense_category_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -377,12 +484,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -391,7 +501,7 @@ public function setLocationId($location_id) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -401,13 +511,16 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { - if (!is_null($notes) && (mb_strlen($notes) > 255)) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } + if ((mb_strlen($notes) > 255)) { throw new \InvalidArgumentException('invalid length for $notes when calling ExpenseRequestLineItemModel., must be smaller than or equal to 255.'); } @@ -419,7 +532,7 @@ public function setNotes($notes) /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -429,12 +542,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -443,7 +559,7 @@ public function setTaxCode($tax_code) /** * Gets tax_code_display_name * - * @return string + * @return string|null */ public function getTaxCodeDisplayName() { @@ -453,12 +569,15 @@ public function getTaxCodeDisplayName() /** * Sets tax_code_display_name * - * @param string $tax_code_display_name + * @param string|null $tax_code_display_name * - * @return $this + * @return self */ public function setTaxCodeDisplayName($tax_code_display_name) { + if (is_null($tax_code_display_name)) { + throw new \InvalidArgumentException('non-nullable tax_code_display_name cannot be null'); + } $this->container['tax_code_display_name'] = $tax_code_display_name; return $this; @@ -467,7 +586,7 @@ public function setTaxCodeDisplayName($tax_code_display_name) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -477,12 +596,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -491,7 +613,7 @@ public function setTaxRate($tax_rate) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -501,12 +623,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -515,7 +640,7 @@ public function setAmount($amount) /** * Gets date_incurred * - * @return \DateTime + * @return \DateTime|null */ public function getDateIncurred() { @@ -525,12 +650,15 @@ public function getDateIncurred() /** * Sets date_incurred * - * @param \DateTime $date_incurred + * @param \DateTime|null $date_incurred * - * @return $this + * @return self */ public function setDateIncurred($date_incurred) { + if (is_null($date_incurred)) { + throw new \InvalidArgumentException('non-nullable date_incurred cannot be null'); + } $this->container['date_incurred'] = $date_incurred; return $this; @@ -542,7 +670,7 @@ public function setDateIncurred($date_incurred) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -552,22 +680,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -583,11 +712,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -595,13 +737,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseRequestResponseModel.php b/src/lib/Model/ExpenseRequestResponseModel.php index 7614d46..3983a4d 100644 --- a/src/lib/Model/ExpenseRequestResponseModel.php +++ b/src/lib/Model/ExpenseRequestResponseModel.php @@ -2,68 +2,68 @@ /** * ExpenseRequestResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseRequestResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseRequestResponseModel implements ModelInterface, ArrayAccess +class ExpenseRequestResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseRequestResponseModel'; + protected static $openAPIModelName = 'ExpenseRequestResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', 'employee_name' => 'string', 'status' => 'string', 'description' => 'string', - 'line_items' => '\Swagger\Client\Model\ExpenseRequestLineItemModel[]', - 'attachments' => '\Swagger\Client\Model\AttachmentModel[]', + 'line_items' => '\OpenAPI\Client\Model\ExpenseRequestLineItemModel[]', + 'attachments' => '\OpenAPI\Client\Model\AttachmentModel[]', 'status_updated_by_user' => 'string', 'status_update_notes' => 'string', 'date_status_updated' => '\DateTime', @@ -74,8 +74,10 @@ class ExpenseRequestResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'employee_name' => null, @@ -89,14 +91,40 @@ class ExpenseRequestResponseModel implements ModelInterface, ArrayAccess 'date_created' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'employee_name' => false, + 'status' => false, + 'description' => false, + 'line_items' => false, + 'attachments' => false, + 'status_updated_by_user' => false, + 'status_update_notes' => false, + 'date_status_updated' => false, + 'date_created' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['line_items'] = isset($data['line_items']) ? $data['line_items'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['status_updated_by_user'] = isset($data['status_updated_by_user']) ? $data['status_updated_by_user'] : null; - $this->container['status_update_notes'] = isset($data['status_update_notes']) ? $data['status_update_notes'] : null; - $this->container['date_status_updated'] = isset($data['date_status_updated']) ? $data['date_status_updated'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('line_items', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('status_updated_by_user', $data ?? [], null); + $this->setIfExists('status_update_notes', $data ?? [], null); + $this->setIfExists('date_status_updated', $data ?? [], null); + $this->setIfExists('date_created', $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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -277,12 +372,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -291,7 +389,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -301,12 +399,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -315,7 +416,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -325,12 +426,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -339,7 +443,7 @@ public function setEmployeeName($employee_name) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -349,12 +453,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -363,7 +470,7 @@ public function setStatus($status) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -373,12 +480,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -387,7 +497,7 @@ public function setDescription($description) /** * Gets line_items * - * @return \Swagger\Client\Model\ExpenseRequestLineItemModel[] + * @return \OpenAPI\Client\Model\ExpenseRequestLineItemModel[]|null */ public function getLineItems() { @@ -397,12 +507,15 @@ public function getLineItems() /** * Sets line_items * - * @param \Swagger\Client\Model\ExpenseRequestLineItemModel[] $line_items + * @param \OpenAPI\Client\Model\ExpenseRequestLineItemModel[]|null $line_items * - * @return $this + * @return self */ public function setLineItems($line_items) { + if (is_null($line_items)) { + throw new \InvalidArgumentException('non-nullable line_items cannot be null'); + } $this->container['line_items'] = $line_items; return $this; @@ -411,7 +524,7 @@ public function setLineItems($line_items) /** * Gets attachments * - * @return \Swagger\Client\Model\AttachmentModel[] + * @return \OpenAPI\Client\Model\AttachmentModel[]|null */ public function getAttachments() { @@ -421,12 +534,15 @@ public function getAttachments() /** * Sets attachments * - * @param \Swagger\Client\Model\AttachmentModel[] $attachments + * @param \OpenAPI\Client\Model\AttachmentModel[]|null $attachments * - * @return $this + * @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; @@ -435,7 +551,7 @@ public function setAttachments($attachments) /** * Gets status_updated_by_user * - * @return string + * @return string|null */ public function getStatusUpdatedByUser() { @@ -445,12 +561,15 @@ public function getStatusUpdatedByUser() /** * Sets status_updated_by_user * - * @param string $status_updated_by_user + * @param string|null $status_updated_by_user * - * @return $this + * @return self */ public function setStatusUpdatedByUser($status_updated_by_user) { + if (is_null($status_updated_by_user)) { + throw new \InvalidArgumentException('non-nullable status_updated_by_user cannot be null'); + } $this->container['status_updated_by_user'] = $status_updated_by_user; return $this; @@ -459,7 +578,7 @@ public function setStatusUpdatedByUser($status_updated_by_user) /** * Gets status_update_notes * - * @return string + * @return string|null */ public function getStatusUpdateNotes() { @@ -469,12 +588,15 @@ public function getStatusUpdateNotes() /** * Sets status_update_notes * - * @param string $status_update_notes + * @param string|null $status_update_notes * - * @return $this + * @return self */ public function setStatusUpdateNotes($status_update_notes) { + if (is_null($status_update_notes)) { + throw new \InvalidArgumentException('non-nullable status_update_notes cannot be null'); + } $this->container['status_update_notes'] = $status_update_notes; return $this; @@ -483,7 +605,7 @@ public function setStatusUpdateNotes($status_update_notes) /** * Gets date_status_updated * - * @return \DateTime + * @return \DateTime|null */ public function getDateStatusUpdated() { @@ -493,12 +615,15 @@ public function getDateStatusUpdated() /** * Sets date_status_updated * - * @param \DateTime $date_status_updated + * @param \DateTime|null $date_status_updated * - * @return $this + * @return self */ public function setDateStatusUpdated($date_status_updated) { + if (is_null($date_status_updated)) { + throw new \InvalidArgumentException('non-nullable date_status_updated cannot be null'); + } $this->container['date_status_updated'] = $date_status_updated; return $this; @@ -507,7 +632,7 @@ public function setDateStatusUpdated($date_status_updated) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -517,12 +642,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -534,7 +662,7 @@ public function setDateCreated($date_created) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ExpenseTaxCode.php b/src/lib/Model/ExpenseTaxCode.php index f77c29d..f17ca32 100644 --- a/src/lib/Model/ExpenseTaxCode.php +++ b/src/lib/Model/ExpenseTaxCode.php @@ -2,85 +2,105 @@ /** * ExpenseTaxCode * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ExpenseTaxCode Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ExpenseTaxCode implements ModelInterface, ArrayAccess +class ExpenseTaxCode implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ExpenseTaxCode'; + protected static $openAPIModelName = 'ExpenseTaxCode'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'tax_code' => 'string', 'tax_code_display_name' => 'string', - 'tax_rate' => 'double' + 'tax_rate' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'tax_code' => null, 'tax_code_display_name' => null, 'tax_rate' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tax_code' => false, + 'tax_code_display_name' => false, + 'tax_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['tax_code'] = isset($data['tax_code']) ? $data['tax_code'] : null; - $this->container['tax_code_display_name'] = isset($data['tax_code_display_name']) ? $data['tax_code_display_name'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; + $this->setIfExists('tax_code', $data ?? [], null); + $this->setIfExists('tax_code_display_name', $data ?? [], null); + $this->setIfExists('tax_rate', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets tax_code * - * @return string + * @return string|null */ public function getTaxCode() { @@ -229,12 +316,15 @@ public function getTaxCode() /** * Sets tax_code * - * @param string $tax_code + * @param string|null $tax_code * - * @return $this + * @return self */ public function setTaxCode($tax_code) { + if (is_null($tax_code)) { + throw new \InvalidArgumentException('non-nullable tax_code cannot be null'); + } $this->container['tax_code'] = $tax_code; return $this; @@ -243,7 +333,7 @@ public function setTaxCode($tax_code) /** * Gets tax_code_display_name * - * @return string + * @return string|null */ public function getTaxCodeDisplayName() { @@ -253,12 +343,15 @@ public function getTaxCodeDisplayName() /** * Sets tax_code_display_name * - * @param string $tax_code_display_name + * @param string|null $tax_code_display_name * - * @return $this + * @return self */ public function setTaxCodeDisplayName($tax_code_display_name) { + if (is_null($tax_code_display_name)) { + throw new \InvalidArgumentException('non-nullable tax_code_display_name cannot be null'); + } $this->container['tax_code_display_name'] = $tax_code_display_name; return $this; @@ -267,7 +360,7 @@ public function setTaxCodeDisplayName($tax_code_display_name) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -277,12 +370,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -294,7 +390,7 @@ public function setTaxRate($tax_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/FilterClause.php b/src/lib/Model/FilterClause.php index 78ec13e..d64e898 100644 --- a/src/lib/Model/FilterClause.php +++ b/src/lib/Model/FilterClause.php @@ -2,85 +2,105 @@ /** * FilterClause * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * FilterClause Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class FilterClause implements ModelInterface, ArrayAccess +class FilterClause implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'FilterClause'; + protected static $openAPIModelName = 'FilterClause'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'expression' => '\Swagger\Client\Model\SingleValueNode', - 'range_variable' => '\Swagger\Client\Model\RangeVariable', - 'item_type' => '\Swagger\Client\Model\IEdmTypeReference' + protected static $openAPITypes = [ + 'expression' => '\OpenAPI\Client\Model\SingleValueNode', + 'range_variable' => '\OpenAPI\Client\Model\RangeVariable', + 'item_type' => '\OpenAPI\Client\Model\IEdmTypeReference' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'expression' => null, 'range_variable' => null, 'item_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expression' => false, + 'range_variable' => false, + 'item_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['expression'] = isset($data['expression']) ? $data['expression'] : null; - $this->container['range_variable'] = isset($data['range_variable']) ? $data['range_variable'] : null; - $this->container['item_type'] = isset($data['item_type']) ? $data['item_type'] : null; + $this->setIfExists('expression', $data ?? [], null); + $this->setIfExists('range_variable', $data ?? [], null); + $this->setIfExists('item_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets expression * - * @return \Swagger\Client\Model\SingleValueNode + * @return \OpenAPI\Client\Model\SingleValueNode|null */ public function getExpression() { @@ -229,12 +316,15 @@ public function getExpression() /** * Sets expression * - * @param \Swagger\Client\Model\SingleValueNode $expression + * @param \OpenAPI\Client\Model\SingleValueNode|null $expression expression * - * @return $this + * @return self */ public function setExpression($expression) { + if (is_null($expression)) { + throw new \InvalidArgumentException('non-nullable expression cannot be null'); + } $this->container['expression'] = $expression; return $this; @@ -243,7 +333,7 @@ public function setExpression($expression) /** * Gets range_variable * - * @return \Swagger\Client\Model\RangeVariable + * @return \OpenAPI\Client\Model\RangeVariable|null */ public function getRangeVariable() { @@ -253,12 +343,15 @@ public function getRangeVariable() /** * Sets range_variable * - * @param \Swagger\Client\Model\RangeVariable $range_variable + * @param \OpenAPI\Client\Model\RangeVariable|null $range_variable range_variable * - * @return $this + * @return self */ public function setRangeVariable($range_variable) { + if (is_null($range_variable)) { + throw new \InvalidArgumentException('non-nullable range_variable cannot be null'); + } $this->container['range_variable'] = $range_variable; return $this; @@ -267,7 +360,7 @@ public function setRangeVariable($range_variable) /** * Gets item_type * - * @return \Swagger\Client\Model\IEdmTypeReference + * @return \OpenAPI\Client\Model\IEdmTypeReference|null */ public function getItemType() { @@ -277,12 +370,15 @@ public function getItemType() /** * Sets item_type * - * @param \Swagger\Client\Model\IEdmTypeReference $item_type + * @param \OpenAPI\Client\Model\IEdmTypeReference|null $item_type item_type * - * @return $this + * @return self */ public function setItemType($item_type) { + if (is_null($item_type)) { + throw new \InvalidArgumentException('non-nullable item_type cannot be null'); + } $this->container['item_type'] = $item_type; return $this; @@ -294,7 +390,7 @@ public function setItemType($item_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/FilterQueryOption.php b/src/lib/Model/FilterQueryOption.php index 5d3e326..0bb4fb1 100644 --- a/src/lib/Model/FilterQueryOption.php +++ b/src/lib/Model/FilterQueryOption.php @@ -2,64 +2,64 @@ /** * FilterQueryOption * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * FilterQueryOption Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class FilterQueryOption implements ModelInterface, ArrayAccess +class FilterQueryOption implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'FilterQueryOption'; + protected static $openAPIModelName = 'FilterQueryOption'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'context' => '\Swagger\Client\Model\ODataQueryContext', - 'validator' => '\Swagger\Client\Model\FilterQueryValidator', - 'filter_clause' => '\Swagger\Client\Model\FilterClause', + protected static $openAPITypes = [ + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', + 'validator' => 'object', + 'filter_clause' => '\OpenAPI\Client\Model\FilterClause', 'raw_value' => 'string' ]; @@ -67,22 +67,43 @@ class FilterQueryOption implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'context' => null, 'validator' => null, 'filter_clause' => null, 'raw_value' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'context' => false, + 'validator' => false, + 'filter_clause' => false, + 'raw_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; - $this->container['filter_clause'] = isset($data['filter_clause']) ? $data['filter_clause'] : null; - $this->container['raw_value'] = isset($data['raw_value']) ? $data['raw_value'] : null; + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('validator', $data ?? [], null); + $this->setIfExists('filter_clause', $data ?? [], null); + $this->setIfExists('raw_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -235,12 +323,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -249,7 +340,7 @@ public function setContext($context) /** * Gets validator * - * @return \Swagger\Client\Model\FilterQueryValidator + * @return object|null */ public function getValidator() { @@ -259,12 +350,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\FilterQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -273,7 +367,7 @@ public function setValidator($validator) /** * Gets filter_clause * - * @return \Swagger\Client\Model\FilterClause + * @return \OpenAPI\Client\Model\FilterClause|null */ public function getFilterClause() { @@ -283,12 +377,15 @@ public function getFilterClause() /** * Sets filter_clause * - * @param \Swagger\Client\Model\FilterClause $filter_clause + * @param \OpenAPI\Client\Model\FilterClause|null $filter_clause filter_clause * - * @return $this + * @return self */ public function setFilterClause($filter_clause) { + if (is_null($filter_clause)) { + throw new \InvalidArgumentException('non-nullable filter_clause cannot be null'); + } $this->container['filter_clause'] = $filter_clause; return $this; @@ -297,7 +394,7 @@ public function setFilterClause($filter_clause) /** * Gets raw_value * - * @return string + * @return string|null */ public function getRawValue() { @@ -307,12 +404,15 @@ public function getRawValue() /** * Sets raw_value * - * @param string $raw_value + * @param string|null $raw_value * - * @return $this + * @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; @@ -324,7 +424,7 @@ public function setRawValue($raw_value) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/FilterQueryValidator.php b/src/lib/Model/FilterQueryValidator.php deleted file mode 100644 index af6021d..0000000 --- a/src/lib/Model/FilterQueryValidator.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/FinalisePayRunOptions.php b/src/lib/Model/FinalisePayRunOptions.php index a7570fc..b386e85 100644 --- a/src/lib/Model/FinalisePayRunOptions.php +++ b/src/lib/Model/FinalisePayRunOptions.php @@ -2,61 +2,61 @@ /** * FinalisePayRunOptions * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * FinalisePayRunOptions Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class FinalisePayRunOptions implements ModelInterface, ArrayAccess +class FinalisePayRunOptions implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'FinalisePayRunOptions'; + protected static $openAPIModelName = 'FinalisePayRunOptions'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_id' => 'int', 'date_paid' => '\DateTime', 'export_journals' => 'bool', @@ -88,8 +88,10 @@ class FinalisePayRunOptions implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_id' => 'int32', 'date_paid' => 'date-time', 'export_journals' => null, @@ -117,14 +119,54 @@ class FinalisePayRunOptions implements ModelInterface, ArrayAccess 'from_pay_run_automation' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_id' => false, + 'date_paid' => false, + 'export_journals' => false, + 'publish_pay_slips' => false, + 'publish_pay_slips_date_time' => false, + 'suppress_notifications' => false, + 'lodge_pay_run' => false, + 'lodge_pay_run_in_test_mode' => false, + 'submit_to_pension_sync' => false, + 'lodge_final_pay_run' => false, + 'relodge_hmrc_late_submission_reason' => false, + 'relodge_selected_employees_only' => false, + 'finalise_as_admin' => false, + 'publish_pay_slips_preference' => false, + 'export_journals_preference' => false, + 'export_journals_date_time' => false, + 'lodge_pay_run_preference' => false, + 'lodge_pay_run_date_time' => false, + 'run_report_packs_preference' => false, + 'run_report_packs_date_time' => false, + 'report_packs_to_run' => false, + 'submit_to_pension_sync_preference' => false, + 'submit_to_pension_sync_date_time' => false, + 'save_changes_to_default_settings' => false, + 'from_pay_run_automation' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -132,9 +174,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -275,38 +369,36 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; - const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; - const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_A = 'A'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_B = 'B'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_C = 'C'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_D = 'D'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_E = 'E'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_F = 'F'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_G = 'G'; - const RELODGE_HMRC_LATE_SUBMISSION_REASON_H = 'H'; - const PUBLISH_PAY_SLIPS_PREFERENCE_MANUAL = 'Manual'; - const PUBLISH_PAY_SLIPS_PREFERENCE_IMMEDIATE = 'Immediate'; - const PUBLISH_PAY_SLIPS_PREFERENCE_SCHEDULED = 'Scheduled'; - const EXPORT_JOURNALS_PREFERENCE_MANUAL = 'Manual'; - const EXPORT_JOURNALS_PREFERENCE_IMMEDIATE = 'Immediate'; - const EXPORT_JOURNALS_PREFERENCE_SCHEDULED = 'Scheduled'; - const LODGE_PAY_RUN_PREFERENCE_MANUAL = 'Manual'; - const LODGE_PAY_RUN_PREFERENCE_IMMEDIATE = 'Immediate'; - const LODGE_PAY_RUN_PREFERENCE_SCHEDULED = 'Scheduled'; - const RUN_REPORT_PACKS_PREFERENCE_MANUAL = 'Manual'; - const RUN_REPORT_PACKS_PREFERENCE_IMMEDIATE = 'Immediate'; - const RUN_REPORT_PACKS_PREFERENCE_SCHEDULED = 'Scheduled'; - const SUBMIT_TO_PENSION_SYNC_PREFERENCE_MANUAL = 'Manual'; - const SUBMIT_TO_PENSION_SYNC_PREFERENCE_IMMEDIATE = 'Immediate'; - const SUBMIT_TO_PENSION_SYNC_PREFERENCE_SCHEDULED = 'Scheduled'; - - - + return self::$openAPIModelName; + } + + public const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; + public const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; + public const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_A = 'A'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_B = 'B'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_C = 'C'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_D = 'D'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_E = 'E'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_F = 'F'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_G = 'G'; + public const RELODGE_HMRC_LATE_SUBMISSION_REASON_H = 'H'; + public const PUBLISH_PAY_SLIPS_PREFERENCE_MANUAL = 'Manual'; + public const PUBLISH_PAY_SLIPS_PREFERENCE_IMMEDIATE = 'Immediate'; + public const PUBLISH_PAY_SLIPS_PREFERENCE_SCHEDULED = 'Scheduled'; + public const EXPORT_JOURNALS_PREFERENCE_MANUAL = 'Manual'; + public const EXPORT_JOURNALS_PREFERENCE_IMMEDIATE = 'Immediate'; + public const EXPORT_JOURNALS_PREFERENCE_SCHEDULED = 'Scheduled'; + public const LODGE_PAY_RUN_PREFERENCE_MANUAL = 'Manual'; + public const LODGE_PAY_RUN_PREFERENCE_IMMEDIATE = 'Immediate'; + public const LODGE_PAY_RUN_PREFERENCE_SCHEDULED = 'Scheduled'; + public const RUN_REPORT_PACKS_PREFERENCE_MANUAL = 'Manual'; + public const RUN_REPORT_PACKS_PREFERENCE_IMMEDIATE = 'Immediate'; + public const RUN_REPORT_PACKS_PREFERENCE_SCHEDULED = 'Scheduled'; + public const SUBMIT_TO_PENSION_SYNC_PREFERENCE_MANUAL = 'Manual'; + public const SUBMIT_TO_PENSION_SYNC_PREFERENCE_IMMEDIATE = 'Immediate'; + public const SUBMIT_TO_PENSION_SYNC_PREFERENCE_SCHEDULED = 'Scheduled'; + /** * Gets allowable values of the enum * @@ -320,7 +412,7 @@ public function getPublishPaySlipsAllowableValues() self::PUBLISH_PAY_SLIPS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -339,7 +431,7 @@ public function getRelodgeHmrcLateSubmissionReasonAllowableValues() self::RELODGE_HMRC_LATE_SUBMISSION_REASON_H, ]; } - + /** * Gets allowable values of the enum * @@ -353,7 +445,7 @@ public function getPublishPaySlipsPreferenceAllowableValues() self::PUBLISH_PAY_SLIPS_PREFERENCE_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -367,7 +459,7 @@ public function getExportJournalsPreferenceAllowableValues() self::EXPORT_JOURNALS_PREFERENCE_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -381,7 +473,7 @@ public function getLodgePayRunPreferenceAllowableValues() self::LODGE_PAY_RUN_PREFERENCE_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -395,7 +487,7 @@ public function getRunReportPacksPreferenceAllowableValues() self::RUN_REPORT_PACKS_PREFERENCE_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -409,7 +501,6 @@ public function getSubmitToPensionSyncPreferenceAllowableValues() self::SUBMIT_TO_PENSION_SYNC_PREFERENCE_SCHEDULED, ]; } - /** * Associative array for storing property values @@ -426,31 +517,49 @@ public function getSubmitToPensionSyncPreferenceAllowableValues() */ public function __construct(array $data = null) { - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['export_journals'] = isset($data['export_journals']) ? $data['export_journals'] : null; - $this->container['publish_pay_slips'] = isset($data['publish_pay_slips']) ? $data['publish_pay_slips'] : null; - $this->container['publish_pay_slips_date_time'] = isset($data['publish_pay_slips_date_time']) ? $data['publish_pay_slips_date_time'] : null; - $this->container['suppress_notifications'] = isset($data['suppress_notifications']) ? $data['suppress_notifications'] : null; - $this->container['lodge_pay_run'] = isset($data['lodge_pay_run']) ? $data['lodge_pay_run'] : null; - $this->container['lodge_pay_run_in_test_mode'] = isset($data['lodge_pay_run_in_test_mode']) ? $data['lodge_pay_run_in_test_mode'] : null; - $this->container['submit_to_pension_sync'] = isset($data['submit_to_pension_sync']) ? $data['submit_to_pension_sync'] : null; - $this->container['lodge_final_pay_run'] = isset($data['lodge_final_pay_run']) ? $data['lodge_final_pay_run'] : null; - $this->container['relodge_hmrc_late_submission_reason'] = isset($data['relodge_hmrc_late_submission_reason']) ? $data['relodge_hmrc_late_submission_reason'] : null; - $this->container['relodge_selected_employees_only'] = isset($data['relodge_selected_employees_only']) ? $data['relodge_selected_employees_only'] : null; - $this->container['finalise_as_admin'] = isset($data['finalise_as_admin']) ? $data['finalise_as_admin'] : null; - $this->container['publish_pay_slips_preference'] = isset($data['publish_pay_slips_preference']) ? $data['publish_pay_slips_preference'] : null; - $this->container['export_journals_preference'] = isset($data['export_journals_preference']) ? $data['export_journals_preference'] : null; - $this->container['export_journals_date_time'] = isset($data['export_journals_date_time']) ? $data['export_journals_date_time'] : null; - $this->container['lodge_pay_run_preference'] = isset($data['lodge_pay_run_preference']) ? $data['lodge_pay_run_preference'] : null; - $this->container['lodge_pay_run_date_time'] = isset($data['lodge_pay_run_date_time']) ? $data['lodge_pay_run_date_time'] : null; - $this->container['run_report_packs_preference'] = isset($data['run_report_packs_preference']) ? $data['run_report_packs_preference'] : null; - $this->container['run_report_packs_date_time'] = isset($data['run_report_packs_date_time']) ? $data['run_report_packs_date_time'] : null; - $this->container['report_packs_to_run'] = isset($data['report_packs_to_run']) ? $data['report_packs_to_run'] : null; - $this->container['submit_to_pension_sync_preference'] = isset($data['submit_to_pension_sync_preference']) ? $data['submit_to_pension_sync_preference'] : null; - $this->container['submit_to_pension_sync_date_time'] = isset($data['submit_to_pension_sync_date_time']) ? $data['submit_to_pension_sync_date_time'] : null; - $this->container['save_changes_to_default_settings'] = isset($data['save_changes_to_default_settings']) ? $data['save_changes_to_default_settings'] : null; - $this->container['from_pay_run_automation'] = isset($data['from_pay_run_automation']) ? $data['from_pay_run_automation'] : null; + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('export_journals', $data ?? [], null); + $this->setIfExists('publish_pay_slips', $data ?? [], null); + $this->setIfExists('publish_pay_slips_date_time', $data ?? [], null); + $this->setIfExists('suppress_notifications', $data ?? [], null); + $this->setIfExists('lodge_pay_run', $data ?? [], null); + $this->setIfExists('lodge_pay_run_in_test_mode', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync', $data ?? [], null); + $this->setIfExists('lodge_final_pay_run', $data ?? [], null); + $this->setIfExists('relodge_hmrc_late_submission_reason', $data ?? [], null); + $this->setIfExists('relodge_selected_employees_only', $data ?? [], null); + $this->setIfExists('finalise_as_admin', $data ?? [], null); + $this->setIfExists('publish_pay_slips_preference', $data ?? [], null); + $this->setIfExists('export_journals_preference', $data ?? [], null); + $this->setIfExists('export_journals_date_time', $data ?? [], null); + $this->setIfExists('lodge_pay_run_preference', $data ?? [], null); + $this->setIfExists('lodge_pay_run_date_time', $data ?? [], null); + $this->setIfExists('run_report_packs_preference', $data ?? [], null); + $this->setIfExists('run_report_packs_date_time', $data ?? [], null); + $this->setIfExists('report_packs_to_run', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync_preference', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync_date_time', $data ?? [], null); + $this->setIfExists('save_changes_to_default_settings', $data ?? [], null); + $this->setIfExists('from_pay_run_automation', $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; } /** @@ -465,7 +574,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPaySlipsAllowableValues(); if (!is_null($this->container['publish_pay_slips']) && !in_array($this->container['publish_pay_slips'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_pay_slips', must be one of '%s'", + "invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $this->container['publish_pay_slips'], implode("', '", $allowedValues) ); } @@ -473,7 +583,8 @@ public function listInvalidProperties() $allowedValues = $this->getRelodgeHmrcLateSubmissionReasonAllowableValues(); if (!is_null($this->container['relodge_hmrc_late_submission_reason']) && !in_array($this->container['relodge_hmrc_late_submission_reason'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'relodge_hmrc_late_submission_reason', must be one of '%s'", + "invalid value '%s' for 'relodge_hmrc_late_submission_reason', must be one of '%s'", + $this->container['relodge_hmrc_late_submission_reason'], implode("', '", $allowedValues) ); } @@ -481,7 +592,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPaySlipsPreferenceAllowableValues(); if (!is_null($this->container['publish_pay_slips_preference']) && !in_array($this->container['publish_pay_slips_preference'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_pay_slips_preference', must be one of '%s'", + "invalid value '%s' for 'publish_pay_slips_preference', must be one of '%s'", + $this->container['publish_pay_slips_preference'], implode("', '", $allowedValues) ); } @@ -489,7 +601,8 @@ public function listInvalidProperties() $allowedValues = $this->getExportJournalsPreferenceAllowableValues(); if (!is_null($this->container['export_journals_preference']) && !in_array($this->container['export_journals_preference'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'export_journals_preference', must be one of '%s'", + "invalid value '%s' for 'export_journals_preference', must be one of '%s'", + $this->container['export_journals_preference'], implode("', '", $allowedValues) ); } @@ -497,7 +610,8 @@ public function listInvalidProperties() $allowedValues = $this->getLodgePayRunPreferenceAllowableValues(); if (!is_null($this->container['lodge_pay_run_preference']) && !in_array($this->container['lodge_pay_run_preference'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'lodge_pay_run_preference', must be one of '%s'", + "invalid value '%s' for 'lodge_pay_run_preference', must be one of '%s'", + $this->container['lodge_pay_run_preference'], implode("', '", $allowedValues) ); } @@ -505,7 +619,8 @@ public function listInvalidProperties() $allowedValues = $this->getRunReportPacksPreferenceAllowableValues(); if (!is_null($this->container['run_report_packs_preference']) && !in_array($this->container['run_report_packs_preference'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'run_report_packs_preference', must be one of '%s'", + "invalid value '%s' for 'run_report_packs_preference', must be one of '%s'", + $this->container['run_report_packs_preference'], implode("', '", $allowedValues) ); } @@ -513,7 +628,8 @@ public function listInvalidProperties() $allowedValues = $this->getSubmitToPensionSyncPreferenceAllowableValues(); if (!is_null($this->container['submit_to_pension_sync_preference']) && !in_array($this->container['submit_to_pension_sync_preference'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'submit_to_pension_sync_preference', must be one of '%s'", + "invalid value '%s' for 'submit_to_pension_sync_preference', must be one of '%s'", + $this->container['submit_to_pension_sync_preference'], implode("', '", $allowedValues) ); } @@ -536,7 +652,7 @@ public function valid() /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -546,12 +662,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -560,7 +679,7 @@ public function setPayRunId($pay_run_id) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -570,12 +689,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -584,7 +706,7 @@ public function setDatePaid($date_paid) /** * Gets export_journals * - * @return bool + * @return bool|null */ public function getExportJournals() { @@ -594,12 +716,15 @@ public function getExportJournals() /** * Sets export_journals * - * @param bool $export_journals + * @param bool|null $export_journals * - * @return $this + * @return self */ public function setExportJournals($export_journals) { + if (is_null($export_journals)) { + throw new \InvalidArgumentException('non-nullable export_journals cannot be null'); + } $this->container['export_journals'] = $export_journals; return $this; @@ -608,7 +733,7 @@ public function setExportJournals($export_journals) /** * Gets publish_pay_slips * - * @return string + * @return string|null */ public function getPublishPaySlips() { @@ -618,17 +743,21 @@ public function getPublishPaySlips() /** * Sets publish_pay_slips * - * @param string $publish_pay_slips + * @param string|null $publish_pay_slips * - * @return $this + * @return self */ public function setPublishPaySlips($publish_pay_slips) { + if (is_null($publish_pay_slips)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips cannot be null'); + } $allowedValues = $this->getPublishPaySlipsAllowableValues(); - if (!is_null($publish_pay_slips) && !in_array($publish_pay_slips, $allowedValues, true)) { + if (!in_array($publish_pay_slips, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_pay_slips', must be one of '%s'", + "Invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $publish_pay_slips, implode("', '", $allowedValues) ) ); @@ -641,7 +770,7 @@ public function setPublishPaySlips($publish_pay_slips) /** * Gets publish_pay_slips_date_time * - * @return \DateTime + * @return \DateTime|null */ public function getPublishPaySlipsDateTime() { @@ -651,12 +780,15 @@ public function getPublishPaySlipsDateTime() /** * Sets publish_pay_slips_date_time * - * @param \DateTime $publish_pay_slips_date_time + * @param \DateTime|null $publish_pay_slips_date_time * - * @return $this + * @return self */ public function setPublishPaySlipsDateTime($publish_pay_slips_date_time) { + if (is_null($publish_pay_slips_date_time)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_date_time cannot be null'); + } $this->container['publish_pay_slips_date_time'] = $publish_pay_slips_date_time; return $this; @@ -665,7 +797,7 @@ public function setPublishPaySlipsDateTime($publish_pay_slips_date_time) /** * Gets suppress_notifications * - * @return bool + * @return bool|null */ public function getSuppressNotifications() { @@ -675,12 +807,15 @@ public function getSuppressNotifications() /** * Sets suppress_notifications * - * @param bool $suppress_notifications + * @param bool|null $suppress_notifications * - * @return $this + * @return self */ public function setSuppressNotifications($suppress_notifications) { + if (is_null($suppress_notifications)) { + throw new \InvalidArgumentException('non-nullable suppress_notifications cannot be null'); + } $this->container['suppress_notifications'] = $suppress_notifications; return $this; @@ -689,7 +824,7 @@ public function setSuppressNotifications($suppress_notifications) /** * Gets lodge_pay_run * - * @return bool + * @return bool|null */ public function getLodgePayRun() { @@ -699,12 +834,15 @@ public function getLodgePayRun() /** * Sets lodge_pay_run * - * @param bool $lodge_pay_run + * @param bool|null $lodge_pay_run * - * @return $this + * @return self */ public function setLodgePayRun($lodge_pay_run) { + if (is_null($lodge_pay_run)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run cannot be null'); + } $this->container['lodge_pay_run'] = $lodge_pay_run; return $this; @@ -713,7 +851,7 @@ public function setLodgePayRun($lodge_pay_run) /** * Gets lodge_pay_run_in_test_mode * - * @return bool + * @return bool|null */ public function getLodgePayRunInTestMode() { @@ -723,12 +861,15 @@ public function getLodgePayRunInTestMode() /** * Sets lodge_pay_run_in_test_mode * - * @param bool $lodge_pay_run_in_test_mode + * @param bool|null $lodge_pay_run_in_test_mode * - * @return $this + * @return self */ public function setLodgePayRunInTestMode($lodge_pay_run_in_test_mode) { + if (is_null($lodge_pay_run_in_test_mode)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_in_test_mode cannot be null'); + } $this->container['lodge_pay_run_in_test_mode'] = $lodge_pay_run_in_test_mode; return $this; @@ -737,7 +878,7 @@ public function setLodgePayRunInTestMode($lodge_pay_run_in_test_mode) /** * Gets submit_to_pension_sync * - * @return bool + * @return bool|null */ public function getSubmitToPensionSync() { @@ -747,12 +888,15 @@ public function getSubmitToPensionSync() /** * Sets submit_to_pension_sync * - * @param bool $submit_to_pension_sync + * @param bool|null $submit_to_pension_sync * - * @return $this + * @return self */ public function setSubmitToPensionSync($submit_to_pension_sync) { + if (is_null($submit_to_pension_sync)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync cannot be null'); + } $this->container['submit_to_pension_sync'] = $submit_to_pension_sync; return $this; @@ -761,7 +905,7 @@ public function setSubmitToPensionSync($submit_to_pension_sync) /** * Gets lodge_final_pay_run * - * @return bool + * @return bool|null */ public function getLodgeFinalPayRun() { @@ -771,12 +915,15 @@ public function getLodgeFinalPayRun() /** * Sets lodge_final_pay_run * - * @param bool $lodge_final_pay_run + * @param bool|null $lodge_final_pay_run * - * @return $this + * @return self */ public function setLodgeFinalPayRun($lodge_final_pay_run) { + if (is_null($lodge_final_pay_run)) { + throw new \InvalidArgumentException('non-nullable lodge_final_pay_run cannot be null'); + } $this->container['lodge_final_pay_run'] = $lodge_final_pay_run; return $this; @@ -785,7 +932,7 @@ public function setLodgeFinalPayRun($lodge_final_pay_run) /** * Gets relodge_hmrc_late_submission_reason * - * @return string + * @return string|null */ public function getRelodgeHmrcLateSubmissionReason() { @@ -795,17 +942,21 @@ public function getRelodgeHmrcLateSubmissionReason() /** * Sets relodge_hmrc_late_submission_reason * - * @param string $relodge_hmrc_late_submission_reason + * @param string|null $relodge_hmrc_late_submission_reason * - * @return $this + * @return self */ public function setRelodgeHmrcLateSubmissionReason($relodge_hmrc_late_submission_reason) { + if (is_null($relodge_hmrc_late_submission_reason)) { + throw new \InvalidArgumentException('non-nullable relodge_hmrc_late_submission_reason cannot be null'); + } $allowedValues = $this->getRelodgeHmrcLateSubmissionReasonAllowableValues(); - if (!is_null($relodge_hmrc_late_submission_reason) && !in_array($relodge_hmrc_late_submission_reason, $allowedValues, true)) { + if (!in_array($relodge_hmrc_late_submission_reason, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'relodge_hmrc_late_submission_reason', must be one of '%s'", + "Invalid value '%s' for 'relodge_hmrc_late_submission_reason', must be one of '%s'", + $relodge_hmrc_late_submission_reason, implode("', '", $allowedValues) ) ); @@ -818,7 +969,7 @@ public function setRelodgeHmrcLateSubmissionReason($relodge_hmrc_late_submission /** * Gets relodge_selected_employees_only * - * @return bool + * @return bool|null */ public function getRelodgeSelectedEmployeesOnly() { @@ -828,12 +979,15 @@ public function getRelodgeSelectedEmployeesOnly() /** * Sets relodge_selected_employees_only * - * @param bool $relodge_selected_employees_only + * @param bool|null $relodge_selected_employees_only * - * @return $this + * @return self */ public function setRelodgeSelectedEmployeesOnly($relodge_selected_employees_only) { + if (is_null($relodge_selected_employees_only)) { + throw new \InvalidArgumentException('non-nullable relodge_selected_employees_only cannot be null'); + } $this->container['relodge_selected_employees_only'] = $relodge_selected_employees_only; return $this; @@ -842,7 +996,7 @@ public function setRelodgeSelectedEmployeesOnly($relodge_selected_employees_only /** * Gets finalise_as_admin * - * @return bool + * @return bool|null */ public function getFinaliseAsAdmin() { @@ -852,12 +1006,15 @@ public function getFinaliseAsAdmin() /** * Sets finalise_as_admin * - * @param bool $finalise_as_admin + * @param bool|null $finalise_as_admin * - * @return $this + * @return self */ public function setFinaliseAsAdmin($finalise_as_admin) { + if (is_null($finalise_as_admin)) { + throw new \InvalidArgumentException('non-nullable finalise_as_admin cannot be null'); + } $this->container['finalise_as_admin'] = $finalise_as_admin; return $this; @@ -866,7 +1023,7 @@ public function setFinaliseAsAdmin($finalise_as_admin) /** * Gets publish_pay_slips_preference * - * @return string + * @return string|null */ public function getPublishPaySlipsPreference() { @@ -876,17 +1033,21 @@ public function getPublishPaySlipsPreference() /** * Sets publish_pay_slips_preference * - * @param string $publish_pay_slips_preference + * @param string|null $publish_pay_slips_preference * - * @return $this + * @return self */ public function setPublishPaySlipsPreference($publish_pay_slips_preference) { + if (is_null($publish_pay_slips_preference)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_preference cannot be null'); + } $allowedValues = $this->getPublishPaySlipsPreferenceAllowableValues(); - if (!is_null($publish_pay_slips_preference) && !in_array($publish_pay_slips_preference, $allowedValues, true)) { + if (!in_array($publish_pay_slips_preference, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_pay_slips_preference', must be one of '%s'", + "Invalid value '%s' for 'publish_pay_slips_preference', must be one of '%s'", + $publish_pay_slips_preference, implode("', '", $allowedValues) ) ); @@ -899,7 +1060,7 @@ public function setPublishPaySlipsPreference($publish_pay_slips_preference) /** * Gets export_journals_preference * - * @return string + * @return string|null */ public function getExportJournalsPreference() { @@ -909,17 +1070,21 @@ public function getExportJournalsPreference() /** * Sets export_journals_preference * - * @param string $export_journals_preference + * @param string|null $export_journals_preference * - * @return $this + * @return self */ public function setExportJournalsPreference($export_journals_preference) { + if (is_null($export_journals_preference)) { + throw new \InvalidArgumentException('non-nullable export_journals_preference cannot be null'); + } $allowedValues = $this->getExportJournalsPreferenceAllowableValues(); - if (!is_null($export_journals_preference) && !in_array($export_journals_preference, $allowedValues, true)) { + if (!in_array($export_journals_preference, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'export_journals_preference', must be one of '%s'", + "Invalid value '%s' for 'export_journals_preference', must be one of '%s'", + $export_journals_preference, implode("', '", $allowedValues) ) ); @@ -932,7 +1097,7 @@ public function setExportJournalsPreference($export_journals_preference) /** * Gets export_journals_date_time * - * @return \DateTime + * @return \DateTime|null */ public function getExportJournalsDateTime() { @@ -942,12 +1107,15 @@ public function getExportJournalsDateTime() /** * Sets export_journals_date_time * - * @param \DateTime $export_journals_date_time + * @param \DateTime|null $export_journals_date_time * - * @return $this + * @return self */ public function setExportJournalsDateTime($export_journals_date_time) { + if (is_null($export_journals_date_time)) { + throw new \InvalidArgumentException('non-nullable export_journals_date_time cannot be null'); + } $this->container['export_journals_date_time'] = $export_journals_date_time; return $this; @@ -956,7 +1124,7 @@ public function setExportJournalsDateTime($export_journals_date_time) /** * Gets lodge_pay_run_preference * - * @return string + * @return string|null */ public function getLodgePayRunPreference() { @@ -966,17 +1134,21 @@ public function getLodgePayRunPreference() /** * Sets lodge_pay_run_preference * - * @param string $lodge_pay_run_preference + * @param string|null $lodge_pay_run_preference * - * @return $this + * @return self */ public function setLodgePayRunPreference($lodge_pay_run_preference) { + if (is_null($lodge_pay_run_preference)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_preference cannot be null'); + } $allowedValues = $this->getLodgePayRunPreferenceAllowableValues(); - if (!is_null($lodge_pay_run_preference) && !in_array($lodge_pay_run_preference, $allowedValues, true)) { + if (!in_array($lodge_pay_run_preference, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'lodge_pay_run_preference', must be one of '%s'", + "Invalid value '%s' for 'lodge_pay_run_preference', must be one of '%s'", + $lodge_pay_run_preference, implode("', '", $allowedValues) ) ); @@ -989,7 +1161,7 @@ public function setLodgePayRunPreference($lodge_pay_run_preference) /** * Gets lodge_pay_run_date_time * - * @return \DateTime + * @return \DateTime|null */ public function getLodgePayRunDateTime() { @@ -999,12 +1171,15 @@ public function getLodgePayRunDateTime() /** * Sets lodge_pay_run_date_time * - * @param \DateTime $lodge_pay_run_date_time + * @param \DateTime|null $lodge_pay_run_date_time * - * @return $this + * @return self */ public function setLodgePayRunDateTime($lodge_pay_run_date_time) { + if (is_null($lodge_pay_run_date_time)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_date_time cannot be null'); + } $this->container['lodge_pay_run_date_time'] = $lodge_pay_run_date_time; return $this; @@ -1013,7 +1188,7 @@ public function setLodgePayRunDateTime($lodge_pay_run_date_time) /** * Gets run_report_packs_preference * - * @return string + * @return string|null */ public function getRunReportPacksPreference() { @@ -1023,17 +1198,21 @@ public function getRunReportPacksPreference() /** * Sets run_report_packs_preference * - * @param string $run_report_packs_preference + * @param string|null $run_report_packs_preference * - * @return $this + * @return self */ public function setRunReportPacksPreference($run_report_packs_preference) { + if (is_null($run_report_packs_preference)) { + throw new \InvalidArgumentException('non-nullable run_report_packs_preference cannot be null'); + } $allowedValues = $this->getRunReportPacksPreferenceAllowableValues(); - if (!is_null($run_report_packs_preference) && !in_array($run_report_packs_preference, $allowedValues, true)) { + if (!in_array($run_report_packs_preference, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'run_report_packs_preference', must be one of '%s'", + "Invalid value '%s' for 'run_report_packs_preference', must be one of '%s'", + $run_report_packs_preference, implode("', '", $allowedValues) ) ); @@ -1046,7 +1225,7 @@ public function setRunReportPacksPreference($run_report_packs_preference) /** * Gets run_report_packs_date_time * - * @return \DateTime + * @return \DateTime|null */ public function getRunReportPacksDateTime() { @@ -1056,12 +1235,15 @@ public function getRunReportPacksDateTime() /** * Sets run_report_packs_date_time * - * @param \DateTime $run_report_packs_date_time + * @param \DateTime|null $run_report_packs_date_time * - * @return $this + * @return self */ public function setRunReportPacksDateTime($run_report_packs_date_time) { + if (is_null($run_report_packs_date_time)) { + throw new \InvalidArgumentException('non-nullable run_report_packs_date_time cannot be null'); + } $this->container['run_report_packs_date_time'] = $run_report_packs_date_time; return $this; @@ -1070,7 +1252,7 @@ public function setRunReportPacksDateTime($run_report_packs_date_time) /** * Gets report_packs_to_run * - * @return int[] + * @return int[]|null */ public function getReportPacksToRun() { @@ -1080,12 +1262,15 @@ public function getReportPacksToRun() /** * Sets report_packs_to_run * - * @param int[] $report_packs_to_run + * @param int[]|null $report_packs_to_run * - * @return $this + * @return self */ public function setReportPacksToRun($report_packs_to_run) { + if (is_null($report_packs_to_run)) { + throw new \InvalidArgumentException('non-nullable report_packs_to_run cannot be null'); + } $this->container['report_packs_to_run'] = $report_packs_to_run; return $this; @@ -1094,7 +1279,7 @@ public function setReportPacksToRun($report_packs_to_run) /** * Gets submit_to_pension_sync_preference * - * @return string + * @return string|null */ public function getSubmitToPensionSyncPreference() { @@ -1104,17 +1289,21 @@ public function getSubmitToPensionSyncPreference() /** * Sets submit_to_pension_sync_preference * - * @param string $submit_to_pension_sync_preference + * @param string|null $submit_to_pension_sync_preference * - * @return $this + * @return self */ public function setSubmitToPensionSyncPreference($submit_to_pension_sync_preference) { + if (is_null($submit_to_pension_sync_preference)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync_preference cannot be null'); + } $allowedValues = $this->getSubmitToPensionSyncPreferenceAllowableValues(); - if (!is_null($submit_to_pension_sync_preference) && !in_array($submit_to_pension_sync_preference, $allowedValues, true)) { + if (!in_array($submit_to_pension_sync_preference, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'submit_to_pension_sync_preference', must be one of '%s'", + "Invalid value '%s' for 'submit_to_pension_sync_preference', must be one of '%s'", + $submit_to_pension_sync_preference, implode("', '", $allowedValues) ) ); @@ -1127,7 +1316,7 @@ public function setSubmitToPensionSyncPreference($submit_to_pension_sync_prefere /** * Gets submit_to_pension_sync_date_time * - * @return \DateTime + * @return \DateTime|null */ public function getSubmitToPensionSyncDateTime() { @@ -1137,12 +1326,15 @@ public function getSubmitToPensionSyncDateTime() /** * Sets submit_to_pension_sync_date_time * - * @param \DateTime $submit_to_pension_sync_date_time + * @param \DateTime|null $submit_to_pension_sync_date_time * - * @return $this + * @return self */ public function setSubmitToPensionSyncDateTime($submit_to_pension_sync_date_time) { + if (is_null($submit_to_pension_sync_date_time)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync_date_time cannot be null'); + } $this->container['submit_to_pension_sync_date_time'] = $submit_to_pension_sync_date_time; return $this; @@ -1151,7 +1343,7 @@ public function setSubmitToPensionSyncDateTime($submit_to_pension_sync_date_time /** * Gets save_changes_to_default_settings * - * @return bool + * @return bool|null */ public function getSaveChangesToDefaultSettings() { @@ -1161,12 +1353,15 @@ public function getSaveChangesToDefaultSettings() /** * Sets save_changes_to_default_settings * - * @param bool $save_changes_to_default_settings + * @param bool|null $save_changes_to_default_settings * - * @return $this + * @return self */ public function setSaveChangesToDefaultSettings($save_changes_to_default_settings) { + if (is_null($save_changes_to_default_settings)) { + throw new \InvalidArgumentException('non-nullable save_changes_to_default_settings cannot be null'); + } $this->container['save_changes_to_default_settings'] = $save_changes_to_default_settings; return $this; @@ -1175,7 +1370,7 @@ public function setSaveChangesToDefaultSettings($save_changes_to_default_setting /** * Gets from_pay_run_automation * - * @return bool + * @return bool|null */ public function getFromPayRunAutomation() { @@ -1185,12 +1380,15 @@ public function getFromPayRunAutomation() /** * Sets from_pay_run_automation * - * @param bool $from_pay_run_automation + * @param bool|null $from_pay_run_automation * - * @return $this + * @return self */ public function setFromPayRunAutomation($from_pay_run_automation) { + if (is_null($from_pay_run_automation)) { + throw new \InvalidArgumentException('non-nullable from_pay_run_automation cannot be null'); + } $this->container['from_pay_run_automation'] = $from_pay_run_automation; return $this; @@ -1202,7 +1400,7 @@ public function setFromPayRunAutomation($from_pay_run_automation) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1212,22 +1410,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1243,11 +1442,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1255,13 +1467,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/GetShiftNotesModel.php b/src/lib/Model/GetShiftNotesModel.php index 5485fa3..7d3ea3b 100644 --- a/src/lib/Model/GetShiftNotesModel.php +++ b/src/lib/Model/GetShiftNotesModel.php @@ -2,61 +2,61 @@ /** * GetShiftNotesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * GetShiftNotesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class GetShiftNotesModel implements ModelInterface, ArrayAccess +class GetShiftNotesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'GetShiftNotesModel'; + protected static $openAPIModelName = 'GetShiftNotesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'is_admin_initiated' => 'bool', 'type' => 'string', @@ -67,22 +67,43 @@ class GetShiftNotesModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'is_admin_initiated' => null, 'type' => null, 'visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'is_admin_initiated' => false, + 'type' => false, + 'visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -170,17 +243,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TYPE_SHIFT = 'Shift'; - const TYPE_CLOCK_ON = 'ClockOn'; - const TYPE_CLOCK_OFF = 'ClockOff'; - const VISIBILITY_HIDDEN = 'Hidden'; - const VISIBILITY_VISIBLE = 'Visible'; - + public const TYPE_SHIFT = 'Shift'; + public const TYPE_CLOCK_ON = 'ClockOn'; + public const TYPE_CLOCK_OFF = 'ClockOff'; + public const VISIBILITY_HIDDEN = 'Hidden'; + public const VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -194,7 +265,7 @@ public function getTypeAllowableValues() self::TYPE_CLOCK_OFF, ]; } - + /** * Gets allowable values of the enum * @@ -207,7 +278,6 @@ public function getVisibilityAllowableValues() self::VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -224,10 +294,28 @@ public function getVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['visibility'] = isset($data['visibility']) ? $data['visibility'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('visibility', $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; } /** @@ -242,7 +330,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -250,7 +339,8 @@ public function listInvalidProperties() $allowedValues = $this->getVisibilityAllowableValues(); if (!is_null($this->container['visibility']) && !in_array($this->container['visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'visibility', must be one of '%s'", + "invalid value '%s' for 'visibility', must be one of '%s'", + $this->container['visibility'], implode("', '", $allowedValues) ); } @@ -273,7 +363,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -283,12 +373,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -297,7 +390,7 @@ public function setEmployeeId($employee_id) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -307,12 +400,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -321,7 +417,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -331,17 +427,21 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { + if (!in_array($type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -354,7 +454,7 @@ public function setType($type) /** * Gets visibility * - * @return string + * @return string|null */ public function getVisibility() { @@ -364,17 +464,21 @@ public function getVisibility() /** * Sets visibility * - * @param string $visibility + * @param string|null $visibility * - * @return $this + * @return self */ public function setVisibility($visibility) { + if (is_null($visibility)) { + throw new \InvalidArgumentException('non-nullable visibility cannot be null'); + } $allowedValues = $this->getVisibilityAllowableValues(); - if (!is_null($visibility) && !in_array($visibility, $allowedValues, true)) { + if (!in_array($visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'visibility', must be one of '%s'", + "Invalid value '%s' for 'visibility', must be one of '%s'", + $visibility, implode("', '", $allowedValues) ) ); @@ -390,7 +494,7 @@ public function setVisibility($visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -400,22 +504,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -431,11 +536,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -443,13 +561,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/GetShiftPeriodsModel.php b/src/lib/Model/GetShiftPeriodsModel.php index 4cc1c3e..00dfa41 100644 --- a/src/lib/Model/GetShiftPeriodsModel.php +++ b/src/lib/Model/GetShiftPeriodsModel.php @@ -2,61 +2,61 @@ /** * GetShiftPeriodsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * GetShiftPeriodsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class GetShiftPeriodsModel implements ModelInterface, ArrayAccess +class GetShiftPeriodsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'GetShiftPeriodsModel'; + protected static $openAPIModelName = 'GetShiftPeriodsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'first_shift_start_time' => '\DateTime', 'last_shift_start_time' => '\DateTime' ]; @@ -65,20 +65,39 @@ class GetShiftPeriodsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'first_shift_start_time' => 'date-time', 'last_shift_start_time' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'first_shift_start_time' => false, + 'last_shift_start_time' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['first_shift_start_time'] = isset($data['first_shift_start_time']) ? $data['first_shift_start_time'] : null; - $this->container['last_shift_start_time'] = isset($data['last_shift_start_time']) ? $data['last_shift_start_time'] : null; + $this->setIfExists('first_shift_start_time', $data ?? [], null); + $this->setIfExists('last_shift_start_time', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets first_shift_start_time * - * @return \DateTime + * @return \DateTime|null */ public function getFirstShiftStartTime() { @@ -223,12 +309,15 @@ public function getFirstShiftStartTime() /** * Sets first_shift_start_time * - * @param \DateTime $first_shift_start_time + * @param \DateTime|null $first_shift_start_time * - * @return $this + * @return self */ public function setFirstShiftStartTime($first_shift_start_time) { + if (is_null($first_shift_start_time)) { + throw new \InvalidArgumentException('non-nullable first_shift_start_time cannot be null'); + } $this->container['first_shift_start_time'] = $first_shift_start_time; return $this; @@ -237,7 +326,7 @@ public function setFirstShiftStartTime($first_shift_start_time) /** * Gets last_shift_start_time * - * @return \DateTime + * @return \DateTime|null */ public function getLastShiftStartTime() { @@ -247,12 +336,15 @@ public function getLastShiftStartTime() /** * Sets last_shift_start_time * - * @param \DateTime $last_shift_start_time + * @param \DateTime|null $last_shift_start_time * - * @return $this + * @return self */ public function setLastShiftStartTime($last_shift_start_time) { + if (is_null($last_shift_start_time)) { + throw new \InvalidArgumentException('non-nullable last_shift_start_time cannot be null'); + } $this->container['last_shift_start_time'] = $last_shift_start_time; return $this; @@ -264,7 +356,7 @@ public function setLastShiftStartTime($last_shift_start_time) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/GetShiftsModel.php b/src/lib/Model/GetShiftsModel.php index c2e7456..860b146 100644 --- a/src/lib/Model/GetShiftsModel.php +++ b/src/lib/Model/GetShiftsModel.php @@ -2,61 +2,61 @@ /** * GetShiftsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * GetShiftsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class GetShiftsModel implements ModelInterface, ArrayAccess +class GetShiftsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'GetShiftsModel'; + protected static $openAPIModelName = 'GetShiftsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'kiosk_id' => 'int', 'location_id' => 'int', 'employee_id' => 'int', @@ -68,8 +68,10 @@ class GetShiftsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'kiosk_id' => 'int32', 'location_id' => 'int32', 'employee_id' => 'int32', @@ -77,14 +79,34 @@ class GetShiftsModel implements ModelInterface, ArrayAccess 'to_date_utc' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'kiosk_id' => false, + 'location_id' => false, + 'employee_id' => false, + 'from_date_utc' => false, + 'to_date_utc' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['from_date_utc'] = isset($data['from_date_utc']) ? $data['from_date_utc'] : null; - $this->container['to_date_utc'] = isset($data['to_date_utc']) ? $data['to_date_utc'] : null; + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('from_date_utc', $data ?? [], null); + $this->setIfExists('to_date_utc', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -241,12 +330,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -255,7 +347,7 @@ public function setKioskId($kiosk_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -265,12 +357,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -279,7 +374,7 @@ public function setLocationId($location_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -289,12 +384,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -303,7 +401,7 @@ public function setEmployeeId($employee_id) /** * Gets from_date_utc * - * @return \DateTime + * @return \DateTime|null */ public function getFromDateUtc() { @@ -313,12 +411,15 @@ public function getFromDateUtc() /** * Sets from_date_utc * - * @param \DateTime $from_date_utc + * @param \DateTime|null $from_date_utc * - * @return $this + * @return self */ public function setFromDateUtc($from_date_utc) { + if (is_null($from_date_utc)) { + throw new \InvalidArgumentException('non-nullable from_date_utc cannot be null'); + } $this->container['from_date_utc'] = $from_date_utc; return $this; @@ -327,7 +428,7 @@ public function setFromDateUtc($from_date_utc) /** * Gets to_date_utc * - * @return \DateTime + * @return \DateTime|null */ public function getToDateUtc() { @@ -337,12 +438,15 @@ public function getToDateUtc() /** * Sets to_date_utc * - * @param \DateTime $to_date_utc + * @param \DateTime|null $to_date_utc * - * @return $this + * @return self */ public function setToDateUtc($to_date_utc) { + if (is_null($to_date_utc)) { + throw new \InvalidArgumentException('non-nullable to_date_utc cannot be null'); + } $this->container['to_date_utc'] = $to_date_utc; return $this; @@ -354,7 +458,7 @@ public function setToDateUtc($to_date_utc) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/GrossToNetReportRequest.php b/src/lib/Model/GrossToNetReportRequest.php index 861a283..58bed39 100644 --- a/src/lib/Model/GrossToNetReportRequest.php +++ b/src/lib/Model/GrossToNetReportRequest.php @@ -2,61 +2,61 @@ /** * GrossToNetReportRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * GrossToNetReportRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class GrossToNetReportRequest implements ModelInterface, ArrayAccess +class GrossToNetReportRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'GrossToNetReportRequest'; + protected static $openAPIModelName = 'GrossToNetReportRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'pay_category_ids' => 'int[]', 'pay_schedule_id' => 'int', @@ -71,8 +71,10 @@ class GrossToNetReportRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'pay_category_ids' => 'int32', 'pay_schedule_id' => 'int32', @@ -83,14 +85,37 @@ class GrossToNetReportRequest implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'pay_category_ids' => false, + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['pay_category_ids'] = isset($data['pay_category_ids']) ? $data['pay_category_ids'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('pay_category_ids', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -259,12 +351,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -273,7 +368,7 @@ public function setEmployeeId($employee_id) /** * Gets pay_category_ids * - * @return int[] + * @return int[]|null */ public function getPayCategoryIds() { @@ -283,12 +378,15 @@ public function getPayCategoryIds() /** * Sets pay_category_ids * - * @param int[] $pay_category_ids + * @param int[]|null $pay_category_ids * - * @return $this + * @return self */ public function setPayCategoryIds($pay_category_ids) { + if (is_null($pay_category_ids)) { + throw new \InvalidArgumentException('non-nullable pay_category_ids cannot be null'); + } $this->container['pay_category_ids'] = $pay_category_ids; return $this; @@ -297,7 +395,7 @@ public function setPayCategoryIds($pay_category_ids) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -307,12 +405,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -321,7 +422,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -331,12 +432,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -345,7 +449,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -355,12 +459,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -369,7 +476,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -379,12 +486,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -393,7 +503,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -403,12 +513,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -417,7 +530,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -427,12 +540,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -444,7 +560,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/HourLeaveEstimateModel.php b/src/lib/Model/HourLeaveEstimateModel.php index 24b303c..26b6a5a 100644 --- a/src/lib/Model/HourLeaveEstimateModel.php +++ b/src/lib/Model/HourLeaveEstimateModel.php @@ -2,62 +2,62 @@ /** * HourLeaveEstimateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * HourLeaveEstimateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class HourLeaveEstimateModel implements ModelInterface, ArrayAccess +class HourLeaveEstimateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'HourLeaveEstimateModel'; + protected static $openAPIModelName = 'HourLeaveEstimateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'hours' => 'double', + protected static $openAPITypes = [ + 'hours' => 'float', 'employee_id' => 'int', 'details' => 'string[]' ]; @@ -66,21 +66,41 @@ class HourLeaveEstimateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'hours' => 'double', 'employee_id' => 'int32', 'details' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'hours' => false, + 'employee_id' => false, + 'details' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['details'] = isset($data['details']) ? $data['details'] : null; + $this->setIfExists('hours', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('details', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -229,12 +316,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -243,7 +333,7 @@ public function setHours($hours) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -253,12 +343,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -267,7 +360,7 @@ public function setEmployeeId($employee_id) /** * Gets details * - * @return string[] + * @return string[]|null */ public function getDetails() { @@ -277,12 +370,15 @@ public function getDetails() /** * Sets details * - * @param string[] $details + * @param string[]|null $details * - * @return $this + * @return self */ public function setDetails($details) { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } $this->container['details'] = $details; return $this; @@ -294,7 +390,7 @@ public function setDetails($details) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/HourLeaveRequestModel.php b/src/lib/Model/HourLeaveRequestModel.php index 76ef3c0..d1956a4 100644 --- a/src/lib/Model/HourLeaveRequestModel.php +++ b/src/lib/Model/HourLeaveRequestModel.php @@ -2,66 +2,66 @@ /** * HourLeaveRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * HourLeaveRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class HourLeaveRequestModel implements ModelInterface, ArrayAccess +class HourLeaveRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'HourLeaveRequestModel'; + protected static $openAPIModelName = 'HourLeaveRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'hours' => 'double', + protected static $openAPITypes = [ + 'hours' => 'float', 'automatically_approve' => 'bool', 'employee_id' => 'int', 'require_notes_for_leave_requests' => 'bool', - 'attachment' => '\Swagger\Client\Model\AttachmentModel', + 'attachment' => '\OpenAPI\Client\Model\AttachmentModel', 'id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -73,8 +73,10 @@ class HourLeaveRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'hours' => 'double', 'automatically_approve' => null, 'employee_id' => 'int32', @@ -87,14 +89,39 @@ class HourLeaveRequestModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'hours' => false, + 'automatically_approve' => false, + 'employee_id' => false, + 'require_notes_for_leave_requests' => false, + 'attachment' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'leave_category_id' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; - $this->container['automatically_approve'] = isset($data['automatically_approve']) ? $data['automatically_approve'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['require_notes_for_leave_requests'] = isset($data['require_notes_for_leave_requests']) ? $data['require_notes_for_leave_requests'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('hours', $data ?? [], null); + $this->setIfExists('automatically_approve', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('require_notes_for_leave_requests', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -271,12 +365,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -285,7 +382,7 @@ public function setHours($hours) /** * Gets automatically_approve * - * @return bool + * @return bool|null */ public function getAutomaticallyApprove() { @@ -295,12 +392,15 @@ public function getAutomaticallyApprove() /** * Sets automatically_approve * - * @param bool $automatically_approve + * @param bool|null $automatically_approve * - * @return $this + * @return self */ public function setAutomaticallyApprove($automatically_approve) { + if (is_null($automatically_approve)) { + throw new \InvalidArgumentException('non-nullable automatically_approve cannot be null'); + } $this->container['automatically_approve'] = $automatically_approve; return $this; @@ -309,7 +409,7 @@ public function setAutomaticallyApprove($automatically_approve) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -319,12 +419,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -333,7 +436,7 @@ public function setEmployeeId($employee_id) /** * Gets require_notes_for_leave_requests * - * @return bool + * @return bool|null */ public function getRequireNotesForLeaveRequests() { @@ -343,12 +446,15 @@ public function getRequireNotesForLeaveRequests() /** * Sets require_notes_for_leave_requests * - * @param bool $require_notes_for_leave_requests + * @param bool|null $require_notes_for_leave_requests * - * @return $this + * @return self */ public function setRequireNotesForLeaveRequests($require_notes_for_leave_requests) { + if (is_null($require_notes_for_leave_requests)) { + throw new \InvalidArgumentException('non-nullable require_notes_for_leave_requests cannot be null'); + } $this->container['require_notes_for_leave_requests'] = $require_notes_for_leave_requests; return $this; @@ -357,7 +463,7 @@ public function setRequireNotesForLeaveRequests($require_notes_for_leave_request /** * Gets attachment * - * @return \Swagger\Client\Model\AttachmentModel + * @return \OpenAPI\Client\Model\AttachmentModel|null */ public function getAttachment() { @@ -367,12 +473,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\AttachmentModel $attachment + * @param \OpenAPI\Client\Model\AttachmentModel|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -381,7 +490,7 @@ public function setAttachment($attachment) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -391,12 +500,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -405,7 +517,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -415,12 +527,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -429,7 +544,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -439,12 +554,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -453,7 +571,7 @@ public function setToDate($to_date) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -463,12 +581,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -477,7 +598,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -487,12 +608,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -504,7 +628,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/HourLeaveRequestResponseModel.php b/src/lib/Model/HourLeaveRequestResponseModel.php index 661cfcd..b19035d 100644 --- a/src/lib/Model/HourLeaveRequestResponseModel.php +++ b/src/lib/Model/HourLeaveRequestResponseModel.php @@ -2,63 +2,63 @@ /** * HourLeaveRequestResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * HourLeaveRequestResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class HourLeaveRequestResponseModel implements ModelInterface, ArrayAccess +class HourLeaveRequestResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'HourLeaveRequestResponseModel'; + protected static $openAPIModelName = 'HourLeaveRequestResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'total_hours' => 'double', - 'hours_applied' => 'double', + protected static $openAPITypes = [ + 'total_hours' => 'float', + 'hours_applied' => 'float', 'id' => 'int', 'employee_id' => 'int', 'leave_category_id' => 'int', @@ -75,8 +75,10 @@ class HourLeaveRequestResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'total_hours' => 'double', 'hours_applied' => 'double', 'id' => 'int32', @@ -91,14 +93,41 @@ class HourLeaveRequestResponseModel implements ModelInterface, ArrayAccess 'attachment_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total_hours' => false, + 'hours_applied' => false, + 'id' => false, + 'employee_id' => false, + 'leave_category_id' => false, + 'employee' => false, + 'leave_category' => false, + 'from_date' => false, + 'to_date' => false, + 'notes' => false, + 'status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['hours_applied'] = isset($data['hours_applied']) ? $data['hours_applied'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['employee'] = isset($data['employee']) ? $data['employee'] : null; - $this->container['leave_category'] = isset($data['leave_category']) ? $data['leave_category'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('hours_applied', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('employee', $data ?? [], null); + $this->setIfExists('leave_category', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('status', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -283,12 +379,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -297,7 +396,7 @@ public function setTotalHours($total_hours) /** * Gets hours_applied * - * @return double + * @return float|null */ public function getHoursApplied() { @@ -307,12 +406,15 @@ public function getHoursApplied() /** * Sets hours_applied * - * @param double $hours_applied + * @param float|null $hours_applied * - * @return $this + * @return self */ public function setHoursApplied($hours_applied) { + if (is_null($hours_applied)) { + throw new \InvalidArgumentException('non-nullable hours_applied cannot be null'); + } $this->container['hours_applied'] = $hours_applied; return $this; @@ -321,7 +423,7 @@ public function setHoursApplied($hours_applied) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -331,12 +433,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -345,7 +450,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -355,12 +460,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -369,7 +477,7 @@ public function setEmployeeId($employee_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -379,12 +487,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -393,7 +504,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets employee * - * @return string + * @return string|null */ public function getEmployee() { @@ -403,12 +514,15 @@ public function getEmployee() /** * Sets employee * - * @param string $employee + * @param string|null $employee * - * @return $this + * @return self */ public function setEmployee($employee) { + if (is_null($employee)) { + throw new \InvalidArgumentException('non-nullable employee cannot be null'); + } $this->container['employee'] = $employee; return $this; @@ -417,7 +531,7 @@ public function setEmployee($employee) /** * Gets leave_category * - * @return string + * @return string|null */ public function getLeaveCategory() { @@ -427,12 +541,15 @@ public function getLeaveCategory() /** * Sets leave_category * - * @param string $leave_category + * @param string|null $leave_category * - * @return $this + * @return self */ public function setLeaveCategory($leave_category) { + if (is_null($leave_category)) { + throw new \InvalidArgumentException('non-nullable leave_category cannot be null'); + } $this->container['leave_category'] = $leave_category; return $this; @@ -441,7 +558,7 @@ public function setLeaveCategory($leave_category) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -451,12 +568,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -465,7 +585,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -475,12 +595,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -489,7 +612,7 @@ public function setToDate($to_date) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -499,12 +622,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -513,7 +639,7 @@ public function setNotes($notes) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -523,12 +649,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -537,7 +666,7 @@ public function setStatus($status) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -547,12 +676,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -564,7 +696,7 @@ public function setAttachmentId($attachment_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IEdmDirectValueAnnotationsManager.php b/src/lib/Model/IEdmDirectValueAnnotationsManager.php deleted file mode 100644 index f7395c4..0000000 --- a/src/lib/Model/IEdmDirectValueAnnotationsManager.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/IEdmModel.php b/src/lib/Model/IEdmModel.php index 77169f8..163ed5a 100644 --- a/src/lib/Model/IEdmModel.php +++ b/src/lib/Model/IEdmModel.php @@ -2,87 +2,108 @@ /** * IEdmModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IEdmModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IEdmModel implements ModelInterface, ArrayAccess +class IEdmModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IEdmModel'; + protected static $openAPIModelName = 'IEdmModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'schema_elements' => '\Swagger\Client\Model\IEdmSchemaElement[]', - 'vocabulary_annotations' => '\Swagger\Client\Model\IEdmVocabularyAnnotation[]', - 'referenced_models' => '\Swagger\Client\Model\IEdmModel[]', - 'direct_value_annotations_manager' => '\Swagger\Client\Model\IEdmDirectValueAnnotationsManager' + protected static $openAPITypes = [ + 'schema_elements' => '\OpenAPI\Client\Model\IEdmSchemaElement[]', + 'vocabulary_annotations' => '\OpenAPI\Client\Model\IEdmVocabularyAnnotation[]', + 'referenced_models' => '\OpenAPI\Client\Model\IEdmModel[]', + 'direct_value_annotations_manager' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'schema_elements' => null, 'vocabulary_annotations' => null, 'referenced_models' => null, 'direct_value_annotations_manager' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schema_elements' => false, + 'vocabulary_annotations' => false, + 'referenced_models' => false, + 'direct_value_annotations_manager' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['schema_elements'] = isset($data['schema_elements']) ? $data['schema_elements'] : null; - $this->container['vocabulary_annotations'] = isset($data['vocabulary_annotations']) ? $data['vocabulary_annotations'] : null; - $this->container['referenced_models'] = isset($data['referenced_models']) ? $data['referenced_models'] : null; - $this->container['direct_value_annotations_manager'] = isset($data['direct_value_annotations_manager']) ? $data['direct_value_annotations_manager'] : null; + $this->setIfExists('schema_elements', $data ?? [], null); + $this->setIfExists('vocabulary_annotations', $data ?? [], null); + $this->setIfExists('referenced_models', $data ?? [], null); + $this->setIfExists('direct_value_annotations_manager', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets schema_elements * - * @return \Swagger\Client\Model\IEdmSchemaElement[] + * @return \OpenAPI\Client\Model\IEdmSchemaElement[]|null */ public function getSchemaElements() { @@ -235,12 +323,15 @@ public function getSchemaElements() /** * Sets schema_elements * - * @param \Swagger\Client\Model\IEdmSchemaElement[] $schema_elements + * @param \OpenAPI\Client\Model\IEdmSchemaElement[]|null $schema_elements * - * @return $this + * @return self */ public function setSchemaElements($schema_elements) { + if (is_null($schema_elements)) { + throw new \InvalidArgumentException('non-nullable schema_elements cannot be null'); + } $this->container['schema_elements'] = $schema_elements; return $this; @@ -249,7 +340,7 @@ public function setSchemaElements($schema_elements) /** * Gets vocabulary_annotations * - * @return \Swagger\Client\Model\IEdmVocabularyAnnotation[] + * @return \OpenAPI\Client\Model\IEdmVocabularyAnnotation[]|null */ public function getVocabularyAnnotations() { @@ -259,12 +350,15 @@ public function getVocabularyAnnotations() /** * Sets vocabulary_annotations * - * @param \Swagger\Client\Model\IEdmVocabularyAnnotation[] $vocabulary_annotations + * @param \OpenAPI\Client\Model\IEdmVocabularyAnnotation[]|null $vocabulary_annotations * - * @return $this + * @return self */ public function setVocabularyAnnotations($vocabulary_annotations) { + if (is_null($vocabulary_annotations)) { + throw new \InvalidArgumentException('non-nullable vocabulary_annotations cannot be null'); + } $this->container['vocabulary_annotations'] = $vocabulary_annotations; return $this; @@ -273,7 +367,7 @@ public function setVocabularyAnnotations($vocabulary_annotations) /** * Gets referenced_models * - * @return \Swagger\Client\Model\IEdmModel[] + * @return \OpenAPI\Client\Model\IEdmModel[]|null */ public function getReferencedModels() { @@ -283,12 +377,15 @@ public function getReferencedModels() /** * Sets referenced_models * - * @param \Swagger\Client\Model\IEdmModel[] $referenced_models + * @param \OpenAPI\Client\Model\IEdmModel[]|null $referenced_models * - * @return $this + * @return self */ public function setReferencedModels($referenced_models) { + if (is_null($referenced_models)) { + throw new \InvalidArgumentException('non-nullable referenced_models cannot be null'); + } $this->container['referenced_models'] = $referenced_models; return $this; @@ -297,7 +394,7 @@ public function setReferencedModels($referenced_models) /** * Gets direct_value_annotations_manager * - * @return \Swagger\Client\Model\IEdmDirectValueAnnotationsManager + * @return object|null */ public function getDirectValueAnnotationsManager() { @@ -307,12 +404,15 @@ public function getDirectValueAnnotationsManager() /** * Sets direct_value_annotations_manager * - * @param \Swagger\Client\Model\IEdmDirectValueAnnotationsManager $direct_value_annotations_manager + * @param object|null $direct_value_annotations_manager direct_value_annotations_manager * - * @return $this + * @return self */ public function setDirectValueAnnotationsManager($direct_value_annotations_manager) { + if (is_null($direct_value_annotations_manager)) { + throw new \InvalidArgumentException('non-nullable direct_value_annotations_manager cannot be null'); + } $this->container['direct_value_annotations_manager'] = $direct_value_annotations_manager; return $this; @@ -324,7 +424,7 @@ public function setDirectValueAnnotationsManager($direct_value_annotations_manag * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IEdmSchemaElement.php b/src/lib/Model/IEdmSchemaElement.php index f650fa8..fa4b6f4 100644 --- a/src/lib/Model/IEdmSchemaElement.php +++ b/src/lib/Model/IEdmSchemaElement.php @@ -2,61 +2,61 @@ /** * IEdmSchemaElement * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IEdmSchemaElement Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IEdmSchemaElement implements ModelInterface, ArrayAccess +class IEdmSchemaElement implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IEdmSchemaElement'; + protected static $openAPIModelName = 'IEdmSchemaElement'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'schema_element_kind' => 'string', 'namespace' => 'string', 'name' => 'string' @@ -66,21 +66,41 @@ class IEdmSchemaElement implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'schema_element_kind' => null, 'namespace' => null, 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schema_element_kind' => false, + 'namespace' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,17 +237,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SCHEMA_ELEMENT_KIND_NONE = 'None'; - const SCHEMA_ELEMENT_KIND_TYPE_DEFINITION = 'TypeDefinition'; - const SCHEMA_ELEMENT_KIND__FUNCTION = 'Function'; - const SCHEMA_ELEMENT_KIND_VALUE_TERM = 'ValueTerm'; - const SCHEMA_ELEMENT_KIND_ENTITY_CONTAINER = 'EntityContainer'; - + public const SCHEMA_ELEMENT_KIND_NONE = 'None'; + public const SCHEMA_ELEMENT_KIND_TYPE_DEFINITION = 'TypeDefinition'; + public const SCHEMA_ELEMENT_KIND__FUNCTION = 'Function'; + public const SCHEMA_ELEMENT_KIND_VALUE_TERM = 'ValueTerm'; + public const SCHEMA_ELEMENT_KIND_ENTITY_CONTAINER = 'EntityContainer'; - /** * Gets allowable values of the enum * @@ -191,7 +261,6 @@ public function getSchemaElementKindAllowableValues() self::SCHEMA_ELEMENT_KIND_ENTITY_CONTAINER, ]; } - /** * Associative array for storing property values @@ -208,9 +277,27 @@ public function getSchemaElementKindAllowableValues() */ public function __construct(array $data = null) { - $this->container['schema_element_kind'] = isset($data['schema_element_kind']) ? $data['schema_element_kind'] : null; - $this->container['namespace'] = isset($data['namespace']) ? $data['namespace'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('schema_element_kind', $data ?? [], null); + $this->setIfExists('namespace', $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; } /** @@ -225,7 +312,8 @@ public function listInvalidProperties() $allowedValues = $this->getSchemaElementKindAllowableValues(); if (!is_null($this->container['schema_element_kind']) && !in_array($this->container['schema_element_kind'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'schema_element_kind', must be one of '%s'", + "invalid value '%s' for 'schema_element_kind', must be one of '%s'", + $this->container['schema_element_kind'], implode("', '", $allowedValues) ); } @@ -248,7 +336,7 @@ public function valid() /** * Gets schema_element_kind * - * @return string + * @return string|null */ public function getSchemaElementKind() { @@ -258,17 +346,21 @@ public function getSchemaElementKind() /** * Sets schema_element_kind * - * @param string $schema_element_kind + * @param string|null $schema_element_kind * - * @return $this + * @return self */ public function setSchemaElementKind($schema_element_kind) { + if (is_null($schema_element_kind)) { + throw new \InvalidArgumentException('non-nullable schema_element_kind cannot be null'); + } $allowedValues = $this->getSchemaElementKindAllowableValues(); - if (!is_null($schema_element_kind) && !in_array($schema_element_kind, $allowedValues, true)) { + if (!in_array($schema_element_kind, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'schema_element_kind', must be one of '%s'", + "Invalid value '%s' for 'schema_element_kind', must be one of '%s'", + $schema_element_kind, implode("', '", $allowedValues) ) ); @@ -281,7 +373,7 @@ public function setSchemaElementKind($schema_element_kind) /** * Gets namespace * - * @return string + * @return string|null */ public function getNamespace() { @@ -291,12 +383,15 @@ public function getNamespace() /** * Sets namespace * - * @param string $namespace + * @param string|null $namespace * - * @return $this + * @return self */ public function setNamespace($namespace) { + if (is_null($namespace)) { + throw new \InvalidArgumentException('non-nullable namespace cannot be null'); + } $this->container['namespace'] = $namespace; return $this; @@ -305,7 +400,7 @@ public function setNamespace($namespace) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -315,12 +410,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -332,7 +430,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -342,22 +440,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -373,11 +472,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -385,13 +497,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IEdmTerm.php b/src/lib/Model/IEdmTerm.php index 053b01f..fdd3386 100644 --- a/src/lib/Model/IEdmTerm.php +++ b/src/lib/Model/IEdmTerm.php @@ -2,61 +2,61 @@ /** * IEdmTerm * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IEdmTerm Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IEdmTerm implements ModelInterface, ArrayAccess +class IEdmTerm implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IEdmTerm'; + protected static $openAPIModelName = 'IEdmTerm'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'term_kind' => 'string', 'schema_element_kind' => 'string', 'namespace' => 'string', @@ -67,22 +67,43 @@ class IEdmTerm implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'term_kind' => null, 'schema_element_kind' => null, 'namespace' => null, 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'term_kind' => false, + 'schema_element_kind' => false, + 'namespace' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -170,20 +243,18 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TERM_KIND_NONE = 'None'; - const TERM_KIND_TYPE = 'Type'; - const TERM_KIND_VALUE = 'Value'; - const SCHEMA_ELEMENT_KIND_NONE = 'None'; - const SCHEMA_ELEMENT_KIND_TYPE_DEFINITION = 'TypeDefinition'; - const SCHEMA_ELEMENT_KIND__FUNCTION = 'Function'; - const SCHEMA_ELEMENT_KIND_VALUE_TERM = 'ValueTerm'; - const SCHEMA_ELEMENT_KIND_ENTITY_CONTAINER = 'EntityContainer'; - + public const TERM_KIND_NONE = 'None'; + public const TERM_KIND_TYPE = 'Type'; + public const TERM_KIND_VALUE = 'Value'; + public const SCHEMA_ELEMENT_KIND_NONE = 'None'; + public const SCHEMA_ELEMENT_KIND_TYPE_DEFINITION = 'TypeDefinition'; + public const SCHEMA_ELEMENT_KIND__FUNCTION = 'Function'; + public const SCHEMA_ELEMENT_KIND_VALUE_TERM = 'ValueTerm'; + public const SCHEMA_ELEMENT_KIND_ENTITY_CONTAINER = 'EntityContainer'; - /** * Gets allowable values of the enum * @@ -197,7 +268,7 @@ public function getTermKindAllowableValues() self::TERM_KIND_VALUE, ]; } - + /** * Gets allowable values of the enum * @@ -213,7 +284,6 @@ public function getSchemaElementKindAllowableValues() self::SCHEMA_ELEMENT_KIND_ENTITY_CONTAINER, ]; } - /** * Associative array for storing property values @@ -230,10 +300,28 @@ public function getSchemaElementKindAllowableValues() */ public function __construct(array $data = null) { - $this->container['term_kind'] = isset($data['term_kind']) ? $data['term_kind'] : null; - $this->container['schema_element_kind'] = isset($data['schema_element_kind']) ? $data['schema_element_kind'] : null; - $this->container['namespace'] = isset($data['namespace']) ? $data['namespace'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('term_kind', $data ?? [], null); + $this->setIfExists('schema_element_kind', $data ?? [], null); + $this->setIfExists('namespace', $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; } /** @@ -248,7 +336,8 @@ public function listInvalidProperties() $allowedValues = $this->getTermKindAllowableValues(); if (!is_null($this->container['term_kind']) && !in_array($this->container['term_kind'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'term_kind', must be one of '%s'", + "invalid value '%s' for 'term_kind', must be one of '%s'", + $this->container['term_kind'], implode("', '", $allowedValues) ); } @@ -256,7 +345,8 @@ public function listInvalidProperties() $allowedValues = $this->getSchemaElementKindAllowableValues(); if (!is_null($this->container['schema_element_kind']) && !in_array($this->container['schema_element_kind'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'schema_element_kind', must be one of '%s'", + "invalid value '%s' for 'schema_element_kind', must be one of '%s'", + $this->container['schema_element_kind'], implode("', '", $allowedValues) ); } @@ -279,7 +369,7 @@ public function valid() /** * Gets term_kind * - * @return string + * @return string|null */ public function getTermKind() { @@ -289,17 +379,21 @@ public function getTermKind() /** * Sets term_kind * - * @param string $term_kind + * @param string|null $term_kind * - * @return $this + * @return self */ public function setTermKind($term_kind) { + if (is_null($term_kind)) { + throw new \InvalidArgumentException('non-nullable term_kind cannot be null'); + } $allowedValues = $this->getTermKindAllowableValues(); - if (!is_null($term_kind) && !in_array($term_kind, $allowedValues, true)) { + if (!in_array($term_kind, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'term_kind', must be one of '%s'", + "Invalid value '%s' for 'term_kind', must be one of '%s'", + $term_kind, implode("', '", $allowedValues) ) ); @@ -312,7 +406,7 @@ public function setTermKind($term_kind) /** * Gets schema_element_kind * - * @return string + * @return string|null */ public function getSchemaElementKind() { @@ -322,17 +416,21 @@ public function getSchemaElementKind() /** * Sets schema_element_kind * - * @param string $schema_element_kind + * @param string|null $schema_element_kind * - * @return $this + * @return self */ public function setSchemaElementKind($schema_element_kind) { + if (is_null($schema_element_kind)) { + throw new \InvalidArgumentException('non-nullable schema_element_kind cannot be null'); + } $allowedValues = $this->getSchemaElementKindAllowableValues(); - if (!is_null($schema_element_kind) && !in_array($schema_element_kind, $allowedValues, true)) { + if (!in_array($schema_element_kind, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'schema_element_kind', must be one of '%s'", + "Invalid value '%s' for 'schema_element_kind', must be one of '%s'", + $schema_element_kind, implode("', '", $allowedValues) ) ); @@ -345,7 +443,7 @@ public function setSchemaElementKind($schema_element_kind) /** * Gets namespace * - * @return string + * @return string|null */ public function getNamespace() { @@ -355,12 +453,15 @@ public function getNamespace() /** * Sets namespace * - * @param string $namespace + * @param string|null $namespace * - * @return $this + * @return self */ public function setNamespace($namespace) { + if (is_null($namespace)) { + throw new \InvalidArgumentException('non-nullable namespace cannot be null'); + } $this->container['namespace'] = $namespace; return $this; @@ -369,7 +470,7 @@ public function setNamespace($namespace) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -379,12 +480,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -396,7 +500,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -406,22 +510,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -437,11 +542,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -449,13 +567,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IEdmType.php b/src/lib/Model/IEdmType.php index 7f0443f..c144c6d 100644 --- a/src/lib/Model/IEdmType.php +++ b/src/lib/Model/IEdmType.php @@ -2,61 +2,61 @@ /** * IEdmType * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IEdmType Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IEdmType implements ModelInterface, ArrayAccess +class IEdmType implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IEdmType'; + protected static $openAPIModelName = 'IEdmType'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'type_kind' => 'string' ]; @@ -64,19 +64,37 @@ class IEdmType implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'type_kind' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type_kind' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,20 +225,18 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TYPE_KIND_NONE = 'None'; - const TYPE_KIND_PRIMITIVE = 'Primitive'; - const TYPE_KIND_ENTITY = 'Entity'; - const TYPE_KIND_COMPLEX = 'Complex'; - const TYPE_KIND_ROW = 'Row'; - const TYPE_KIND_COLLECTION = 'Collection'; - const TYPE_KIND_ENTITY_REFERENCE = 'EntityReference'; - const TYPE_KIND_ENUM = 'Enum'; - + public const TYPE_KIND_NONE = 'None'; + public const TYPE_KIND_PRIMITIVE = 'Primitive'; + public const TYPE_KIND_ENTITY = 'Entity'; + public const TYPE_KIND_COMPLEX = 'Complex'; + public const TYPE_KIND_ROW = 'Row'; + public const TYPE_KIND_COLLECTION = 'Collection'; + public const TYPE_KIND_ENTITY_REFERENCE = 'EntityReference'; + public const TYPE_KIND_ENUM = 'Enum'; - /** * Gets allowable values of the enum * @@ -187,7 +255,6 @@ public function getTypeKindAllowableValues() self::TYPE_KIND_ENUM, ]; } - /** * Associative array for storing property values @@ -204,7 +271,25 @@ public function getTypeKindAllowableValues() */ public function __construct(array $data = null) { - $this->container['type_kind'] = isset($data['type_kind']) ? $data['type_kind'] : null; + $this->setIfExists('type_kind', $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; } /** @@ -219,7 +304,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeKindAllowableValues(); if (!is_null($this->container['type_kind']) && !in_array($this->container['type_kind'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type_kind', must be one of '%s'", + "invalid value '%s' for 'type_kind', must be one of '%s'", + $this->container['type_kind'], implode("', '", $allowedValues) ); } @@ -242,7 +328,7 @@ public function valid() /** * Gets type_kind * - * @return string + * @return string|null */ public function getTypeKind() { @@ -252,17 +338,21 @@ public function getTypeKind() /** * Sets type_kind * - * @param string $type_kind + * @param string|null $type_kind * - * @return $this + * @return self */ public function setTypeKind($type_kind) { + if (is_null($type_kind)) { + throw new \InvalidArgumentException('non-nullable type_kind cannot be null'); + } $allowedValues = $this->getTypeKindAllowableValues(); - if (!is_null($type_kind) && !in_array($type_kind, $allowedValues, true)) { + if (!in_array($type_kind, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'type_kind', must be one of '%s'", + "Invalid value '%s' for 'type_kind', must be one of '%s'", + $type_kind, implode("', '", $allowedValues) ) ); @@ -278,7 +368,7 @@ public function setTypeKind($type_kind) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -288,22 +378,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -319,11 +410,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -331,13 +435,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IEdmTypeReference.php b/src/lib/Model/IEdmTypeReference.php index a3d6f75..ad152dd 100644 --- a/src/lib/Model/IEdmTypeReference.php +++ b/src/lib/Model/IEdmTypeReference.php @@ -2,83 +2,102 @@ /** * IEdmTypeReference * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IEdmTypeReference Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IEdmTypeReference implements ModelInterface, ArrayAccess +class IEdmTypeReference implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IEdmTypeReference'; + protected static $openAPIModelName = 'IEdmTypeReference'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_nullable' => 'bool', - 'definition' => '\Swagger\Client\Model\IEdmType' + 'definition' => '\OpenAPI\Client\Model\IEdmType' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_nullable' => null, 'definition' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_nullable' => false, + 'definition' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['is_nullable'] = isset($data['is_nullable']) ? $data['is_nullable'] : null; - $this->container['definition'] = isset($data['definition']) ? $data['definition'] : null; + $this->setIfExists('is_nullable', $data ?? [], null); + $this->setIfExists('definition', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets is_nullable * - * @return bool + * @return bool|null */ public function getIsNullable() { @@ -223,12 +309,15 @@ public function getIsNullable() /** * Sets is_nullable * - * @param bool $is_nullable + * @param bool|null $is_nullable * - * @return $this + * @return self */ public function setIsNullable($is_nullable) { + if (is_null($is_nullable)) { + throw new \InvalidArgumentException('non-nullable is_nullable cannot be null'); + } $this->container['is_nullable'] = $is_nullable; return $this; @@ -237,7 +326,7 @@ public function setIsNullable($is_nullable) /** * Gets definition * - * @return \Swagger\Client\Model\IEdmType + * @return \OpenAPI\Client\Model\IEdmType|null */ public function getDefinition() { @@ -247,12 +336,15 @@ public function getDefinition() /** * Sets definition * - * @param \Swagger\Client\Model\IEdmType $definition + * @param \OpenAPI\Client\Model\IEdmType|null $definition definition * - * @return $this + * @return self */ public function setDefinition($definition) { + if (is_null($definition)) { + throw new \InvalidArgumentException('non-nullable definition cannot be null'); + } $this->container['definition'] = $definition; return $this; @@ -264,7 +356,7 @@ public function setDefinition($definition) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IEdmVocabularyAnnotatable.php b/src/lib/Model/IEdmVocabularyAnnotatable.php deleted file mode 100644 index 863f961..0000000 --- a/src/lib/Model/IEdmVocabularyAnnotatable.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/IEdmVocabularyAnnotation.php b/src/lib/Model/IEdmVocabularyAnnotation.php index 3c3aae7..b9f5645 100644 --- a/src/lib/Model/IEdmVocabularyAnnotation.php +++ b/src/lib/Model/IEdmVocabularyAnnotation.php @@ -2,85 +2,105 @@ /** * IEdmVocabularyAnnotation * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IEdmVocabularyAnnotation Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IEdmVocabularyAnnotation implements ModelInterface, ArrayAccess +class IEdmVocabularyAnnotation implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IEdmVocabularyAnnotation'; + protected static $openAPIModelName = 'IEdmVocabularyAnnotation'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'qualifier' => 'string', - 'term' => '\Swagger\Client\Model\IEdmTerm', - 'target' => '\Swagger\Client\Model\IEdmVocabularyAnnotatable' + 'term' => '\OpenAPI\Client\Model\IEdmTerm', + 'target' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'qualifier' => null, 'term' => null, 'target' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qualifier' => false, + 'term' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['qualifier'] = isset($data['qualifier']) ? $data['qualifier'] : null; - $this->container['term'] = isset($data['term']) ? $data['term'] : null; - $this->container['target'] = isset($data['target']) ? $data['target'] : null; + $this->setIfExists('qualifier', $data ?? [], null); + $this->setIfExists('term', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets qualifier * - * @return string + * @return string|null */ public function getQualifier() { @@ -229,12 +316,15 @@ public function getQualifier() /** * Sets qualifier * - * @param string $qualifier + * @param string|null $qualifier * - * @return $this + * @return self */ public function setQualifier($qualifier) { + if (is_null($qualifier)) { + throw new \InvalidArgumentException('non-nullable qualifier cannot be null'); + } $this->container['qualifier'] = $qualifier; return $this; @@ -243,7 +333,7 @@ public function setQualifier($qualifier) /** * Gets term * - * @return \Swagger\Client\Model\IEdmTerm + * @return \OpenAPI\Client\Model\IEdmTerm|null */ public function getTerm() { @@ -253,12 +343,15 @@ public function getTerm() /** * Sets term * - * @param \Swagger\Client\Model\IEdmTerm $term + * @param \OpenAPI\Client\Model\IEdmTerm|null $term term * - * @return $this + * @return self */ public function setTerm($term) { + if (is_null($term)) { + throw new \InvalidArgumentException('non-nullable term cannot be null'); + } $this->container['term'] = $term; return $this; @@ -267,7 +360,7 @@ public function setTerm($term) /** * Gets target * - * @return \Swagger\Client\Model\IEdmVocabularyAnnotatable + * @return object|null */ public function getTarget() { @@ -277,12 +370,15 @@ public function getTarget() /** * Sets target * - * @param \Swagger\Client\Model\IEdmVocabularyAnnotatable $target + * @param object|null $target target * - * @return $this + * @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; @@ -294,7 +390,7 @@ public function setTarget($target) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/IFutureValueOfInt32.php b/src/lib/Model/IFutureValueOfInt32.php index be8cdc9..76c768f 100644 --- a/src/lib/Model/IFutureValueOfInt32.php +++ b/src/lib/Model/IFutureValueOfInt32.php @@ -2,61 +2,61 @@ /** * IFutureValueOfInt32 * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * IFutureValueOfInt32 Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class IFutureValueOfInt32 implements ModelInterface, ArrayAccess +class IFutureValueOfInt32 implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'IFutureValueOfInt32'; + protected static $openAPIModelName = 'IFutureValueOfInt32'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'value' => 'int' ]; @@ -64,19 +64,37 @@ class IFutureValueOfInt32 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'value' => 'int32' ]; + /** + * 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : 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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets value * - * @return int + * @return int|null */ public function getValue() { @@ -217,12 +302,15 @@ public function getValue() /** * Sets value * - * @param int $value + * @param int|null $value * - * @return $this + * @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; @@ -234,7 +322,7 @@ public function setValue($value) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ILeaveBasedRosterShift.php b/src/lib/Model/ILeaveBasedRosterShift.php index 135f29f..1b5884d 100644 --- a/src/lib/Model/ILeaveBasedRosterShift.php +++ b/src/lib/Model/ILeaveBasedRosterShift.php @@ -2,61 +2,61 @@ /** * ILeaveBasedRosterShift * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ILeaveBasedRosterShift Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ILeaveBasedRosterShift implements ModelInterface, ArrayAccess +class ILeaveBasedRosterShift implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ILeaveBasedRosterShift'; + protected static $openAPIModelName = 'ILeaveBasedRosterShift'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_leave_based_roster_shift' => 'bool' ]; @@ -64,19 +64,37 @@ class ILeaveBasedRosterShift implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_leave_based_roster_shift' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_leave_based_roster_shift' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['is_leave_based_roster_shift'] = isset($data['is_leave_based_roster_shift']) ? $data['is_leave_based_roster_shift'] : null; + $this->setIfExists('is_leave_based_roster_shift', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets is_leave_based_roster_shift * - * @return bool + * @return bool|null */ public function getIsLeaveBasedRosterShift() { @@ -217,12 +302,15 @@ public function getIsLeaveBasedRosterShift() /** * Sets is_leave_based_roster_shift * - * @param bool $is_leave_based_roster_shift + * @param bool|null $is_leave_based_roster_shift * - * @return $this + * @return self */ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) { + if (is_null($is_leave_based_roster_shift)) { + throw new \InvalidArgumentException('non-nullable is_leave_based_roster_shift cannot be null'); + } $this->container['is_leave_based_roster_shift'] = $is_leave_based_roster_shift; return $this; @@ -234,7 +322,7 @@ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InitialEmployerLiabilityModel.php b/src/lib/Model/InitialEmployerLiabilityModel.php index cea1571..0583513 100644 --- a/src/lib/Model/InitialEmployerLiabilityModel.php +++ b/src/lib/Model/InitialEmployerLiabilityModel.php @@ -2,85 +2,105 @@ /** * InitialEmployerLiabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InitialEmployerLiabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InitialEmployerLiabilityModel implements ModelInterface, ArrayAccess +class InitialEmployerLiabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InitialEmployerLiabilityModel'; + protected static $openAPIModelName = 'InitialEmployerLiabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employer_liability_category_id' => 'int', 'name' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employer_liability_category_id' => 'int32', 'name' => null, 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employer_liability_category_id' => false, + 'name' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employer_liability_category_id'] = isset($data['employer_liability_category_id']) ? $data['employer_liability_category_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('employer_liability_category_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets employer_liability_category_id * - * @return int + * @return int|null */ public function getEmployerLiabilityCategoryId() { @@ -229,12 +316,15 @@ public function getEmployerLiabilityCategoryId() /** * Sets employer_liability_category_id * - * @param int $employer_liability_category_id + * @param int|null $employer_liability_category_id * - * @return $this + * @return self */ public function setEmployerLiabilityCategoryId($employer_liability_category_id) { + if (is_null($employer_liability_category_id)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category_id cannot be null'); + } $this->container['employer_liability_category_id'] = $employer_liability_category_id; return $this; @@ -243,7 +333,7 @@ public function setEmployerLiabilityCategoryId($employer_liability_category_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -277,12 +370,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -294,7 +390,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InitialLeaveBalanceModel.php b/src/lib/Model/InitialLeaveBalanceModel.php index 3694170..535d093 100644 --- a/src/lib/Model/InitialLeaveBalanceModel.php +++ b/src/lib/Model/InitialLeaveBalanceModel.php @@ -2,64 +2,64 @@ /** * InitialLeaveBalanceModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InitialLeaveBalanceModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InitialLeaveBalanceModel implements ModelInterface, ArrayAccess +class InitialLeaveBalanceModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InitialLeaveBalanceModel'; + protected static $openAPIModelName = 'InitialLeaveBalanceModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_category_id' => 'int', 'name' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'unit_type' => 'string' ]; @@ -67,22 +67,43 @@ class InitialLeaveBalanceModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_category_id' => 'int32', 'name' => null, 'amount' => 'double', 'unit_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_category_id' => false, + 'name' => false, + 'amount' => false, + 'unit_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,15 +243,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -192,7 +263,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -209,10 +279,28 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('unit_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; } /** @@ -227,7 +315,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -250,7 +339,7 @@ public function valid() /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -260,12 +349,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -274,7 +366,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -284,12 +376,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -298,7 +393,7 @@ public function setName($name) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -308,12 +403,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -322,7 +420,7 @@ public function setAmount($amount) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -332,17 +430,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -358,7 +460,7 @@ public function setUnitType($unit_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -368,22 +470,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -399,11 +502,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -411,13 +527,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InlineCountQueryOption.php b/src/lib/Model/InlineCountQueryOption.php index 83f6f81..17c48c5 100644 --- a/src/lib/Model/InlineCountQueryOption.php +++ b/src/lib/Model/InlineCountQueryOption.php @@ -2,62 +2,62 @@ /** * InlineCountQueryOption * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InlineCountQueryOption Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InlineCountQueryOption implements ModelInterface, ArrayAccess +class InlineCountQueryOption implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InlineCountQueryOption'; + protected static $openAPIModelName = 'InlineCountQueryOption'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'context' => '\Swagger\Client\Model\ODataQueryContext', + protected static $openAPITypes = [ + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'raw_value' => 'string', 'value' => 'string' ]; @@ -66,21 +66,41 @@ class InlineCountQueryOption implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'context' => null, 'raw_value' => null, 'value' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'context' => false, + 'raw_value' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,14 +237,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const VALUE_NONE = 'None'; - const VALUE_ALL_PAGES = 'AllPages'; - + public const VALUE_NONE = 'None'; + public const VALUE_ALL_PAGES = 'AllPages'; - /** * Gets allowable values of the enum * @@ -185,7 +255,6 @@ public function getValueAllowableValues() self::VALUE_ALL_PAGES, ]; } - /** * Associative array for storing property values @@ -202,9 +271,27 @@ public function getValueAllowableValues() */ public function __construct(array $data = null) { - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['raw_value'] = isset($data['raw_value']) ? $data['raw_value'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('raw_value', $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; } /** @@ -219,7 +306,8 @@ public function listInvalidProperties() $allowedValues = $this->getValueAllowableValues(); if (!is_null($this->container['value']) && !in_array($this->container['value'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'value', must be one of '%s'", + "invalid value '%s' for 'value', must be one of '%s'", + $this->container['value'], implode("', '", $allowedValues) ); } @@ -242,7 +330,7 @@ public function valid() /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -252,12 +340,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -266,7 +357,7 @@ public function setContext($context) /** * Gets raw_value * - * @return string + * @return string|null */ public function getRawValue() { @@ -276,12 +367,15 @@ public function getRawValue() /** * Sets raw_value * - * @param string $raw_value + * @param string|null $raw_value * - * @return $this + * @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; @@ -290,7 +384,7 @@ public function setRawValue($raw_value) /** * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -300,17 +394,21 @@ public function getValue() /** * Sets value * - * @param string $value + * @param string|null $value * - * @return $this + * @return self */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $allowedValues = $this->getValueAllowableValues(); - if (!is_null($value) && !in_array($value, $allowedValues, true)) { + if (!in_array($value, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'value', must be one of '%s'", + "Invalid value '%s' for 'value', must be one of '%s'", + $value, implode("', '", $allowedValues) ) ); @@ -326,7 +424,7 @@ public function setValue($value) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -336,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -367,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -379,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InvoiceLineItemDetailModel.php b/src/lib/Model/InvoiceLineItemDetailModel.php index 1dda488..da0045d 100644 --- a/src/lib/Model/InvoiceLineItemDetailModel.php +++ b/src/lib/Model/InvoiceLineItemDetailModel.php @@ -2,61 +2,61 @@ /** * InvoiceLineItemDetailModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InvoiceLineItemDetailModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InvoiceLineItemDetailModel implements ModelInterface, ArrayAccess +class InvoiceLineItemDetailModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InvoiceLineItemDetailModel'; + protected static $openAPIModelName = 'InvoiceLineItemDetailModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'group_name' => 'string', 'description' => 'string' ]; @@ -65,20 +65,39 @@ class InvoiceLineItemDetailModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'group_name' => null, 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'group_name' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['group_name'] = isset($data['group_name']) ? $data['group_name'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('group_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets group_name * - * @return string + * @return string|null */ public function getGroupName() { @@ -223,12 +309,15 @@ public function getGroupName() /** * Sets group_name * - * @param string $group_name + * @param string|null $group_name * - * @return $this + * @return self */ public function setGroupName($group_name) { + if (is_null($group_name)) { + throw new \InvalidArgumentException('non-nullable group_name cannot be null'); + } $this->container['group_name'] = $group_name; return $this; @@ -237,7 +326,7 @@ public function setGroupName($group_name) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -247,12 +336,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -264,7 +356,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InvoiceLineItemModel.php b/src/lib/Model/InvoiceLineItemModel.php index 14fe357..1724e71 100644 --- a/src/lib/Model/InvoiceLineItemModel.php +++ b/src/lib/Model/InvoiceLineItemModel.php @@ -2,70 +2,70 @@ /** * InvoiceLineItemModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InvoiceLineItemModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InvoiceLineItemModel implements ModelInterface, ArrayAccess +class InvoiceLineItemModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InvoiceLineItemModel'; + protected static $openAPIModelName = 'InvoiceLineItemModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'abn' => 'string', 'business_number' => 'string', 'business_id' => 'int', 'billing_plan' => 'string', 'description' => 'string', - 'unit_price_including_gst' => 'double', - 'quantity' => 'double', - 'total_including_gst' => 'double', - 'details' => '\Swagger\Client\Model\InvoiceLineItemDetailModel[]', + 'unit_price_including_gst' => 'float', + 'quantity' => 'float', + 'total_including_gst' => 'float', + 'details' => '\OpenAPI\Client\Model\InvoiceLineItemDetailModel[]', 'white_label_name' => 'string', 'brand_name' => 'string' ]; @@ -74,8 +74,10 @@ class InvoiceLineItemModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'abn' => null, 'business_number' => null, 'business_id' => 'int32', @@ -89,14 +91,40 @@ class InvoiceLineItemModel implements ModelInterface, ArrayAccess 'brand_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'abn' => false, + 'business_number' => false, + 'business_id' => false, + 'billing_plan' => false, + 'description' => false, + 'unit_price_including_gst' => false, + 'quantity' => false, + 'total_including_gst' => false, + 'details' => false, + 'white_label_name' => false, + 'brand_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['business_number'] = isset($data['business_number']) ? $data['business_number'] : null; - $this->container['business_id'] = isset($data['business_id']) ? $data['business_id'] : null; - $this->container['billing_plan'] = isset($data['billing_plan']) ? $data['billing_plan'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['unit_price_including_gst'] = isset($data['unit_price_including_gst']) ? $data['unit_price_including_gst'] : null; - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['total_including_gst'] = isset($data['total_including_gst']) ? $data['total_including_gst'] : null; - $this->container['details'] = isset($data['details']) ? $data['details'] : null; - $this->container['white_label_name'] = isset($data['white_label_name']) ? $data['white_label_name'] : null; - $this->container['brand_name'] = isset($data['brand_name']) ? $data['brand_name'] : null; + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('business_number', $data ?? [], null); + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('billing_plan', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('unit_price_including_gst', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('total_including_gst', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('white_label_name', $data ?? [], null); + $this->setIfExists('brand_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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -277,12 +372,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -291,7 +389,7 @@ public function setAbn($abn) /** * Gets business_number * - * @return string + * @return string|null */ public function getBusinessNumber() { @@ -301,12 +399,15 @@ public function getBusinessNumber() /** * Sets business_number * - * @param string $business_number + * @param string|null $business_number * - * @return $this + * @return self */ public function setBusinessNumber($business_number) { + if (is_null($business_number)) { + throw new \InvalidArgumentException('non-nullable business_number cannot be null'); + } $this->container['business_number'] = $business_number; return $this; @@ -315,7 +416,7 @@ public function setBusinessNumber($business_number) /** * Gets business_id * - * @return int + * @return int|null */ public function getBusinessId() { @@ -325,12 +426,15 @@ public function getBusinessId() /** * Sets business_id * - * @param int $business_id + * @param int|null $business_id * - * @return $this + * @return self */ public function setBusinessId($business_id) { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } $this->container['business_id'] = $business_id; return $this; @@ -339,7 +443,7 @@ public function setBusinessId($business_id) /** * Gets billing_plan * - * @return string + * @return string|null */ public function getBillingPlan() { @@ -349,12 +453,15 @@ public function getBillingPlan() /** * Sets billing_plan * - * @param string $billing_plan + * @param string|null $billing_plan * - * @return $this + * @return self */ public function setBillingPlan($billing_plan) { + if (is_null($billing_plan)) { + throw new \InvalidArgumentException('non-nullable billing_plan cannot be null'); + } $this->container['billing_plan'] = $billing_plan; return $this; @@ -363,7 +470,7 @@ public function setBillingPlan($billing_plan) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -373,12 +480,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -387,7 +497,7 @@ public function setDescription($description) /** * Gets unit_price_including_gst * - * @return double + * @return float|null */ public function getUnitPriceIncludingGst() { @@ -397,12 +507,15 @@ public function getUnitPriceIncludingGst() /** * Sets unit_price_including_gst * - * @param double $unit_price_including_gst + * @param float|null $unit_price_including_gst * - * @return $this + * @return self */ public function setUnitPriceIncludingGst($unit_price_including_gst) { + if (is_null($unit_price_including_gst)) { + throw new \InvalidArgumentException('non-nullable unit_price_including_gst cannot be null'); + } $this->container['unit_price_including_gst'] = $unit_price_including_gst; return $this; @@ -411,7 +524,7 @@ public function setUnitPriceIncludingGst($unit_price_including_gst) /** * Gets quantity * - * @return double + * @return float|null */ public function getQuantity() { @@ -421,12 +534,15 @@ public function getQuantity() /** * Sets quantity * - * @param double $quantity + * @param float|null $quantity * - * @return $this + * @return self */ public function setQuantity($quantity) { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } $this->container['quantity'] = $quantity; return $this; @@ -435,7 +551,7 @@ public function setQuantity($quantity) /** * Gets total_including_gst * - * @return double + * @return float|null */ public function getTotalIncludingGst() { @@ -445,12 +561,15 @@ public function getTotalIncludingGst() /** * Sets total_including_gst * - * @param double $total_including_gst + * @param float|null $total_including_gst * - * @return $this + * @return self */ public function setTotalIncludingGst($total_including_gst) { + if (is_null($total_including_gst)) { + throw new \InvalidArgumentException('non-nullable total_including_gst cannot be null'); + } $this->container['total_including_gst'] = $total_including_gst; return $this; @@ -459,7 +578,7 @@ public function setTotalIncludingGst($total_including_gst) /** * Gets details * - * @return \Swagger\Client\Model\InvoiceLineItemDetailModel[] + * @return \OpenAPI\Client\Model\InvoiceLineItemDetailModel[]|null */ public function getDetails() { @@ -469,12 +588,15 @@ public function getDetails() /** * Sets details * - * @param \Swagger\Client\Model\InvoiceLineItemDetailModel[] $details + * @param \OpenAPI\Client\Model\InvoiceLineItemDetailModel[]|null $details * - * @return $this + * @return self */ public function setDetails($details) { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } $this->container['details'] = $details; return $this; @@ -483,7 +605,7 @@ public function setDetails($details) /** * Gets white_label_name * - * @return string + * @return string|null */ public function getWhiteLabelName() { @@ -493,12 +615,15 @@ public function getWhiteLabelName() /** * Sets white_label_name * - * @param string $white_label_name + * @param string|null $white_label_name * - * @return $this + * @return self */ public function setWhiteLabelName($white_label_name) { + if (is_null($white_label_name)) { + throw new \InvalidArgumentException('non-nullable white_label_name cannot be null'); + } $this->container['white_label_name'] = $white_label_name; return $this; @@ -507,7 +632,7 @@ public function setWhiteLabelName($white_label_name) /** * Gets brand_name * - * @return string + * @return string|null */ public function getBrandName() { @@ -517,12 +642,15 @@ public function getBrandName() /** * Sets brand_name * - * @param string $brand_name + * @param string|null $brand_name * - * @return $this + * @return self */ public function setBrandName($brand_name) { + if (is_null($brand_name)) { + throw new \InvalidArgumentException('non-nullable brand_name cannot be null'); + } $this->container['brand_name'] = $brand_name; return $this; @@ -534,7 +662,7 @@ public function setBrandName($brand_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InvoiceModel.php b/src/lib/Model/InvoiceModel.php index 6b20836..cdfe26f 100644 --- a/src/lib/Model/InvoiceModel.php +++ b/src/lib/Model/InvoiceModel.php @@ -2,78 +2,80 @@ /** * InvoiceModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InvoiceModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InvoiceModel implements ModelInterface, ArrayAccess +class InvoiceModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InvoiceModel'; + protected static $openAPIModelName = 'InvoiceModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'invoice_number' => 'string', 'date' => '\DateTime', - 'total_excluding_gst' => 'double', - 'gst' => 'double', - 'total_including_gst' => 'double', + 'total_excluding_gst' => 'float', + 'gst' => 'float', + 'total_including_gst' => 'float', 'culture_name' => 'string', 'currency' => 'string', - 'line_items' => '\Swagger\Client\Model\InvoiceLineItemModel[]' + 'line_items' => '\OpenAPI\Client\Model\InvoiceLineItemModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'invoice_number' => null, 'date' => 'date-time', @@ -85,14 +87,38 @@ class InvoiceModel implements ModelInterface, ArrayAccess 'line_items' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'invoice_number' => false, + 'date' => false, + 'total_excluding_gst' => false, + 'gst' => false, + 'total_including_gst' => false, + 'culture_name' => false, + 'currency' => false, + 'line_items' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['invoice_number'] = isset($data['invoice_number']) ? $data['invoice_number'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['total_excluding_gst'] = isset($data['total_excluding_gst']) ? $data['total_excluding_gst'] : null; - $this->container['gst'] = isset($data['gst']) ? $data['gst'] : null; - $this->container['total_including_gst'] = isset($data['total_including_gst']) ? $data['total_including_gst'] : null; - $this->container['culture_name'] = isset($data['culture_name']) ? $data['culture_name'] : null; - $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; - $this->container['line_items'] = isset($data['line_items']) ? $data['line_items'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('invoice_number', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('total_excluding_gst', $data ?? [], null); + $this->setIfExists('gst', $data ?? [], null); + $this->setIfExists('total_including_gst', $data ?? [], null); + $this->setIfExists('culture_name', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('line_items', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +358,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +375,7 @@ public function setId($id) /** * Gets invoice_number * - * @return string + * @return string|null */ public function getInvoiceNumber() { @@ -289,12 +385,15 @@ public function getInvoiceNumber() /** * Sets invoice_number * - * @param string $invoice_number + * @param string|null $invoice_number * - * @return $this + * @return self */ public function setInvoiceNumber($invoice_number) { + if (is_null($invoice_number)) { + throw new \InvalidArgumentException('non-nullable invoice_number cannot be null'); + } $this->container['invoice_number'] = $invoice_number; return $this; @@ -303,7 +402,7 @@ public function setInvoiceNumber($invoice_number) /** * Gets date * - * @return \DateTime + * @return \DateTime|null */ public function getDate() { @@ -313,12 +412,15 @@ public function getDate() /** * Sets date * - * @param \DateTime $date + * @param \DateTime|null $date * - * @return $this + * @return self */ public function setDate($date) { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -327,7 +429,7 @@ public function setDate($date) /** * Gets total_excluding_gst * - * @return double + * @return float|null */ public function getTotalExcludingGst() { @@ -337,12 +439,15 @@ public function getTotalExcludingGst() /** * Sets total_excluding_gst * - * @param double $total_excluding_gst + * @param float|null $total_excluding_gst * - * @return $this + * @return self */ public function setTotalExcludingGst($total_excluding_gst) { + if (is_null($total_excluding_gst)) { + throw new \InvalidArgumentException('non-nullable total_excluding_gst cannot be null'); + } $this->container['total_excluding_gst'] = $total_excluding_gst; return $this; @@ -351,7 +456,7 @@ public function setTotalExcludingGst($total_excluding_gst) /** * Gets gst * - * @return double + * @return float|null */ public function getGst() { @@ -361,12 +466,15 @@ public function getGst() /** * Sets gst * - * @param double $gst + * @param float|null $gst * - * @return $this + * @return self */ public function setGst($gst) { + if (is_null($gst)) { + throw new \InvalidArgumentException('non-nullable gst cannot be null'); + } $this->container['gst'] = $gst; return $this; @@ -375,7 +483,7 @@ public function setGst($gst) /** * Gets total_including_gst * - * @return double + * @return float|null */ public function getTotalIncludingGst() { @@ -385,12 +493,15 @@ public function getTotalIncludingGst() /** * Sets total_including_gst * - * @param double $total_including_gst + * @param float|null $total_including_gst * - * @return $this + * @return self */ public function setTotalIncludingGst($total_including_gst) { + if (is_null($total_including_gst)) { + throw new \InvalidArgumentException('non-nullable total_including_gst cannot be null'); + } $this->container['total_including_gst'] = $total_including_gst; return $this; @@ -399,7 +510,7 @@ public function setTotalIncludingGst($total_including_gst) /** * Gets culture_name * - * @return string + * @return string|null */ public function getCultureName() { @@ -409,12 +520,15 @@ public function getCultureName() /** * Sets culture_name * - * @param string $culture_name + * @param string|null $culture_name * - * @return $this + * @return self */ public function setCultureName($culture_name) { + if (is_null($culture_name)) { + throw new \InvalidArgumentException('non-nullable culture_name cannot be null'); + } $this->container['culture_name'] = $culture_name; return $this; @@ -423,7 +537,7 @@ public function setCultureName($culture_name) /** * Gets currency * - * @return string + * @return string|null */ public function getCurrency() { @@ -433,12 +547,15 @@ public function getCurrency() /** * Sets currency * - * @param string $currency + * @param string|null $currency * - * @return $this + * @return self */ public function setCurrency($currency) { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } $this->container['currency'] = $currency; return $this; @@ -447,7 +564,7 @@ public function setCurrency($currency) /** * Gets line_items * - * @return \Swagger\Client\Model\InvoiceLineItemModel[] + * @return \OpenAPI\Client\Model\InvoiceLineItemModel[]|null */ public function getLineItems() { @@ -457,12 +574,15 @@ public function getLineItems() /** * Sets line_items * - * @param \Swagger\Client\Model\InvoiceLineItemModel[] $line_items + * @param \OpenAPI\Client\Model\InvoiceLineItemModel[]|null $line_items * - * @return $this + * @return self */ public function setLineItems($line_items) { + if (is_null($line_items)) { + throw new \InvalidArgumentException('non-nullable line_items cannot be null'); + } $this->container['line_items'] = $line_items; return $this; @@ -474,7 +594,7 @@ public function setLineItems($line_items) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/InvoiceQueryOptionsModel.php b/src/lib/Model/InvoiceQueryOptionsModel.php index 1f5f7b5..41b55d0 100644 --- a/src/lib/Model/InvoiceQueryOptionsModel.php +++ b/src/lib/Model/InvoiceQueryOptionsModel.php @@ -2,61 +2,61 @@ /** * InvoiceQueryOptionsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * InvoiceQueryOptionsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class InvoiceQueryOptionsModel implements ModelInterface, ArrayAccess +class InvoiceQueryOptionsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'InvoiceQueryOptionsModel'; + protected static $openAPIModelName = 'InvoiceQueryOptionsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime' ]; @@ -65,20 +65,39 @@ class InvoiceQueryOptionsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -223,12 +309,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -237,7 +326,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -247,12 +336,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -264,7 +356,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/JournalAccountBulkCreateModel.php b/src/lib/Model/JournalAccountBulkCreateModel.php index 6bea6a8..7ac39cc 100644 --- a/src/lib/Model/JournalAccountBulkCreateModel.php +++ b/src/lib/Model/JournalAccountBulkCreateModel.php @@ -2,83 +2,102 @@ /** * JournalAccountBulkCreateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * JournalAccountBulkCreateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class JournalAccountBulkCreateModel implements ModelInterface, ArrayAccess +class JournalAccountBulkCreateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'JournalAccountBulkCreateModel'; + protected static $openAPIModelName = 'JournalAccountBulkCreateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'error_messages' => 'string[]', - 'created_journal_accounts' => '\Swagger\Client\Model\JournalAccountModel[]' + 'created_journal_accounts' => '\OpenAPI\Client\Model\JournalAccountModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'error_messages' => null, 'created_journal_accounts' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_messages' => false, + 'created_journal_accounts' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['error_messages'] = isset($data['error_messages']) ? $data['error_messages'] : null; - $this->container['created_journal_accounts'] = isset($data['created_journal_accounts']) ? $data['created_journal_accounts'] : null; + $this->setIfExists('error_messages', $data ?? [], null); + $this->setIfExists('created_journal_accounts', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets error_messages * - * @return string[] + * @return string[]|null */ public function getErrorMessages() { @@ -223,12 +309,15 @@ public function getErrorMessages() /** * Sets error_messages * - * @param string[] $error_messages + * @param string[]|null $error_messages * - * @return $this + * @return self */ public function setErrorMessages($error_messages) { + if (is_null($error_messages)) { + throw new \InvalidArgumentException('non-nullable error_messages cannot be null'); + } $this->container['error_messages'] = $error_messages; return $this; @@ -237,7 +326,7 @@ public function setErrorMessages($error_messages) /** * Gets created_journal_accounts * - * @return \Swagger\Client\Model\JournalAccountModel[] + * @return \OpenAPI\Client\Model\JournalAccountModel[]|null */ public function getCreatedJournalAccounts() { @@ -247,12 +336,15 @@ public function getCreatedJournalAccounts() /** * Sets created_journal_accounts * - * @param \Swagger\Client\Model\JournalAccountModel[] $created_journal_accounts + * @param \OpenAPI\Client\Model\JournalAccountModel[]|null $created_journal_accounts * - * @return $this + * @return self */ public function setCreatedJournalAccounts($created_journal_accounts) { + if (is_null($created_journal_accounts)) { + throw new \InvalidArgumentException('non-nullable created_journal_accounts cannot be null'); + } $this->container['created_journal_accounts'] = $created_journal_accounts; return $this; @@ -264,7 +356,7 @@ public function setCreatedJournalAccounts($created_journal_accounts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/JournalAccountModel.php b/src/lib/Model/JournalAccountModel.php index 1716792..0bc9819 100644 --- a/src/lib/Model/JournalAccountModel.php +++ b/src/lib/Model/JournalAccountModel.php @@ -2,61 +2,61 @@ /** * JournalAccountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * JournalAccountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class JournalAccountModel implements ModelInterface, ArrayAccess +class JournalAccountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'JournalAccountModel'; + protected static $openAPIModelName = 'JournalAccountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'account_code' => 'string', 'account_name' => 'string', @@ -68,8 +68,10 @@ class JournalAccountModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'account_code' => null, 'account_name' => null, @@ -77,14 +79,34 @@ class JournalAccountModel implements ModelInterface, ArrayAccess 'external_reference_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'account_code' => false, + 'account_name' => false, + 'account_type' => false, + 'external_reference_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -175,25 +249,23 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCOUNT_TYPE_ASSET = 'Asset'; - const ACCOUNT_TYPE_EXPENSE = 'Expense'; - const ACCOUNT_TYPE_LIABILITY = 'Liability'; - const ACCOUNT_TYPE_EQUITY = 'Equity'; - const ACCOUNT_TYPE_INCOME = 'Income'; - const ACCOUNT_TYPE_UNKNOWN = 'Unknown'; - const ACCOUNT_TYPE_NOT_ALLOWED = 'NotAllowed'; - const ACCOUNT_TYPE_COST_OF_GOODS_SOLD = 'CostOfGoodsSold'; - const ACCOUNT_TYPE_ASSET_AND_LIABILITY = 'AssetAndLiability'; - const ACCOUNT_TYPE_CAPITALS_AND_RESERVES = 'CapitalsAndReserves'; - const ACCOUNT_TYPE_SALES = 'Sales'; - const ACCOUNT_TYPE_PURCHASES = 'Purchases'; - const ACCOUNT_TYPE_OVERHEADS = 'Overheads'; - + public const ACCOUNT_TYPE_ASSET = 'Asset'; + public const ACCOUNT_TYPE_EXPENSE = 'Expense'; + public const ACCOUNT_TYPE_LIABILITY = 'Liability'; + public const ACCOUNT_TYPE_EQUITY = 'Equity'; + public const ACCOUNT_TYPE_INCOME = 'Income'; + public const ACCOUNT_TYPE_UNKNOWN = 'Unknown'; + public const ACCOUNT_TYPE_NOT_ALLOWED = 'NotAllowed'; + public const ACCOUNT_TYPE_COST_OF_GOODS_SOLD = 'CostOfGoodsSold'; + public const ACCOUNT_TYPE_ASSET_AND_LIABILITY = 'AssetAndLiability'; + public const ACCOUNT_TYPE_CAPITALS_AND_RESERVES = 'CapitalsAndReserves'; + public const ACCOUNT_TYPE_SALES = 'Sales'; + public const ACCOUNT_TYPE_PURCHASES = 'Purchases'; + public const ACCOUNT_TYPE_OVERHEADS = 'Overheads'; - /** * Gets allowable values of the enum * @@ -217,7 +289,6 @@ public function getAccountTypeAllowableValues() self::ACCOUNT_TYPE_OVERHEADS, ]; } - /** * Associative array for storing property values @@ -234,11 +305,29 @@ public function getAccountTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['account_code'] = isset($data['account_code']) ? $data['account_code'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('account_code', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_type', $data ?? [], null); + $this->setIfExists('external_reference_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; } /** @@ -253,7 +342,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccountTypeAllowableValues(); if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'account_type', must be one of '%s'", + "invalid value '%s' for 'account_type', must be one of '%s'", + $this->container['account_type'], implode("', '", $allowedValues) ); } @@ -276,7 +366,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -286,12 +376,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -300,7 +393,7 @@ public function setId($id) /** * Gets account_code * - * @return string + * @return string|null */ public function getAccountCode() { @@ -310,12 +403,15 @@ public function getAccountCode() /** * Sets account_code * - * @param string $account_code + * @param string|null $account_code * - * @return $this + * @return self */ public function setAccountCode($account_code) { + if (is_null($account_code)) { + throw new \InvalidArgumentException('non-nullable account_code cannot be null'); + } $this->container['account_code'] = $account_code; return $this; @@ -324,7 +420,7 @@ public function setAccountCode($account_code) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -334,12 +430,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -348,7 +447,7 @@ public function setAccountName($account_name) /** * Gets account_type * - * @return string + * @return string|null */ public function getAccountType() { @@ -358,17 +457,21 @@ public function getAccountType() /** * Sets account_type * - * @param string $account_type + * @param string|null $account_type * - * @return $this + * @return self */ public function setAccountType($account_type) { + if (is_null($account_type)) { + throw new \InvalidArgumentException('non-nullable account_type cannot be null'); + } $allowedValues = $this->getAccountTypeAllowableValues(); - if (!is_null($account_type) && !in_array($account_type, $allowedValues, true)) { + if (!in_array($account_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'account_type', must be one of '%s'", + "Invalid value '%s' for 'account_type', must be one of '%s'", + $account_type, implode("', '", $allowedValues) ) ); @@ -381,7 +484,7 @@ public function setAccountType($account_type) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -391,12 +494,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -408,7 +514,7 @@ public function setExternalReferenceId($external_reference_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -418,22 +524,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -449,11 +556,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -461,13 +581,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/JournalExportResult.php b/src/lib/Model/JournalExportResult.php index 4766154..4c0936f 100644 --- a/src/lib/Model/JournalExportResult.php +++ b/src/lib/Model/JournalExportResult.php @@ -2,61 +2,61 @@ /** * JournalExportResult * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * JournalExportResult Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class JournalExportResult implements ModelInterface, ArrayAccess +class JournalExportResult implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'JournalExportResult'; + protected static $openAPIModelName = 'JournalExportResult'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'status' => 'string', 'message' => 'string', 'journal_source' => 'string', @@ -67,22 +67,43 @@ class JournalExportResult implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'status' => null, 'message' => null, 'journal_source' => null, 'journal_external_reference_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'message' => false, + 'journal_source' => false, + 'journal_external_reference_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,106 +243,104 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const STATUS_NOT_EXPORTED = 'NotExported'; - const STATUS_SUCCESS = 'Success'; - const STATUS_FAILURE_UNKNOWN_ERROR = 'FailureUnknownError'; - const STATUS_FAILURE_ACCOUNTS_NOT_CONFIGURED = 'FailureAccountsNotConfigured'; - const STATUS_FAILURE_ITEMS_DELETED = 'FailureItemsDeleted'; - const STATUS_FAILURE_ACCOUNT_PERIOD_CLOSED = 'FailureAccountPeriodClosed'; - const STATUS_FAILURE_NOT_AUTHENTICATED = 'FailureNotAuthenticated'; - const STATUS_FAILURE_ALREADY_EXPORTED = 'FailureAlreadyExported'; - const STATUS_FAILURE_FUNCTION_DISABLED = 'FailureFunctionDisabled'; - const STATUS_FAILURE_CANNOT_USE_ACCOUNTS_PAYABLE_ACCOUNT = 'FailureCannotUseAccountsPayableAccount'; - const STATUS_FAILURE_VENDOR_MESSAGE = 'FailureVendorMessage'; - const STATUS_FAILURE_INTERCOMPANY_LOAN_ACCOUNTS_NOT_CONFIGURED = 'FailureIntercompanyLoanAccountsNotConfigured'; - const STATUS_FAILURE_GST_SETUP = 'FailureGSTSetup'; - const STATUS_FAILURE_KNOWN_ERROR = 'FailureKnownError'; - const STATUS_FAILURES_TENANT_NOT_SUPPLIED = 'FailuresTenantNotSupplied'; - const STATUS_FAILURE_NO_JOURNAL_ID = 'FailureNoJournalId'; - const STATUS_FAILURE_API_ERROR = 'FailureAPIError'; - const STATUS_RESULT_UNKNOWN = 'ResultUnknown'; - const JOURNAL_SOURCE_NONE = 'None'; - const JOURNAL_SOURCE_SAASU = 'Saasu'; - const JOURNAL_SOURCE_XERO = 'Xero'; - const JOURNAL_SOURCE_MYOB = 'MYOB'; - const JOURNAL_SOURCE_DEPUTY = 'Deputy'; - const JOURNAL_SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const JOURNAL_SOURCE_CLICK_SUPER = 'ClickSuper'; - const JOURNAL_SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const JOURNAL_SOURCE_FILE_IMPORT = 'FileImport'; - const JOURNAL_SOURCE_FILE_EXPORT = 'FileExport'; - const JOURNAL_SOURCE_QUICK_BOOKS = 'QuickBooks'; - const JOURNAL_SOURCE_HARMONY = 'Harmony'; - const JOURNAL_SOURCE_AWARD_STORE = 'AwardStore'; - const JOURNAL_SOURCE_ATTACHE = 'Attache'; - const JOURNAL_SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const JOURNAL_SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const JOURNAL_SOURCE_API = 'API'; - const JOURNAL_SOURCE_MICRO_POWER = 'MicroPower'; - const JOURNAL_SOURCE_ROSTER_LIVE = 'RosterLive'; - const JOURNAL_SOURCE_NET_SUITE = 'NetSuite'; - const JOURNAL_SOURCE_KOUNTA = 'Kounta'; - const JOURNAL_SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const JOURNAL_SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const JOURNAL_SOURCE_JONAS_PREMIER = 'JonasPremier'; - const JOURNAL_SOURCE_WAGE_EASY = 'WageEasy'; - const JOURNAL_SOURCE_MAESTRANO = 'Maestrano'; - const JOURNAL_SOURCE_WORK_ZONE = 'WorkZone'; - const JOURNAL_SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const JOURNAL_SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const JOURNAL_SOURCE_ONBOARDING = 'Onboarding'; - const JOURNAL_SOURCE_ADMIN = 'Admin'; - const JOURNAL_SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const JOURNAL_SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const JOURNAL_SOURCE_SAGE50 = 'Sage50'; - const JOURNAL_SOURCE_PENSION_SYNC = 'PensionSync'; - const JOURNAL_SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const JOURNAL_SOURCE_PRONTO_XI = 'ProntoXI'; - const JOURNAL_SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const JOURNAL_SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const JOURNAL_SOURCE_BEAM = 'Beam'; - const JOURNAL_SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const JOURNAL_SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const JOURNAL_SOURCE_WIISE = 'Wiise'; - const JOURNAL_SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const JOURNAL_SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const JOURNAL_SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const JOURNAL_SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const JOURNAL_SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const JOURNAL_SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const JOURNAL_SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const JOURNAL_SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const JOURNAL_SOURCE_O_AUTH = 'OAuth'; - const JOURNAL_SOURCE_FRESH_BOOKS = 'FreshBooks'; - const JOURNAL_SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const JOURNAL_SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const JOURNAL_SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const JOURNAL_SOURCE_TELLEROO = 'Telleroo'; - const JOURNAL_SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const JOURNAL_SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const JOURNAL_SOURCE_PAYTRON = 'Paytron'; - const JOURNAL_SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const JOURNAL_SOURCE_COMMA = 'Comma'; - const JOURNAL_SOURCE_ZOHO = 'Zoho'; - const JOURNAL_SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const JOURNAL_SOURCE_TWINFIELD = 'Twinfield'; - const JOURNAL_SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const JOURNAL_SOURCE_SQUARE = 'Square'; - const JOURNAL_SOURCE_QUICKFILE = 'Quickfile'; - const JOURNAL_SOURCE_TIDE = 'Tide'; - const JOURNAL_SOURCE_TIDE_SSO = 'TideSso'; - const JOURNAL_SOURCE_FREE_AGENT = 'FreeAgent'; - const JOURNAL_SOURCE_AKAHU = 'Akahu'; - const JOURNAL_SOURCE_INSTA_PAY = 'InstaPay'; - const JOURNAL_SOURCE_ZEPTO = 'Zepto'; - const JOURNAL_SOURCE_SLACK = 'Slack'; - const JOURNAL_SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const STATUS_NOT_EXPORTED = 'NotExported'; + public const STATUS_SUCCESS = 'Success'; + public const STATUS_FAILURE_UNKNOWN_ERROR = 'FailureUnknownError'; + public const STATUS_FAILURE_ACCOUNTS_NOT_CONFIGURED = 'FailureAccountsNotConfigured'; + public const STATUS_FAILURE_ITEMS_DELETED = 'FailureItemsDeleted'; + public const STATUS_FAILURE_ACCOUNT_PERIOD_CLOSED = 'FailureAccountPeriodClosed'; + public const STATUS_FAILURE_NOT_AUTHENTICATED = 'FailureNotAuthenticated'; + public const STATUS_FAILURE_ALREADY_EXPORTED = 'FailureAlreadyExported'; + public const STATUS_FAILURE_FUNCTION_DISABLED = 'FailureFunctionDisabled'; + public const STATUS_FAILURE_CANNOT_USE_ACCOUNTS_PAYABLE_ACCOUNT = 'FailureCannotUseAccountsPayableAccount'; + public const STATUS_FAILURE_VENDOR_MESSAGE = 'FailureVendorMessage'; + public const STATUS_FAILURE_INTERCOMPANY_LOAN_ACCOUNTS_NOT_CONFIGURED = 'FailureIntercompanyLoanAccountsNotConfigured'; + public const STATUS_FAILURE_GST_SETUP = 'FailureGSTSetup'; + public const STATUS_FAILURE_KNOWN_ERROR = 'FailureKnownError'; + public const STATUS_FAILURES_TENANT_NOT_SUPPLIED = 'FailuresTenantNotSupplied'; + public const STATUS_FAILURE_NO_JOURNAL_ID = 'FailureNoJournalId'; + public const STATUS_FAILURE_API_ERROR = 'FailureAPIError'; + public const STATUS_RESULT_UNKNOWN = 'ResultUnknown'; + public const JOURNAL_SOURCE_NONE = 'None'; + public const JOURNAL_SOURCE_SAASU = 'Saasu'; + public const JOURNAL_SOURCE_XERO = 'Xero'; + public const JOURNAL_SOURCE_MYOB = 'MYOB'; + public const JOURNAL_SOURCE_DEPUTY = 'Deputy'; + public const JOURNAL_SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const JOURNAL_SOURCE_CLICK_SUPER = 'ClickSuper'; + public const JOURNAL_SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const JOURNAL_SOURCE_FILE_IMPORT = 'FileImport'; + public const JOURNAL_SOURCE_FILE_EXPORT = 'FileExport'; + public const JOURNAL_SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const JOURNAL_SOURCE_HARMONY = 'Harmony'; + public const JOURNAL_SOURCE_AWARD_STORE = 'AwardStore'; + public const JOURNAL_SOURCE_ATTACHE = 'Attache'; + public const JOURNAL_SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const JOURNAL_SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const JOURNAL_SOURCE_API = 'API'; + public const JOURNAL_SOURCE_MICRO_POWER = 'MicroPower'; + public const JOURNAL_SOURCE_ROSTER_LIVE = 'RosterLive'; + public const JOURNAL_SOURCE_NET_SUITE = 'NetSuite'; + public const JOURNAL_SOURCE_KOUNTA = 'Kounta'; + public const JOURNAL_SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const JOURNAL_SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const JOURNAL_SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const JOURNAL_SOURCE_WAGE_EASY = 'WageEasy'; + public const JOURNAL_SOURCE_MAESTRANO = 'Maestrano'; + public const JOURNAL_SOURCE_WORK_ZONE = 'WorkZone'; + public const JOURNAL_SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const JOURNAL_SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const JOURNAL_SOURCE_ONBOARDING = 'Onboarding'; + public const JOURNAL_SOURCE_ADMIN = 'Admin'; + public const JOURNAL_SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const JOURNAL_SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const JOURNAL_SOURCE_SAGE50 = 'Sage50'; + public const JOURNAL_SOURCE_PENSION_SYNC = 'PensionSync'; + public const JOURNAL_SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const JOURNAL_SOURCE_PRONTO_XI = 'ProntoXI'; + public const JOURNAL_SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const JOURNAL_SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const JOURNAL_SOURCE_BEAM = 'Beam'; + public const JOURNAL_SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const JOURNAL_SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const JOURNAL_SOURCE_WIISE = 'Wiise'; + public const JOURNAL_SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const JOURNAL_SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const JOURNAL_SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const JOURNAL_SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const JOURNAL_SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const JOURNAL_SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const JOURNAL_SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const JOURNAL_SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const JOURNAL_SOURCE_O_AUTH = 'OAuth'; + public const JOURNAL_SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const JOURNAL_SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const JOURNAL_SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const JOURNAL_SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const JOURNAL_SOURCE_TELLEROO = 'Telleroo'; + public const JOURNAL_SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const JOURNAL_SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const JOURNAL_SOURCE_PAYTRON = 'Paytron'; + public const JOURNAL_SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const JOURNAL_SOURCE_COMMA = 'Comma'; + public const JOURNAL_SOURCE_ZOHO = 'Zoho'; + public const JOURNAL_SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const JOURNAL_SOURCE_TWINFIELD = 'Twinfield'; + public const JOURNAL_SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const JOURNAL_SOURCE_SQUARE = 'Square'; + public const JOURNAL_SOURCE_QUICKFILE = 'Quickfile'; + public const JOURNAL_SOURCE_TIDE = 'Tide'; + public const JOURNAL_SOURCE_TIDE_SSO = 'TideSso'; + public const JOURNAL_SOURCE_FREE_AGENT = 'FreeAgent'; + public const JOURNAL_SOURCE_AKAHU = 'Akahu'; + public const JOURNAL_SOURCE_INSTA_PAY = 'InstaPay'; + public const JOURNAL_SOURCE_ZEPTO = 'Zepto'; + public const JOURNAL_SOURCE_SLACK = 'Slack'; + public const JOURNAL_SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -298,7 +369,7 @@ public function getStatusAllowableValues() self::STATUS_RESULT_UNKNOWN, ]; } - + /** * Gets allowable values of the enum * @@ -385,7 +456,6 @@ public function getJournalSourceAllowableValues() self::JOURNAL_SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -402,10 +472,28 @@ public function getJournalSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; - $this->container['journal_source'] = isset($data['journal_source']) ? $data['journal_source'] : null; - $this->container['journal_external_reference_id'] = isset($data['journal_external_reference_id']) ? $data['journal_external_reference_id'] : null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('journal_source', $data ?? [], null); + $this->setIfExists('journal_external_reference_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; } /** @@ -420,7 +508,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -428,7 +517,8 @@ public function listInvalidProperties() $allowedValues = $this->getJournalSourceAllowableValues(); if (!is_null($this->container['journal_source']) && !in_array($this->container['journal_source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'journal_source', must be one of '%s'", + "invalid value '%s' for 'journal_source', must be one of '%s'", + $this->container['journal_source'], implode("', '", $allowedValues) ); } @@ -451,7 +541,7 @@ public function valid() /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -461,17 +551,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -484,7 +578,7 @@ public function setStatus($status) /** * Gets message * - * @return string + * @return string|null */ public function getMessage() { @@ -494,12 +588,15 @@ public function getMessage() /** * Sets message * - * @param string $message + * @param string|null $message * - * @return $this + * @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; @@ -508,7 +605,7 @@ public function setMessage($message) /** * Gets journal_source * - * @return string + * @return string|null */ public function getJournalSource() { @@ -518,17 +615,21 @@ public function getJournalSource() /** * Sets journal_source * - * @param string $journal_source + * @param string|null $journal_source * - * @return $this + * @return self */ public function setJournalSource($journal_source) { + if (is_null($journal_source)) { + throw new \InvalidArgumentException('non-nullable journal_source cannot be null'); + } $allowedValues = $this->getJournalSourceAllowableValues(); - if (!is_null($journal_source) && !in_array($journal_source, $allowedValues, true)) { + if (!in_array($journal_source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'journal_source', must be one of '%s'", + "Invalid value '%s' for 'journal_source', must be one of '%s'", + $journal_source, implode("', '", $allowedValues) ) ); @@ -541,7 +642,7 @@ public function setJournalSource($journal_source) /** * Gets journal_external_reference_id * - * @return string + * @return string|null */ public function getJournalExternalReferenceId() { @@ -551,12 +652,15 @@ public function getJournalExternalReferenceId() /** * Sets journal_external_reference_id * - * @param string $journal_external_reference_id + * @param string|null $journal_external_reference_id * - * @return $this + * @return self */ public function setJournalExternalReferenceId($journal_external_reference_id) { + if (is_null($journal_external_reference_id)) { + throw new \InvalidArgumentException('non-nullable journal_external_reference_id cannot be null'); + } $this->container['journal_external_reference_id'] = $journal_external_reference_id; return $this; @@ -568,7 +672,7 @@ public function setJournalExternalReferenceId($journal_external_reference_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -578,22 +682,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -609,11 +714,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -621,13 +739,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/JournalServiceProviderModel.php b/src/lib/Model/JournalServiceProviderModel.php index aece5e7..0e3a192 100644 --- a/src/lib/Model/JournalServiceProviderModel.php +++ b/src/lib/Model/JournalServiceProviderModel.php @@ -2,61 +2,61 @@ /** * JournalServiceProviderModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * JournalServiceProviderModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class JournalServiceProviderModel implements ModelInterface, ArrayAccess +class JournalServiceProviderModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'JournalServiceProviderModel'; + protected static $openAPIModelName = 'JournalServiceProviderModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'journal_service' => 'string' ]; @@ -64,19 +64,37 @@ class JournalServiceProviderModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'journal_service' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'journal_service' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['journal_service'] = isset($data['journal_service']) ? $data['journal_service'] : null; + $this->setIfExists('journal_service', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets journal_service * - * @return string + * @return string|null */ public function getJournalService() { @@ -217,12 +302,15 @@ public function getJournalService() /** * Sets journal_service * - * @param string $journal_service + * @param string|null $journal_service * - * @return $this + * @return self */ public function setJournalService($journal_service) { + if (is_null($journal_service)) { + throw new \InvalidArgumentException('non-nullable journal_service cannot be null'); + } $this->container['journal_service'] = $journal_service; return $this; @@ -234,7 +322,7 @@ public function setJournalService($journal_service) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/JournalServiceTaxCode.php b/src/lib/Model/JournalServiceTaxCode.php index f1bd026..9a019f5 100644 --- a/src/lib/Model/JournalServiceTaxCode.php +++ b/src/lib/Model/JournalServiceTaxCode.php @@ -2,85 +2,105 @@ /** * JournalServiceTaxCode * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * JournalServiceTaxCode Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class JournalServiceTaxCode implements ModelInterface, ArrayAccess +class JournalServiceTaxCode implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'JournalServiceTaxCode'; + protected static $openAPIModelName = 'JournalServiceTaxCode'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'string', 'name' => 'string', - 'tax_rate' => 'double' + 'tax_rate' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => null, 'name' => null, 'tax_rate' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'tax_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['tax_rate'] = isset($data['tax_rate']) ? $data['tax_rate'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tax_rate', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param string $id + * @param string|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets tax_rate * - * @return double + * @return float|null */ public function getTaxRate() { @@ -277,12 +370,15 @@ public function getTaxRate() /** * Sets tax_rate * - * @param double $tax_rate + * @param float|null $tax_rate * - * @return $this + * @return self */ public function setTaxRate($tax_rate) { + if (is_null($tax_rate)) { + throw new \InvalidArgumentException('non-nullable tax_rate cannot be null'); + } $this->container['tax_rate'] = $tax_rate; return $this; @@ -294,7 +390,7 @@ public function setTaxRate($tax_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/KeyValuePairOfStringAndIEnumerableOfString.php b/src/lib/Model/KeyValuePairOfStringAndIEnumerableOfString.php index 9779624..21dbb79 100644 --- a/src/lib/Model/KeyValuePairOfStringAndIEnumerableOfString.php +++ b/src/lib/Model/KeyValuePairOfStringAndIEnumerableOfString.php @@ -2,61 +2,61 @@ /** * KeyValuePairOfStringAndIEnumerableOfString * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * KeyValuePairOfStringAndIEnumerableOfString Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class KeyValuePairOfStringAndIEnumerableOfString implements ModelInterface, ArrayAccess +class KeyValuePairOfStringAndIEnumerableOfString implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'KeyValuePairOfStringAndIEnumerableOfString'; + protected static $openAPIModelName = 'KeyValuePairOfStringAndIEnumerableOfString'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'key' => 'string', 'value' => 'string[]' ]; @@ -65,20 +65,39 @@ class KeyValuePairOfStringAndIEnumerableOfString implements ModelInterface, Arra * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'key' => null, 'value' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['key'] = isset($data['key']) ? $data['key'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; + $this->setIfExists('key', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets key * - * @return string + * @return string|null */ public function getKey() { @@ -223,12 +309,15 @@ public function getKey() /** * Sets key * - * @param string $key + * @param string|null $key * - * @return $this + * @return self */ public function setKey($key) { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } $this->container['key'] = $key; return $this; @@ -237,7 +326,7 @@ public function setKey($key) /** * Gets value * - * @return string[] + * @return string[]|null */ public function getValue() { @@ -247,12 +336,15 @@ public function getValue() /** * Sets value * - * @param string[] $value + * @param string[]|null $value * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setValue($value) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/KioskAccessModel.php b/src/lib/Model/KioskAccessModel.php index 00656bd..75cd5d3 100644 --- a/src/lib/Model/KioskAccessModel.php +++ b/src/lib/Model/KioskAccessModel.php @@ -2,61 +2,61 @@ /** * KioskAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * KioskAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class KioskAccessModel implements ModelInterface, ArrayAccess +class KioskAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'KioskAccessModel'; + protected static $openAPIModelName = 'KioskAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'kiosks' => 'int[]', 'access_type' => 'string', 'permissions' => 'string' @@ -66,21 +66,41 @@ class KioskAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'kiosks' => 'int32', 'access_type' => null, 'permissions' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'kiosks' => false, + 'access_type' => false, + 'permissions' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,37 +237,35 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCESS_TYPE_NONE = 'None'; - const ACCESS_TYPE_ALL_KIOSKS = 'AllKiosks'; - const ACCESS_TYPE_SPECIFIC_KIOSKS = 'SpecificKiosks'; - const PERMISSIONS_APPROVE_TIMESHEETS = 'ApproveTimesheets'; - const PERMISSIONS_APPROVE_LEAVE_REQUESTS = 'ApproveLeaveRequests'; - const PERMISSIONS_CREATE_TIMESHEETS = 'CreateTimesheets'; - const PERMISSIONS_CREATE_LEAVE_REQUESTS = 'CreateLeaveRequests'; - const PERMISSIONS_VIEW_LEAVE_REQUESTS = 'ViewLeaveRequests'; - const PERMISSIONS_MANAGE_ROSTERS = 'ManageRosters'; - const PERMISSIONS_VIEW_ROSTERS = 'ViewRosters'; - const PERMISSIONS_VIEW_SHIFT_COSTS = 'ViewShiftCosts'; - const PERMISSIONS_VIEW_EXPENSES = 'ViewExpenses'; - const PERMISSIONS_CREATE_EXPENSES = 'CreateExpenses'; - const PERMISSIONS_APPROVE_EXPENSES = 'ApproveExpenses'; - const PERMISSIONS_CREATE_TASKS = 'CreateTasks'; - const PERMISSIONS_VIEW_EMPLOYEE_DOCUMENTS = 'ViewEmployeeDocuments'; - const PERMISSIONS_MANAGE_EMPLOYEE_DOCUMENTS = 'ManageEmployeeDocuments'; - const PERMISSIONS_VIEW_EMPLOYEE_QUALIFICATIONS = 'ViewEmployeeQualifications'; - const PERMISSIONS_MANAGE_EMPLOYEE_QUALIFICATIONS = 'ManageEmployeeQualifications'; - const PERMISSIONS_INITIATE_EMPLOYEE_SELF_SETUP = 'InitiateEmployeeSelfSetup'; - const PERMISSIONS_ADD_EMPLOYEE_FROM_KIOSK = 'AddEmployeeFromKiosk'; - const PERMISSIONS_VIEW_EMPLOYEE_DETAILS = 'ViewEmployeeDetails'; - const PERMISSIONS_EDIT_BASIC_EMPLOYEE_DETAILS = 'EditBasicEmployeeDetails'; - const PERMISSIONS_EDIT_ALL_EMPLOYEE_DETAILS = 'EditAllEmployeeDetails'; - const PERMISSIONS_VIEW_TIMESHEET_REPORTS = 'ViewTimesheetReports'; - - - + public const ACCESS_TYPE_NONE = 'None'; + public const ACCESS_TYPE_ALL_KIOSKS = 'AllKiosks'; + public const ACCESS_TYPE_SPECIFIC_KIOSKS = 'SpecificKiosks'; + public const PERMISSIONS_APPROVE_TIMESHEETS = 'ApproveTimesheets'; + public const PERMISSIONS_APPROVE_LEAVE_REQUESTS = 'ApproveLeaveRequests'; + public const PERMISSIONS_CREATE_TIMESHEETS = 'CreateTimesheets'; + public const PERMISSIONS_CREATE_LEAVE_REQUESTS = 'CreateLeaveRequests'; + public const PERMISSIONS_VIEW_LEAVE_REQUESTS = 'ViewLeaveRequests'; + public const PERMISSIONS_MANAGE_ROSTERS = 'ManageRosters'; + public const PERMISSIONS_VIEW_ROSTERS = 'ViewRosters'; + public const PERMISSIONS_VIEW_SHIFT_COSTS = 'ViewShiftCosts'; + public const PERMISSIONS_VIEW_EXPENSES = 'ViewExpenses'; + public const PERMISSIONS_CREATE_EXPENSES = 'CreateExpenses'; + public const PERMISSIONS_APPROVE_EXPENSES = 'ApproveExpenses'; + public const PERMISSIONS_CREATE_TASKS = 'CreateTasks'; + public const PERMISSIONS_VIEW_EMPLOYEE_DOCUMENTS = 'ViewEmployeeDocuments'; + public const PERMISSIONS_MANAGE_EMPLOYEE_DOCUMENTS = 'ManageEmployeeDocuments'; + public const PERMISSIONS_VIEW_EMPLOYEE_QUALIFICATIONS = 'ViewEmployeeQualifications'; + public const PERMISSIONS_MANAGE_EMPLOYEE_QUALIFICATIONS = 'ManageEmployeeQualifications'; + public const PERMISSIONS_INITIATE_EMPLOYEE_SELF_SETUP = 'InitiateEmployeeSelfSetup'; + public const PERMISSIONS_ADD_EMPLOYEE_FROM_KIOSK = 'AddEmployeeFromKiosk'; + public const PERMISSIONS_VIEW_EMPLOYEE_DETAILS = 'ViewEmployeeDetails'; + public const PERMISSIONS_EDIT_BASIC_EMPLOYEE_DETAILS = 'EditBasicEmployeeDetails'; + public const PERMISSIONS_EDIT_ALL_EMPLOYEE_DETAILS = 'EditAllEmployeeDetails'; + public const PERMISSIONS_VIEW_TIMESHEET_REPORTS = 'ViewTimesheetReports'; + /** * Gets allowable values of the enum * @@ -209,7 +279,7 @@ public function getAccessTypeAllowableValues() self::ACCESS_TYPE_SPECIFIC_KIOSKS, ]; } - + /** * Gets allowable values of the enum * @@ -242,7 +312,6 @@ public function getPermissionsAllowableValues() self::PERMISSIONS_VIEW_TIMESHEET_REPORTS, ]; } - /** * Associative array for storing property values @@ -259,9 +328,27 @@ public function getPermissionsAllowableValues() */ public function __construct(array $data = null) { - $this->container['kiosks'] = isset($data['kiosks']) ? $data['kiosks'] : null; - $this->container['access_type'] = isset($data['access_type']) ? $data['access_type'] : null; - $this->container['permissions'] = isset($data['permissions']) ? $data['permissions'] : null; + $this->setIfExists('kiosks', $data ?? [], null); + $this->setIfExists('access_type', $data ?? [], null); + $this->setIfExists('permissions', $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; } /** @@ -276,7 +363,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccessTypeAllowableValues(); if (!is_null($this->container['access_type']) && !in_array($this->container['access_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'access_type', must be one of '%s'", + "invalid value '%s' for 'access_type', must be one of '%s'", + $this->container['access_type'], implode("', '", $allowedValues) ); } @@ -284,7 +372,8 @@ public function listInvalidProperties() $allowedValues = $this->getPermissionsAllowableValues(); if (!is_null($this->container['permissions']) && !in_array($this->container['permissions'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'permissions', must be one of '%s'", + "invalid value '%s' for 'permissions', must be one of '%s'", + $this->container['permissions'], implode("', '", $allowedValues) ); } @@ -307,7 +396,7 @@ public function valid() /** * Gets kiosks * - * @return int[] + * @return int[]|null */ public function getKiosks() { @@ -317,12 +406,15 @@ public function getKiosks() /** * Sets kiosks * - * @param int[] $kiosks + * @param int[]|null $kiosks * - * @return $this + * @return self */ public function setKiosks($kiosks) { + if (is_null($kiosks)) { + throw new \InvalidArgumentException('non-nullable kiosks cannot be null'); + } $this->container['kiosks'] = $kiosks; return $this; @@ -331,7 +423,7 @@ public function setKiosks($kiosks) /** * Gets access_type * - * @return string + * @return string|null */ public function getAccessType() { @@ -341,17 +433,21 @@ public function getAccessType() /** * Sets access_type * - * @param string $access_type + * @param string|null $access_type * - * @return $this + * @return self */ public function setAccessType($access_type) { + if (is_null($access_type)) { + throw new \InvalidArgumentException('non-nullable access_type cannot be null'); + } $allowedValues = $this->getAccessTypeAllowableValues(); - if (!is_null($access_type) && !in_array($access_type, $allowedValues, true)) { + if (!in_array($access_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'access_type', must be one of '%s'", + "Invalid value '%s' for 'access_type', must be one of '%s'", + $access_type, implode("', '", $allowedValues) ) ); @@ -364,7 +460,7 @@ public function setAccessType($access_type) /** * Gets permissions * - * @return string + * @return string|null */ public function getPermissions() { @@ -374,17 +470,21 @@ public function getPermissions() /** * Sets permissions * - * @param string $permissions + * @param string|null $permissions * - * @return $this + * @return self */ public function setPermissions($permissions) { + if (is_null($permissions)) { + throw new \InvalidArgumentException('non-nullable permissions cannot be null'); + } $allowedValues = $this->getPermissionsAllowableValues(); - if (!is_null($permissions) && !in_array($permissions, $allowedValues, true)) { + if (!in_array($permissions, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'permissions', must be one of '%s'", + "Invalid value '%s' for 'permissions', must be one of '%s'", + $permissions, implode("', '", $allowedValues) ) ); @@ -400,7 +500,7 @@ public function setPermissions($permissions) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -410,22 +510,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -441,11 +542,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -453,13 +567,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/KioskCreateEmployeeModel.php b/src/lib/Model/KioskCreateEmployeeModel.php index bd5ea43..496e75f 100644 --- a/src/lib/Model/KioskCreateEmployeeModel.php +++ b/src/lib/Model/KioskCreateEmployeeModel.php @@ -2,61 +2,61 @@ /** * KioskCreateEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * KioskCreateEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class KioskCreateEmployeeModel implements ModelInterface, ArrayAccess +class KioskCreateEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'KioskCreateEmployeeModel'; + protected static $openAPIModelName = 'KioskCreateEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'first_name' => 'string', 'surname' => 'string', 'email' => 'string', @@ -68,8 +68,10 @@ class KioskCreateEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'first_name' => null, 'surname' => null, 'email' => null, @@ -77,14 +79,34 @@ class KioskCreateEmployeeModel implements ModelInterface, ArrayAccess 'pin' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'first_name' => false, + 'surname' => false, + 'email' => false, + 'mobile_number' => false, + 'pin' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['mobile_number'] = isset($data['mobile_number']) ? $data['mobile_number'] : null; - $this->container['pin'] = isset($data['pin']) ? $data['pin'] : null; + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('pin', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -241,12 +330,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -255,7 +347,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -265,12 +357,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -279,7 +374,7 @@ public function setSurname($surname) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -289,12 +384,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -303,7 +401,7 @@ public function setEmail($email) /** * Gets mobile_number * - * @return string + * @return string|null */ public function getMobileNumber() { @@ -313,12 +411,15 @@ public function getMobileNumber() /** * Sets mobile_number * - * @param string $mobile_number + * @param string|null $mobile_number * - * @return $this + * @return self */ public function setMobileNumber($mobile_number) { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } $this->container['mobile_number'] = $mobile_number; return $this; @@ -327,7 +428,7 @@ public function setMobileNumber($mobile_number) /** * Gets pin * - * @return string + * @return string|null */ public function getPin() { @@ -337,12 +438,15 @@ public function getPin() /** * Sets pin * - * @param string $pin + * @param string|null $pin * - * @return $this + * @return self */ public function setPin($pin) { + if (is_null($pin)) { + throw new \InvalidArgumentException('non-nullable pin cannot be null'); + } $this->container['pin'] = $pin; return $this; @@ -354,7 +458,7 @@ public function setPin($pin) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/KioskEmployeeModel.php b/src/lib/Model/KioskEmployeeModel.php index 1939aa8..77d7c14 100644 --- a/src/lib/Model/KioskEmployeeModel.php +++ b/src/lib/Model/KioskEmployeeModel.php @@ -2,61 +2,61 @@ /** * KioskEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * KioskEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class KioskEmployeeModel implements ModelInterface, ArrayAccess +class KioskEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'KioskEmployeeModel'; + protected static $openAPIModelName = 'KioskEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pin_expired' => 'bool', 'employee_id' => 'int', 'first_name' => 'string', @@ -79,8 +79,10 @@ class KioskEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pin_expired' => null, 'employee_id' => 'int32', 'first_name' => null, @@ -99,14 +101,45 @@ class KioskEmployeeModel implements ModelInterface, ArrayAccess 'employee_start_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pin_expired' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'name' => false, + 'has_email' => false, + 'profile_image_url' => false, + 'mobile_number' => false, + 'status' => false, + 'long_shift' => false, + 'clock_on_time_utc' => false, + 'break_start_time_utc' => false, + 'recorded_time_utc' => false, + 'current_shift_id' => false, + 'employee_group_ids' => false, + 'employee_start_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -114,9 +147,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -230,16 +315,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; - const STATUS_CLOCKED_ON = 'ClockedOn'; - const STATUS_ON_BREAK = 'OnBreak'; - const STATUS_CLOCKED_OFF = 'ClockedOff'; - + public const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; + public const STATUS_CLOCKED_ON = 'ClockedOn'; + public const STATUS_ON_BREAK = 'OnBreak'; + public const STATUS_CLOCKED_OFF = 'ClockedOff'; - /** * Gets allowable values of the enum * @@ -254,7 +337,6 @@ public function getStatusAllowableValues() self::STATUS_CLOCKED_OFF, ]; } - /** * Associative array for storing property values @@ -271,22 +353,40 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['pin_expired'] = isset($data['pin_expired']) ? $data['pin_expired'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['has_email'] = isset($data['has_email']) ? $data['has_email'] : null; - $this->container['profile_image_url'] = isset($data['profile_image_url']) ? $data['profile_image_url'] : null; - $this->container['mobile_number'] = isset($data['mobile_number']) ? $data['mobile_number'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['long_shift'] = isset($data['long_shift']) ? $data['long_shift'] : null; - $this->container['clock_on_time_utc'] = isset($data['clock_on_time_utc']) ? $data['clock_on_time_utc'] : null; - $this->container['break_start_time_utc'] = isset($data['break_start_time_utc']) ? $data['break_start_time_utc'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['current_shift_id'] = isset($data['current_shift_id']) ? $data['current_shift_id'] : null; - $this->container['employee_group_ids'] = isset($data['employee_group_ids']) ? $data['employee_group_ids'] : null; - $this->container['employee_start_date'] = isset($data['employee_start_date']) ? $data['employee_start_date'] : null; + $this->setIfExists('pin_expired', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('has_email', $data ?? [], null); + $this->setIfExists('profile_image_url', $data ?? [], null); + $this->setIfExists('mobile_number', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('long_shift', $data ?? [], null); + $this->setIfExists('clock_on_time_utc', $data ?? [], null); + $this->setIfExists('break_start_time_utc', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('current_shift_id', $data ?? [], null); + $this->setIfExists('employee_group_ids', $data ?? [], null); + $this->setIfExists('employee_start_date', $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; } /** @@ -301,7 +401,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -324,7 +425,7 @@ public function valid() /** * Gets pin_expired * - * @return bool + * @return bool|null */ public function getPinExpired() { @@ -334,12 +435,15 @@ public function getPinExpired() /** * Sets pin_expired * - * @param bool $pin_expired + * @param bool|null $pin_expired * - * @return $this + * @return self */ public function setPinExpired($pin_expired) { + if (is_null($pin_expired)) { + throw new \InvalidArgumentException('non-nullable pin_expired cannot be null'); + } $this->container['pin_expired'] = $pin_expired; return $this; @@ -348,7 +452,7 @@ public function setPinExpired($pin_expired) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -358,12 +462,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -372,7 +479,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -382,12 +489,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -396,7 +506,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -406,12 +516,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -420,7 +533,7 @@ public function setSurname($surname) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -430,12 +543,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -444,7 +560,7 @@ public function setName($name) /** * Gets has_email * - * @return bool + * @return bool|null */ public function getHasEmail() { @@ -454,12 +570,15 @@ public function getHasEmail() /** * Sets has_email * - * @param bool $has_email + * @param bool|null $has_email * - * @return $this + * @return self */ public function setHasEmail($has_email) { + if (is_null($has_email)) { + throw new \InvalidArgumentException('non-nullable has_email cannot be null'); + } $this->container['has_email'] = $has_email; return $this; @@ -468,7 +587,7 @@ public function setHasEmail($has_email) /** * Gets profile_image_url * - * @return string + * @return string|null */ public function getProfileImageUrl() { @@ -478,12 +597,15 @@ public function getProfileImageUrl() /** * Sets profile_image_url * - * @param string $profile_image_url + * @param string|null $profile_image_url * - * @return $this + * @return self */ public function setProfileImageUrl($profile_image_url) { + if (is_null($profile_image_url)) { + throw new \InvalidArgumentException('non-nullable profile_image_url cannot be null'); + } $this->container['profile_image_url'] = $profile_image_url; return $this; @@ -492,7 +614,7 @@ public function setProfileImageUrl($profile_image_url) /** * Gets mobile_number * - * @return string + * @return string|null */ public function getMobileNumber() { @@ -502,12 +624,15 @@ public function getMobileNumber() /** * Sets mobile_number * - * @param string $mobile_number + * @param string|null $mobile_number * - * @return $this + * @return self */ public function setMobileNumber($mobile_number) { + if (is_null($mobile_number)) { + throw new \InvalidArgumentException('non-nullable mobile_number cannot be null'); + } $this->container['mobile_number'] = $mobile_number; return $this; @@ -516,7 +641,7 @@ public function setMobileNumber($mobile_number) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -526,17 +651,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -549,7 +678,7 @@ public function setStatus($status) /** * Gets long_shift * - * @return bool + * @return bool|null */ public function getLongShift() { @@ -559,12 +688,15 @@ public function getLongShift() /** * Sets long_shift * - * @param bool $long_shift + * @param bool|null $long_shift * - * @return $this + * @return self */ public function setLongShift($long_shift) { + if (is_null($long_shift)) { + throw new \InvalidArgumentException('non-nullable long_shift cannot be null'); + } $this->container['long_shift'] = $long_shift; return $this; @@ -573,7 +705,7 @@ public function setLongShift($long_shift) /** * Gets clock_on_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getClockOnTimeUtc() { @@ -583,12 +715,15 @@ public function getClockOnTimeUtc() /** * Sets clock_on_time_utc * - * @param \DateTime $clock_on_time_utc + * @param \DateTime|null $clock_on_time_utc * - * @return $this + * @return self */ public function setClockOnTimeUtc($clock_on_time_utc) { + if (is_null($clock_on_time_utc)) { + throw new \InvalidArgumentException('non-nullable clock_on_time_utc cannot be null'); + } $this->container['clock_on_time_utc'] = $clock_on_time_utc; return $this; @@ -597,7 +732,7 @@ public function setClockOnTimeUtc($clock_on_time_utc) /** * Gets break_start_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getBreakStartTimeUtc() { @@ -607,12 +742,15 @@ public function getBreakStartTimeUtc() /** * Sets break_start_time_utc * - * @param \DateTime $break_start_time_utc + * @param \DateTime|null $break_start_time_utc * - * @return $this + * @return self */ public function setBreakStartTimeUtc($break_start_time_utc) { + if (is_null($break_start_time_utc)) { + throw new \InvalidArgumentException('non-nullable break_start_time_utc cannot be null'); + } $this->container['break_start_time_utc'] = $break_start_time_utc; return $this; @@ -621,7 +759,7 @@ public function setBreakStartTimeUtc($break_start_time_utc) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -631,12 +769,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -645,7 +786,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets current_shift_id * - * @return int + * @return int|null */ public function getCurrentShiftId() { @@ -655,12 +796,15 @@ public function getCurrentShiftId() /** * Sets current_shift_id * - * @param int $current_shift_id + * @param int|null $current_shift_id * - * @return $this + * @return self */ public function setCurrentShiftId($current_shift_id) { + if (is_null($current_shift_id)) { + throw new \InvalidArgumentException('non-nullable current_shift_id cannot be null'); + } $this->container['current_shift_id'] = $current_shift_id; return $this; @@ -669,7 +813,7 @@ public function setCurrentShiftId($current_shift_id) /** * Gets employee_group_ids * - * @return int[] + * @return int[]|null */ public function getEmployeeGroupIds() { @@ -679,12 +823,15 @@ public function getEmployeeGroupIds() /** * Sets employee_group_ids * - * @param int[] $employee_group_ids + * @param int[]|null $employee_group_ids * - * @return $this + * @return self */ public function setEmployeeGroupIds($employee_group_ids) { + if (is_null($employee_group_ids)) { + throw new \InvalidArgumentException('non-nullable employee_group_ids cannot be null'); + } $this->container['employee_group_ids'] = $employee_group_ids; return $this; @@ -693,7 +840,7 @@ public function setEmployeeGroupIds($employee_group_ids) /** * Gets employee_start_date * - * @return \DateTime + * @return \DateTime|null */ public function getEmployeeStartDate() { @@ -703,12 +850,15 @@ public function getEmployeeStartDate() /** * Sets employee_start_date * - * @param \DateTime $employee_start_date + * @param \DateTime|null $employee_start_date * - * @return $this + * @return self */ public function setEmployeeStartDate($employee_start_date) { + if (is_null($employee_start_date)) { + throw new \InvalidArgumentException('non-nullable employee_start_date cannot be null'); + } $this->container['employee_start_date'] = $employee_start_date; return $this; @@ -720,7 +870,7 @@ public function setEmployeeStartDate($employee_start_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -730,22 +880,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -761,11 +912,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -773,13 +937,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveAccrualModel.php b/src/lib/Model/LeaveAccrualModel.php index 9f361a2..30fea85 100644 --- a/src/lib/Model/LeaveAccrualModel.php +++ b/src/lib/Model/LeaveAccrualModel.php @@ -2,65 +2,65 @@ /** * LeaveAccrualModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveAccrualModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveAccrualModel implements ModelInterface, ArrayAccess +class LeaveAccrualModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveAccrualModel'; + protected static $openAPIModelName = 'LeaveAccrualModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'leave_category_name' => 'string', 'leave_category_id' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'notes' => 'string', 'accrual_type' => 'string' ]; @@ -69,8 +69,10 @@ class LeaveAccrualModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'leave_category_name' => null, 'leave_category_id' => null, @@ -79,14 +81,35 @@ class LeaveAccrualModel implements ModelInterface, ArrayAccess 'accrual_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'leave_category_name' => false, + 'leave_category_id' => false, + 'amount' => false, + 'notes' => false, + 'accrual_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['accrual_type'] = isset($data['accrual_type']) ? $data['accrual_type'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('accrual_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -247,12 +337,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setId($id) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -271,12 +364,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -285,7 +381,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets leave_category_id * - * @return string + * @return string|null */ public function getLeaveCategoryId() { @@ -295,12 +391,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param string $leave_category_id + * @param string|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -309,7 +408,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -319,12 +418,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -333,7 +435,7 @@ public function setAmount($amount) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -343,12 +445,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -357,7 +462,7 @@ public function setNotes($notes) /** * Gets accrual_type * - * @return string + * @return string|null */ public function getAccrualType() { @@ -367,12 +472,15 @@ public function getAccrualType() /** * Sets accrual_type * - * @param string $accrual_type + * @param string|null $accrual_type * - * @return $this + * @return self */ public function setAccrualType($accrual_type) { + if (is_null($accrual_type)) { + throw new \InvalidArgumentException('non-nullable accrual_type cannot be null'); + } $this->container['accrual_type'] = $accrual_type; return $this; @@ -384,7 +492,7 @@ public function setAccrualType($accrual_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveAccrualResponse.php b/src/lib/Model/LeaveAccrualResponse.php index 99d09a9..03ab1a4 100644 --- a/src/lib/Model/LeaveAccrualResponse.php +++ b/src/lib/Model/LeaveAccrualResponse.php @@ -2,83 +2,102 @@ /** * LeaveAccrualResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveAccrualResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveAccrualResponse implements ModelInterface, ArrayAccess +class LeaveAccrualResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveAccrualResponse'; + protected static $openAPIModelName = 'LeaveAccrualResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_id' => 'int', - 'leave' => 'map[string,\Swagger\Client\Model\LeaveAccrualModel[]]' + 'leave' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_id' => 'int32', 'leave' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_id' => false, + 'leave' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['leave'] = isset($data['leave']) ? $data['leave'] : null; + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('leave', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -223,12 +309,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -237,7 +326,7 @@ public function setPayRunId($pay_run_id) /** * Gets leave * - * @return map[string,\Swagger\Client\Model\LeaveAccrualModel[]] + * @return array|null */ public function getLeave() { @@ -247,12 +336,15 @@ public function getLeave() /** * Sets leave * - * @param map[string,\Swagger\Client\Model\LeaveAccrualModel[]] $leave + * @param array|null $leave * - * @return $this + * @return self */ public function setLeave($leave) { + if (is_null($leave)) { + throw new \InvalidArgumentException('non-nullable leave cannot be null'); + } $this->container['leave'] = $leave; return $this; @@ -264,7 +356,7 @@ public function setLeave($leave) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveAllowanceTemplateLeaveCategoryModel.php b/src/lib/Model/LeaveAllowanceTemplateLeaveCategoryModel.php index 08e4ac0..279987b 100644 --- a/src/lib/Model/LeaveAllowanceTemplateLeaveCategoryModel.php +++ b/src/lib/Model/LeaveAllowanceTemplateLeaveCategoryModel.php @@ -2,74 +2,74 @@ /** * LeaveAllowanceTemplateLeaveCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveAllowanceTemplateLeaveCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveAllowanceTemplateLeaveCategoryModel implements ModelInterface, ArrayAccess +class LeaveAllowanceTemplateLeaveCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveAllowanceTemplateLeaveCategoryModel'; + protected static $openAPIModelName = 'LeaveAllowanceTemplateLeaveCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_category_id' => 'int', - 'units' => 'double', + 'units' => 'float', 'unit_type' => 'string', - 'leave_loading' => 'double', + 'leave_loading' => 'float', 'can_apply_for_leave' => 'bool', - 'contingent_period' => 'double', - 'entitlement_period' => 'double', + 'contingent_period' => 'float', + 'entitlement_period' => 'float', 'leave_accrual_rule_id' => 'int', 'leave_accrual_rule_accrual_type' => 'string', 'leave_accrual_rule_cap_type' => 'string', - 'leave_accrual_rule_unit_cap' => 'double', + 'leave_accrual_rule_unit_cap' => 'float', 'leave_accrual_rule_carry_over_behaviour' => 'string', - 'leave_accrual_rule_carry_over_amount' => 'double', + 'leave_accrual_rule_carry_over_amount' => 'float', 'leave_accrual_rule_accrue_in_advance' => 'bool' ]; @@ -77,8 +77,10 @@ class LeaveAllowanceTemplateLeaveCategoryModel implements ModelInterface, ArrayA * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_category_id' => 'int32', 'units' => 'double', 'unit_type' => null, @@ -95,14 +97,43 @@ class LeaveAllowanceTemplateLeaveCategoryModel implements ModelInterface, ArrayA 'leave_accrual_rule_accrue_in_advance' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_category_id' => false, + 'units' => false, + 'unit_type' => false, + 'leave_loading' => false, + 'can_apply_for_leave' => false, + 'contingent_period' => false, + 'entitlement_period' => false, + 'leave_accrual_rule_id' => false, + 'leave_accrual_rule_accrual_type' => false, + 'leave_accrual_rule_cap_type' => false, + 'leave_accrual_rule_unit_cap' => false, + 'leave_accrual_rule_carry_over_behaviour' => false, + 'leave_accrual_rule_carry_over_amount' => false, + 'leave_accrual_rule_accrue_in_advance' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,26 +303,24 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - const UNIT_TYPE_HOURS_PER_HOUR_WORKED = 'HoursPerHourWorked'; - const UNIT_TYPE_HOURS_PER_PAY_RUN = 'HoursPerPayRun'; - const UNIT_TYPE_STANDARD_DAYS = 'StandardDays'; - const UNIT_TYPE_STANDARD_WEEKS = 'StandardWeeks'; - const UNIT_TYPE_DAY_PER_CALENDAR_DAY = 'DayPerCalendarDay'; - const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_ONGOING = 'Ongoing'; - const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_YEARLY = 'Yearly'; - const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE = 'BasedOnLengthOfService'; - const LEAVE_ACCRUAL_RULE_CAP_TYPE_NOT_LIMITED = 'NotLimited'; - const LEAVE_ACCRUAL_RULE_CAP_TYPE_LIMITED = 'Limited'; - const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_ENTIRE_AMOUNT = 'CarryEntireAmount'; - const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_HOURS = 'CarryHours'; - + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; + public const UNIT_TYPE_HOURS_PER_HOUR_WORKED = 'HoursPerHourWorked'; + public const UNIT_TYPE_HOURS_PER_PAY_RUN = 'HoursPerPayRun'; + public const UNIT_TYPE_STANDARD_DAYS = 'StandardDays'; + public const UNIT_TYPE_STANDARD_WEEKS = 'StandardWeeks'; + public const UNIT_TYPE_DAY_PER_CALENDAR_DAY = 'DayPerCalendarDay'; + public const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_ONGOING = 'Ongoing'; + public const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_YEARLY = 'Yearly'; + public const LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE = 'BasedOnLengthOfService'; + public const LEAVE_ACCRUAL_RULE_CAP_TYPE_NOT_LIMITED = 'NotLimited'; + public const LEAVE_ACCRUAL_RULE_CAP_TYPE_LIMITED = 'Limited'; + public const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_ENTIRE_AMOUNT = 'CarryEntireAmount'; + public const LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_HOURS = 'CarryHours'; - /** * Gets allowable values of the enum * @@ -257,7 +338,7 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_DAY_PER_CALENDAR_DAY, ]; } - + /** * Gets allowable values of the enum * @@ -271,7 +352,7 @@ public function getLeaveAccrualRuleAccrualTypeAllowableValues() self::LEAVE_ACCRUAL_RULE_ACCRUAL_TYPE_BASED_ON_LENGTH_OF_SERVICE, ]; } - + /** * Gets allowable values of the enum * @@ -284,7 +365,7 @@ public function getLeaveAccrualRuleCapTypeAllowableValues() self::LEAVE_ACCRUAL_RULE_CAP_TYPE_LIMITED, ]; } - + /** * Gets allowable values of the enum * @@ -297,7 +378,6 @@ public function getLeaveAccrualRuleCarryOverBehaviourAllowableValues() self::LEAVE_ACCRUAL_RULE_CARRY_OVER_BEHAVIOUR_CARRY_HOURS, ]; } - /** * Associative array for storing property values @@ -314,20 +394,38 @@ public function getLeaveAccrualRuleCarryOverBehaviourAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['leave_loading'] = isset($data['leave_loading']) ? $data['leave_loading'] : null; - $this->container['can_apply_for_leave'] = isset($data['can_apply_for_leave']) ? $data['can_apply_for_leave'] : null; - $this->container['contingent_period'] = isset($data['contingent_period']) ? $data['contingent_period'] : null; - $this->container['entitlement_period'] = isset($data['entitlement_period']) ? $data['entitlement_period'] : null; - $this->container['leave_accrual_rule_id'] = isset($data['leave_accrual_rule_id']) ? $data['leave_accrual_rule_id'] : null; - $this->container['leave_accrual_rule_accrual_type'] = isset($data['leave_accrual_rule_accrual_type']) ? $data['leave_accrual_rule_accrual_type'] : null; - $this->container['leave_accrual_rule_cap_type'] = isset($data['leave_accrual_rule_cap_type']) ? $data['leave_accrual_rule_cap_type'] : null; - $this->container['leave_accrual_rule_unit_cap'] = isset($data['leave_accrual_rule_unit_cap']) ? $data['leave_accrual_rule_unit_cap'] : null; - $this->container['leave_accrual_rule_carry_over_behaviour'] = isset($data['leave_accrual_rule_carry_over_behaviour']) ? $data['leave_accrual_rule_carry_over_behaviour'] : null; - $this->container['leave_accrual_rule_carry_over_amount'] = isset($data['leave_accrual_rule_carry_over_amount']) ? $data['leave_accrual_rule_carry_over_amount'] : null; - $this->container['leave_accrual_rule_accrue_in_advance'] = isset($data['leave_accrual_rule_accrue_in_advance']) ? $data['leave_accrual_rule_accrue_in_advance'] : null; + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('leave_loading', $data ?? [], null); + $this->setIfExists('can_apply_for_leave', $data ?? [], null); + $this->setIfExists('contingent_period', $data ?? [], null); + $this->setIfExists('entitlement_period', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_id', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_accrual_type', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_cap_type', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_unit_cap', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_carry_over_behaviour', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_carry_over_amount', $data ?? [], null); + $this->setIfExists('leave_accrual_rule_accrue_in_advance', $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; } /** @@ -342,7 +440,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -350,7 +449,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualRuleAccrualTypeAllowableValues(); if (!is_null($this->container['leave_accrual_rule_accrual_type']) && !in_array($this->container['leave_accrual_rule_accrual_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_rule_accrual_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_rule_accrual_type', must be one of '%s'", + $this->container['leave_accrual_rule_accrual_type'], implode("', '", $allowedValues) ); } @@ -358,7 +458,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualRuleCapTypeAllowableValues(); if (!is_null($this->container['leave_accrual_rule_cap_type']) && !in_array($this->container['leave_accrual_rule_cap_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_rule_cap_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_rule_cap_type', must be one of '%s'", + $this->container['leave_accrual_rule_cap_type'], implode("', '", $allowedValues) ); } @@ -366,7 +467,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualRuleCarryOverBehaviourAllowableValues(); if (!is_null($this->container['leave_accrual_rule_carry_over_behaviour']) && !in_array($this->container['leave_accrual_rule_carry_over_behaviour'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + $this->container['leave_accrual_rule_carry_over_behaviour'], implode("', '", $allowedValues) ); } @@ -389,7 +491,7 @@ public function valid() /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -399,12 +501,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -413,7 +518,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -423,12 +528,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -437,7 +545,7 @@ public function setUnits($units) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -447,17 +555,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -470,7 +582,7 @@ public function setUnitType($unit_type) /** * Gets leave_loading * - * @return double + * @return float|null */ public function getLeaveLoading() { @@ -480,12 +592,15 @@ public function getLeaveLoading() /** * Sets leave_loading * - * @param double $leave_loading + * @param float|null $leave_loading * - * @return $this + * @return self */ public function setLeaveLoading($leave_loading) { + if (is_null($leave_loading)) { + throw new \InvalidArgumentException('non-nullable leave_loading cannot be null'); + } $this->container['leave_loading'] = $leave_loading; return $this; @@ -494,7 +609,7 @@ public function setLeaveLoading($leave_loading) /** * Gets can_apply_for_leave * - * @return bool + * @return bool|null */ public function getCanApplyForLeave() { @@ -504,12 +619,15 @@ public function getCanApplyForLeave() /** * Sets can_apply_for_leave * - * @param bool $can_apply_for_leave + * @param bool|null $can_apply_for_leave * - * @return $this + * @return self */ public function setCanApplyForLeave($can_apply_for_leave) { + if (is_null($can_apply_for_leave)) { + throw new \InvalidArgumentException('non-nullable can_apply_for_leave cannot be null'); + } $this->container['can_apply_for_leave'] = $can_apply_for_leave; return $this; @@ -518,7 +636,7 @@ public function setCanApplyForLeave($can_apply_for_leave) /** * Gets contingent_period * - * @return double + * @return float|null */ public function getContingentPeriod() { @@ -528,12 +646,15 @@ public function getContingentPeriod() /** * Sets contingent_period * - * @param double $contingent_period + * @param float|null $contingent_period * - * @return $this + * @return self */ public function setContingentPeriod($contingent_period) { + if (is_null($contingent_period)) { + throw new \InvalidArgumentException('non-nullable contingent_period cannot be null'); + } $this->container['contingent_period'] = $contingent_period; return $this; @@ -542,7 +663,7 @@ public function setContingentPeriod($contingent_period) /** * Gets entitlement_period * - * @return double + * @return float|null */ public function getEntitlementPeriod() { @@ -552,12 +673,15 @@ public function getEntitlementPeriod() /** * Sets entitlement_period * - * @param double $entitlement_period + * @param float|null $entitlement_period * - * @return $this + * @return self */ public function setEntitlementPeriod($entitlement_period) { + if (is_null($entitlement_period)) { + throw new \InvalidArgumentException('non-nullable entitlement_period cannot be null'); + } $this->container['entitlement_period'] = $entitlement_period; return $this; @@ -566,7 +690,7 @@ public function setEntitlementPeriod($entitlement_period) /** * Gets leave_accrual_rule_id * - * @return int + * @return int|null */ public function getLeaveAccrualRuleId() { @@ -576,12 +700,15 @@ public function getLeaveAccrualRuleId() /** * Sets leave_accrual_rule_id * - * @param int $leave_accrual_rule_id + * @param int|null $leave_accrual_rule_id * - * @return $this + * @return self */ public function setLeaveAccrualRuleId($leave_accrual_rule_id) { + if (is_null($leave_accrual_rule_id)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_id cannot be null'); + } $this->container['leave_accrual_rule_id'] = $leave_accrual_rule_id; return $this; @@ -590,7 +717,7 @@ public function setLeaveAccrualRuleId($leave_accrual_rule_id) /** * Gets leave_accrual_rule_accrual_type * - * @return string + * @return string|null */ public function getLeaveAccrualRuleAccrualType() { @@ -600,17 +727,21 @@ public function getLeaveAccrualRuleAccrualType() /** * Sets leave_accrual_rule_accrual_type * - * @param string $leave_accrual_rule_accrual_type + * @param string|null $leave_accrual_rule_accrual_type * - * @return $this + * @return self */ public function setLeaveAccrualRuleAccrualType($leave_accrual_rule_accrual_type) { + if (is_null($leave_accrual_rule_accrual_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_accrual_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualRuleAccrualTypeAllowableValues(); - if (!is_null($leave_accrual_rule_accrual_type) && !in_array($leave_accrual_rule_accrual_type, $allowedValues, true)) { + if (!in_array($leave_accrual_rule_accrual_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_rule_accrual_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_rule_accrual_type', must be one of '%s'", + $leave_accrual_rule_accrual_type, implode("', '", $allowedValues) ) ); @@ -623,7 +754,7 @@ public function setLeaveAccrualRuleAccrualType($leave_accrual_rule_accrual_type) /** * Gets leave_accrual_rule_cap_type * - * @return string + * @return string|null */ public function getLeaveAccrualRuleCapType() { @@ -633,17 +764,21 @@ public function getLeaveAccrualRuleCapType() /** * Sets leave_accrual_rule_cap_type * - * @param string $leave_accrual_rule_cap_type + * @param string|null $leave_accrual_rule_cap_type * - * @return $this + * @return self */ public function setLeaveAccrualRuleCapType($leave_accrual_rule_cap_type) { + if (is_null($leave_accrual_rule_cap_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_cap_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualRuleCapTypeAllowableValues(); - if (!is_null($leave_accrual_rule_cap_type) && !in_array($leave_accrual_rule_cap_type, $allowedValues, true)) { + if (!in_array($leave_accrual_rule_cap_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_rule_cap_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_rule_cap_type', must be one of '%s'", + $leave_accrual_rule_cap_type, implode("', '", $allowedValues) ) ); @@ -656,7 +791,7 @@ public function setLeaveAccrualRuleCapType($leave_accrual_rule_cap_type) /** * Gets leave_accrual_rule_unit_cap * - * @return double + * @return float|null */ public function getLeaveAccrualRuleUnitCap() { @@ -666,12 +801,15 @@ public function getLeaveAccrualRuleUnitCap() /** * Sets leave_accrual_rule_unit_cap * - * @param double $leave_accrual_rule_unit_cap + * @param float|null $leave_accrual_rule_unit_cap * - * @return $this + * @return self */ public function setLeaveAccrualRuleUnitCap($leave_accrual_rule_unit_cap) { + if (is_null($leave_accrual_rule_unit_cap)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_unit_cap cannot be null'); + } $this->container['leave_accrual_rule_unit_cap'] = $leave_accrual_rule_unit_cap; return $this; @@ -680,7 +818,7 @@ public function setLeaveAccrualRuleUnitCap($leave_accrual_rule_unit_cap) /** * Gets leave_accrual_rule_carry_over_behaviour * - * @return string + * @return string|null */ public function getLeaveAccrualRuleCarryOverBehaviour() { @@ -690,17 +828,21 @@ public function getLeaveAccrualRuleCarryOverBehaviour() /** * Sets leave_accrual_rule_carry_over_behaviour * - * @param string $leave_accrual_rule_carry_over_behaviour + * @param string|null $leave_accrual_rule_carry_over_behaviour * - * @return $this + * @return self */ public function setLeaveAccrualRuleCarryOverBehaviour($leave_accrual_rule_carry_over_behaviour) { + if (is_null($leave_accrual_rule_carry_over_behaviour)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_carry_over_behaviour cannot be null'); + } $allowedValues = $this->getLeaveAccrualRuleCarryOverBehaviourAllowableValues(); - if (!is_null($leave_accrual_rule_carry_over_behaviour) && !in_array($leave_accrual_rule_carry_over_behaviour, $allowedValues, true)) { + if (!in_array($leave_accrual_rule_carry_over_behaviour, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_rule_carry_over_behaviour', must be one of '%s'", + $leave_accrual_rule_carry_over_behaviour, implode("', '", $allowedValues) ) ); @@ -713,7 +855,7 @@ public function setLeaveAccrualRuleCarryOverBehaviour($leave_accrual_rule_carry_ /** * Gets leave_accrual_rule_carry_over_amount * - * @return double + * @return float|null */ public function getLeaveAccrualRuleCarryOverAmount() { @@ -723,12 +865,15 @@ public function getLeaveAccrualRuleCarryOverAmount() /** * Sets leave_accrual_rule_carry_over_amount * - * @param double $leave_accrual_rule_carry_over_amount + * @param float|null $leave_accrual_rule_carry_over_amount * - * @return $this + * @return self */ public function setLeaveAccrualRuleCarryOverAmount($leave_accrual_rule_carry_over_amount) { + if (is_null($leave_accrual_rule_carry_over_amount)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_carry_over_amount cannot be null'); + } $this->container['leave_accrual_rule_carry_over_amount'] = $leave_accrual_rule_carry_over_amount; return $this; @@ -737,7 +882,7 @@ public function setLeaveAccrualRuleCarryOverAmount($leave_accrual_rule_carry_ove /** * Gets leave_accrual_rule_accrue_in_advance * - * @return bool + * @return bool|null */ public function getLeaveAccrualRuleAccrueInAdvance() { @@ -747,12 +892,15 @@ public function getLeaveAccrualRuleAccrueInAdvance() /** * Sets leave_accrual_rule_accrue_in_advance * - * @param bool $leave_accrual_rule_accrue_in_advance + * @param bool|null $leave_accrual_rule_accrue_in_advance * - * @return $this + * @return self */ public function setLeaveAccrualRuleAccrueInAdvance($leave_accrual_rule_accrue_in_advance) { + if (is_null($leave_accrual_rule_accrue_in_advance)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_rule_accrue_in_advance cannot be null'); + } $this->container['leave_accrual_rule_accrue_in_advance'] = $leave_accrual_rule_accrue_in_advance; return $this; @@ -764,7 +912,7 @@ public function setLeaveAccrualRuleAccrueInAdvance($leave_accrual_rule_accrue_in * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -774,22 +922,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -805,11 +954,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -817,13 +979,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveAllowanceTemplateModel.php b/src/lib/Model/LeaveAllowanceTemplateModel.php index 8e42bbe..e42355c 100644 --- a/src/lib/Model/LeaveAllowanceTemplateModel.php +++ b/src/lib/Model/LeaveAllowanceTemplateModel.php @@ -2,64 +2,64 @@ /** * LeaveAllowanceTemplateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveAllowanceTemplateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess +class LeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveAllowanceTemplateModel'; + protected static $openAPIModelName = 'LeaveAllowanceTemplateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', - 'leave_categories' => '\Swagger\Client\Model\LeaveAllowanceTemplateLeaveCategoryModel[]', + 'leave_categories' => '\OpenAPI\Client\Model\LeaveAllowanceTemplateLeaveCategoryModel[]', 'external_id' => 'string', 'source' => 'string', 'leave_loading_calculated_from_pay_category_id' => 'int', @@ -71,8 +71,10 @@ class LeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'leave_categories' => null, @@ -83,14 +85,37 @@ class LeaveAllowanceTemplateModel implements ModelInterface, ArrayAccess 'leave_year_start' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'leave_categories' => false, + 'external_id' => false, + 'source' => false, + 'leave_loading_calculated_from_pay_category_id' => false, + 'leave_accrual_start_date_type' => false, + 'leave_year_start' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -190,93 +267,91 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; - const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; - const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_EMPLOYEE_START_DATE = 'EmployeeStartDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_SPECIFIED_DATE = 'SpecifiedDate'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_CALENDAR_YEAR = 'CalendarYear'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR12_MONTH = 'RollingYear12Month'; + public const LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH = 'RollingYear24Month'; + /** * Gets allowable values of the enum * @@ -363,7 +438,7 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - + /** * Gets allowable values of the enum * @@ -379,7 +454,6 @@ public function getLeaveAccrualStartDateTypeAllowableValues() self::LEAVE_ACCRUAL_START_DATE_TYPE_ROLLING_YEAR24_MONTH, ]; } - /** * Associative array for storing property values @@ -396,14 +470,32 @@ public function getLeaveAccrualStartDateTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['leave_categories'] = isset($data['leave_categories']) ? $data['leave_categories'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['leave_loading_calculated_from_pay_category_id'] = isset($data['leave_loading_calculated_from_pay_category_id']) ? $data['leave_loading_calculated_from_pay_category_id'] : null; - $this->container['leave_accrual_start_date_type'] = isset($data['leave_accrual_start_date_type']) ? $data['leave_accrual_start_date_type'] : null; - $this->container['leave_year_start'] = isset($data['leave_year_start']) ? $data['leave_year_start'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('leave_categories', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('leave_loading_calculated_from_pay_category_id', $data ?? [], null); + $this->setIfExists('leave_accrual_start_date_type', $data ?? [], null); + $this->setIfExists('leave_year_start', $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; } /** @@ -418,7 +510,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -426,7 +519,8 @@ public function listInvalidProperties() $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); if (!is_null($this->container['leave_accrual_start_date_type']) && !in_array($this->container['leave_accrual_start_date_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $this->container['leave_accrual_start_date_type'], implode("', '", $allowedValues) ); } @@ -449,7 +543,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -459,12 +553,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -473,7 +570,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -483,12 +580,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -497,7 +597,7 @@ public function setName($name) /** * Gets leave_categories * - * @return \Swagger\Client\Model\LeaveAllowanceTemplateLeaveCategoryModel[] + * @return \OpenAPI\Client\Model\LeaveAllowanceTemplateLeaveCategoryModel[]|null */ public function getLeaveCategories() { @@ -507,12 +607,15 @@ public function getLeaveCategories() /** * Sets leave_categories * - * @param \Swagger\Client\Model\LeaveAllowanceTemplateLeaveCategoryModel[] $leave_categories + * @param \OpenAPI\Client\Model\LeaveAllowanceTemplateLeaveCategoryModel[]|null $leave_categories * - * @return $this + * @return self */ public function setLeaveCategories($leave_categories) { + if (is_null($leave_categories)) { + throw new \InvalidArgumentException('non-nullable leave_categories cannot be null'); + } $this->container['leave_categories'] = $leave_categories; return $this; @@ -521,7 +624,7 @@ public function setLeaveCategories($leave_categories) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -531,12 +634,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -545,7 +651,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -555,17 +661,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -578,7 +688,7 @@ public function setSource($source) /** * Gets leave_loading_calculated_from_pay_category_id * - * @return int + * @return int|null */ public function getLeaveLoadingCalculatedFromPayCategoryId() { @@ -588,12 +698,15 @@ public function getLeaveLoadingCalculatedFromPayCategoryId() /** * Sets leave_loading_calculated_from_pay_category_id * - * @param int $leave_loading_calculated_from_pay_category_id + * @param int|null $leave_loading_calculated_from_pay_category_id * - * @return $this + * @return self */ public function setLeaveLoadingCalculatedFromPayCategoryId($leave_loading_calculated_from_pay_category_id) { + if (is_null($leave_loading_calculated_from_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_loading_calculated_from_pay_category_id cannot be null'); + } $this->container['leave_loading_calculated_from_pay_category_id'] = $leave_loading_calculated_from_pay_category_id; return $this; @@ -602,7 +715,7 @@ public function setLeaveLoadingCalculatedFromPayCategoryId($leave_loading_calcul /** * Gets leave_accrual_start_date_type * - * @return string + * @return string|null */ public function getLeaveAccrualStartDateType() { @@ -612,17 +725,21 @@ public function getLeaveAccrualStartDateType() /** * Sets leave_accrual_start_date_type * - * @param string $leave_accrual_start_date_type + * @param string|null $leave_accrual_start_date_type * - * @return $this + * @return self */ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) { + if (is_null($leave_accrual_start_date_type)) { + throw new \InvalidArgumentException('non-nullable leave_accrual_start_date_type cannot be null'); + } $allowedValues = $this->getLeaveAccrualStartDateTypeAllowableValues(); - if (!is_null($leave_accrual_start_date_type) && !in_array($leave_accrual_start_date_type, $allowedValues, true)) { + if (!in_array($leave_accrual_start_date_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'leave_accrual_start_date_type', must be one of '%s'", + "Invalid value '%s' for 'leave_accrual_start_date_type', must be one of '%s'", + $leave_accrual_start_date_type, implode("', '", $allowedValues) ) ); @@ -635,7 +752,7 @@ public function setLeaveAccrualStartDateType($leave_accrual_start_date_type) /** * Gets leave_year_start * - * @return \DateTime + * @return \DateTime|null */ public function getLeaveYearStart() { @@ -645,12 +762,15 @@ public function getLeaveYearStart() /** * Sets leave_year_start * - * @param \DateTime $leave_year_start + * @param \DateTime|null $leave_year_start * - * @return $this + * @return self */ public function setLeaveYearStart($leave_year_start) { + if (is_null($leave_year_start)) { + throw new \InvalidArgumentException('non-nullable leave_year_start cannot be null'); + } $this->container['leave_year_start'] = $leave_year_start; return $this; @@ -662,7 +782,7 @@ public function setLeaveYearStart($leave_year_start) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -672,22 +792,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -703,11 +824,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -715,13 +849,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveApplicationWithAttachmentModel.php b/src/lib/Model/LeaveApplicationWithAttachmentModel.php index 8c6250e..791b138 100644 --- a/src/lib/Model/LeaveApplicationWithAttachmentModel.php +++ b/src/lib/Model/LeaveApplicationWithAttachmentModel.php @@ -2,66 +2,66 @@ /** * LeaveApplicationWithAttachmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveApplicationWithAttachmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveApplicationWithAttachmentModel implements ModelInterface, ArrayAccess +class LeaveApplicationWithAttachmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveApplicationWithAttachmentModel'; + protected static $openAPIModelName = 'LeaveApplicationWithAttachmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'attachment' => 'string', 'attachment_id' => 'int', 'filename' => 'string', - 'hours' => 'double', - 'units' => 'double', + 'hours' => 'float', + 'units' => 'float', 'id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -73,8 +73,10 @@ class LeaveApplicationWithAttachmentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'attachment' => 'byte', 'attachment_id' => 'int32', 'filename' => null, @@ -87,14 +89,39 @@ class LeaveApplicationWithAttachmentModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'attachment' => false, + 'attachment_id' => false, + 'filename' => false, + 'hours' => false, + 'units' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'leave_category_id' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; - $this->container['filename'] = isset($data['filename']) ? $data['filename'] : null; - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + $this->setIfExists('hours', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -278,7 +372,7 @@ public function valid() /** * Gets attachment * - * @return string + * @return string|null */ public function getAttachment() { @@ -288,15 +382,18 @@ public function getAttachment() /** * Sets attachment * - * @param string $attachment + * @param string|null $attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } - if (!is_null($attachment) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $attachment))) { - throw new \InvalidArgumentException("invalid value for $attachment when calling LeaveApplicationWithAttachmentModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $attachment))) { + throw new \InvalidArgumentException("invalid value for \$attachment when calling LeaveApplicationWithAttachmentModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['attachment'] = $attachment; @@ -307,7 +404,7 @@ public function setAttachment($attachment) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -317,12 +414,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -331,7 +431,7 @@ public function setAttachmentId($attachment_id) /** * Gets filename * - * @return string + * @return string|null */ public function getFilename() { @@ -341,12 +441,15 @@ public function getFilename() /** * Sets filename * - * @param string $filename + * @param string|null $filename * - * @return $this + * @return self */ public function setFilename($filename) { + if (is_null($filename)) { + throw new \InvalidArgumentException('non-nullable filename cannot be null'); + } $this->container['filename'] = $filename; return $this; @@ -355,7 +458,7 @@ public function setFilename($filename) /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -365,12 +468,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -379,7 +485,7 @@ public function setHours($hours) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -389,12 +495,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -403,7 +512,7 @@ public function setUnits($units) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -413,12 +522,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -439,10 +551,13 @@ public function getFromDate() * * @param \DateTime $from_date Required * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -463,10 +578,13 @@ public function getToDate() * * @param \DateTime $to_date Required * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -487,10 +605,13 @@ public function getLeaveCategoryId() * * @param int $leave_category_id Required * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -499,7 +620,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -509,13 +630,16 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { - if (!is_null($notes) && (mb_strlen($notes) > 255)) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } + if ((mb_strlen($notes) > 255)) { throw new \InvalidArgumentException('invalid length for $notes when calling LeaveApplicationWithAttachmentModel., must be smaller than or equal to 255.'); } @@ -530,7 +654,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -540,22 +664,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -571,11 +696,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -583,13 +721,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveBalanceModel.php b/src/lib/Model/LeaveBalanceModel.php index 73c33ff..64a6e26 100644 --- a/src/lib/Model/LeaveBalanceModel.php +++ b/src/lib/Model/LeaveBalanceModel.php @@ -2,64 +2,64 @@ /** * LeaveBalanceModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveBalanceModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveBalanceModel implements ModelInterface, ArrayAccess +class LeaveBalanceModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveBalanceModel'; + protected static $openAPIModelName = 'LeaveBalanceModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_category_id' => 'int', 'leave_category_name' => 'string', - 'accrued_amount' => 'double', + 'accrued_amount' => 'float', 'unit_type' => 'string' ]; @@ -67,22 +67,43 @@ class LeaveBalanceModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_category_id' => 'int32', 'leave_category_name' => null, 'accrued_amount' => 'double', 'unit_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_category_id' => false, + 'leave_category_name' => false, + 'accrued_amount' => false, + 'unit_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,15 +243,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -192,7 +263,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -209,10 +279,28 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['accrued_amount'] = isset($data['accrued_amount']) ? $data['accrued_amount'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('accrued_amount', $data ?? [], null); + $this->setIfExists('unit_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; } /** @@ -227,7 +315,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -250,7 +339,7 @@ public function valid() /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -260,12 +349,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -274,7 +366,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -284,12 +376,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -298,7 +393,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets accrued_amount * - * @return double + * @return float|null */ public function getAccruedAmount() { @@ -308,12 +403,15 @@ public function getAccruedAmount() /** * Sets accrued_amount * - * @param double $accrued_amount + * @param float|null $accrued_amount * - * @return $this + * @return self */ public function setAccruedAmount($accrued_amount) { + if (is_null($accrued_amount)) { + throw new \InvalidArgumentException('non-nullable accrued_amount cannot be null'); + } $this->container['accrued_amount'] = $accrued_amount; return $this; @@ -322,7 +420,7 @@ public function setAccruedAmount($accrued_amount) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -332,17 +430,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -358,7 +460,7 @@ public function setUnitType($unit_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -368,22 +470,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -399,11 +502,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -411,13 +527,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveBalancesReportRequestModel.php b/src/lib/Model/LeaveBalancesReportRequestModel.php index 0775132..118c0cd 100644 --- a/src/lib/Model/LeaveBalancesReportRequestModel.php +++ b/src/lib/Model/LeaveBalancesReportRequestModel.php @@ -2,61 +2,61 @@ /** * LeaveBalancesReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveBalancesReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveBalancesReportRequestModel implements ModelInterface, ArrayAccess +class LeaveBalancesReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveBalancesReportRequestModel'; + protected static $openAPIModelName = 'LeaveBalancesReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'leave_type_id' => 'int', 'group_by' => 'string', @@ -68,8 +68,10 @@ class LeaveBalancesReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'leave_type_id' => 'int32', 'group_by' => null, @@ -77,14 +79,34 @@ class LeaveBalancesReportRequestModel implements ModelInterface, ArrayAccess 'as_at_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'leave_type_id' => false, + 'group_by' => false, + 'employing_entity_id' => false, + 'as_at_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,14 +249,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const GROUP_BY_ACCRUAL_LOCATION = 'AccrualLocation'; - const GROUP_BY_DEFAULT_LOCATION = 'DefaultLocation'; - + public const GROUP_BY_ACCRUAL_LOCATION = 'AccrualLocation'; + public const GROUP_BY_DEFAULT_LOCATION = 'DefaultLocation'; - /** * Gets allowable values of the enum * @@ -195,7 +267,6 @@ public function getGroupByAllowableValues() self::GROUP_BY_DEFAULT_LOCATION, ]; } - /** * Associative array for storing property values @@ -212,11 +283,29 @@ public function getGroupByAllowableValues() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['leave_type_id'] = isset($data['leave_type_id']) ? $data['leave_type_id'] : null; - $this->container['group_by'] = isset($data['group_by']) ? $data['group_by'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; - $this->container['as_at_date'] = isset($data['as_at_date']) ? $data['as_at_date'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('leave_type_id', $data ?? [], null); + $this->setIfExists('group_by', $data ?? [], null); + $this->setIfExists('employing_entity_id', $data ?? [], null); + $this->setIfExists('as_at_date', $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; } /** @@ -231,7 +320,8 @@ public function listInvalidProperties() $allowedValues = $this->getGroupByAllowableValues(); if (!is_null($this->container['group_by']) && !in_array($this->container['group_by'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'group_by', must be one of '%s'", + "invalid value '%s' for 'group_by', must be one of '%s'", + $this->container['group_by'], implode("', '", $allowedValues) ); } @@ -254,7 +344,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -264,12 +354,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -278,7 +371,7 @@ public function setLocationId($location_id) /** * Gets leave_type_id * - * @return int + * @return int|null */ public function getLeaveTypeId() { @@ -288,12 +381,15 @@ public function getLeaveTypeId() /** * Sets leave_type_id * - * @param int $leave_type_id + * @param int|null $leave_type_id * - * @return $this + * @return self */ public function setLeaveTypeId($leave_type_id) { + if (is_null($leave_type_id)) { + throw new \InvalidArgumentException('non-nullable leave_type_id cannot be null'); + } $this->container['leave_type_id'] = $leave_type_id; return $this; @@ -302,7 +398,7 @@ public function setLeaveTypeId($leave_type_id) /** * Gets group_by * - * @return string + * @return string|null */ public function getGroupBy() { @@ -312,17 +408,21 @@ public function getGroupBy() /** * Sets group_by * - * @param string $group_by + * @param string|null $group_by * - * @return $this + * @return self */ public function setGroupBy($group_by) { + if (is_null($group_by)) { + throw new \InvalidArgumentException('non-nullable group_by cannot be null'); + } $allowedValues = $this->getGroupByAllowableValues(); - if (!is_null($group_by) && !in_array($group_by, $allowedValues, true)) { + if (!in_array($group_by, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'group_by', must be one of '%s'", + "Invalid value '%s' for 'group_by', must be one of '%s'", + $group_by, implode("', '", $allowedValues) ) ); @@ -335,7 +435,7 @@ public function setGroupBy($group_by) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -345,12 +445,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -359,7 +462,7 @@ public function setEmployingEntityId($employing_entity_id) /** * Gets as_at_date * - * @return \DateTime + * @return \DateTime|null */ public function getAsAtDate() { @@ -369,12 +472,15 @@ public function getAsAtDate() /** * Sets as_at_date * - * @param \DateTime $as_at_date + * @param \DateTime|null $as_at_date * - * @return $this + * @return self */ public function setAsAtDate($as_at_date) { + if (is_null($as_at_date)) { + throw new \InvalidArgumentException('non-nullable as_at_date cannot be null'); + } $this->container['as_at_date'] = $as_at_date; return $this; @@ -386,7 +492,7 @@ public function setAsAtDate($as_at_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -396,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -439,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveHistoryApiReportModel.php b/src/lib/Model/LeaveHistoryApiReportModel.php index d9b4942..974f58a 100644 --- a/src/lib/Model/LeaveHistoryApiReportModel.php +++ b/src/lib/Model/LeaveHistoryApiReportModel.php @@ -2,61 +2,61 @@ /** * LeaveHistoryApiReportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveHistoryApiReportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveHistoryApiReportModel implements ModelInterface, ArrayAccess +class LeaveHistoryApiReportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveHistoryApiReportModel'; + protected static $openAPIModelName = 'LeaveHistoryApiReportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime', 'pay_schedule_id' => 'int', @@ -70,8 +70,10 @@ class LeaveHistoryApiReportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time', 'pay_schedule_id' => 'int32', @@ -81,14 +83,36 @@ class LeaveHistoryApiReportModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => false, + 'pay_schedule_id' => false, + 'location_id' => false, + 'employee_id' => false, + 'leave_category_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -253,12 +344,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -267,7 +361,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -277,12 +371,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -291,7 +388,7 @@ public function setToDate($to_date) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -301,12 +398,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -315,7 +415,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -325,12 +425,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -339,7 +442,7 @@ public function setLocationId($location_id) /** * Gets employee_id * - * @return string[] + * @return string[]|null */ public function getEmployeeId() { @@ -349,12 +452,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string[] $employee_id + * @param string[]|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -363,7 +469,7 @@ public function setEmployeeId($employee_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -373,12 +479,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -387,7 +496,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -397,12 +506,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -414,7 +526,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveHistoryReportDetailModel.php b/src/lib/Model/LeaveHistoryReportDetailModel.php index e7babc3..53040f7 100644 --- a/src/lib/Model/LeaveHistoryReportDetailModel.php +++ b/src/lib/Model/LeaveHistoryReportDetailModel.php @@ -2,65 +2,65 @@ /** * LeaveHistoryReportDetailModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveHistoryReportDetailModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveHistoryReportDetailModel implements ModelInterface, ArrayAccess +class LeaveHistoryReportDetailModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveHistoryReportDetailModel'; + protected static $openAPIModelName = 'LeaveHistoryReportDetailModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_period' => 'string', 'notes' => 'string', - 'leave_accrued' => 'double', - 'leave_taken' => 'double', + 'leave_accrued' => 'float', + 'leave_taken' => 'float', 'unit_type' => 'string' ]; @@ -68,8 +68,10 @@ class LeaveHistoryReportDetailModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_period' => null, 'notes' => null, 'leave_accrued' => 'double', @@ -77,14 +79,34 @@ class LeaveHistoryReportDetailModel implements ModelInterface, ArrayAccess 'unit_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_period' => false, + 'notes' => false, + 'leave_accrued' => false, + 'leave_taken' => false, + 'unit_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,15 +249,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -197,7 +269,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -214,11 +285,29 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['pay_period'] = isset($data['pay_period']) ? $data['pay_period'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['leave_accrued'] = isset($data['leave_accrued']) ? $data['leave_accrued'] : null; - $this->container['leave_taken'] = isset($data['leave_taken']) ? $data['leave_taken'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; + $this->setIfExists('pay_period', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('leave_accrued', $data ?? [], null); + $this->setIfExists('leave_taken', $data ?? [], null); + $this->setIfExists('unit_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; } /** @@ -233,7 +322,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -256,7 +346,7 @@ public function valid() /** * Gets pay_period * - * @return string + * @return string|null */ public function getPayPeriod() { @@ -266,12 +356,15 @@ public function getPayPeriod() /** * Sets pay_period * - * @param string $pay_period + * @param string|null $pay_period * - * @return $this + * @return self */ public function setPayPeriod($pay_period) { + if (is_null($pay_period)) { + throw new \InvalidArgumentException('non-nullable pay_period cannot be null'); + } $this->container['pay_period'] = $pay_period; return $this; @@ -280,7 +373,7 @@ public function setPayPeriod($pay_period) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -290,12 +383,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -304,7 +400,7 @@ public function setNotes($notes) /** * Gets leave_accrued * - * @return double + * @return float|null */ public function getLeaveAccrued() { @@ -314,12 +410,15 @@ public function getLeaveAccrued() /** * Sets leave_accrued * - * @param double $leave_accrued + * @param float|null $leave_accrued * - * @return $this + * @return self */ public function setLeaveAccrued($leave_accrued) { + if (is_null($leave_accrued)) { + throw new \InvalidArgumentException('non-nullable leave_accrued cannot be null'); + } $this->container['leave_accrued'] = $leave_accrued; return $this; @@ -328,7 +427,7 @@ public function setLeaveAccrued($leave_accrued) /** * Gets leave_taken * - * @return double + * @return float|null */ public function getLeaveTaken() { @@ -338,12 +437,15 @@ public function getLeaveTaken() /** * Sets leave_taken * - * @param double $leave_taken + * @param float|null $leave_taken * - * @return $this + * @return self */ public function setLeaveTaken($leave_taken) { + if (is_null($leave_taken)) { + throw new \InvalidArgumentException('non-nullable leave_taken cannot be null'); + } $this->container['leave_taken'] = $leave_taken; return $this; @@ -352,7 +454,7 @@ public function setLeaveTaken($leave_taken) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -362,17 +464,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -388,7 +494,7 @@ public function setUnitType($unit_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -398,22 +504,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -429,11 +536,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -441,13 +561,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveHistoryReportGroupModel.php b/src/lib/Model/LeaveHistoryReportGroupModel.php index 13d797b..aa47809 100644 --- a/src/lib/Model/LeaveHistoryReportGroupModel.php +++ b/src/lib/Model/LeaveHistoryReportGroupModel.php @@ -2,69 +2,69 @@ /** * LeaveHistoryReportGroupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveHistoryReportGroupModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveHistoryReportGroupModel implements ModelInterface, ArrayAccess +class LeaveHistoryReportGroupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveHistoryReportGroupModel'; + protected static $openAPIModelName = 'LeaveHistoryReportGroupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'employee_external_id' => 'string', 'first_name' => 'string', 'surname' => 'string', 'leave_category_type' => 'string', - 'opening_balance' => 'double', - 'closing_balance' => 'double', - 'leave_history_details' => '\Swagger\Client\Model\LeaveHistoryReportDetailModel[]', + 'opening_balance' => 'float', + 'closing_balance' => 'float', + 'leave_history_details' => '\OpenAPI\Client\Model\LeaveHistoryReportDetailModel[]', 'unit_type' => 'string' ]; @@ -72,8 +72,10 @@ class LeaveHistoryReportGroupModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'employee_external_id' => null, 'first_name' => null, @@ -85,14 +87,38 @@ class LeaveHistoryReportGroupModel implements ModelInterface, ArrayAccess 'unit_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'employee_external_id' => false, + 'first_name' => false, + 'surname' => false, + 'leave_category_type' => false, + 'opening_balance' => false, + 'closing_balance' => false, + 'leave_history_details' => false, + 'unit_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -195,15 +273,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -217,7 +293,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -234,15 +309,33 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['leave_category_type'] = isset($data['leave_category_type']) ? $data['leave_category_type'] : null; - $this->container['opening_balance'] = isset($data['opening_balance']) ? $data['opening_balance'] : null; - $this->container['closing_balance'] = isset($data['closing_balance']) ? $data['closing_balance'] : null; - $this->container['leave_history_details'] = isset($data['leave_history_details']) ? $data['leave_history_details'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('leave_category_type', $data ?? [], null); + $this->setIfExists('opening_balance', $data ?? [], null); + $this->setIfExists('closing_balance', $data ?? [], null); + $this->setIfExists('leave_history_details', $data ?? [], null); + $this->setIfExists('unit_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; } /** @@ -257,7 +350,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -280,7 +374,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -290,12 +384,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -304,7 +401,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -314,12 +411,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -328,7 +428,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -338,12 +438,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -352,7 +455,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -362,12 +465,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -376,7 +482,7 @@ public function setSurname($surname) /** * Gets leave_category_type * - * @return string + * @return string|null */ public function getLeaveCategoryType() { @@ -386,12 +492,15 @@ public function getLeaveCategoryType() /** * Sets leave_category_type * - * @param string $leave_category_type + * @param string|null $leave_category_type * - * @return $this + * @return self */ public function setLeaveCategoryType($leave_category_type) { + if (is_null($leave_category_type)) { + throw new \InvalidArgumentException('non-nullable leave_category_type cannot be null'); + } $this->container['leave_category_type'] = $leave_category_type; return $this; @@ -400,7 +509,7 @@ public function setLeaveCategoryType($leave_category_type) /** * Gets opening_balance * - * @return double + * @return float|null */ public function getOpeningBalance() { @@ -410,12 +519,15 @@ public function getOpeningBalance() /** * Sets opening_balance * - * @param double $opening_balance + * @param float|null $opening_balance * - * @return $this + * @return self */ public function setOpeningBalance($opening_balance) { + if (is_null($opening_balance)) { + throw new \InvalidArgumentException('non-nullable opening_balance cannot be null'); + } $this->container['opening_balance'] = $opening_balance; return $this; @@ -424,7 +536,7 @@ public function setOpeningBalance($opening_balance) /** * Gets closing_balance * - * @return double + * @return float|null */ public function getClosingBalance() { @@ -434,12 +546,15 @@ public function getClosingBalance() /** * Sets closing_balance * - * @param double $closing_balance + * @param float|null $closing_balance * - * @return $this + * @return self */ public function setClosingBalance($closing_balance) { + if (is_null($closing_balance)) { + throw new \InvalidArgumentException('non-nullable closing_balance cannot be null'); + } $this->container['closing_balance'] = $closing_balance; return $this; @@ -448,7 +563,7 @@ public function setClosingBalance($closing_balance) /** * Gets leave_history_details * - * @return \Swagger\Client\Model\LeaveHistoryReportDetailModel[] + * @return \OpenAPI\Client\Model\LeaveHistoryReportDetailModel[]|null */ public function getLeaveHistoryDetails() { @@ -458,12 +573,15 @@ public function getLeaveHistoryDetails() /** * Sets leave_history_details * - * @param \Swagger\Client\Model\LeaveHistoryReportDetailModel[] $leave_history_details + * @param \OpenAPI\Client\Model\LeaveHistoryReportDetailModel[]|null $leave_history_details * - * @return $this + * @return self */ public function setLeaveHistoryDetails($leave_history_details) { + if (is_null($leave_history_details)) { + throw new \InvalidArgumentException('non-nullable leave_history_details cannot be null'); + } $this->container['leave_history_details'] = $leave_history_details; return $this; @@ -472,7 +590,7 @@ public function setLeaveHistoryDetails($leave_history_details) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -482,17 +600,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -508,7 +630,7 @@ public function setUnitType($unit_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -518,22 +640,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -549,11 +672,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -561,13 +697,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveHoursEstimateFilter.php b/src/lib/Model/LeaveHoursEstimateFilter.php index 0513d74..0f39721 100644 --- a/src/lib/Model/LeaveHoursEstimateFilter.php +++ b/src/lib/Model/LeaveHoursEstimateFilter.php @@ -2,61 +2,61 @@ /** * LeaveHoursEstimateFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveHoursEstimateFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveHoursEstimateFilter implements ModelInterface, ArrayAccess +class LeaveHoursEstimateFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveHoursEstimateFilter'; + protected static $openAPIModelName = 'LeaveHoursEstimateFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'leave_category_id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime' @@ -66,21 +66,41 @@ class LeaveHoursEstimateFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_category_id' => 'int32', 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_category_id' => false, + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -225,7 +312,7 @@ public function valid() /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -235,12 +322,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -261,10 +351,13 @@ public function getFromDate() * * @param \DateTime $from_date Required * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -285,10 +378,13 @@ public function getToDate() * * @param \DateTime $to_date Required * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -300,7 +396,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -310,22 +406,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -341,11 +438,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -353,13 +463,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LeaveRequestFilterModel.php b/src/lib/Model/LeaveRequestFilterModel.php index 3b9a845..f413118 100644 --- a/src/lib/Model/LeaveRequestFilterModel.php +++ b/src/lib/Model/LeaveRequestFilterModel.php @@ -2,61 +2,61 @@ /** * LeaveRequestFilterModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LeaveRequestFilterModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LeaveRequestFilterModel implements ModelInterface, ArrayAccess +class LeaveRequestFilterModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LeaveRequestFilterModel'; + protected static $openAPIModelName = 'LeaveRequestFilterModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'status' => 'string', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -71,8 +71,10 @@ class LeaveRequestFilterModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'status' => null, 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -83,14 +85,37 @@ class LeaveRequestFilterModel implements ModelInterface, ArrayAccess 'restrict_overlapping_leave' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'from_date' => false, + 'to_date' => false, + 'leave_category_id' => false, + 'location_id' => false, + 'employee_id' => false, + 'group_by' => false, + 'restrict_overlapping_leave' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -190,18 +267,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_APPROVED = 'Approved'; - const STATUS_PENDING = 'Pending'; - const STATUS_REJECTED = 'Rejected'; - const STATUS_CANCELLED = 'Cancelled'; - const GROUP_BY_EMPLOYEE = 'Employee'; - const GROUP_BY_LEAVE_TYPE = 'LeaveType'; - + public const STATUS_APPROVED = 'Approved'; + public const STATUS_PENDING = 'Pending'; + public const STATUS_REJECTED = 'Rejected'; + public const STATUS_CANCELLED = 'Cancelled'; + public const GROUP_BY_EMPLOYEE = 'Employee'; + public const GROUP_BY_LEAVE_TYPE = 'LeaveType'; - /** * Gets allowable values of the enum * @@ -216,7 +291,7 @@ public function getStatusAllowableValues() self::STATUS_CANCELLED, ]; } - + /** * Gets allowable values of the enum * @@ -229,7 +304,6 @@ public function getGroupByAllowableValues() self::GROUP_BY_LEAVE_TYPE, ]; } - /** * Associative array for storing property values @@ -246,14 +320,32 @@ public function getGroupByAllowableValues() */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['group_by'] = isset($data['group_by']) ? $data['group_by'] : null; - $this->container['restrict_overlapping_leave'] = isset($data['restrict_overlapping_leave']) ? $data['restrict_overlapping_leave'] : null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('group_by', $data ?? [], null); + $this->setIfExists('restrict_overlapping_leave', $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; } /** @@ -268,7 +360,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -276,7 +369,8 @@ public function listInvalidProperties() $allowedValues = $this->getGroupByAllowableValues(); if (!is_null($this->container['group_by']) && !in_array($this->container['group_by'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'group_by', must be one of '%s'", + "invalid value '%s' for 'group_by', must be one of '%s'", + $this->container['group_by'], implode("', '", $allowedValues) ); } @@ -299,7 +393,7 @@ public function valid() /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -309,17 +403,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -332,7 +430,7 @@ public function setStatus($status) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -342,12 +440,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -356,7 +457,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -366,12 +467,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -380,7 +484,7 @@ public function setToDate($to_date) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -390,12 +494,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -404,7 +511,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -414,12 +521,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -428,7 +538,7 @@ public function setLocationId($location_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -438,12 +548,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -452,7 +565,7 @@ public function setEmployeeId($employee_id) /** * Gets group_by * - * @return string + * @return string|null */ public function getGroupBy() { @@ -462,17 +575,21 @@ public function getGroupBy() /** * Sets group_by * - * @param string $group_by + * @param string|null $group_by * - * @return $this + * @return self */ public function setGroupBy($group_by) { + if (is_null($group_by)) { + throw new \InvalidArgumentException('non-nullable group_by cannot be null'); + } $allowedValues = $this->getGroupByAllowableValues(); - if (!is_null($group_by) && !in_array($group_by, $allowedValues, true)) { + if (!in_array($group_by, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'group_by', must be one of '%s'", + "Invalid value '%s' for 'group_by', must be one of '%s'", + $group_by, implode("', '", $allowedValues) ) ); @@ -485,7 +602,7 @@ public function setGroupBy($group_by) /** * Gets restrict_overlapping_leave * - * @return bool + * @return bool|null */ public function getRestrictOverlappingLeave() { @@ -495,12 +612,15 @@ public function getRestrictOverlappingLeave() /** * Sets restrict_overlapping_leave * - * @param bool $restrict_overlapping_leave + * @param bool|null $restrict_overlapping_leave * - * @return $this + * @return self */ public function setRestrictOverlappingLeave($restrict_overlapping_leave) { + if (is_null($restrict_overlapping_leave)) { + throw new \InvalidArgumentException('non-nullable restrict_overlapping_leave cannot be null'); + } $this->container['restrict_overlapping_leave'] = $restrict_overlapping_leave; return $this; @@ -512,7 +632,7 @@ public function setRestrictOverlappingLeave($restrict_overlapping_leave) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -522,22 +642,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -553,11 +674,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -565,13 +699,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LocationAccessModel.php b/src/lib/Model/LocationAccessModel.php index c80282a..ceb7715 100644 --- a/src/lib/Model/LocationAccessModel.php +++ b/src/lib/Model/LocationAccessModel.php @@ -2,61 +2,61 @@ /** * LocationAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LocationAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LocationAccessModel implements ModelInterface, ArrayAccess +class LocationAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LocationAccessModel'; + protected static $openAPIModelName = 'LocationAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'filter_type' => 'string', 'location_ids' => 'int[]', 'permissions' => 'string' @@ -66,21 +66,41 @@ class LocationAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'filter_type' => null, 'location_ids' => 'int32', 'permissions' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filter_type' => false, + 'location_ids' => false, + 'permissions' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,36 +237,34 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const FILTER_TYPE_LOCATION = 'Location'; - const FILTER_TYPE_LOCATION_OR_PARENTS = 'LocationOrParents'; - const PERMISSIONS_APPROVE_TIMESHEETS = 'ApproveTimesheets'; - const PERMISSIONS_APPROVE_LEAVE_REQUESTS = 'ApproveLeaveRequests'; - const PERMISSIONS_CREATE_TIMESHEETS = 'CreateTimesheets'; - const PERMISSIONS_CREATE_LEAVE_REQUESTS = 'CreateLeaveRequests'; - const PERMISSIONS_VIEW_LEAVE_REQUESTS = 'ViewLeaveRequests'; - const PERMISSIONS_MANAGE_ROSTERS = 'ManageRosters'; - const PERMISSIONS_VIEW_ROSTERS = 'ViewRosters'; - const PERMISSIONS_VIEW_SHIFT_COSTS = 'ViewShiftCosts'; - const PERMISSIONS_VIEW_EXPENSES = 'ViewExpenses'; - const PERMISSIONS_CREATE_EXPENSES = 'CreateExpenses'; - const PERMISSIONS_APPROVE_EXPENSES = 'ApproveExpenses'; - const PERMISSIONS_CREATE_TASKS = 'CreateTasks'; - const PERMISSIONS_VIEW_EMPLOYEE_DOCUMENTS = 'ViewEmployeeDocuments'; - const PERMISSIONS_MANAGE_EMPLOYEE_DOCUMENTS = 'ManageEmployeeDocuments'; - const PERMISSIONS_VIEW_EMPLOYEE_QUALIFICATIONS = 'ViewEmployeeQualifications'; - const PERMISSIONS_MANAGE_EMPLOYEE_QUALIFICATIONS = 'ManageEmployeeQualifications'; - const PERMISSIONS_INITIATE_EMPLOYEE_SELF_SETUP = 'InitiateEmployeeSelfSetup'; - const PERMISSIONS_ADD_EMPLOYEE_FROM_KIOSK = 'AddEmployeeFromKiosk'; - const PERMISSIONS_VIEW_EMPLOYEE_DETAILS = 'ViewEmployeeDetails'; - const PERMISSIONS_EDIT_BASIC_EMPLOYEE_DETAILS = 'EditBasicEmployeeDetails'; - const PERMISSIONS_EDIT_ALL_EMPLOYEE_DETAILS = 'EditAllEmployeeDetails'; - const PERMISSIONS_VIEW_TIMESHEET_REPORTS = 'ViewTimesheetReports'; - - - + public const FILTER_TYPE_LOCATION = 'Location'; + public const FILTER_TYPE_LOCATION_OR_PARENTS = 'LocationOrParents'; + public const PERMISSIONS_APPROVE_TIMESHEETS = 'ApproveTimesheets'; + public const PERMISSIONS_APPROVE_LEAVE_REQUESTS = 'ApproveLeaveRequests'; + public const PERMISSIONS_CREATE_TIMESHEETS = 'CreateTimesheets'; + public const PERMISSIONS_CREATE_LEAVE_REQUESTS = 'CreateLeaveRequests'; + public const PERMISSIONS_VIEW_LEAVE_REQUESTS = 'ViewLeaveRequests'; + public const PERMISSIONS_MANAGE_ROSTERS = 'ManageRosters'; + public const PERMISSIONS_VIEW_ROSTERS = 'ViewRosters'; + public const PERMISSIONS_VIEW_SHIFT_COSTS = 'ViewShiftCosts'; + public const PERMISSIONS_VIEW_EXPENSES = 'ViewExpenses'; + public const PERMISSIONS_CREATE_EXPENSES = 'CreateExpenses'; + public const PERMISSIONS_APPROVE_EXPENSES = 'ApproveExpenses'; + public const PERMISSIONS_CREATE_TASKS = 'CreateTasks'; + public const PERMISSIONS_VIEW_EMPLOYEE_DOCUMENTS = 'ViewEmployeeDocuments'; + public const PERMISSIONS_MANAGE_EMPLOYEE_DOCUMENTS = 'ManageEmployeeDocuments'; + public const PERMISSIONS_VIEW_EMPLOYEE_QUALIFICATIONS = 'ViewEmployeeQualifications'; + public const PERMISSIONS_MANAGE_EMPLOYEE_QUALIFICATIONS = 'ManageEmployeeQualifications'; + public const PERMISSIONS_INITIATE_EMPLOYEE_SELF_SETUP = 'InitiateEmployeeSelfSetup'; + public const PERMISSIONS_ADD_EMPLOYEE_FROM_KIOSK = 'AddEmployeeFromKiosk'; + public const PERMISSIONS_VIEW_EMPLOYEE_DETAILS = 'ViewEmployeeDetails'; + public const PERMISSIONS_EDIT_BASIC_EMPLOYEE_DETAILS = 'EditBasicEmployeeDetails'; + public const PERMISSIONS_EDIT_ALL_EMPLOYEE_DETAILS = 'EditAllEmployeeDetails'; + public const PERMISSIONS_VIEW_TIMESHEET_REPORTS = 'ViewTimesheetReports'; + /** * Gets allowable values of the enum * @@ -207,7 +277,7 @@ public function getFilterTypeAllowableValues() self::FILTER_TYPE_LOCATION_OR_PARENTS, ]; } - + /** * Gets allowable values of the enum * @@ -240,7 +310,6 @@ public function getPermissionsAllowableValues() self::PERMISSIONS_VIEW_TIMESHEET_REPORTS, ]; } - /** * Associative array for storing property values @@ -257,9 +326,27 @@ public function getPermissionsAllowableValues() */ public function __construct(array $data = null) { - $this->container['filter_type'] = isset($data['filter_type']) ? $data['filter_type'] : null; - $this->container['location_ids'] = isset($data['location_ids']) ? $data['location_ids'] : null; - $this->container['permissions'] = isset($data['permissions']) ? $data['permissions'] : null; + $this->setIfExists('filter_type', $data ?? [], null); + $this->setIfExists('location_ids', $data ?? [], null); + $this->setIfExists('permissions', $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; } /** @@ -274,7 +361,8 @@ public function listInvalidProperties() $allowedValues = $this->getFilterTypeAllowableValues(); if (!is_null($this->container['filter_type']) && !in_array($this->container['filter_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'filter_type', must be one of '%s'", + "invalid value '%s' for 'filter_type', must be one of '%s'", + $this->container['filter_type'], implode("', '", $allowedValues) ); } @@ -282,7 +370,8 @@ public function listInvalidProperties() $allowedValues = $this->getPermissionsAllowableValues(); if (!is_null($this->container['permissions']) && !in_array($this->container['permissions'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'permissions', must be one of '%s'", + "invalid value '%s' for 'permissions', must be one of '%s'", + $this->container['permissions'], implode("', '", $allowedValues) ); } @@ -305,7 +394,7 @@ public function valid() /** * Gets filter_type * - * @return string + * @return string|null */ public function getFilterType() { @@ -315,17 +404,21 @@ public function getFilterType() /** * Sets filter_type * - * @param string $filter_type + * @param string|null $filter_type * - * @return $this + * @return self */ public function setFilterType($filter_type) { + if (is_null($filter_type)) { + throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); + } $allowedValues = $this->getFilterTypeAllowableValues(); - if (!is_null($filter_type) && !in_array($filter_type, $allowedValues, true)) { + if (!in_array($filter_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'filter_type', must be one of '%s'", + "Invalid value '%s' for 'filter_type', must be one of '%s'", + $filter_type, implode("', '", $allowedValues) ) ); @@ -338,7 +431,7 @@ public function setFilterType($filter_type) /** * Gets location_ids * - * @return int[] + * @return int[]|null */ public function getLocationIds() { @@ -348,12 +441,15 @@ public function getLocationIds() /** * Sets location_ids * - * @param int[] $location_ids + * @param int[]|null $location_ids * - * @return $this + * @return self */ public function setLocationIds($location_ids) { + if (is_null($location_ids)) { + throw new \InvalidArgumentException('non-nullable location_ids cannot be null'); + } $this->container['location_ids'] = $location_ids; return $this; @@ -362,7 +458,7 @@ public function setLocationIds($location_ids) /** * Gets permissions * - * @return string + * @return string|null */ public function getPermissions() { @@ -372,17 +468,21 @@ public function getPermissions() /** * Sets permissions * - * @param string $permissions + * @param string|null $permissions * - * @return $this + * @return self */ public function setPermissions($permissions) { + if (is_null($permissions)) { + throw new \InvalidArgumentException('non-nullable permissions cannot be null'); + } $allowedValues = $this->getPermissionsAllowableValues(); - if (!is_null($permissions) && !in_array($permissions, $allowedValues, true)) { + if (!in_array($permissions, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'permissions', must be one of '%s'", + "Invalid value '%s' for 'permissions', must be one of '%s'", + $permissions, implode("', '", $allowedValues) ) ); @@ -398,7 +498,7 @@ public function setPermissions($permissions) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -408,22 +508,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -439,11 +540,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -451,13 +565,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LocationItemModel.php b/src/lib/Model/LocationItemModel.php index 258fe31..ab751e5 100644 --- a/src/lib/Model/LocationItemModel.php +++ b/src/lib/Model/LocationItemModel.php @@ -2,61 +2,61 @@ /** * LocationItemModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LocationItemModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LocationItemModel implements ModelInterface, ArrayAccess +class LocationItemModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LocationItemModel'; + protected static $openAPIModelName = 'LocationItemModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class LocationItemModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LocationModel.php b/src/lib/Model/LocationModel.php index 0161e7d..dc4e095 100644 --- a/src/lib/Model/LocationModel.php +++ b/src/lib/Model/LocationModel.php @@ -2,61 +2,61 @@ /** * LocationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LocationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LocationModel implements ModelInterface, ArrayAccess +class LocationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LocationModel'; + protected static $openAPIModelName = 'LocationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'parent_id' => 'int', 'name' => 'string', @@ -75,8 +75,10 @@ class LocationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'parent_id' => 'int32', 'name' => null, @@ -91,14 +93,41 @@ class LocationModel implements ModelInterface, ArrayAccess 'state' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'parent_id' => false, + 'name' => false, + 'external_id' => false, + 'external_accounting_location_id' => false, + 'source' => false, + 'fully_qualified_name' => false, + 'is_global' => false, + 'is_rollup_reporting_location' => false, + 'general_ledger_mapping_code' => false, + 'default_shift_condition_ids' => false, + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['external_accounting_location_id'] = isset($data['external_accounting_location_id']) ? $data['external_accounting_location_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['fully_qualified_name'] = isset($data['fully_qualified_name']) ? $data['fully_qualified_name'] : null; - $this->container['is_global'] = isset($data['is_global']) ? $data['is_global'] : null; - $this->container['is_rollup_reporting_location'] = isset($data['is_rollup_reporting_location']) ? $data['is_rollup_reporting_location'] : null; - $this->container['general_ledger_mapping_code'] = isset($data['general_ledger_mapping_code']) ? $data['general_ledger_mapping_code'] : null; - $this->container['default_shift_condition_ids'] = isset($data['default_shift_condition_ids']) ? $data['default_shift_condition_ids'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('external_accounting_location_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('fully_qualified_name', $data ?? [], null); + $this->setIfExists('is_global', $data ?? [], null); + $this->setIfExists('is_rollup_reporting_location', $data ?? [], null); + $this->setIfExists('general_ledger_mapping_code', $data ?? [], null); + $this->setIfExists('default_shift_condition_ids', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -283,12 +379,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -297,7 +396,7 @@ public function setId($id) /** * Gets parent_id * - * @return int + * @return int|null */ public function getParentId() { @@ -307,12 +406,15 @@ public function getParentId() /** * Sets parent_id * - * @param int $parent_id + * @param int|null $parent_id * - * @return $this + * @return self */ public function setParentId($parent_id) { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } $this->container['parent_id'] = $parent_id; return $this; @@ -321,7 +423,7 @@ public function setParentId($parent_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -331,12 +433,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -345,7 +450,7 @@ public function setName($name) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -355,12 +460,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -369,7 +477,7 @@ public function setExternalId($external_id) /** * Gets external_accounting_location_id * - * @return string + * @return string|null */ public function getExternalAccountingLocationId() { @@ -379,12 +487,15 @@ public function getExternalAccountingLocationId() /** * Sets external_accounting_location_id * - * @param string $external_accounting_location_id + * @param string|null $external_accounting_location_id * - * @return $this + * @return self */ public function setExternalAccountingLocationId($external_accounting_location_id) { + if (is_null($external_accounting_location_id)) { + throw new \InvalidArgumentException('non-nullable external_accounting_location_id cannot be null'); + } $this->container['external_accounting_location_id'] = $external_accounting_location_id; return $this; @@ -393,7 +504,7 @@ public function setExternalAccountingLocationId($external_accounting_location_id /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -403,12 +514,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -417,7 +531,7 @@ public function setSource($source) /** * Gets fully_qualified_name * - * @return string + * @return string|null */ public function getFullyQualifiedName() { @@ -427,12 +541,15 @@ public function getFullyQualifiedName() /** * Sets fully_qualified_name * - * @param string $fully_qualified_name + * @param string|null $fully_qualified_name * - * @return $this + * @return self */ public function setFullyQualifiedName($fully_qualified_name) { + if (is_null($fully_qualified_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_name cannot be null'); + } $this->container['fully_qualified_name'] = $fully_qualified_name; return $this; @@ -441,7 +558,7 @@ public function setFullyQualifiedName($fully_qualified_name) /** * Gets is_global * - * @return bool + * @return bool|null */ public function getIsGlobal() { @@ -451,12 +568,15 @@ public function getIsGlobal() /** * Sets is_global * - * @param bool $is_global + * @param bool|null $is_global * - * @return $this + * @return self */ public function setIsGlobal($is_global) { + if (is_null($is_global)) { + throw new \InvalidArgumentException('non-nullable is_global cannot be null'); + } $this->container['is_global'] = $is_global; return $this; @@ -465,7 +585,7 @@ public function setIsGlobal($is_global) /** * Gets is_rollup_reporting_location * - * @return bool + * @return bool|null */ public function getIsRollupReportingLocation() { @@ -475,12 +595,15 @@ public function getIsRollupReportingLocation() /** * Sets is_rollup_reporting_location * - * @param bool $is_rollup_reporting_location + * @param bool|null $is_rollup_reporting_location * - * @return $this + * @return self */ public function setIsRollupReportingLocation($is_rollup_reporting_location) { + if (is_null($is_rollup_reporting_location)) { + throw new \InvalidArgumentException('non-nullable is_rollup_reporting_location cannot be null'); + } $this->container['is_rollup_reporting_location'] = $is_rollup_reporting_location; return $this; @@ -489,7 +612,7 @@ public function setIsRollupReportingLocation($is_rollup_reporting_location) /** * Gets general_ledger_mapping_code * - * @return string + * @return string|null */ public function getGeneralLedgerMappingCode() { @@ -499,12 +622,15 @@ public function getGeneralLedgerMappingCode() /** * Sets general_ledger_mapping_code * - * @param string $general_ledger_mapping_code + * @param string|null $general_ledger_mapping_code * - * @return $this + * @return self */ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) { + if (is_null($general_ledger_mapping_code)) { + throw new \InvalidArgumentException('non-nullable general_ledger_mapping_code cannot be null'); + } $this->container['general_ledger_mapping_code'] = $general_ledger_mapping_code; return $this; @@ -513,7 +639,7 @@ public function setGeneralLedgerMappingCode($general_ledger_mapping_code) /** * Gets default_shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getDefaultShiftConditionIds() { @@ -523,12 +649,15 @@ public function getDefaultShiftConditionIds() /** * Sets default_shift_condition_ids * - * @param int[] $default_shift_condition_ids + * @param int[]|null $default_shift_condition_ids * - * @return $this + * @return self */ public function setDefaultShiftConditionIds($default_shift_condition_ids) { + if (is_null($default_shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable default_shift_condition_ids cannot be null'); + } $this->container['default_shift_condition_ids'] = $default_shift_condition_ids; return $this; @@ -537,7 +666,7 @@ public function setDefaultShiftConditionIds($default_shift_condition_ids) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -547,12 +676,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -564,7 +696,7 @@ public function setState($state) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LocationPermissionModel.php b/src/lib/Model/LocationPermissionModel.php index d40a05a..35ec9f9 100644 --- a/src/lib/Model/LocationPermissionModel.php +++ b/src/lib/Model/LocationPermissionModel.php @@ -2,61 +2,61 @@ /** * LocationPermissionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LocationPermissionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LocationPermissionModel implements ModelInterface, ArrayAccess +class LocationPermissionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LocationPermissionModel'; + protected static $openAPIModelName = 'LocationPermissionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int[]', 'can_approve_leave_requests' => 'bool', 'can_view_leave_requests' => 'bool', @@ -73,8 +73,10 @@ class LocationPermissionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'can_approve_leave_requests' => null, 'can_view_leave_requests' => null, @@ -87,14 +89,39 @@ class LocationPermissionModel implements ModelInterface, ArrayAccess 'can_manage_rosters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'can_approve_leave_requests' => false, + 'can_view_leave_requests' => false, + 'can_approve_timesheets' => false, + 'can_create_timesheets' => false, + 'can_approve_expenses' => false, + 'can_view_expenses' => false, + 'can_view_shift_costs' => false, + 'can_view_rosters' => false, + 'can_manage_rosters' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['can_approve_leave_requests'] = isset($data['can_approve_leave_requests']) ? $data['can_approve_leave_requests'] : null; - $this->container['can_view_leave_requests'] = isset($data['can_view_leave_requests']) ? $data['can_view_leave_requests'] : null; - $this->container['can_approve_timesheets'] = isset($data['can_approve_timesheets']) ? $data['can_approve_timesheets'] : null; - $this->container['can_create_timesheets'] = isset($data['can_create_timesheets']) ? $data['can_create_timesheets'] : null; - $this->container['can_approve_expenses'] = isset($data['can_approve_expenses']) ? $data['can_approve_expenses'] : null; - $this->container['can_view_expenses'] = isset($data['can_view_expenses']) ? $data['can_view_expenses'] : null; - $this->container['can_view_shift_costs'] = isset($data['can_view_shift_costs']) ? $data['can_view_shift_costs'] : null; - $this->container['can_view_rosters'] = isset($data['can_view_rosters']) ? $data['can_view_rosters'] : null; - $this->container['can_manage_rosters'] = isset($data['can_manage_rosters']) ? $data['can_manage_rosters'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('can_approve_leave_requests', $data ?? [], null); + $this->setIfExists('can_view_leave_requests', $data ?? [], null); + $this->setIfExists('can_approve_timesheets', $data ?? [], null); + $this->setIfExists('can_create_timesheets', $data ?? [], null); + $this->setIfExists('can_approve_expenses', $data ?? [], null); + $this->setIfExists('can_view_expenses', $data ?? [], null); + $this->setIfExists('can_view_shift_costs', $data ?? [], null); + $this->setIfExists('can_view_rosters', $data ?? [], null); + $this->setIfExists('can_manage_rosters', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int[] + * @return int[]|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int[] $id + * @param int[]|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets can_approve_leave_requests * - * @return bool + * @return bool|null */ public function getCanApproveLeaveRequests() { @@ -295,12 +392,15 @@ public function getCanApproveLeaveRequests() /** * Sets can_approve_leave_requests * - * @param bool $can_approve_leave_requests + * @param bool|null $can_approve_leave_requests * - * @return $this + * @return self */ public function setCanApproveLeaveRequests($can_approve_leave_requests) { + if (is_null($can_approve_leave_requests)) { + throw new \InvalidArgumentException('non-nullable can_approve_leave_requests cannot be null'); + } $this->container['can_approve_leave_requests'] = $can_approve_leave_requests; return $this; @@ -309,7 +409,7 @@ public function setCanApproveLeaveRequests($can_approve_leave_requests) /** * Gets can_view_leave_requests * - * @return bool + * @return bool|null */ public function getCanViewLeaveRequests() { @@ -319,12 +419,15 @@ public function getCanViewLeaveRequests() /** * Sets can_view_leave_requests * - * @param bool $can_view_leave_requests + * @param bool|null $can_view_leave_requests * - * @return $this + * @return self */ public function setCanViewLeaveRequests($can_view_leave_requests) { + if (is_null($can_view_leave_requests)) { + throw new \InvalidArgumentException('non-nullable can_view_leave_requests cannot be null'); + } $this->container['can_view_leave_requests'] = $can_view_leave_requests; return $this; @@ -333,7 +436,7 @@ public function setCanViewLeaveRequests($can_view_leave_requests) /** * Gets can_approve_timesheets * - * @return bool + * @return bool|null */ public function getCanApproveTimesheets() { @@ -343,12 +446,15 @@ public function getCanApproveTimesheets() /** * Sets can_approve_timesheets * - * @param bool $can_approve_timesheets + * @param bool|null $can_approve_timesheets * - * @return $this + * @return self */ public function setCanApproveTimesheets($can_approve_timesheets) { + if (is_null($can_approve_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_approve_timesheets cannot be null'); + } $this->container['can_approve_timesheets'] = $can_approve_timesheets; return $this; @@ -357,7 +463,7 @@ public function setCanApproveTimesheets($can_approve_timesheets) /** * Gets can_create_timesheets * - * @return bool + * @return bool|null */ public function getCanCreateTimesheets() { @@ -367,12 +473,15 @@ public function getCanCreateTimesheets() /** * Sets can_create_timesheets * - * @param bool $can_create_timesheets + * @param bool|null $can_create_timesheets * - * @return $this + * @return self */ public function setCanCreateTimesheets($can_create_timesheets) { + if (is_null($can_create_timesheets)) { + throw new \InvalidArgumentException('non-nullable can_create_timesheets cannot be null'); + } $this->container['can_create_timesheets'] = $can_create_timesheets; return $this; @@ -381,7 +490,7 @@ public function setCanCreateTimesheets($can_create_timesheets) /** * Gets can_approve_expenses * - * @return bool + * @return bool|null */ public function getCanApproveExpenses() { @@ -391,12 +500,15 @@ public function getCanApproveExpenses() /** * Sets can_approve_expenses * - * @param bool $can_approve_expenses + * @param bool|null $can_approve_expenses * - * @return $this + * @return self */ public function setCanApproveExpenses($can_approve_expenses) { + if (is_null($can_approve_expenses)) { + throw new \InvalidArgumentException('non-nullable can_approve_expenses cannot be null'); + } $this->container['can_approve_expenses'] = $can_approve_expenses; return $this; @@ -405,7 +517,7 @@ public function setCanApproveExpenses($can_approve_expenses) /** * Gets can_view_expenses * - * @return bool + * @return bool|null */ public function getCanViewExpenses() { @@ -415,12 +527,15 @@ public function getCanViewExpenses() /** * Sets can_view_expenses * - * @param bool $can_view_expenses + * @param bool|null $can_view_expenses * - * @return $this + * @return self */ public function setCanViewExpenses($can_view_expenses) { + if (is_null($can_view_expenses)) { + throw new \InvalidArgumentException('non-nullable can_view_expenses cannot be null'); + } $this->container['can_view_expenses'] = $can_view_expenses; return $this; @@ -429,7 +544,7 @@ public function setCanViewExpenses($can_view_expenses) /** * Gets can_view_shift_costs * - * @return bool + * @return bool|null */ public function getCanViewShiftCosts() { @@ -439,12 +554,15 @@ public function getCanViewShiftCosts() /** * Sets can_view_shift_costs * - * @param bool $can_view_shift_costs + * @param bool|null $can_view_shift_costs * - * @return $this + * @return self */ public function setCanViewShiftCosts($can_view_shift_costs) { + if (is_null($can_view_shift_costs)) { + throw new \InvalidArgumentException('non-nullable can_view_shift_costs cannot be null'); + } $this->container['can_view_shift_costs'] = $can_view_shift_costs; return $this; @@ -453,7 +571,7 @@ public function setCanViewShiftCosts($can_view_shift_costs) /** * Gets can_view_rosters * - * @return bool + * @return bool|null */ public function getCanViewRosters() { @@ -463,12 +581,15 @@ public function getCanViewRosters() /** * Sets can_view_rosters * - * @param bool $can_view_rosters + * @param bool|null $can_view_rosters * - * @return $this + * @return self */ public function setCanViewRosters($can_view_rosters) { + if (is_null($can_view_rosters)) { + throw new \InvalidArgumentException('non-nullable can_view_rosters cannot be null'); + } $this->container['can_view_rosters'] = $can_view_rosters; return $this; @@ -477,7 +598,7 @@ public function setCanViewRosters($can_view_rosters) /** * Gets can_manage_rosters * - * @return bool + * @return bool|null */ public function getCanManageRosters() { @@ -487,12 +608,15 @@ public function getCanManageRosters() /** * Sets can_manage_rosters * - * @param bool $can_manage_rosters + * @param bool|null $can_manage_rosters * - * @return $this + * @return self */ public function setCanManageRosters($can_manage_rosters) { + if (is_null($can_manage_rosters)) { + throw new \InvalidArgumentException('non-nullable can_manage_rosters cannot be null'); + } $this->container['can_manage_rosters'] = $can_manage_rosters; return $this; @@ -504,7 +628,7 @@ public function setCanManageRosters($can_manage_rosters) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LocationSelectModel.php b/src/lib/Model/LocationSelectModel.php index b916e84..6189c4c 100644 --- a/src/lib/Model/LocationSelectModel.php +++ b/src/lib/Model/LocationSelectModel.php @@ -2,61 +2,61 @@ /** * LocationSelectModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LocationSelectModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LocationSelectModel implements ModelInterface, ArrayAccess +class LocationSelectModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LocationSelectModel'; + protected static $openAPIModelName = 'LocationSelectModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'description' => 'string' ]; @@ -65,20 +65,39 @@ class LocationSelectModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -247,12 +336,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -264,7 +356,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/LocationShiftConditionsModel.php b/src/lib/Model/LocationShiftConditionsModel.php index 7780646..ade39d8 100644 --- a/src/lib/Model/LocationShiftConditionsModel.php +++ b/src/lib/Model/LocationShiftConditionsModel.php @@ -2,61 +2,61 @@ /** * LocationShiftConditionsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * LocationShiftConditionsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class LocationShiftConditionsModel implements ModelInterface, ArrayAccess +class LocationShiftConditionsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'LocationShiftConditionsModel'; + protected static $openAPIModelName = 'LocationShiftConditionsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'shift_condition_ids' => 'int[]' ]; @@ -65,20 +65,39 @@ class LocationShiftConditionsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'shift_condition_ids' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'shift_condition_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('shift_condition_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -223,12 +309,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -237,7 +326,7 @@ public function setLocationId($location_id) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -247,12 +336,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -264,7 +356,7 @@ public function setShiftConditionIds($shift_condition_ids) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerBiddableRosterShiftModel.php b/src/lib/Model/ManagerBiddableRosterShiftModel.php index c8323a7..e9f28d6 100644 --- a/src/lib/Model/ManagerBiddableRosterShiftModel.php +++ b/src/lib/Model/ManagerBiddableRosterShiftModel.php @@ -2,86 +2,86 @@ /** * ManagerBiddableRosterShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerBiddableRosterShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerBiddableRosterShiftModel implements ModelInterface, ArrayAccess +class ManagerBiddableRosterShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerBiddableRosterShiftModel'; + protected static $openAPIModelName = 'ManagerBiddableRosterShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'total_bidding_employees' => 'int', - 'bidding_employees' => '\Swagger\Client\Model\BiddingEmployee[]', + 'bidding_employees' => '\OpenAPI\Client\Model\BiddingEmployee[]', 'employee_phone_number' => 'string', - 'cost' => 'double', + 'cost' => 'float', 'cost_formatted' => 'string', 'warnings' => 'string[]', 'is_leave_based_roster_shift' => 'bool', - 'current_shift' => '\Swagger\Client\Model\ManagerCurrentRosterShift', + 'current_shift' => '\OpenAPI\Client\Model\ManagerCurrentRosterShift', 'id' => 'int', 'token' => 'string', - 'qualifications' => '\Swagger\Client\Model\QualificationModel[]', - 'breaks' => '\Swagger\Client\Model\RosterShiftBreakApiModel[]', + 'qualifications' => '\OpenAPI\Client\Model\QualificationModel[]', + 'breaks' => '\OpenAPI\Client\Model\RosterShiftBreakApiModel[]', 'employee_id' => 'int', 'employee_name' => 'string', 'location_id' => 'int', 'location_name' => 'string', 'work_type_id' => 'int', 'work_type_name' => 'string', - 'role' => '\Swagger\Client\Model\RosterShiftRole', + 'role' => '\OpenAPI\Client\Model\RosterShiftRole', 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'notes' => 'string', 'published' => 'bool', 'accepted' => 'bool', - 'pending_swap' => '\Swagger\Client\Model\RosterShiftSwapModel', + 'pending_swap' => '\OpenAPI\Client\Model\RosterShiftSwapModel', 'date_published' => '\DateTime', 'biddable' => 'bool', 'shift_swap_cutoff_time' => '\DateTime', @@ -92,8 +92,10 @@ class ManagerBiddableRosterShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'total_bidding_employees' => 'int32', 'bidding_employees' => null, 'employee_phone_number' => null, @@ -125,14 +127,58 @@ class ManagerBiddableRosterShiftModel implements ModelInterface, ArrayAccess 'shift_assignment_status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total_bidding_employees' => false, + 'bidding_employees' => false, + 'employee_phone_number' => false, + 'cost' => false, + 'cost_formatted' => false, + 'warnings' => false, + 'is_leave_based_roster_shift' => false, + 'current_shift' => false, + 'id' => false, + 'token' => false, + 'qualifications' => false, + 'breaks' => false, + 'employee_id' => false, + 'employee_name' => false, + 'location_id' => false, + 'location_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'role' => false, + 'start_time' => false, + 'end_time' => false, + 'notes' => false, + 'published' => false, + 'accepted' => false, + 'pending_swap' => false, + 'date_published' => false, + 'biddable' => false, + 'shift_swap_cutoff_time' => false, + 'shift_assignment_status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -140,9 +186,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -295,19 +393,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; - const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; - const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; - const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - + public const SHIFT_ASSIGNMENT_STATUS_PENDING = 'Pending'; + public const SHIFT_ASSIGNMENT_STATUS_ASSIGNED = 'Assigned'; + public const SHIFT_ASSIGNMENT_STATUS_BIDDING = 'Bidding'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP = 'PendingShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PENDING_SHIFT_SWAP_AWAITING_APPROVAL = 'PendingShiftSwapAwaitingApproval'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP = 'ProposedShiftSwap'; + public const SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL = 'ProposedShiftSwapAwaitingApproval'; - /** * Gets allowable values of the enum * @@ -325,7 +421,6 @@ public function getShiftAssignmentStatusAllowableValues() self::SHIFT_ASSIGNMENT_STATUS_PROPOSED_SHIFT_SWAP_AWAITING_APPROVAL, ]; } - /** * Associative array for storing property values @@ -342,35 +437,53 @@ public function getShiftAssignmentStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['total_bidding_employees'] = isset($data['total_bidding_employees']) ? $data['total_bidding_employees'] : null; - $this->container['bidding_employees'] = isset($data['bidding_employees']) ? $data['bidding_employees'] : null; - $this->container['employee_phone_number'] = isset($data['employee_phone_number']) ? $data['employee_phone_number'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['cost_formatted'] = isset($data['cost_formatted']) ? $data['cost_formatted'] : null; - $this->container['warnings'] = isset($data['warnings']) ? $data['warnings'] : null; - $this->container['is_leave_based_roster_shift'] = isset($data['is_leave_based_roster_shift']) ? $data['is_leave_based_roster_shift'] : null; - $this->container['current_shift'] = isset($data['current_shift']) ? $data['current_shift'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; - $this->container['qualifications'] = isset($data['qualifications']) ? $data['qualifications'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['published'] = isset($data['published']) ? $data['published'] : null; - $this->container['accepted'] = isset($data['accepted']) ? $data['accepted'] : null; - $this->container['pending_swap'] = isset($data['pending_swap']) ? $data['pending_swap'] : null; - $this->container['date_published'] = isset($data['date_published']) ? $data['date_published'] : null; - $this->container['biddable'] = isset($data['biddable']) ? $data['biddable'] : null; - $this->container['shift_swap_cutoff_time'] = isset($data['shift_swap_cutoff_time']) ? $data['shift_swap_cutoff_time'] : null; - $this->container['shift_assignment_status'] = isset($data['shift_assignment_status']) ? $data['shift_assignment_status'] : null; + $this->setIfExists('total_bidding_employees', $data ?? [], null); + $this->setIfExists('bidding_employees', $data ?? [], null); + $this->setIfExists('employee_phone_number', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('cost_formatted', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); + $this->setIfExists('is_leave_based_roster_shift', $data ?? [], null); + $this->setIfExists('current_shift', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + $this->setIfExists('qualifications', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('published', $data ?? [], null); + $this->setIfExists('accepted', $data ?? [], null); + $this->setIfExists('pending_swap', $data ?? [], null); + $this->setIfExists('date_published', $data ?? [], null); + $this->setIfExists('biddable', $data ?? [], null); + $this->setIfExists('shift_swap_cutoff_time', $data ?? [], null); + $this->setIfExists('shift_assignment_status', $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; } /** @@ -385,7 +498,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); if (!is_null($this->container['shift_assignment_status']) && !in_array($this->container['shift_assignment_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_assignment_status', must be one of '%s'", + "invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $this->container['shift_assignment_status'], implode("', '", $allowedValues) ); } @@ -408,7 +522,7 @@ public function valid() /** * Gets total_bidding_employees * - * @return int + * @return int|null */ public function getTotalBiddingEmployees() { @@ -418,12 +532,15 @@ public function getTotalBiddingEmployees() /** * Sets total_bidding_employees * - * @param int $total_bidding_employees + * @param int|null $total_bidding_employees * - * @return $this + * @return self */ public function setTotalBiddingEmployees($total_bidding_employees) { + if (is_null($total_bidding_employees)) { + throw new \InvalidArgumentException('non-nullable total_bidding_employees cannot be null'); + } $this->container['total_bidding_employees'] = $total_bidding_employees; return $this; @@ -432,7 +549,7 @@ public function setTotalBiddingEmployees($total_bidding_employees) /** * Gets bidding_employees * - * @return \Swagger\Client\Model\BiddingEmployee[] + * @return \OpenAPI\Client\Model\BiddingEmployee[]|null */ public function getBiddingEmployees() { @@ -442,12 +559,15 @@ public function getBiddingEmployees() /** * Sets bidding_employees * - * @param \Swagger\Client\Model\BiddingEmployee[] $bidding_employees + * @param \OpenAPI\Client\Model\BiddingEmployee[]|null $bidding_employees * - * @return $this + * @return self */ public function setBiddingEmployees($bidding_employees) { + if (is_null($bidding_employees)) { + throw new \InvalidArgumentException('non-nullable bidding_employees cannot be null'); + } $this->container['bidding_employees'] = $bidding_employees; return $this; @@ -456,7 +576,7 @@ public function setBiddingEmployees($bidding_employees) /** * Gets employee_phone_number * - * @return string + * @return string|null */ public function getEmployeePhoneNumber() { @@ -466,12 +586,15 @@ public function getEmployeePhoneNumber() /** * Sets employee_phone_number * - * @param string $employee_phone_number + * @param string|null $employee_phone_number * - * @return $this + * @return self */ public function setEmployeePhoneNumber($employee_phone_number) { + if (is_null($employee_phone_number)) { + throw new \InvalidArgumentException('non-nullable employee_phone_number cannot be null'); + } $this->container['employee_phone_number'] = $employee_phone_number; return $this; @@ -480,7 +603,7 @@ public function setEmployeePhoneNumber($employee_phone_number) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -490,12 +613,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -504,7 +630,7 @@ public function setCost($cost) /** * Gets cost_formatted * - * @return string + * @return string|null */ public function getCostFormatted() { @@ -514,12 +640,15 @@ public function getCostFormatted() /** * Sets cost_formatted * - * @param string $cost_formatted + * @param string|null $cost_formatted * - * @return $this + * @return self */ public function setCostFormatted($cost_formatted) { + if (is_null($cost_formatted)) { + throw new \InvalidArgumentException('non-nullable cost_formatted cannot be null'); + } $this->container['cost_formatted'] = $cost_formatted; return $this; @@ -528,7 +657,7 @@ public function setCostFormatted($cost_formatted) /** * Gets warnings * - * @return string[] + * @return string[]|null */ public function getWarnings() { @@ -538,12 +667,15 @@ public function getWarnings() /** * Sets warnings * - * @param string[] $warnings + * @param string[]|null $warnings * - * @return $this + * @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; @@ -552,7 +684,7 @@ public function setWarnings($warnings) /** * Gets is_leave_based_roster_shift * - * @return bool + * @return bool|null */ public function getIsLeaveBasedRosterShift() { @@ -562,12 +694,15 @@ public function getIsLeaveBasedRosterShift() /** * Sets is_leave_based_roster_shift * - * @param bool $is_leave_based_roster_shift + * @param bool|null $is_leave_based_roster_shift * - * @return $this + * @return self */ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) { + if (is_null($is_leave_based_roster_shift)) { + throw new \InvalidArgumentException('non-nullable is_leave_based_roster_shift cannot be null'); + } $this->container['is_leave_based_roster_shift'] = $is_leave_based_roster_shift; return $this; @@ -576,7 +711,7 @@ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) /** * Gets current_shift * - * @return \Swagger\Client\Model\ManagerCurrentRosterShift + * @return \OpenAPI\Client\Model\ManagerCurrentRosterShift|null */ public function getCurrentShift() { @@ -586,12 +721,15 @@ public function getCurrentShift() /** * Sets current_shift * - * @param \Swagger\Client\Model\ManagerCurrentRosterShift $current_shift + * @param \OpenAPI\Client\Model\ManagerCurrentRosterShift|null $current_shift current_shift * - * @return $this + * @return self */ public function setCurrentShift($current_shift) { + if (is_null($current_shift)) { + throw new \InvalidArgumentException('non-nullable current_shift cannot be null'); + } $this->container['current_shift'] = $current_shift; return $this; @@ -600,7 +738,7 @@ public function setCurrentShift($current_shift) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -610,12 +748,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -624,7 +765,7 @@ public function setId($id) /** * Gets token * - * @return string + * @return string|null */ public function getToken() { @@ -634,12 +775,15 @@ public function getToken() /** * Sets token * - * @param string $token + * @param string|null $token * - * @return $this + * @return self */ public function setToken($token) { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -648,7 +792,7 @@ public function setToken($token) /** * Gets qualifications * - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[]|null */ public function getQualifications() { @@ -658,12 +802,15 @@ public function getQualifications() /** * Sets qualifications * - * @param \Swagger\Client\Model\QualificationModel[] $qualifications + * @param \OpenAPI\Client\Model\QualificationModel[]|null $qualifications * - * @return $this + * @return self */ public function setQualifications($qualifications) { + if (is_null($qualifications)) { + throw new \InvalidArgumentException('non-nullable qualifications cannot be null'); + } $this->container['qualifications'] = $qualifications; return $this; @@ -672,7 +819,7 @@ public function setQualifications($qualifications) /** * Gets breaks * - * @return \Swagger\Client\Model\RosterShiftBreakApiModel[] + * @return \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null */ public function getBreaks() { @@ -682,12 +829,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\RosterShiftBreakApiModel[] $breaks + * @param \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -696,7 +846,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -706,12 +856,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -720,7 +873,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -730,12 +883,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -744,7 +900,7 @@ public function setEmployeeName($employee_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -754,12 +910,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -768,7 +927,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -778,12 +937,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -792,7 +954,7 @@ public function setLocationName($location_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -802,12 +964,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -816,7 +981,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -826,12 +991,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -840,7 +1008,7 @@ public function setWorkTypeName($work_type_name) /** * Gets role * - * @return \Swagger\Client\Model\RosterShiftRole + * @return \OpenAPI\Client\Model\RosterShiftRole|null */ public function getRole() { @@ -850,12 +1018,15 @@ public function getRole() /** * Sets role * - * @param \Swagger\Client\Model\RosterShiftRole $role + * @param \OpenAPI\Client\Model\RosterShiftRole|null $role role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -864,7 +1035,7 @@ public function setRole($role) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -874,12 +1045,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -888,7 +1062,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -898,12 +1072,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -912,7 +1089,7 @@ public function setEndTime($end_time) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -922,12 +1099,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -936,7 +1116,7 @@ public function setNotes($notes) /** * Gets published * - * @return bool + * @return bool|null */ public function getPublished() { @@ -946,12 +1126,15 @@ public function getPublished() /** * Sets published * - * @param bool $published + * @param bool|null $published * - * @return $this + * @return self */ public function setPublished($published) { + if (is_null($published)) { + throw new \InvalidArgumentException('non-nullable published cannot be null'); + } $this->container['published'] = $published; return $this; @@ -960,7 +1143,7 @@ public function setPublished($published) /** * Gets accepted * - * @return bool + * @return bool|null */ public function getAccepted() { @@ -970,12 +1153,15 @@ public function getAccepted() /** * Sets accepted * - * @param bool $accepted + * @param bool|null $accepted * - * @return $this + * @return self */ public function setAccepted($accepted) { + if (is_null($accepted)) { + throw new \InvalidArgumentException('non-nullable accepted cannot be null'); + } $this->container['accepted'] = $accepted; return $this; @@ -984,7 +1170,7 @@ public function setAccepted($accepted) /** * Gets pending_swap * - * @return \Swagger\Client\Model\RosterShiftSwapModel + * @return \OpenAPI\Client\Model\RosterShiftSwapModel|null */ public function getPendingSwap() { @@ -994,12 +1180,15 @@ public function getPendingSwap() /** * Sets pending_swap * - * @param \Swagger\Client\Model\RosterShiftSwapModel $pending_swap + * @param \OpenAPI\Client\Model\RosterShiftSwapModel|null $pending_swap pending_swap * - * @return $this + * @return self */ public function setPendingSwap($pending_swap) { + if (is_null($pending_swap)) { + throw new \InvalidArgumentException('non-nullable pending_swap cannot be null'); + } $this->container['pending_swap'] = $pending_swap; return $this; @@ -1008,7 +1197,7 @@ public function setPendingSwap($pending_swap) /** * Gets date_published * - * @return \DateTime + * @return \DateTime|null */ public function getDatePublished() { @@ -1018,12 +1207,15 @@ public function getDatePublished() /** * Sets date_published * - * @param \DateTime $date_published + * @param \DateTime|null $date_published * - * @return $this + * @return self */ public function setDatePublished($date_published) { + if (is_null($date_published)) { + throw new \InvalidArgumentException('non-nullable date_published cannot be null'); + } $this->container['date_published'] = $date_published; return $this; @@ -1032,7 +1224,7 @@ public function setDatePublished($date_published) /** * Gets biddable * - * @return bool + * @return bool|null */ public function getBiddable() { @@ -1042,12 +1234,15 @@ public function getBiddable() /** * Sets biddable * - * @param bool $biddable + * @param bool|null $biddable * - * @return $this + * @return self */ public function setBiddable($biddable) { + if (is_null($biddable)) { + throw new \InvalidArgumentException('non-nullable biddable cannot be null'); + } $this->container['biddable'] = $biddable; return $this; @@ -1056,7 +1251,7 @@ public function setBiddable($biddable) /** * Gets shift_swap_cutoff_time * - * @return \DateTime + * @return \DateTime|null */ public function getShiftSwapCutoffTime() { @@ -1066,12 +1261,15 @@ public function getShiftSwapCutoffTime() /** * Sets shift_swap_cutoff_time * - * @param \DateTime $shift_swap_cutoff_time + * @param \DateTime|null $shift_swap_cutoff_time * - * @return $this + * @return self */ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) { + if (is_null($shift_swap_cutoff_time)) { + throw new \InvalidArgumentException('non-nullable shift_swap_cutoff_time cannot be null'); + } $this->container['shift_swap_cutoff_time'] = $shift_swap_cutoff_time; return $this; @@ -1080,7 +1278,7 @@ public function setShiftSwapCutoffTime($shift_swap_cutoff_time) /** * Gets shift_assignment_status * - * @return string + * @return string|null */ public function getShiftAssignmentStatus() { @@ -1090,17 +1288,21 @@ public function getShiftAssignmentStatus() /** * Sets shift_assignment_status * - * @param string $shift_assignment_status + * @param string|null $shift_assignment_status * - * @return $this + * @return self */ public function setShiftAssignmentStatus($shift_assignment_status) { + if (is_null($shift_assignment_status)) { + throw new \InvalidArgumentException('non-nullable shift_assignment_status cannot be null'); + } $allowedValues = $this->getShiftAssignmentStatusAllowableValues(); - if (!is_null($shift_assignment_status) && !in_array($shift_assignment_status, $allowedValues, true)) { + if (!in_array($shift_assignment_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_assignment_status', must be one of '%s'", + "Invalid value '%s' for 'shift_assignment_status', must be one of '%s'", + $shift_assignment_status, implode("', '", $allowedValues) ) ); @@ -1116,7 +1318,7 @@ public function setShiftAssignmentStatus($shift_assignment_status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1126,22 +1328,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1157,11 +1360,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1169,13 +1385,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerCurrentRosterShift.php b/src/lib/Model/ManagerCurrentRosterShift.php index 1626ccd..2afd0d6 100644 --- a/src/lib/Model/ManagerCurrentRosterShift.php +++ b/src/lib/Model/ManagerCurrentRosterShift.php @@ -2,61 +2,61 @@ /** * ManagerCurrentRosterShift * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerCurrentRosterShift Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerCurrentRosterShift implements ModelInterface, ArrayAccess +class ManagerCurrentRosterShift implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerCurrentRosterShift'; + protected static $openAPIModelName = 'ManagerCurrentRosterShift'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'status' => 'string', 'is_late' => 'bool', 'is_not_clocked_off' => 'bool' @@ -66,21 +66,41 @@ class ManagerCurrentRosterShift implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'status' => null, 'is_late' => null, 'is_not_clocked_off' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'is_late' => false, + 'is_not_clocked_off' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,16 +237,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; - const STATUS_CLOCKED_ON = 'ClockedOn'; - const STATUS_ON_BREAK = 'OnBreak'; - const STATUS_CLOCKED_OFF = 'ClockedOff'; - + public const STATUS_NOT_CLOCKED_ON = 'NotClockedOn'; + public const STATUS_CLOCKED_ON = 'ClockedOn'; + public const STATUS_ON_BREAK = 'OnBreak'; + public const STATUS_CLOCKED_OFF = 'ClockedOff'; - /** * Gets allowable values of the enum * @@ -189,7 +259,6 @@ public function getStatusAllowableValues() self::STATUS_CLOCKED_OFF, ]; } - /** * Associative array for storing property values @@ -206,9 +275,27 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['is_late'] = isset($data['is_late']) ? $data['is_late'] : null; - $this->container['is_not_clocked_off'] = isset($data['is_not_clocked_off']) ? $data['is_not_clocked_off'] : null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('is_late', $data ?? [], null); + $this->setIfExists('is_not_clocked_off', $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; } /** @@ -223,7 +310,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -246,7 +334,7 @@ public function valid() /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -256,17 +344,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -279,7 +371,7 @@ public function setStatus($status) /** * Gets is_late * - * @return bool + * @return bool|null */ public function getIsLate() { @@ -289,12 +381,15 @@ public function getIsLate() /** * Sets is_late * - * @param bool $is_late + * @param bool|null $is_late * - * @return $this + * @return self */ public function setIsLate($is_late) { + if (is_null($is_late)) { + throw new \InvalidArgumentException('non-nullable is_late cannot be null'); + } $this->container['is_late'] = $is_late; return $this; @@ -303,7 +398,7 @@ public function setIsLate($is_late) /** * Gets is_not_clocked_off * - * @return bool + * @return bool|null */ public function getIsNotClockedOff() { @@ -313,12 +408,15 @@ public function getIsNotClockedOff() /** * Sets is_not_clocked_off * - * @param bool $is_not_clocked_off + * @param bool|null $is_not_clocked_off * - * @return $this + * @return self */ public function setIsNotClockedOff($is_not_clocked_off) { + if (is_null($is_not_clocked_off)) { + throw new \InvalidArgumentException('non-nullable is_not_clocked_off cannot be null'); + } $this->container['is_not_clocked_off'] = $is_not_clocked_off; return $this; @@ -330,7 +428,7 @@ public function setIsNotClockedOff($is_not_clocked_off) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -340,22 +438,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -371,11 +470,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -383,13 +495,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerDashboardModel.php b/src/lib/Model/ManagerDashboardModel.php index d761872..ee6d924 100644 --- a/src/lib/Model/ManagerDashboardModel.php +++ b/src/lib/Model/ManagerDashboardModel.php @@ -2,85 +2,105 @@ /** * ManagerDashboardModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerDashboardModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerDashboardModel implements ModelInterface, ArrayAccess +class ManagerDashboardModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerDashboardModel'; + protected static $openAPIModelName = 'ManagerDashboardModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'pending_leave_requests' => '\Swagger\Client\Model\ManagerItemCountModel', - 'submitted_timesheets' => '\Swagger\Client\Model\ManagerItemCountModel', - 'pending_expense_requests' => '\Swagger\Client\Model\ManagerItemCountModel' + protected static $openAPITypes = [ + 'pending_leave_requests' => '\OpenAPI\Client\Model\ManagerItemCountModel', + 'submitted_timesheets' => '\OpenAPI\Client\Model\ManagerItemCountModel', + 'pending_expense_requests' => '\OpenAPI\Client\Model\ManagerItemCountModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pending_leave_requests' => null, 'submitted_timesheets' => null, 'pending_expense_requests' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pending_leave_requests' => false, + 'submitted_timesheets' => false, + 'pending_expense_requests' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pending_leave_requests'] = isset($data['pending_leave_requests']) ? $data['pending_leave_requests'] : null; - $this->container['submitted_timesheets'] = isset($data['submitted_timesheets']) ? $data['submitted_timesheets'] : null; - $this->container['pending_expense_requests'] = isset($data['pending_expense_requests']) ? $data['pending_expense_requests'] : null; + $this->setIfExists('pending_leave_requests', $data ?? [], null); + $this->setIfExists('submitted_timesheets', $data ?? [], null); + $this->setIfExists('pending_expense_requests', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets pending_leave_requests * - * @return \Swagger\Client\Model\ManagerItemCountModel + * @return \OpenAPI\Client\Model\ManagerItemCountModel|null */ public function getPendingLeaveRequests() { @@ -229,12 +316,15 @@ public function getPendingLeaveRequests() /** * Sets pending_leave_requests * - * @param \Swagger\Client\Model\ManagerItemCountModel $pending_leave_requests + * @param \OpenAPI\Client\Model\ManagerItemCountModel|null $pending_leave_requests pending_leave_requests * - * @return $this + * @return self */ public function setPendingLeaveRequests($pending_leave_requests) { + if (is_null($pending_leave_requests)) { + throw new \InvalidArgumentException('non-nullable pending_leave_requests cannot be null'); + } $this->container['pending_leave_requests'] = $pending_leave_requests; return $this; @@ -243,7 +333,7 @@ public function setPendingLeaveRequests($pending_leave_requests) /** * Gets submitted_timesheets * - * @return \Swagger\Client\Model\ManagerItemCountModel + * @return \OpenAPI\Client\Model\ManagerItemCountModel|null */ public function getSubmittedTimesheets() { @@ -253,12 +343,15 @@ public function getSubmittedTimesheets() /** * Sets submitted_timesheets * - * @param \Swagger\Client\Model\ManagerItemCountModel $submitted_timesheets + * @param \OpenAPI\Client\Model\ManagerItemCountModel|null $submitted_timesheets submitted_timesheets * - * @return $this + * @return self */ public function setSubmittedTimesheets($submitted_timesheets) { + if (is_null($submitted_timesheets)) { + throw new \InvalidArgumentException('non-nullable submitted_timesheets cannot be null'); + } $this->container['submitted_timesheets'] = $submitted_timesheets; return $this; @@ -267,7 +360,7 @@ public function setSubmittedTimesheets($submitted_timesheets) /** * Gets pending_expense_requests * - * @return \Swagger\Client\Model\ManagerItemCountModel + * @return \OpenAPI\Client\Model\ManagerItemCountModel|null */ public function getPendingExpenseRequests() { @@ -277,12 +370,15 @@ public function getPendingExpenseRequests() /** * Sets pending_expense_requests * - * @param \Swagger\Client\Model\ManagerItemCountModel $pending_expense_requests + * @param \OpenAPI\Client\Model\ManagerItemCountModel|null $pending_expense_requests pending_expense_requests * - * @return $this + * @return self */ public function setPendingExpenseRequests($pending_expense_requests) { + if (is_null($pending_expense_requests)) { + throw new \InvalidArgumentException('non-nullable pending_expense_requests cannot be null'); + } $this->container['pending_expense_requests'] = $pending_expense_requests; return $this; @@ -294,7 +390,7 @@ public function setPendingExpenseRequests($pending_expense_requests) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerEmployeeGroup.php b/src/lib/Model/ManagerEmployeeGroup.php index 7db6a08..eac25de 100644 --- a/src/lib/Model/ManagerEmployeeGroup.php +++ b/src/lib/Model/ManagerEmployeeGroup.php @@ -2,61 +2,61 @@ /** * ManagerEmployeeGroup * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerEmployeeGroup Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerEmployeeGroup implements ModelInterface, ArrayAccess +class ManagerEmployeeGroup implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerEmployeeGroup'; + protected static $openAPIModelName = 'ManagerEmployeeGroup'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class ManagerEmployeeGroup implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerExpenseEmployeeModel.php b/src/lib/Model/ManagerExpenseEmployeeModel.php index e0034c8..2a6fc46 100644 --- a/src/lib/Model/ManagerExpenseEmployeeModel.php +++ b/src/lib/Model/ManagerExpenseEmployeeModel.php @@ -2,61 +2,61 @@ /** * ManagerExpenseEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerExpenseEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerExpenseEmployeeModel implements ModelInterface, ArrayAccess +class ManagerExpenseEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerExpenseEmployeeModel'; + protected static $openAPIModelName = 'ManagerExpenseEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_create' => 'bool', 'can_approve' => 'bool', 'id' => 'int', @@ -69,8 +69,10 @@ class ManagerExpenseEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_create' => null, 'can_approve' => null, 'id' => 'int32', @@ -79,14 +81,35 @@ class ManagerExpenseEmployeeModel implements ModelInterface, ArrayAccess 'surname' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_create' => false, + 'can_approve' => false, + 'id' => false, + 'name' => false, + 'first_name' => false, + 'surname' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['can_create'] = isset($data['can_create']) ? $data['can_create'] : null; - $this->container['can_approve'] = isset($data['can_approve']) ? $data['can_approve'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; + $this->setIfExists('can_create', $data ?? [], null); + $this->setIfExists('can_approve', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets can_create * - * @return bool + * @return bool|null */ public function getCanCreate() { @@ -247,12 +337,15 @@ public function getCanCreate() /** * Sets can_create * - * @param bool $can_create + * @param bool|null $can_create * - * @return $this + * @return self */ public function setCanCreate($can_create) { + if (is_null($can_create)) { + throw new \InvalidArgumentException('non-nullable can_create cannot be null'); + } $this->container['can_create'] = $can_create; return $this; @@ -261,7 +354,7 @@ public function setCanCreate($can_create) /** * Gets can_approve * - * @return bool + * @return bool|null */ public function getCanApprove() { @@ -271,12 +364,15 @@ public function getCanApprove() /** * Sets can_approve * - * @param bool $can_approve + * @param bool|null $can_approve * - * @return $this + * @return self */ public function setCanApprove($can_approve) { + if (is_null($can_approve)) { + throw new \InvalidArgumentException('non-nullable can_approve cannot be null'); + } $this->container['can_approve'] = $can_approve; return $this; @@ -285,7 +381,7 @@ public function setCanApprove($can_approve) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -295,12 +391,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -309,7 +408,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -319,12 +418,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -333,7 +435,7 @@ public function setName($name) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -343,12 +445,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -357,7 +462,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -367,12 +472,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -384,7 +492,7 @@ public function setSurname($surname) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerExpenseRequestModel.php b/src/lib/Model/ManagerExpenseRequestModel.php index 7068fd7..8a7c04b 100644 --- a/src/lib/Model/ManagerExpenseRequestModel.php +++ b/src/lib/Model/ManagerExpenseRequestModel.php @@ -2,61 +2,61 @@ /** * ManagerExpenseRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerExpenseRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerExpenseRequestModel implements ModelInterface, ArrayAccess +class ManagerExpenseRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerExpenseRequestModel'; + protected static $openAPIModelName = 'ManagerExpenseRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_cancel' => 'bool', 'can_modify' => 'bool', 'can_approve' => 'bool', @@ -65,8 +65,8 @@ class ManagerExpenseRequestModel implements ModelInterface, ArrayAccess 'employee_name' => 'string', 'status' => 'string', 'description' => 'string', - 'line_items' => '\Swagger\Client\Model\ExpenseRequestLineItemModel[]', - 'attachments' => '\Swagger\Client\Model\AttachmentModel[]', + 'line_items' => '\OpenAPI\Client\Model\ExpenseRequestLineItemModel[]', + 'attachments' => '\OpenAPI\Client\Model\AttachmentModel[]', 'status_updated_by_user' => 'string', 'status_update_notes' => 'string', 'date_status_updated' => '\DateTime', @@ -77,8 +77,10 @@ class ManagerExpenseRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_cancel' => null, 'can_modify' => null, 'can_approve' => null, @@ -95,14 +97,43 @@ class ManagerExpenseRequestModel implements ModelInterface, ArrayAccess 'date_created' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_cancel' => false, + 'can_modify' => false, + 'can_approve' => false, + 'id' => false, + 'employee_id' => false, + 'employee_name' => false, + 'status' => false, + 'description' => false, + 'line_items' => false, + 'attachments' => false, + 'status_updated_by_user' => false, + 'status_update_notes' => false, + 'date_status_updated' => false, + 'date_created' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -220,12 +303,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -242,20 +322,38 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['can_cancel'] = isset($data['can_cancel']) ? $data['can_cancel'] : null; - $this->container['can_modify'] = isset($data['can_modify']) ? $data['can_modify'] : null; - $this->container['can_approve'] = isset($data['can_approve']) ? $data['can_approve'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['line_items'] = isset($data['line_items']) ? $data['line_items'] : null; - $this->container['attachments'] = isset($data['attachments']) ? $data['attachments'] : null; - $this->container['status_updated_by_user'] = isset($data['status_updated_by_user']) ? $data['status_updated_by_user'] : null; - $this->container['status_update_notes'] = isset($data['status_update_notes']) ? $data['status_update_notes'] : null; - $this->container['date_status_updated'] = isset($data['date_status_updated']) ? $data['date_status_updated'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; + $this->setIfExists('can_cancel', $data ?? [], null); + $this->setIfExists('can_modify', $data ?? [], null); + $this->setIfExists('can_approve', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('line_items', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('status_updated_by_user', $data ?? [], null); + $this->setIfExists('status_update_notes', $data ?? [], null); + $this->setIfExists('date_status_updated', $data ?? [], null); + $this->setIfExists('date_created', $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; } /** @@ -285,7 +383,7 @@ public function valid() /** * Gets can_cancel * - * @return bool + * @return bool|null */ public function getCanCancel() { @@ -295,12 +393,15 @@ public function getCanCancel() /** * Sets can_cancel * - * @param bool $can_cancel + * @param bool|null $can_cancel * - * @return $this + * @return self */ public function setCanCancel($can_cancel) { + if (is_null($can_cancel)) { + throw new \InvalidArgumentException('non-nullable can_cancel cannot be null'); + } $this->container['can_cancel'] = $can_cancel; return $this; @@ -309,7 +410,7 @@ public function setCanCancel($can_cancel) /** * Gets can_modify * - * @return bool + * @return bool|null */ public function getCanModify() { @@ -319,12 +420,15 @@ public function getCanModify() /** * Sets can_modify * - * @param bool $can_modify + * @param bool|null $can_modify * - * @return $this + * @return self */ public function setCanModify($can_modify) { + if (is_null($can_modify)) { + throw new \InvalidArgumentException('non-nullable can_modify cannot be null'); + } $this->container['can_modify'] = $can_modify; return $this; @@ -333,7 +437,7 @@ public function setCanModify($can_modify) /** * Gets can_approve * - * @return bool + * @return bool|null */ public function getCanApprove() { @@ -343,12 +447,15 @@ public function getCanApprove() /** * Sets can_approve * - * @param bool $can_approve + * @param bool|null $can_approve * - * @return $this + * @return self */ public function setCanApprove($can_approve) { + if (is_null($can_approve)) { + throw new \InvalidArgumentException('non-nullable can_approve cannot be null'); + } $this->container['can_approve'] = $can_approve; return $this; @@ -357,7 +464,7 @@ public function setCanApprove($can_approve) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -367,12 +474,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -381,7 +491,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -391,12 +501,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -405,7 +518,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -415,12 +528,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -429,7 +545,7 @@ public function setEmployeeName($employee_name) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -439,12 +555,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -453,7 +572,7 @@ public function setStatus($status) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -463,12 +582,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -477,7 +599,7 @@ public function setDescription($description) /** * Gets line_items * - * @return \Swagger\Client\Model\ExpenseRequestLineItemModel[] + * @return \OpenAPI\Client\Model\ExpenseRequestLineItemModel[]|null */ public function getLineItems() { @@ -487,12 +609,15 @@ public function getLineItems() /** * Sets line_items * - * @param \Swagger\Client\Model\ExpenseRequestLineItemModel[] $line_items + * @param \OpenAPI\Client\Model\ExpenseRequestLineItemModel[]|null $line_items * - * @return $this + * @return self */ public function setLineItems($line_items) { + if (is_null($line_items)) { + throw new \InvalidArgumentException('non-nullable line_items cannot be null'); + } $this->container['line_items'] = $line_items; return $this; @@ -501,7 +626,7 @@ public function setLineItems($line_items) /** * Gets attachments * - * @return \Swagger\Client\Model\AttachmentModel[] + * @return \OpenAPI\Client\Model\AttachmentModel[]|null */ public function getAttachments() { @@ -511,12 +636,15 @@ public function getAttachments() /** * Sets attachments * - * @param \Swagger\Client\Model\AttachmentModel[] $attachments + * @param \OpenAPI\Client\Model\AttachmentModel[]|null $attachments * - * @return $this + * @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; @@ -525,7 +653,7 @@ public function setAttachments($attachments) /** * Gets status_updated_by_user * - * @return string + * @return string|null */ public function getStatusUpdatedByUser() { @@ -535,12 +663,15 @@ public function getStatusUpdatedByUser() /** * Sets status_updated_by_user * - * @param string $status_updated_by_user + * @param string|null $status_updated_by_user * - * @return $this + * @return self */ public function setStatusUpdatedByUser($status_updated_by_user) { + if (is_null($status_updated_by_user)) { + throw new \InvalidArgumentException('non-nullable status_updated_by_user cannot be null'); + } $this->container['status_updated_by_user'] = $status_updated_by_user; return $this; @@ -549,7 +680,7 @@ public function setStatusUpdatedByUser($status_updated_by_user) /** * Gets status_update_notes * - * @return string + * @return string|null */ public function getStatusUpdateNotes() { @@ -559,12 +690,15 @@ public function getStatusUpdateNotes() /** * Sets status_update_notes * - * @param string $status_update_notes + * @param string|null $status_update_notes * - * @return $this + * @return self */ public function setStatusUpdateNotes($status_update_notes) { + if (is_null($status_update_notes)) { + throw new \InvalidArgumentException('non-nullable status_update_notes cannot be null'); + } $this->container['status_update_notes'] = $status_update_notes; return $this; @@ -573,7 +707,7 @@ public function setStatusUpdateNotes($status_update_notes) /** * Gets date_status_updated * - * @return \DateTime + * @return \DateTime|null */ public function getDateStatusUpdated() { @@ -583,12 +717,15 @@ public function getDateStatusUpdated() /** * Sets date_status_updated * - * @param \DateTime $date_status_updated + * @param \DateTime|null $date_status_updated * - * @return $this + * @return self */ public function setDateStatusUpdated($date_status_updated) { + if (is_null($date_status_updated)) { + throw new \InvalidArgumentException('non-nullable date_status_updated cannot be null'); + } $this->container['date_status_updated'] = $date_status_updated; return $this; @@ -597,7 +734,7 @@ public function setDateStatusUpdated($date_status_updated) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -607,12 +744,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -624,7 +764,7 @@ public function setDateCreated($date_created) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -634,22 +774,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -665,11 +806,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -677,13 +831,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerItemCountModel.php b/src/lib/Model/ManagerItemCountModel.php index 3bbb5ab..84a9e2b 100644 --- a/src/lib/Model/ManagerItemCountModel.php +++ b/src/lib/Model/ManagerItemCountModel.php @@ -2,83 +2,102 @@ /** * ManagerItemCountModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerItemCountModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerItemCountModel implements ModelInterface, ArrayAccess +class ManagerItemCountModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerItemCountModel'; + protected static $openAPIModelName = 'ManagerItemCountModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'item_count' => 'int', - 'item_count_by_employee_id' => '\Swagger\Client\Model\EmployeeItemCountModel[]' + 'item_count_by_employee_id' => '\OpenAPI\Client\Model\EmployeeItemCountModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'item_count' => 'int32', 'item_count_by_employee_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'item_count' => false, + 'item_count_by_employee_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['item_count'] = isset($data['item_count']) ? $data['item_count'] : null; - $this->container['item_count_by_employee_id'] = isset($data['item_count_by_employee_id']) ? $data['item_count_by_employee_id'] : null; + $this->setIfExists('item_count', $data ?? [], null); + $this->setIfExists('item_count_by_employee_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets item_count * - * @return int + * @return int|null */ public function getItemCount() { @@ -223,12 +309,15 @@ public function getItemCount() /** * Sets item_count * - * @param int $item_count + * @param int|null $item_count * - * @return $this + * @return self */ public function setItemCount($item_count) { + if (is_null($item_count)) { + throw new \InvalidArgumentException('non-nullable item_count cannot be null'); + } $this->container['item_count'] = $item_count; return $this; @@ -237,7 +326,7 @@ public function setItemCount($item_count) /** * Gets item_count_by_employee_id * - * @return \Swagger\Client\Model\EmployeeItemCountModel[] + * @return \OpenAPI\Client\Model\EmployeeItemCountModel[]|null */ public function getItemCountByEmployeeId() { @@ -247,12 +336,15 @@ public function getItemCountByEmployeeId() /** * Sets item_count_by_employee_id * - * @param \Swagger\Client\Model\EmployeeItemCountModel[] $item_count_by_employee_id + * @param \OpenAPI\Client\Model\EmployeeItemCountModel[]|null $item_count_by_employee_id * - * @return $this + * @return self */ public function setItemCountByEmployeeId($item_count_by_employee_id) { + if (is_null($item_count_by_employee_id)) { + throw new \InvalidArgumentException('non-nullable item_count_by_employee_id cannot be null'); + } $this->container['item_count_by_employee_id'] = $item_count_by_employee_id; return $this; @@ -264,7 +356,7 @@ public function setItemCountByEmployeeId($item_count_by_employee_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerLeaveApplicationModel.php b/src/lib/Model/ManagerLeaveApplicationModel.php index 5ee7ee5..42500dd 100644 --- a/src/lib/Model/ManagerLeaveApplicationModel.php +++ b/src/lib/Model/ManagerLeaveApplicationModel.php @@ -2,66 +2,66 @@ /** * ManagerLeaveApplicationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerLeaveApplicationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerLeaveApplicationModel implements ModelInterface, ArrayAccess +class ManagerLeaveApplicationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerLeaveApplicationModel'; + protected static $openAPIModelName = 'ManagerLeaveApplicationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'attachment' => 'string', 'attachment_id' => 'int', 'filename' => 'string', - 'hours' => 'double', - 'units' => 'double', + 'hours' => 'float', + 'units' => 'float', 'id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -73,8 +73,10 @@ class ManagerLeaveApplicationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'attachment' => 'byte', 'attachment_id' => 'int32', 'filename' => null, @@ -87,14 +89,39 @@ class ManagerLeaveApplicationModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'attachment' => false, + 'attachment_id' => false, + 'filename' => false, + 'hours' => false, + 'units' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'leave_category_id' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; - $this->container['filename'] = isset($data['filename']) ? $data['filename'] : null; - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + $this->setIfExists('hours', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -278,7 +372,7 @@ public function valid() /** * Gets attachment * - * @return string + * @return string|null */ public function getAttachment() { @@ -288,15 +382,18 @@ public function getAttachment() /** * Sets attachment * - * @param string $attachment + * @param string|null $attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } - if (!is_null($attachment) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $attachment))) { - throw new \InvalidArgumentException("invalid value for $attachment when calling ManagerLeaveApplicationModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $attachment))) { + throw new \InvalidArgumentException("invalid value for \$attachment when calling ManagerLeaveApplicationModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['attachment'] = $attachment; @@ -307,7 +404,7 @@ public function setAttachment($attachment) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -317,12 +414,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -331,7 +431,7 @@ public function setAttachmentId($attachment_id) /** * Gets filename * - * @return string + * @return string|null */ public function getFilename() { @@ -341,12 +441,15 @@ public function getFilename() /** * Sets filename * - * @param string $filename + * @param string|null $filename * - * @return $this + * @return self */ public function setFilename($filename) { + if (is_null($filename)) { + throw new \InvalidArgumentException('non-nullable filename cannot be null'); + } $this->container['filename'] = $filename; return $this; @@ -355,7 +458,7 @@ public function setFilename($filename) /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -365,12 +468,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -379,7 +485,7 @@ public function setHours($hours) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -389,12 +495,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -403,7 +512,7 @@ public function setUnits($units) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -413,12 +522,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -439,10 +551,13 @@ public function getFromDate() * * @param \DateTime $from_date Required * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -463,10 +578,13 @@ public function getToDate() * * @param \DateTime $to_date Required * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -487,10 +605,13 @@ public function getLeaveCategoryId() * * @param int $leave_category_id Required * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -499,7 +620,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -509,13 +630,16 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { - if (!is_null($notes) && (mb_strlen($notes) > 255)) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } + if ((mb_strlen($notes) > 255)) { throw new \InvalidArgumentException('invalid length for $notes when calling ManagerLeaveApplicationModel., must be smaller than or equal to 255.'); } @@ -530,7 +654,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -540,22 +664,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -571,11 +696,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -583,13 +721,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerLeaveCategoryModel.php b/src/lib/Model/ManagerLeaveCategoryModel.php index 12aafc1..10bcb11 100644 --- a/src/lib/Model/ManagerLeaveCategoryModel.php +++ b/src/lib/Model/ManagerLeaveCategoryModel.php @@ -2,61 +2,61 @@ /** * ManagerLeaveCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerLeaveCategoryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerLeaveCategoryModel implements ModelInterface, ArrayAccess +class ManagerLeaveCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerLeaveCategoryModel'; + protected static $openAPIModelName = 'ManagerLeaveCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class ManagerLeaveCategoryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerLeaveEmployeeModel.php b/src/lib/Model/ManagerLeaveEmployeeModel.php index 05f5231..eb71494 100644 --- a/src/lib/Model/ManagerLeaveEmployeeModel.php +++ b/src/lib/Model/ManagerLeaveEmployeeModel.php @@ -2,61 +2,61 @@ /** * ManagerLeaveEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerLeaveEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerLeaveEmployeeModel implements ModelInterface, ArrayAccess +class ManagerLeaveEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerLeaveEmployeeModel'; + protected static $openAPIModelName = 'ManagerLeaveEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_approve' => 'bool', 'id' => 'int', 'name' => 'string', @@ -68,8 +68,10 @@ class ManagerLeaveEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_approve' => null, 'id' => 'int32', 'name' => null, @@ -77,14 +79,34 @@ class ManagerLeaveEmployeeModel implements ModelInterface, ArrayAccess 'surname' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_approve' => false, + 'id' => false, + 'name' => false, + 'first_name' => false, + 'surname' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['can_approve'] = isset($data['can_approve']) ? $data['can_approve'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; + $this->setIfExists('can_approve', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets can_approve * - * @return bool + * @return bool|null */ public function getCanApprove() { @@ -241,12 +330,15 @@ public function getCanApprove() /** * Sets can_approve * - * @param bool $can_approve + * @param bool|null $can_approve * - * @return $this + * @return self */ public function setCanApprove($can_approve) { + if (is_null($can_approve)) { + throw new \InvalidArgumentException('non-nullable can_approve cannot be null'); + } $this->container['can_approve'] = $can_approve; return $this; @@ -255,7 +347,7 @@ public function setCanApprove($can_approve) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +357,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +374,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -289,12 +384,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -303,7 +401,7 @@ public function setName($name) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -313,12 +411,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -327,7 +428,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -337,12 +438,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -354,7 +458,7 @@ public function setSurname($surname) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerLeaveEstimate.php b/src/lib/Model/ManagerLeaveEstimate.php index 547e917..20c5787 100644 --- a/src/lib/Model/ManagerLeaveEstimate.php +++ b/src/lib/Model/ManagerLeaveEstimate.php @@ -2,87 +2,108 @@ /** * ManagerLeaveEstimate * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerLeaveEstimate Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerLeaveEstimate implements ModelInterface, ArrayAccess +class ManagerLeaveEstimate implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerLeaveEstimate'; + protected static $openAPIModelName = 'ManagerLeaveEstimate'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'leave_balance' => 'double', - 'approved_leave' => 'double', - 'available_balance' => 'double', - 'leave_required' => '\Swagger\Client\Model\UnitAndHourLeaveEstimateModel' + protected static $openAPITypes = [ + 'leave_balance' => 'float', + 'approved_leave' => 'float', + 'available_balance' => 'float', + 'leave_required' => '\OpenAPI\Client\Model\UnitAndHourLeaveEstimateModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'leave_balance' => 'double', 'approved_leave' => 'double', 'available_balance' => 'double', 'leave_required' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'leave_balance' => false, + 'approved_leave' => false, + 'available_balance' => false, + 'leave_required' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['leave_balance'] = isset($data['leave_balance']) ? $data['leave_balance'] : null; - $this->container['approved_leave'] = isset($data['approved_leave']) ? $data['approved_leave'] : null; - $this->container['available_balance'] = isset($data['available_balance']) ? $data['available_balance'] : null; - $this->container['leave_required'] = isset($data['leave_required']) ? $data['leave_required'] : null; + $this->setIfExists('leave_balance', $data ?? [], null); + $this->setIfExists('approved_leave', $data ?? [], null); + $this->setIfExists('available_balance', $data ?? [], null); + $this->setIfExists('leave_required', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets leave_balance * - * @return double + * @return float|null */ public function getLeaveBalance() { @@ -235,12 +323,15 @@ public function getLeaveBalance() /** * Sets leave_balance * - * @param double $leave_balance + * @param float|null $leave_balance * - * @return $this + * @return self */ public function setLeaveBalance($leave_balance) { + if (is_null($leave_balance)) { + throw new \InvalidArgumentException('non-nullable leave_balance cannot be null'); + } $this->container['leave_balance'] = $leave_balance; return $this; @@ -249,7 +340,7 @@ public function setLeaveBalance($leave_balance) /** * Gets approved_leave * - * @return double + * @return float|null */ public function getApprovedLeave() { @@ -259,12 +350,15 @@ public function getApprovedLeave() /** * Sets approved_leave * - * @param double $approved_leave + * @param float|null $approved_leave * - * @return $this + * @return self */ public function setApprovedLeave($approved_leave) { + if (is_null($approved_leave)) { + throw new \InvalidArgumentException('non-nullable approved_leave cannot be null'); + } $this->container['approved_leave'] = $approved_leave; return $this; @@ -273,7 +367,7 @@ public function setApprovedLeave($approved_leave) /** * Gets available_balance * - * @return double + * @return float|null */ public function getAvailableBalance() { @@ -283,12 +377,15 @@ public function getAvailableBalance() /** * Sets available_balance * - * @param double $available_balance + * @param float|null $available_balance * - * @return $this + * @return self */ public function setAvailableBalance($available_balance) { + if (is_null($available_balance)) { + throw new \InvalidArgumentException('non-nullable available_balance cannot be null'); + } $this->container['available_balance'] = $available_balance; return $this; @@ -297,7 +394,7 @@ public function setAvailableBalance($available_balance) /** * Gets leave_required * - * @return \Swagger\Client\Model\UnitAndHourLeaveEstimateModel + * @return \OpenAPI\Client\Model\UnitAndHourLeaveEstimateModel|null */ public function getLeaveRequired() { @@ -307,12 +404,15 @@ public function getLeaveRequired() /** * Sets leave_required * - * @param \Swagger\Client\Model\UnitAndHourLeaveEstimateModel $leave_required + * @param \OpenAPI\Client\Model\UnitAndHourLeaveEstimateModel|null $leave_required leave_required * - * @return $this + * @return self */ public function setLeaveRequired($leave_required) { + if (is_null($leave_required)) { + throw new \InvalidArgumentException('non-nullable leave_required cannot be null'); + } $this->container['leave_required'] = $leave_required; return $this; @@ -324,7 +424,7 @@ public function setLeaveRequired($leave_required) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerLeaveRequestModel.php b/src/lib/Model/ManagerLeaveRequestModel.php index 1b05690..b7c618c 100644 --- a/src/lib/Model/ManagerLeaveRequestModel.php +++ b/src/lib/Model/ManagerLeaveRequestModel.php @@ -2,70 +2,70 @@ /** * ManagerLeaveRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerLeaveRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerLeaveRequestModel implements ModelInterface, ArrayAccess +class ManagerLeaveRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerLeaveRequestModel'; + protected static $openAPIModelName = 'ManagerLeaveRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'employee_name' => 'string', 'in_progress' => 'bool', 'termination_date' => '\DateTime', 'can_approve' => 'bool', - 'accrued_balance' => 'double', + 'accrued_balance' => 'float', 'exceeds_balance' => 'bool', 'is_leave_based_roster_shift' => 'bool', - 'total_hours' => 'double', + 'total_hours' => 'float', 'leave_category_id' => 'int', 'work_type_id' => 'int', 'work_type_name' => 'string', @@ -78,21 +78,21 @@ class ManagerLeaveRequestModel implements ModelInterface, ArrayAccess 'to_date' => '\DateTime', 'requested_date' => '\DateTime', 'leave_category_name' => 'string', - 'hours_per_day' => 'double', - 'total_units' => 'double', - 'previously_applied_units' => 'double', + 'hours_per_day' => 'float', + 'total_units' => 'float', + 'previously_applied_units' => 'float', 'can_partially_edit' => 'bool', 'notes' => 'string', - 'total_days' => 'double', + 'total_days' => 'float', 'amount' => 'string', 'status' => 'string', 'status_update_notes' => 'string', 'can_cancel' => 'bool', 'can_modify' => 'bool', 'require_notes_for_leave_requests' => 'bool', - 'attachment' => '\Swagger\Client\Model\AttachmentModel', + 'attachment' => '\OpenAPI\Client\Model\AttachmentModel', 'unit_type' => 'string', - 'banner' => '\Swagger\Client\Model\PartiallyAppliedLeaveRequestBannerModel', + 'banner' => '\OpenAPI\Client\Model\PartiallyAppliedLeaveRequestBannerModel', 'manually_applied' => 'bool', 'applied_leave_unit_type_description' => 'string' ]; @@ -101,8 +101,10 @@ class ManagerLeaveRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'employee_name' => null, 'in_progress' => null, @@ -143,14 +145,67 @@ class ManagerLeaveRequestModel implements ModelInterface, ArrayAccess 'applied_leave_unit_type_description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'employee_name' => false, + 'in_progress' => false, + 'termination_date' => false, + 'can_approve' => false, + 'accrued_balance' => false, + 'exceeds_balance' => false, + 'is_leave_based_roster_shift' => false, + 'total_hours' => false, + 'leave_category_id' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'is_approved' => false, + 'is_declined' => false, + 'is_cancelled' => false, + 'is_pending' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'requested_date' => false, + 'leave_category_name' => false, + 'hours_per_day' => false, + 'total_units' => false, + 'previously_applied_units' => false, + 'can_partially_edit' => false, + 'notes' => false, + 'total_days' => false, + 'amount' => false, + 'status' => false, + 'status_update_notes' => false, + 'can_cancel' => false, + 'can_modify' => false, + 'require_notes_for_leave_requests' => false, + 'attachment' => false, + 'unit_type' => false, + 'banner' => false, + 'manually_applied' => false, + 'applied_leave_unit_type_description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -158,9 +213,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -340,15 +447,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const UNIT_TYPE_HOURS = 'Hours'; - const UNIT_TYPE_DAYS = 'Days'; - const UNIT_TYPE_WEEKS = 'Weeks'; - + public const UNIT_TYPE_HOURS = 'Hours'; + public const UNIT_TYPE_DAYS = 'Days'; + public const UNIT_TYPE_WEEKS = 'Weeks'; - /** * Gets allowable values of the enum * @@ -362,7 +467,6 @@ public function getUnitTypeAllowableValues() self::UNIT_TYPE_WEEKS, ]; } - /** * Associative array for storing property values @@ -379,44 +483,62 @@ public function getUnitTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['in_progress'] = isset($data['in_progress']) ? $data['in_progress'] : null; - $this->container['termination_date'] = isset($data['termination_date']) ? $data['termination_date'] : null; - $this->container['can_approve'] = isset($data['can_approve']) ? $data['can_approve'] : null; - $this->container['accrued_balance'] = isset($data['accrued_balance']) ? $data['accrued_balance'] : null; - $this->container['exceeds_balance'] = isset($data['exceeds_balance']) ? $data['exceeds_balance'] : null; - $this->container['is_leave_based_roster_shift'] = isset($data['is_leave_based_roster_shift']) ? $data['is_leave_based_roster_shift'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['is_approved'] = isset($data['is_approved']) ? $data['is_approved'] : null; - $this->container['is_declined'] = isset($data['is_declined']) ? $data['is_declined'] : null; - $this->container['is_cancelled'] = isset($data['is_cancelled']) ? $data['is_cancelled'] : null; - $this->container['is_pending'] = isset($data['is_pending']) ? $data['is_pending'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['requested_date'] = isset($data['requested_date']) ? $data['requested_date'] : null; - $this->container['leave_category_name'] = isset($data['leave_category_name']) ? $data['leave_category_name'] : null; - $this->container['hours_per_day'] = isset($data['hours_per_day']) ? $data['hours_per_day'] : null; - $this->container['total_units'] = isset($data['total_units']) ? $data['total_units'] : null; - $this->container['previously_applied_units'] = isset($data['previously_applied_units']) ? $data['previously_applied_units'] : null; - $this->container['can_partially_edit'] = isset($data['can_partially_edit']) ? $data['can_partially_edit'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['total_days'] = isset($data['total_days']) ? $data['total_days'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['status_update_notes'] = isset($data['status_update_notes']) ? $data['status_update_notes'] : null; - $this->container['can_cancel'] = isset($data['can_cancel']) ? $data['can_cancel'] : null; - $this->container['can_modify'] = isset($data['can_modify']) ? $data['can_modify'] : null; - $this->container['require_notes_for_leave_requests'] = isset($data['require_notes_for_leave_requests']) ? $data['require_notes_for_leave_requests'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['banner'] = isset($data['banner']) ? $data['banner'] : null; - $this->container['manually_applied'] = isset($data['manually_applied']) ? $data['manually_applied'] : null; - $this->container['applied_leave_unit_type_description'] = isset($data['applied_leave_unit_type_description']) ? $data['applied_leave_unit_type_description'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('in_progress', $data ?? [], null); + $this->setIfExists('termination_date', $data ?? [], null); + $this->setIfExists('can_approve', $data ?? [], null); + $this->setIfExists('accrued_balance', $data ?? [], null); + $this->setIfExists('exceeds_balance', $data ?? [], null); + $this->setIfExists('is_leave_based_roster_shift', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('is_approved', $data ?? [], null); + $this->setIfExists('is_declined', $data ?? [], null); + $this->setIfExists('is_cancelled', $data ?? [], null); + $this->setIfExists('is_pending', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('requested_date', $data ?? [], null); + $this->setIfExists('leave_category_name', $data ?? [], null); + $this->setIfExists('hours_per_day', $data ?? [], null); + $this->setIfExists('total_units', $data ?? [], null); + $this->setIfExists('previously_applied_units', $data ?? [], null); + $this->setIfExists('can_partially_edit', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('total_days', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('status_update_notes', $data ?? [], null); + $this->setIfExists('can_cancel', $data ?? [], null); + $this->setIfExists('can_modify', $data ?? [], null); + $this->setIfExists('require_notes_for_leave_requests', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('manually_applied', $data ?? [], null); + $this->setIfExists('applied_leave_unit_type_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; } /** @@ -431,7 +553,8 @@ public function listInvalidProperties() $allowedValues = $this->getUnitTypeAllowableValues(); if (!is_null($this->container['unit_type']) && !in_array($this->container['unit_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'unit_type', must be one of '%s'", + "invalid value '%s' for 'unit_type', must be one of '%s'", + $this->container['unit_type'], implode("', '", $allowedValues) ); } @@ -454,7 +577,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -464,12 +587,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -478,7 +604,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -488,12 +614,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -502,7 +631,7 @@ public function setEmployeeName($employee_name) /** * Gets in_progress * - * @return bool + * @return bool|null */ public function getInProgress() { @@ -512,12 +641,15 @@ public function getInProgress() /** * Sets in_progress * - * @param bool $in_progress + * @param bool|null $in_progress * - * @return $this + * @return self */ public function setInProgress($in_progress) { + if (is_null($in_progress)) { + throw new \InvalidArgumentException('non-nullable in_progress cannot be null'); + } $this->container['in_progress'] = $in_progress; return $this; @@ -526,7 +658,7 @@ public function setInProgress($in_progress) /** * Gets termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getTerminationDate() { @@ -536,12 +668,15 @@ public function getTerminationDate() /** * Sets termination_date * - * @param \DateTime $termination_date + * @param \DateTime|null $termination_date * - * @return $this + * @return self */ public function setTerminationDate($termination_date) { + if (is_null($termination_date)) { + throw new \InvalidArgumentException('non-nullable termination_date cannot be null'); + } $this->container['termination_date'] = $termination_date; return $this; @@ -550,7 +685,7 @@ public function setTerminationDate($termination_date) /** * Gets can_approve * - * @return bool + * @return bool|null */ public function getCanApprove() { @@ -560,12 +695,15 @@ public function getCanApprove() /** * Sets can_approve * - * @param bool $can_approve + * @param bool|null $can_approve * - * @return $this + * @return self */ public function setCanApprove($can_approve) { + if (is_null($can_approve)) { + throw new \InvalidArgumentException('non-nullable can_approve cannot be null'); + } $this->container['can_approve'] = $can_approve; return $this; @@ -574,7 +712,7 @@ public function setCanApprove($can_approve) /** * Gets accrued_balance * - * @return double + * @return float|null */ public function getAccruedBalance() { @@ -584,12 +722,15 @@ public function getAccruedBalance() /** * Sets accrued_balance * - * @param double $accrued_balance + * @param float|null $accrued_balance * - * @return $this + * @return self */ public function setAccruedBalance($accrued_balance) { + if (is_null($accrued_balance)) { + throw new \InvalidArgumentException('non-nullable accrued_balance cannot be null'); + } $this->container['accrued_balance'] = $accrued_balance; return $this; @@ -598,7 +739,7 @@ public function setAccruedBalance($accrued_balance) /** * Gets exceeds_balance * - * @return bool + * @return bool|null */ public function getExceedsBalance() { @@ -608,12 +749,15 @@ public function getExceedsBalance() /** * Sets exceeds_balance * - * @param bool $exceeds_balance + * @param bool|null $exceeds_balance * - * @return $this + * @return self */ public function setExceedsBalance($exceeds_balance) { + if (is_null($exceeds_balance)) { + throw new \InvalidArgumentException('non-nullable exceeds_balance cannot be null'); + } $this->container['exceeds_balance'] = $exceeds_balance; return $this; @@ -622,7 +766,7 @@ public function setExceedsBalance($exceeds_balance) /** * Gets is_leave_based_roster_shift * - * @return bool + * @return bool|null */ public function getIsLeaveBasedRosterShift() { @@ -632,12 +776,15 @@ public function getIsLeaveBasedRosterShift() /** * Sets is_leave_based_roster_shift * - * @param bool $is_leave_based_roster_shift + * @param bool|null $is_leave_based_roster_shift * - * @return $this + * @return self */ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) { + if (is_null($is_leave_based_roster_shift)) { + throw new \InvalidArgumentException('non-nullable is_leave_based_roster_shift cannot be null'); + } $this->container['is_leave_based_roster_shift'] = $is_leave_based_roster_shift; return $this; @@ -646,7 +793,7 @@ public function setIsLeaveBasedRosterShift($is_leave_based_roster_shift) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -656,12 +803,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -670,7 +820,7 @@ public function setTotalHours($total_hours) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -680,12 +830,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -694,7 +847,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -704,12 +857,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -718,7 +874,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -728,12 +884,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -742,7 +901,7 @@ public function setWorkTypeName($work_type_name) /** * Gets is_approved * - * @return bool + * @return bool|null */ public function getIsApproved() { @@ -752,12 +911,15 @@ public function getIsApproved() /** * Sets is_approved * - * @param bool $is_approved + * @param bool|null $is_approved * - * @return $this + * @return self */ public function setIsApproved($is_approved) { + if (is_null($is_approved)) { + throw new \InvalidArgumentException('non-nullable is_approved cannot be null'); + } $this->container['is_approved'] = $is_approved; return $this; @@ -766,7 +928,7 @@ public function setIsApproved($is_approved) /** * Gets is_declined * - * @return bool + * @return bool|null */ public function getIsDeclined() { @@ -776,12 +938,15 @@ public function getIsDeclined() /** * Sets is_declined * - * @param bool $is_declined + * @param bool|null $is_declined * - * @return $this + * @return self */ public function setIsDeclined($is_declined) { + if (is_null($is_declined)) { + throw new \InvalidArgumentException('non-nullable is_declined cannot be null'); + } $this->container['is_declined'] = $is_declined; return $this; @@ -790,7 +955,7 @@ public function setIsDeclined($is_declined) /** * Gets is_cancelled * - * @return bool + * @return bool|null */ public function getIsCancelled() { @@ -800,12 +965,15 @@ public function getIsCancelled() /** * Sets is_cancelled * - * @param bool $is_cancelled + * @param bool|null $is_cancelled * - * @return $this + * @return self */ public function setIsCancelled($is_cancelled) { + if (is_null($is_cancelled)) { + throw new \InvalidArgumentException('non-nullable is_cancelled cannot be null'); + } $this->container['is_cancelled'] = $is_cancelled; return $this; @@ -814,7 +982,7 @@ public function setIsCancelled($is_cancelled) /** * Gets is_pending * - * @return bool + * @return bool|null */ public function getIsPending() { @@ -824,12 +992,15 @@ public function getIsPending() /** * Sets is_pending * - * @param bool $is_pending + * @param bool|null $is_pending * - * @return $this + * @return self */ public function setIsPending($is_pending) { + if (is_null($is_pending)) { + throw new \InvalidArgumentException('non-nullable is_pending cannot be null'); + } $this->container['is_pending'] = $is_pending; return $this; @@ -838,7 +1009,7 @@ public function setIsPending($is_pending) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -848,12 +1019,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -862,7 +1036,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -872,12 +1046,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -886,7 +1063,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -896,12 +1073,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -910,7 +1090,7 @@ public function setToDate($to_date) /** * Gets requested_date * - * @return \DateTime + * @return \DateTime|null */ public function getRequestedDate() { @@ -920,12 +1100,15 @@ public function getRequestedDate() /** * Sets requested_date * - * @param \DateTime $requested_date + * @param \DateTime|null $requested_date * - * @return $this + * @return self */ public function setRequestedDate($requested_date) { + if (is_null($requested_date)) { + throw new \InvalidArgumentException('non-nullable requested_date cannot be null'); + } $this->container['requested_date'] = $requested_date; return $this; @@ -934,7 +1117,7 @@ public function setRequestedDate($requested_date) /** * Gets leave_category_name * - * @return string + * @return string|null */ public function getLeaveCategoryName() { @@ -944,12 +1127,15 @@ public function getLeaveCategoryName() /** * Sets leave_category_name * - * @param string $leave_category_name + * @param string|null $leave_category_name * - * @return $this + * @return self */ public function setLeaveCategoryName($leave_category_name) { + if (is_null($leave_category_name)) { + throw new \InvalidArgumentException('non-nullable leave_category_name cannot be null'); + } $this->container['leave_category_name'] = $leave_category_name; return $this; @@ -958,7 +1144,7 @@ public function setLeaveCategoryName($leave_category_name) /** * Gets hours_per_day * - * @return double + * @return float|null */ public function getHoursPerDay() { @@ -968,12 +1154,15 @@ public function getHoursPerDay() /** * Sets hours_per_day * - * @param double $hours_per_day + * @param float|null $hours_per_day * - * @return $this + * @return self */ public function setHoursPerDay($hours_per_day) { + if (is_null($hours_per_day)) { + throw new \InvalidArgumentException('non-nullable hours_per_day cannot be null'); + } $this->container['hours_per_day'] = $hours_per_day; return $this; @@ -982,7 +1171,7 @@ public function setHoursPerDay($hours_per_day) /** * Gets total_units * - * @return double + * @return float|null */ public function getTotalUnits() { @@ -992,12 +1181,15 @@ public function getTotalUnits() /** * Sets total_units * - * @param double $total_units + * @param float|null $total_units * - * @return $this + * @return self */ public function setTotalUnits($total_units) { + if (is_null($total_units)) { + throw new \InvalidArgumentException('non-nullable total_units cannot be null'); + } $this->container['total_units'] = $total_units; return $this; @@ -1006,7 +1198,7 @@ public function setTotalUnits($total_units) /** * Gets previously_applied_units * - * @return double + * @return float|null */ public function getPreviouslyAppliedUnits() { @@ -1016,12 +1208,15 @@ public function getPreviouslyAppliedUnits() /** * Sets previously_applied_units * - * @param double $previously_applied_units + * @param float|null $previously_applied_units * - * @return $this + * @return self */ public function setPreviouslyAppliedUnits($previously_applied_units) { + if (is_null($previously_applied_units)) { + throw new \InvalidArgumentException('non-nullable previously_applied_units cannot be null'); + } $this->container['previously_applied_units'] = $previously_applied_units; return $this; @@ -1030,7 +1225,7 @@ public function setPreviouslyAppliedUnits($previously_applied_units) /** * Gets can_partially_edit * - * @return bool + * @return bool|null */ public function getCanPartiallyEdit() { @@ -1040,12 +1235,15 @@ public function getCanPartiallyEdit() /** * Sets can_partially_edit * - * @param bool $can_partially_edit + * @param bool|null $can_partially_edit * - * @return $this + * @return self */ public function setCanPartiallyEdit($can_partially_edit) { + if (is_null($can_partially_edit)) { + throw new \InvalidArgumentException('non-nullable can_partially_edit cannot be null'); + } $this->container['can_partially_edit'] = $can_partially_edit; return $this; @@ -1054,7 +1252,7 @@ public function setCanPartiallyEdit($can_partially_edit) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -1064,12 +1262,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -1078,7 +1279,7 @@ public function setNotes($notes) /** * Gets total_days * - * @return double + * @return float|null */ public function getTotalDays() { @@ -1088,12 +1289,15 @@ public function getTotalDays() /** * Sets total_days * - * @param double $total_days + * @param float|null $total_days * - * @return $this + * @return self */ public function setTotalDays($total_days) { + if (is_null($total_days)) { + throw new \InvalidArgumentException('non-nullable total_days cannot be null'); + } $this->container['total_days'] = $total_days; return $this; @@ -1102,7 +1306,7 @@ public function setTotalDays($total_days) /** * Gets amount * - * @return string + * @return string|null */ public function getAmount() { @@ -1112,12 +1316,15 @@ public function getAmount() /** * Sets amount * - * @param string $amount + * @param string|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -1126,7 +1333,7 @@ public function setAmount($amount) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -1136,12 +1343,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -1150,7 +1360,7 @@ public function setStatus($status) /** * Gets status_update_notes * - * @return string + * @return string|null */ public function getStatusUpdateNotes() { @@ -1160,12 +1370,15 @@ public function getStatusUpdateNotes() /** * Sets status_update_notes * - * @param string $status_update_notes + * @param string|null $status_update_notes * - * @return $this + * @return self */ public function setStatusUpdateNotes($status_update_notes) { + if (is_null($status_update_notes)) { + throw new \InvalidArgumentException('non-nullable status_update_notes cannot be null'); + } $this->container['status_update_notes'] = $status_update_notes; return $this; @@ -1174,7 +1387,7 @@ public function setStatusUpdateNotes($status_update_notes) /** * Gets can_cancel * - * @return bool + * @return bool|null */ public function getCanCancel() { @@ -1184,12 +1397,15 @@ public function getCanCancel() /** * Sets can_cancel * - * @param bool $can_cancel + * @param bool|null $can_cancel * - * @return $this + * @return self */ public function setCanCancel($can_cancel) { + if (is_null($can_cancel)) { + throw new \InvalidArgumentException('non-nullable can_cancel cannot be null'); + } $this->container['can_cancel'] = $can_cancel; return $this; @@ -1198,7 +1414,7 @@ public function setCanCancel($can_cancel) /** * Gets can_modify * - * @return bool + * @return bool|null */ public function getCanModify() { @@ -1208,12 +1424,15 @@ public function getCanModify() /** * Sets can_modify * - * @param bool $can_modify + * @param bool|null $can_modify * - * @return $this + * @return self */ public function setCanModify($can_modify) { + if (is_null($can_modify)) { + throw new \InvalidArgumentException('non-nullable can_modify cannot be null'); + } $this->container['can_modify'] = $can_modify; return $this; @@ -1222,7 +1441,7 @@ public function setCanModify($can_modify) /** * Gets require_notes_for_leave_requests * - * @return bool + * @return bool|null */ public function getRequireNotesForLeaveRequests() { @@ -1232,12 +1451,15 @@ public function getRequireNotesForLeaveRequests() /** * Sets require_notes_for_leave_requests * - * @param bool $require_notes_for_leave_requests + * @param bool|null $require_notes_for_leave_requests * - * @return $this + * @return self */ public function setRequireNotesForLeaveRequests($require_notes_for_leave_requests) { + if (is_null($require_notes_for_leave_requests)) { + throw new \InvalidArgumentException('non-nullable require_notes_for_leave_requests cannot be null'); + } $this->container['require_notes_for_leave_requests'] = $require_notes_for_leave_requests; return $this; @@ -1246,7 +1468,7 @@ public function setRequireNotesForLeaveRequests($require_notes_for_leave_request /** * Gets attachment * - * @return \Swagger\Client\Model\AttachmentModel + * @return \OpenAPI\Client\Model\AttachmentModel|null */ public function getAttachment() { @@ -1256,12 +1478,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\AttachmentModel $attachment + * @param \OpenAPI\Client\Model\AttachmentModel|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -1270,7 +1495,7 @@ public function setAttachment($attachment) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -1280,17 +1505,21 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $allowedValues = $this->getUnitTypeAllowableValues(); - if (!is_null($unit_type) && !in_array($unit_type, $allowedValues, true)) { + if (!in_array($unit_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'unit_type', must be one of '%s'", + "Invalid value '%s' for 'unit_type', must be one of '%s'", + $unit_type, implode("', '", $allowedValues) ) ); @@ -1303,7 +1532,7 @@ public function setUnitType($unit_type) /** * Gets banner * - * @return \Swagger\Client\Model\PartiallyAppliedLeaveRequestBannerModel + * @return \OpenAPI\Client\Model\PartiallyAppliedLeaveRequestBannerModel|null */ public function getBanner() { @@ -1313,12 +1542,15 @@ public function getBanner() /** * Sets banner * - * @param \Swagger\Client\Model\PartiallyAppliedLeaveRequestBannerModel $banner + * @param \OpenAPI\Client\Model\PartiallyAppliedLeaveRequestBannerModel|null $banner banner * - * @return $this + * @return self */ public function setBanner($banner) { + if (is_null($banner)) { + throw new \InvalidArgumentException('non-nullable banner cannot be null'); + } $this->container['banner'] = $banner; return $this; @@ -1327,7 +1559,7 @@ public function setBanner($banner) /** * Gets manually_applied * - * @return bool + * @return bool|null */ public function getManuallyApplied() { @@ -1337,12 +1569,15 @@ public function getManuallyApplied() /** * Sets manually_applied * - * @param bool $manually_applied + * @param bool|null $manually_applied * - * @return $this + * @return self */ public function setManuallyApplied($manually_applied) { + if (is_null($manually_applied)) { + throw new \InvalidArgumentException('non-nullable manually_applied cannot be null'); + } $this->container['manually_applied'] = $manually_applied; return $this; @@ -1351,7 +1586,7 @@ public function setManuallyApplied($manually_applied) /** * Gets applied_leave_unit_type_description * - * @return string + * @return string|null */ public function getAppliedLeaveUnitTypeDescription() { @@ -1361,12 +1596,15 @@ public function getAppliedLeaveUnitTypeDescription() /** * Sets applied_leave_unit_type_description * - * @param string $applied_leave_unit_type_description + * @param string|null $applied_leave_unit_type_description * - * @return $this + * @return self */ public function setAppliedLeaveUnitTypeDescription($applied_leave_unit_type_description) { + if (is_null($applied_leave_unit_type_description)) { + throw new \InvalidArgumentException('non-nullable applied_leave_unit_type_description cannot be null'); + } $this->container['applied_leave_unit_type_description'] = $applied_leave_unit_type_description; return $this; @@ -1378,7 +1616,7 @@ public function setAppliedLeaveUnitTypeDescription($applied_leave_unit_type_desc * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1388,22 +1626,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1419,11 +1658,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1431,13 +1683,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerRosterEmployeeModel.php b/src/lib/Model/ManagerRosterEmployeeModel.php index 3fbc337..fdc0c18 100644 --- a/src/lib/Model/ManagerRosterEmployeeModel.php +++ b/src/lib/Model/ManagerRosterEmployeeModel.php @@ -2,61 +2,61 @@ /** * ManagerRosterEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerRosterEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerRosterEmployeeModel implements ModelInterface, ArrayAccess +class ManagerRosterEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerRosterEmployeeModel'; + protected static $openAPIModelName = 'ManagerRosterEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_manage' => 'bool', 'id' => 'int', 'name' => 'string', @@ -68,8 +68,10 @@ class ManagerRosterEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_manage' => null, 'id' => 'int32', 'name' => null, @@ -77,14 +79,34 @@ class ManagerRosterEmployeeModel implements ModelInterface, ArrayAccess 'surname' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_manage' => false, + 'id' => false, + 'name' => false, + 'first_name' => false, + 'surname' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['can_manage'] = isset($data['can_manage']) ? $data['can_manage'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; + $this->setIfExists('can_manage', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets can_manage * - * @return bool + * @return bool|null */ public function getCanManage() { @@ -241,12 +330,15 @@ public function getCanManage() /** * Sets can_manage * - * @param bool $can_manage + * @param bool|null $can_manage * - * @return $this + * @return self */ public function setCanManage($can_manage) { + if (is_null($can_manage)) { + throw new \InvalidArgumentException('non-nullable can_manage cannot be null'); + } $this->container['can_manage'] = $can_manage; return $this; @@ -255,7 +347,7 @@ public function setCanManage($can_manage) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +357,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +374,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -289,12 +384,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -303,7 +401,7 @@ public function setName($name) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -313,12 +411,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -327,7 +428,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -337,12 +438,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -354,7 +458,7 @@ public function setSurname($surname) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerRosterShiftFilterModel.php b/src/lib/Model/ManagerRosterShiftFilterModel.php index ae74cd6..03aadde 100644 --- a/src/lib/Model/ManagerRosterShiftFilterModel.php +++ b/src/lib/Model/ManagerRosterShiftFilterModel.php @@ -2,61 +2,61 @@ /** * ManagerRosterShiftFilterModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerRosterShiftFilterModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerRosterShiftFilterModel implements ModelInterface, ArrayAccess +class ManagerRosterShiftFilterModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerRosterShiftFilterModel'; + protected static $openAPIModelName = 'ManagerRosterShiftFilterModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'date' => '\DateTime', 'employee_id' => 'int', 'location_id' => 'int', @@ -69,8 +69,10 @@ class ManagerRosterShiftFilterModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'date' => 'date-time', 'employee_id' => 'int32', 'location_id' => 'int32', @@ -79,14 +81,35 @@ class ManagerRosterShiftFilterModel implements ModelInterface, ArrayAccess 'include_sub_locations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'date' => false, + 'employee_id' => false, + 'location_id' => false, + 'role_id' => false, + 'include_costs' => false, + 'include_sub_locations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['role_id'] = isset($data['role_id']) ? $data['role_id'] : null; - $this->container['include_costs'] = isset($data['include_costs']) ? $data['include_costs'] : null; - $this->container['include_sub_locations'] = isset($data['include_sub_locations']) ? $data['include_sub_locations'] : null; + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('role_id', $data ?? [], null); + $this->setIfExists('include_costs', $data ?? [], null); + $this->setIfExists('include_sub_locations', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets date * - * @return \DateTime + * @return \DateTime|null */ public function getDate() { @@ -247,12 +337,15 @@ public function getDate() /** * Sets date * - * @param \DateTime $date + * @param \DateTime|null $date * - * @return $this + * @return self */ public function setDate($date) { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -261,7 +354,7 @@ public function setDate($date) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -271,12 +364,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -285,7 +381,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -295,12 +391,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -309,7 +408,7 @@ public function setLocationId($location_id) /** * Gets role_id * - * @return int + * @return int|null */ public function getRoleId() { @@ -319,12 +418,15 @@ public function getRoleId() /** * Sets role_id * - * @param int $role_id + * @param int|null $role_id * - * @return $this + * @return self */ public function setRoleId($role_id) { + if (is_null($role_id)) { + throw new \InvalidArgumentException('non-nullable role_id cannot be null'); + } $this->container['role_id'] = $role_id; return $this; @@ -333,7 +435,7 @@ public function setRoleId($role_id) /** * Gets include_costs * - * @return bool + * @return bool|null */ public function getIncludeCosts() { @@ -343,12 +445,15 @@ public function getIncludeCosts() /** * Sets include_costs * - * @param bool $include_costs + * @param bool|null $include_costs * - * @return $this + * @return self */ public function setIncludeCosts($include_costs) { + if (is_null($include_costs)) { + throw new \InvalidArgumentException('non-nullable include_costs cannot be null'); + } $this->container['include_costs'] = $include_costs; return $this; @@ -357,7 +462,7 @@ public function setIncludeCosts($include_costs) /** * Gets include_sub_locations * - * @return bool + * @return bool|null */ public function getIncludeSubLocations() { @@ -367,12 +472,15 @@ public function getIncludeSubLocations() /** * Sets include_sub_locations * - * @param bool $include_sub_locations + * @param bool|null $include_sub_locations * - * @return $this + * @return self */ public function setIncludeSubLocations($include_sub_locations) { + if (is_null($include_sub_locations)) { + throw new \InvalidArgumentException('non-nullable include_sub_locations cannot be null'); + } $this->container['include_sub_locations'] = $include_sub_locations; return $this; @@ -384,7 +492,7 @@ public function setIncludeSubLocations($include_sub_locations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerTimesheetEmployeeModel.php b/src/lib/Model/ManagerTimesheetEmployeeModel.php index c03b730..8b99111 100644 --- a/src/lib/Model/ManagerTimesheetEmployeeModel.php +++ b/src/lib/Model/ManagerTimesheetEmployeeModel.php @@ -2,61 +2,61 @@ /** * ManagerTimesheetEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerTimesheetEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerTimesheetEmployeeModel implements ModelInterface, ArrayAccess +class ManagerTimesheetEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerTimesheetEmployeeModel'; + protected static $openAPIModelName = 'ManagerTimesheetEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'can_create' => 'bool', 'can_approve' => 'bool', 'id' => 'int', @@ -69,8 +69,10 @@ class ManagerTimesheetEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'can_create' => null, 'can_approve' => null, 'id' => 'int32', @@ -79,14 +81,35 @@ class ManagerTimesheetEmployeeModel implements ModelInterface, ArrayAccess 'surname' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'can_create' => false, + 'can_approve' => false, + 'id' => false, + 'name' => false, + 'first_name' => false, + 'surname' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['can_create'] = isset($data['can_create']) ? $data['can_create'] : null; - $this->container['can_approve'] = isset($data['can_approve']) ? $data['can_approve'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; + $this->setIfExists('can_create', $data ?? [], null); + $this->setIfExists('can_approve', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets can_create * - * @return bool + * @return bool|null */ public function getCanCreate() { @@ -247,12 +337,15 @@ public function getCanCreate() /** * Sets can_create * - * @param bool $can_create + * @param bool|null $can_create * - * @return $this + * @return self */ public function setCanCreate($can_create) { + if (is_null($can_create)) { + throw new \InvalidArgumentException('non-nullable can_create cannot be null'); + } $this->container['can_create'] = $can_create; return $this; @@ -261,7 +354,7 @@ public function setCanCreate($can_create) /** * Gets can_approve * - * @return bool + * @return bool|null */ public function getCanApprove() { @@ -271,12 +364,15 @@ public function getCanApprove() /** * Sets can_approve * - * @param bool $can_approve + * @param bool|null $can_approve * - * @return $this + * @return self */ public function setCanApprove($can_approve) { + if (is_null($can_approve)) { + throw new \InvalidArgumentException('non-nullable can_approve cannot be null'); + } $this->container['can_approve'] = $can_approve; return $this; @@ -285,7 +381,7 @@ public function setCanApprove($can_approve) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -295,12 +391,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -309,7 +408,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -319,12 +418,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -333,7 +435,7 @@ public function setName($name) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -343,12 +445,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -357,7 +462,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -367,12 +472,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -384,7 +492,7 @@ public function setSurname($surname) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerTimesheetLineModel.php b/src/lib/Model/ManagerTimesheetLineModel.php index ce2e4f6..c30dc63 100644 --- a/src/lib/Model/ManagerTimesheetLineModel.php +++ b/src/lib/Model/ManagerTimesheetLineModel.php @@ -2,67 +2,67 @@ /** * ManagerTimesheetLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerTimesheetLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerTimesheetLineModel implements ModelInterface, ArrayAccess +class ManagerTimesheetLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerTimesheetLineModel'; + protected static $openAPIModelName = 'ManagerTimesheetLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'default_location_id' => 'int', 'default_location_name' => 'string', 'pay_schedule_id' => 'int', 'pay_schedule_name' => 'string', - 'employee_groups' => '\Swagger\Client\Model\ManagerEmployeeGroup[]', - 'shift_conditions' => '\Swagger\Client\Model\ShiftCondition[]', + 'employee_groups' => '\OpenAPI\Client\Model\ManagerEmployeeGroup[]', + 'shift_conditions' => '\OpenAPI\Client\Model\ShiftCondition[]', 'cost_formatted' => 'string', 'can_delete' => 'bool', 'can_edit' => 'bool', @@ -85,29 +85,29 @@ class ManagerTimesheetLineModel implements ModelInterface, ArrayAccess 'end' => '\DateTime', 'submitted_start' => '\DateTime', 'submitted_end' => '\DateTime', - 'units' => 'double', + 'units' => 'float', 'status' => 'string', 'pay_slip_url' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakManagerModel[]', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakManagerModel[]', 'comments' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'external_reference_id' => 'string', 'source' => 'string', 'pay_category_id' => 'int', 'leave_category_id' => 'int', 'leave_request_id' => 'int', 'is_locked' => 'bool', - 'cost' => 'double', + 'cost' => 'float', 'discard' => 'bool', - 'attachment' => '\Swagger\Client\Model\AttachmentModel', + 'attachment' => '\OpenAPI\Client\Model\AttachmentModel', 'is_overlapping' => 'bool', 'overdraws_leave' => 'bool', 'reviewed_by' => 'string', 'duration_override' => 'string', 'auto_approved_by_roster_shift_id' => 'int', - 'work_duration_in_minutes' => 'double', - 'breaks_duration_in_minutes' => 'double', - 'total_duration_in_minutes' => 'double', + 'work_duration_in_minutes' => 'float', + 'breaks_duration_in_minutes' => 'float', + 'total_duration_in_minutes' => 'float', 'hidden_comments' => 'string', 'read_only' => 'bool', 'ignore_rounding' => 'bool' @@ -117,8 +117,10 @@ class ManagerTimesheetLineModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'default_location_id' => 'int32', 'default_location_name' => null, 'pay_schedule_id' => 'int32', @@ -175,14 +177,83 @@ class ManagerTimesheetLineModel implements ModelInterface, ArrayAccess 'ignore_rounding' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'default_location_id' => false, + 'default_location_name' => false, + 'pay_schedule_id' => false, + 'pay_schedule_name' => false, + 'employee_groups' => false, + 'shift_conditions' => false, + 'cost_formatted' => false, + 'can_delete' => false, + 'can_edit' => false, + 'can_edit_notes_only' => false, + 'can_view_costs' => false, + 'can_approve' => false, + 'termination_date' => false, + 'employee_start_date' => false, + 'employee_name' => false, + 'id' => false, + 'employee_id' => false, + 'location_id' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'location_name' => false, + 'unit_type' => false, + 'is_unit_based_work_type' => false, + 'pay_run_id' => false, + 'start' => false, + 'end' => false, + 'submitted_start' => false, + 'submitted_end' => false, + 'units' => false, + 'status' => false, + 'pay_slip_url' => false, + 'breaks' => false, + 'comments' => false, + 'rate' => false, + 'external_reference_id' => false, + 'source' => false, + 'pay_category_id' => false, + 'leave_category_id' => false, + 'leave_request_id' => false, + 'is_locked' => false, + 'cost' => false, + 'discard' => false, + 'attachment' => false, + 'is_overlapping' => false, + 'overdraws_leave' => false, + 'reviewed_by' => false, + 'duration_override' => false, + 'auto_approved_by_roster_shift_id' => false, + 'work_duration_in_minutes' => false, + 'breaks_duration_in_minutes' => false, + 'total_duration_in_minutes' => false, + 'hidden_comments' => false, + 'read_only' => false, + 'ignore_rounding' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -190,9 +261,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -420,93 +543,91 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const STATUS_MISSING = 'Missing'; - const STATUS_SUBMITTED = 'Submitted'; - const STATUS_APPROVED = 'Approved'; - const STATUS_REJECTED = 'Rejected'; - const STATUS_PROCESSED = 'Processed'; - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const STATUS_MISSING = 'Missing'; + public const STATUS_SUBMITTED = 'Submitted'; + public const STATUS_APPROVED = 'Approved'; + public const STATUS_REJECTED = 'Rejected'; + public const STATUS_PROCESSED = 'Processed'; + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -522,7 +643,7 @@ public function getStatusAllowableValues() self::STATUS_PROCESSED, ]; } - + /** * Gets allowable values of the enum * @@ -609,7 +730,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -626,60 +746,78 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['default_location_id'] = isset($data['default_location_id']) ? $data['default_location_id'] : null; - $this->container['default_location_name'] = isset($data['default_location_name']) ? $data['default_location_name'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['pay_schedule_name'] = isset($data['pay_schedule_name']) ? $data['pay_schedule_name'] : null; - $this->container['employee_groups'] = isset($data['employee_groups']) ? $data['employee_groups'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['cost_formatted'] = isset($data['cost_formatted']) ? $data['cost_formatted'] : null; - $this->container['can_delete'] = isset($data['can_delete']) ? $data['can_delete'] : null; - $this->container['can_edit'] = isset($data['can_edit']) ? $data['can_edit'] : null; - $this->container['can_edit_notes_only'] = isset($data['can_edit_notes_only']) ? $data['can_edit_notes_only'] : null; - $this->container['can_view_costs'] = isset($data['can_view_costs']) ? $data['can_view_costs'] : null; - $this->container['can_approve'] = isset($data['can_approve']) ? $data['can_approve'] : null; - $this->container['termination_date'] = isset($data['termination_date']) ? $data['termination_date'] : null; - $this->container['employee_start_date'] = isset($data['employee_start_date']) ? $data['employee_start_date'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['is_unit_based_work_type'] = isset($data['is_unit_based_work_type']) ? $data['is_unit_based_work_type'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['submitted_start'] = isset($data['submitted_start']) ? $data['submitted_start'] : null; - $this->container['submitted_end'] = isset($data['submitted_end']) ? $data['submitted_end'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['pay_slip_url'] = isset($data['pay_slip_url']) ? $data['pay_slip_url'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['leave_request_id'] = isset($data['leave_request_id']) ? $data['leave_request_id'] : null; - $this->container['is_locked'] = isset($data['is_locked']) ? $data['is_locked'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['discard'] = isset($data['discard']) ? $data['discard'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['is_overlapping'] = isset($data['is_overlapping']) ? $data['is_overlapping'] : null; - $this->container['overdraws_leave'] = isset($data['overdraws_leave']) ? $data['overdraws_leave'] : null; - $this->container['reviewed_by'] = isset($data['reviewed_by']) ? $data['reviewed_by'] : null; - $this->container['duration_override'] = isset($data['duration_override']) ? $data['duration_override'] : null; - $this->container['auto_approved_by_roster_shift_id'] = isset($data['auto_approved_by_roster_shift_id']) ? $data['auto_approved_by_roster_shift_id'] : null; - $this->container['work_duration_in_minutes'] = isset($data['work_duration_in_minutes']) ? $data['work_duration_in_minutes'] : null; - $this->container['breaks_duration_in_minutes'] = isset($data['breaks_duration_in_minutes']) ? $data['breaks_duration_in_minutes'] : null; - $this->container['total_duration_in_minutes'] = isset($data['total_duration_in_minutes']) ? $data['total_duration_in_minutes'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['read_only'] = isset($data['read_only']) ? $data['read_only'] : null; - $this->container['ignore_rounding'] = isset($data['ignore_rounding']) ? $data['ignore_rounding'] : null; + $this->setIfExists('default_location_id', $data ?? [], null); + $this->setIfExists('default_location_name', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('pay_schedule_name', $data ?? [], null); + $this->setIfExists('employee_groups', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('cost_formatted', $data ?? [], null); + $this->setIfExists('can_delete', $data ?? [], null); + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('can_edit_notes_only', $data ?? [], null); + $this->setIfExists('can_view_costs', $data ?? [], null); + $this->setIfExists('can_approve', $data ?? [], null); + $this->setIfExists('termination_date', $data ?? [], null); + $this->setIfExists('employee_start_date', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('is_unit_based_work_type', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('submitted_start', $data ?? [], null); + $this->setIfExists('submitted_end', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('pay_slip_url', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('leave_request_id', $data ?? [], null); + $this->setIfExists('is_locked', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('discard', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('is_overlapping', $data ?? [], null); + $this->setIfExists('overdraws_leave', $data ?? [], null); + $this->setIfExists('reviewed_by', $data ?? [], null); + $this->setIfExists('duration_override', $data ?? [], null); + $this->setIfExists('auto_approved_by_roster_shift_id', $data ?? [], null); + $this->setIfExists('work_duration_in_minutes', $data ?? [], null); + $this->setIfExists('breaks_duration_in_minutes', $data ?? [], null); + $this->setIfExists('total_duration_in_minutes', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('read_only', $data ?? [], null); + $this->setIfExists('ignore_rounding', $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; } /** @@ -694,7 +832,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -702,7 +841,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -725,7 +865,7 @@ public function valid() /** * Gets default_location_id * - * @return int + * @return int|null */ public function getDefaultLocationId() { @@ -735,12 +875,15 @@ public function getDefaultLocationId() /** * Sets default_location_id * - * @param int $default_location_id + * @param int|null $default_location_id * - * @return $this + * @return self */ public function setDefaultLocationId($default_location_id) { + if (is_null($default_location_id)) { + throw new \InvalidArgumentException('non-nullable default_location_id cannot be null'); + } $this->container['default_location_id'] = $default_location_id; return $this; @@ -749,7 +892,7 @@ public function setDefaultLocationId($default_location_id) /** * Gets default_location_name * - * @return string + * @return string|null */ public function getDefaultLocationName() { @@ -759,12 +902,15 @@ public function getDefaultLocationName() /** * Sets default_location_name * - * @param string $default_location_name + * @param string|null $default_location_name * - * @return $this + * @return self */ public function setDefaultLocationName($default_location_name) { + if (is_null($default_location_name)) { + throw new \InvalidArgumentException('non-nullable default_location_name cannot be null'); + } $this->container['default_location_name'] = $default_location_name; return $this; @@ -773,7 +919,7 @@ public function setDefaultLocationName($default_location_name) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -783,12 +929,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -797,7 +946,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets pay_schedule_name * - * @return string + * @return string|null */ public function getPayScheduleName() { @@ -807,12 +956,15 @@ public function getPayScheduleName() /** * Sets pay_schedule_name * - * @param string $pay_schedule_name + * @param string|null $pay_schedule_name * - * @return $this + * @return self */ public function setPayScheduleName($pay_schedule_name) { + if (is_null($pay_schedule_name)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_name cannot be null'); + } $this->container['pay_schedule_name'] = $pay_schedule_name; return $this; @@ -821,7 +973,7 @@ public function setPayScheduleName($pay_schedule_name) /** * Gets employee_groups * - * @return \Swagger\Client\Model\ManagerEmployeeGroup[] + * @return \OpenAPI\Client\Model\ManagerEmployeeGroup[]|null */ public function getEmployeeGroups() { @@ -831,12 +983,15 @@ public function getEmployeeGroups() /** * Sets employee_groups * - * @param \Swagger\Client\Model\ManagerEmployeeGroup[] $employee_groups + * @param \OpenAPI\Client\Model\ManagerEmployeeGroup[]|null $employee_groups * - * @return $this + * @return self */ public function setEmployeeGroups($employee_groups) { + if (is_null($employee_groups)) { + throw new \InvalidArgumentException('non-nullable employee_groups cannot be null'); + } $this->container['employee_groups'] = $employee_groups; return $this; @@ -845,7 +1000,7 @@ public function setEmployeeGroups($employee_groups) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\ShiftCondition[] + * @return \OpenAPI\Client\Model\ShiftCondition[]|null */ public function getShiftConditions() { @@ -855,12 +1010,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\ShiftCondition[] $shift_conditions + * @param \OpenAPI\Client\Model\ShiftCondition[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -869,7 +1027,7 @@ public function setShiftConditions($shift_conditions) /** * Gets cost_formatted * - * @return string + * @return string|null */ public function getCostFormatted() { @@ -879,12 +1037,15 @@ public function getCostFormatted() /** * Sets cost_formatted * - * @param string $cost_formatted + * @param string|null $cost_formatted * - * @return $this + * @return self */ public function setCostFormatted($cost_formatted) { + if (is_null($cost_formatted)) { + throw new \InvalidArgumentException('non-nullable cost_formatted cannot be null'); + } $this->container['cost_formatted'] = $cost_formatted; return $this; @@ -893,7 +1054,7 @@ public function setCostFormatted($cost_formatted) /** * Gets can_delete * - * @return bool + * @return bool|null */ public function getCanDelete() { @@ -903,12 +1064,15 @@ public function getCanDelete() /** * Sets can_delete * - * @param bool $can_delete + * @param bool|null $can_delete * - * @return $this + * @return self */ public function setCanDelete($can_delete) { + if (is_null($can_delete)) { + throw new \InvalidArgumentException('non-nullable can_delete cannot be null'); + } $this->container['can_delete'] = $can_delete; return $this; @@ -917,7 +1081,7 @@ public function setCanDelete($can_delete) /** * Gets can_edit * - * @return bool + * @return bool|null */ public function getCanEdit() { @@ -927,12 +1091,15 @@ public function getCanEdit() /** * Sets can_edit * - * @param bool $can_edit + * @param bool|null $can_edit * - * @return $this + * @return self */ public function setCanEdit($can_edit) { + if (is_null($can_edit)) { + throw new \InvalidArgumentException('non-nullable can_edit cannot be null'); + } $this->container['can_edit'] = $can_edit; return $this; @@ -941,7 +1108,7 @@ public function setCanEdit($can_edit) /** * Gets can_edit_notes_only * - * @return bool + * @return bool|null */ public function getCanEditNotesOnly() { @@ -951,12 +1118,15 @@ public function getCanEditNotesOnly() /** * Sets can_edit_notes_only * - * @param bool $can_edit_notes_only + * @param bool|null $can_edit_notes_only * - * @return $this + * @return self */ public function setCanEditNotesOnly($can_edit_notes_only) { + if (is_null($can_edit_notes_only)) { + throw new \InvalidArgumentException('non-nullable can_edit_notes_only cannot be null'); + } $this->container['can_edit_notes_only'] = $can_edit_notes_only; return $this; @@ -965,7 +1135,7 @@ public function setCanEditNotesOnly($can_edit_notes_only) /** * Gets can_view_costs * - * @return bool + * @return bool|null */ public function getCanViewCosts() { @@ -975,12 +1145,15 @@ public function getCanViewCosts() /** * Sets can_view_costs * - * @param bool $can_view_costs + * @param bool|null $can_view_costs * - * @return $this + * @return self */ public function setCanViewCosts($can_view_costs) { + if (is_null($can_view_costs)) { + throw new \InvalidArgumentException('non-nullable can_view_costs cannot be null'); + } $this->container['can_view_costs'] = $can_view_costs; return $this; @@ -989,7 +1162,7 @@ public function setCanViewCosts($can_view_costs) /** * Gets can_approve * - * @return bool + * @return bool|null */ public function getCanApprove() { @@ -999,12 +1172,15 @@ public function getCanApprove() /** * Sets can_approve * - * @param bool $can_approve + * @param bool|null $can_approve * - * @return $this + * @return self */ public function setCanApprove($can_approve) { + if (is_null($can_approve)) { + throw new \InvalidArgumentException('non-nullable can_approve cannot be null'); + } $this->container['can_approve'] = $can_approve; return $this; @@ -1013,7 +1189,7 @@ public function setCanApprove($can_approve) /** * Gets termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getTerminationDate() { @@ -1023,12 +1199,15 @@ public function getTerminationDate() /** * Sets termination_date * - * @param \DateTime $termination_date + * @param \DateTime|null $termination_date * - * @return $this + * @return self */ public function setTerminationDate($termination_date) { + if (is_null($termination_date)) { + throw new \InvalidArgumentException('non-nullable termination_date cannot be null'); + } $this->container['termination_date'] = $termination_date; return $this; @@ -1037,7 +1216,7 @@ public function setTerminationDate($termination_date) /** * Gets employee_start_date * - * @return \DateTime + * @return \DateTime|null */ public function getEmployeeStartDate() { @@ -1047,12 +1226,15 @@ public function getEmployeeStartDate() /** * Sets employee_start_date * - * @param \DateTime $employee_start_date + * @param \DateTime|null $employee_start_date * - * @return $this + * @return self */ public function setEmployeeStartDate($employee_start_date) { + if (is_null($employee_start_date)) { + throw new \InvalidArgumentException('non-nullable employee_start_date cannot be null'); + } $this->container['employee_start_date'] = $employee_start_date; return $this; @@ -1061,7 +1243,7 @@ public function setEmployeeStartDate($employee_start_date) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -1071,12 +1253,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -1085,7 +1270,7 @@ public function setEmployeeName($employee_name) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -1095,12 +1280,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -1109,7 +1297,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -1119,12 +1307,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -1133,7 +1324,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -1143,12 +1334,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -1157,7 +1351,7 @@ public function setLocationId($location_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -1167,12 +1361,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -1181,7 +1378,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -1191,12 +1388,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -1205,7 +1405,7 @@ public function setWorkTypeName($work_type_name) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -1215,12 +1415,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -1229,7 +1432,7 @@ public function setLocationName($location_name) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -1239,12 +1442,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -1253,7 +1459,7 @@ public function setUnitType($unit_type) /** * Gets is_unit_based_work_type * - * @return bool + * @return bool|null */ public function getIsUnitBasedWorkType() { @@ -1263,12 +1469,15 @@ public function getIsUnitBasedWorkType() /** * Sets is_unit_based_work_type * - * @param bool $is_unit_based_work_type + * @param bool|null $is_unit_based_work_type * - * @return $this + * @return self */ public function setIsUnitBasedWorkType($is_unit_based_work_type) { + if (is_null($is_unit_based_work_type)) { + throw new \InvalidArgumentException('non-nullable is_unit_based_work_type cannot be null'); + } $this->container['is_unit_based_work_type'] = $is_unit_based_work_type; return $this; @@ -1277,7 +1486,7 @@ public function setIsUnitBasedWorkType($is_unit_based_work_type) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -1287,12 +1496,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -1301,7 +1513,7 @@ public function setPayRunId($pay_run_id) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -1311,12 +1523,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -1325,7 +1540,7 @@ public function setStart($start) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -1335,12 +1550,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -1349,7 +1567,7 @@ public function setEnd($end) /** * Gets submitted_start * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedStart() { @@ -1359,12 +1577,15 @@ public function getSubmittedStart() /** * Sets submitted_start * - * @param \DateTime $submitted_start + * @param \DateTime|null $submitted_start * - * @return $this + * @return self */ public function setSubmittedStart($submitted_start) { + if (is_null($submitted_start)) { + throw new \InvalidArgumentException('non-nullable submitted_start cannot be null'); + } $this->container['submitted_start'] = $submitted_start; return $this; @@ -1373,7 +1594,7 @@ public function setSubmittedStart($submitted_start) /** * Gets submitted_end * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedEnd() { @@ -1383,12 +1604,15 @@ public function getSubmittedEnd() /** * Sets submitted_end * - * @param \DateTime $submitted_end + * @param \DateTime|null $submitted_end * - * @return $this + * @return self */ public function setSubmittedEnd($submitted_end) { + if (is_null($submitted_end)) { + throw new \InvalidArgumentException('non-nullable submitted_end cannot be null'); + } $this->container['submitted_end'] = $submitted_end; return $this; @@ -1397,7 +1621,7 @@ public function setSubmittedEnd($submitted_end) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -1407,12 +1631,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -1421,7 +1648,7 @@ public function setUnits($units) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -1431,17 +1658,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -1454,7 +1685,7 @@ public function setStatus($status) /** * Gets pay_slip_url * - * @return string + * @return string|null */ public function getPaySlipUrl() { @@ -1464,12 +1695,15 @@ public function getPaySlipUrl() /** * Sets pay_slip_url * - * @param string $pay_slip_url + * @param string|null $pay_slip_url * - * @return $this + * @return self */ public function setPaySlipUrl($pay_slip_url) { + if (is_null($pay_slip_url)) { + throw new \InvalidArgumentException('non-nullable pay_slip_url cannot be null'); + } $this->container['pay_slip_url'] = $pay_slip_url; return $this; @@ -1478,7 +1712,7 @@ public function setPaySlipUrl($pay_slip_url) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakManagerModel[] + * @return \OpenAPI\Client\Model\TimesheetBreakManagerModel[]|null */ public function getBreaks() { @@ -1488,12 +1722,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakManagerModel[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakManagerModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -1502,7 +1739,7 @@ public function setBreaks($breaks) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -1512,12 +1749,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -1526,7 +1766,7 @@ public function setComments($comments) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -1536,12 +1776,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -1550,7 +1793,7 @@ public function setRate($rate) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -1560,12 +1803,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -1574,7 +1820,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -1584,17 +1830,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -1607,7 +1857,7 @@ public function setSource($source) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -1617,12 +1867,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -1631,7 +1884,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -1641,12 +1894,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -1655,7 +1911,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets leave_request_id * - * @return int + * @return int|null */ public function getLeaveRequestId() { @@ -1665,12 +1921,15 @@ public function getLeaveRequestId() /** * Sets leave_request_id * - * @param int $leave_request_id + * @param int|null $leave_request_id * - * @return $this + * @return self */ public function setLeaveRequestId($leave_request_id) { + if (is_null($leave_request_id)) { + throw new \InvalidArgumentException('non-nullable leave_request_id cannot be null'); + } $this->container['leave_request_id'] = $leave_request_id; return $this; @@ -1679,7 +1938,7 @@ public function setLeaveRequestId($leave_request_id) /** * Gets is_locked * - * @return bool + * @return bool|null */ public function getIsLocked() { @@ -1689,12 +1948,15 @@ public function getIsLocked() /** * Sets is_locked * - * @param bool $is_locked + * @param bool|null $is_locked * - * @return $this + * @return self */ public function setIsLocked($is_locked) { + if (is_null($is_locked)) { + throw new \InvalidArgumentException('non-nullable is_locked cannot be null'); + } $this->container['is_locked'] = $is_locked; return $this; @@ -1703,7 +1965,7 @@ public function setIsLocked($is_locked) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -1713,12 +1975,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -1727,7 +1992,7 @@ public function setCost($cost) /** * Gets discard * - * @return bool + * @return bool|null */ public function getDiscard() { @@ -1737,12 +2002,15 @@ public function getDiscard() /** * Sets discard * - * @param bool $discard + * @param bool|null $discard * - * @return $this + * @return self */ public function setDiscard($discard) { + if (is_null($discard)) { + throw new \InvalidArgumentException('non-nullable discard cannot be null'); + } $this->container['discard'] = $discard; return $this; @@ -1751,7 +2019,7 @@ public function setDiscard($discard) /** * Gets attachment * - * @return \Swagger\Client\Model\AttachmentModel + * @return \OpenAPI\Client\Model\AttachmentModel|null */ public function getAttachment() { @@ -1761,12 +2029,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\AttachmentModel $attachment + * @param \OpenAPI\Client\Model\AttachmentModel|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -1775,7 +2046,7 @@ public function setAttachment($attachment) /** * Gets is_overlapping * - * @return bool + * @return bool|null */ public function getIsOverlapping() { @@ -1785,12 +2056,15 @@ public function getIsOverlapping() /** * Sets is_overlapping * - * @param bool $is_overlapping + * @param bool|null $is_overlapping * - * @return $this + * @return self */ public function setIsOverlapping($is_overlapping) { + if (is_null($is_overlapping)) { + throw new \InvalidArgumentException('non-nullable is_overlapping cannot be null'); + } $this->container['is_overlapping'] = $is_overlapping; return $this; @@ -1799,7 +2073,7 @@ public function setIsOverlapping($is_overlapping) /** * Gets overdraws_leave * - * @return bool + * @return bool|null */ public function getOverdrawsLeave() { @@ -1809,12 +2083,15 @@ public function getOverdrawsLeave() /** * Sets overdraws_leave * - * @param bool $overdraws_leave + * @param bool|null $overdraws_leave * - * @return $this + * @return self */ public function setOverdrawsLeave($overdraws_leave) { + if (is_null($overdraws_leave)) { + throw new \InvalidArgumentException('non-nullable overdraws_leave cannot be null'); + } $this->container['overdraws_leave'] = $overdraws_leave; return $this; @@ -1823,7 +2100,7 @@ public function setOverdrawsLeave($overdraws_leave) /** * Gets reviewed_by * - * @return string + * @return string|null */ public function getReviewedBy() { @@ -1833,12 +2110,15 @@ public function getReviewedBy() /** * Sets reviewed_by * - * @param string $reviewed_by + * @param string|null $reviewed_by * - * @return $this + * @return self */ public function setReviewedBy($reviewed_by) { + if (is_null($reviewed_by)) { + throw new \InvalidArgumentException('non-nullable reviewed_by cannot be null'); + } $this->container['reviewed_by'] = $reviewed_by; return $this; @@ -1847,7 +2127,7 @@ public function setReviewedBy($reviewed_by) /** * Gets duration_override * - * @return string + * @return string|null */ public function getDurationOverride() { @@ -1857,12 +2137,15 @@ public function getDurationOverride() /** * Sets duration_override * - * @param string $duration_override + * @param string|null $duration_override * - * @return $this + * @return self */ public function setDurationOverride($duration_override) { + if (is_null($duration_override)) { + throw new \InvalidArgumentException('non-nullable duration_override cannot be null'); + } $this->container['duration_override'] = $duration_override; return $this; @@ -1871,7 +2154,7 @@ public function setDurationOverride($duration_override) /** * Gets auto_approved_by_roster_shift_id * - * @return int + * @return int|null */ public function getAutoApprovedByRosterShiftId() { @@ -1881,12 +2164,15 @@ public function getAutoApprovedByRosterShiftId() /** * Sets auto_approved_by_roster_shift_id * - * @param int $auto_approved_by_roster_shift_id + * @param int|null $auto_approved_by_roster_shift_id * - * @return $this + * @return self */ public function setAutoApprovedByRosterShiftId($auto_approved_by_roster_shift_id) { + if (is_null($auto_approved_by_roster_shift_id)) { + throw new \InvalidArgumentException('non-nullable auto_approved_by_roster_shift_id cannot be null'); + } $this->container['auto_approved_by_roster_shift_id'] = $auto_approved_by_roster_shift_id; return $this; @@ -1895,7 +2181,7 @@ public function setAutoApprovedByRosterShiftId($auto_approved_by_roster_shift_id /** * Gets work_duration_in_minutes * - * @return double + * @return float|null */ public function getWorkDurationInMinutes() { @@ -1905,12 +2191,15 @@ public function getWorkDurationInMinutes() /** * Sets work_duration_in_minutes * - * @param double $work_duration_in_minutes + * @param float|null $work_duration_in_minutes * - * @return $this + * @return self */ public function setWorkDurationInMinutes($work_duration_in_minutes) { + if (is_null($work_duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable work_duration_in_minutes cannot be null'); + } $this->container['work_duration_in_minutes'] = $work_duration_in_minutes; return $this; @@ -1919,7 +2208,7 @@ public function setWorkDurationInMinutes($work_duration_in_minutes) /** * Gets breaks_duration_in_minutes * - * @return double + * @return float|null */ public function getBreaksDurationInMinutes() { @@ -1929,12 +2218,15 @@ public function getBreaksDurationInMinutes() /** * Sets breaks_duration_in_minutes * - * @param double $breaks_duration_in_minutes + * @param float|null $breaks_duration_in_minutes * - * @return $this + * @return self */ public function setBreaksDurationInMinutes($breaks_duration_in_minutes) { + if (is_null($breaks_duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable breaks_duration_in_minutes cannot be null'); + } $this->container['breaks_duration_in_minutes'] = $breaks_duration_in_minutes; return $this; @@ -1943,7 +2235,7 @@ public function setBreaksDurationInMinutes($breaks_duration_in_minutes) /** * Gets total_duration_in_minutes * - * @return double + * @return float|null */ public function getTotalDurationInMinutes() { @@ -1953,12 +2245,15 @@ public function getTotalDurationInMinutes() /** * Sets total_duration_in_minutes * - * @param double $total_duration_in_minutes + * @param float|null $total_duration_in_minutes * - * @return $this + * @return self */ public function setTotalDurationInMinutes($total_duration_in_minutes) { + if (is_null($total_duration_in_minutes)) { + throw new \InvalidArgumentException('non-nullable total_duration_in_minutes cannot be null'); + } $this->container['total_duration_in_minutes'] = $total_duration_in_minutes; return $this; @@ -1967,7 +2262,7 @@ public function setTotalDurationInMinutes($total_duration_in_minutes) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -1977,12 +2272,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -1991,7 +2289,7 @@ public function setHiddenComments($hidden_comments) /** * Gets read_only * - * @return bool + * @return bool|null */ public function getReadOnly() { @@ -2001,12 +2299,15 @@ public function getReadOnly() /** * Sets read_only * - * @param bool $read_only + * @param bool|null $read_only * - * @return $this + * @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; @@ -2015,7 +2316,7 @@ public function setReadOnly($read_only) /** * Gets ignore_rounding * - * @return bool + * @return bool|null */ public function getIgnoreRounding() { @@ -2025,12 +2326,15 @@ public function getIgnoreRounding() /** * Sets ignore_rounding * - * @param bool $ignore_rounding + * @param bool|null $ignore_rounding * - * @return $this + * @return self */ public function setIgnoreRounding($ignore_rounding) { + if (is_null($ignore_rounding)) { + throw new \InvalidArgumentException('non-nullable ignore_rounding cannot be null'); + } $this->container['ignore_rounding'] = $ignore_rounding; return $this; @@ -2042,7 +2346,7 @@ public function setIgnoreRounding($ignore_rounding) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -2052,22 +2356,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -2083,11 +2388,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -2095,13 +2413,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerTimesheetSubmitModel.php b/src/lib/Model/ManagerTimesheetSubmitModel.php index 3a6a6de..27bc86a 100644 --- a/src/lib/Model/ManagerTimesheetSubmitModel.php +++ b/src/lib/Model/ManagerTimesheetSubmitModel.php @@ -2,61 +2,61 @@ /** * ManagerTimesheetSubmitModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerTimesheetSubmitModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerTimesheetSubmitModel implements ModelInterface, ArrayAccess +class ManagerTimesheetSubmitModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerTimesheetSubmitModel'; + protected static $openAPIModelName = 'ManagerTimesheetSubmitModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', 'location_id' => 'int', @@ -70,12 +70,12 @@ class ManagerTimesheetSubmitModel implements ModelInterface, ArrayAccess 'end' => '\DateTime', 'submitted_start' => '\DateTime', 'submitted_end' => '\DateTime', - 'units' => 'double', - 'rate' => 'double', + 'units' => 'float', + 'rate' => 'float', 'comments' => 'string', 'hidden_comments' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakSubmitModel[]', - 'attachment' => '\Swagger\Client\Model\Attachment', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakSubmitModel[]', + 'attachment' => '\OpenAPI\Client\Model\Attachment', 'source' => 'string', 'location_is_deleted' => 'bool' ]; @@ -84,8 +84,10 @@ class ManagerTimesheetSubmitModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'location_id' => 'int32', @@ -109,14 +111,50 @@ class ManagerTimesheetSubmitModel implements ModelInterface, ArrayAccess 'location_is_deleted' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'location_id' => false, + 'work_type_id' => false, + 'pay_category_id' => false, + 'leave_category_id' => false, + 'leave_request_id' => false, + 'classification_id' => false, + 'shift_condition_ids' => false, + 'start' => false, + 'end' => false, + 'submitted_start' => false, + 'submitted_end' => false, + 'units' => false, + 'rate' => false, + 'comments' => false, + 'hidden_comments' => false, + 'breaks' => false, + 'attachment' => false, + 'source' => false, + 'location_is_deleted' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -124,9 +162,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -255,88 +345,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -423,7 +511,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -440,27 +527,45 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['leave_request_id'] = isset($data['leave_request_id']) ? $data['leave_request_id'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['submitted_start'] = isset($data['submitted_start']) ? $data['submitted_start'] : null; - $this->container['submitted_end'] = isset($data['submitted_end']) ? $data['submitted_end'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['location_is_deleted'] = isset($data['location_is_deleted']) ? $data['location_is_deleted'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('leave_request_id', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('submitted_start', $data ?? [], null); + $this->setIfExists('submitted_end', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('location_is_deleted', $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; } /** @@ -475,7 +580,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -498,7 +604,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -508,12 +614,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -522,7 +631,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -532,12 +641,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -546,7 +658,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -556,12 +668,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -570,7 +685,7 @@ public function setLocationId($location_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -580,12 +695,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -594,7 +712,7 @@ public function setWorkTypeId($work_type_id) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -604,12 +722,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -618,7 +739,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -628,12 +749,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -642,7 +766,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets leave_request_id * - * @return int + * @return int|null */ public function getLeaveRequestId() { @@ -652,12 +776,15 @@ public function getLeaveRequestId() /** * Sets leave_request_id * - * @param int $leave_request_id + * @param int|null $leave_request_id * - * @return $this + * @return self */ public function setLeaveRequestId($leave_request_id) { + if (is_null($leave_request_id)) { + throw new \InvalidArgumentException('non-nullable leave_request_id cannot be null'); + } $this->container['leave_request_id'] = $leave_request_id; return $this; @@ -666,7 +793,7 @@ public function setLeaveRequestId($leave_request_id) /** * Gets classification_id * - * @return int + * @return int|null */ public function getClassificationId() { @@ -676,12 +803,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param int $classification_id + * @param int|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -690,7 +820,7 @@ public function setClassificationId($classification_id) /** * Gets shift_condition_ids * - * @return int[] + * @return int[]|null */ public function getShiftConditionIds() { @@ -700,12 +830,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param int[] $shift_condition_ids + * @param int[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -714,7 +847,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -724,12 +857,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -738,7 +874,7 @@ public function setStart($start) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -748,12 +884,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -762,7 +901,7 @@ public function setEnd($end) /** * Gets submitted_start * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedStart() { @@ -772,12 +911,15 @@ public function getSubmittedStart() /** * Sets submitted_start * - * @param \DateTime $submitted_start + * @param \DateTime|null $submitted_start * - * @return $this + * @return self */ public function setSubmittedStart($submitted_start) { + if (is_null($submitted_start)) { + throw new \InvalidArgumentException('non-nullable submitted_start cannot be null'); + } $this->container['submitted_start'] = $submitted_start; return $this; @@ -786,7 +928,7 @@ public function setSubmittedStart($submitted_start) /** * Gets submitted_end * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedEnd() { @@ -796,12 +938,15 @@ public function getSubmittedEnd() /** * Sets submitted_end * - * @param \DateTime $submitted_end + * @param \DateTime|null $submitted_end * - * @return $this + * @return self */ public function setSubmittedEnd($submitted_end) { + if (is_null($submitted_end)) { + throw new \InvalidArgumentException('non-nullable submitted_end cannot be null'); + } $this->container['submitted_end'] = $submitted_end; return $this; @@ -810,7 +955,7 @@ public function setSubmittedEnd($submitted_end) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -820,12 +965,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -834,7 +982,7 @@ public function setUnits($units) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -844,12 +992,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -858,7 +1009,7 @@ public function setRate($rate) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -868,12 +1019,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -882,7 +1036,7 @@ public function setComments($comments) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -892,12 +1046,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -906,7 +1063,7 @@ public function setHiddenComments($hidden_comments) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakSubmitModel[] + * @return \OpenAPI\Client\Model\TimesheetBreakSubmitModel[]|null */ public function getBreaks() { @@ -916,12 +1073,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakSubmitModel[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakSubmitModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -930,7 +1090,7 @@ public function setBreaks($breaks) /** * Gets attachment * - * @return \Swagger\Client\Model\Attachment + * @return \OpenAPI\Client\Model\Attachment|null */ public function getAttachment() { @@ -940,12 +1100,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\Attachment $attachment + * @param \OpenAPI\Client\Model\Attachment|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -954,7 +1117,7 @@ public function setAttachment($attachment) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -964,17 +1127,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -987,7 +1154,7 @@ public function setSource($source) /** * Gets location_is_deleted * - * @return bool + * @return bool|null */ public function getLocationIsDeleted() { @@ -997,12 +1164,15 @@ public function getLocationIsDeleted() /** * Sets location_is_deleted * - * @param bool $location_is_deleted + * @param bool|null $location_is_deleted * - * @return $this + * @return self */ public function setLocationIsDeleted($location_is_deleted) { + if (is_null($location_is_deleted)) { + throw new \InvalidArgumentException('non-nullable location_is_deleted cannot be null'); + } $this->container['location_is_deleted'] = $location_is_deleted; return $this; @@ -1014,7 +1184,7 @@ public function setLocationIsDeleted($location_is_deleted) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1024,22 +1194,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1055,11 +1226,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1067,13 +1251,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ManagerUnavailabilityModel.php b/src/lib/Model/ManagerUnavailabilityModel.php index 8dbcaf6..101206d 100644 --- a/src/lib/Model/ManagerUnavailabilityModel.php +++ b/src/lib/Model/ManagerUnavailabilityModel.php @@ -2,61 +2,61 @@ /** * ManagerUnavailabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ManagerUnavailabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ManagerUnavailabilityModel implements ModelInterface, ArrayAccess +class ManagerUnavailabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ManagerUnavailabilityModel'; + protected static $openAPIModelName = 'ManagerUnavailabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'employee_name' => 'string', 'termination_date' => '\DateTime', @@ -77,8 +77,10 @@ class ManagerUnavailabilityModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'employee_name' => null, 'termination_date' => 'date-time', @@ -95,14 +97,43 @@ class ManagerUnavailabilityModel implements ModelInterface, ArrayAccess 'view_only' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'employee_name' => false, + 'termination_date' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'end_date' => false, + 'reason' => false, + 'recurring' => false, + 'recurring_day' => false, + 'recurring_days' => false, + 'recurring_days_csv' => false, + 'is_all_day' => false, + 'view_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -220,26 +303,24 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const RECURRING_DAY_SUNDAY = 'Sunday'; - const RECURRING_DAY_MONDAY = 'Monday'; - const RECURRING_DAY_TUESDAY = 'Tuesday'; - const RECURRING_DAY_WEDNESDAY = 'Wednesday'; - const RECURRING_DAY_THURSDAY = 'Thursday'; - const RECURRING_DAY_FRIDAY = 'Friday'; - const RECURRING_DAY_SATURDAY = 'Saturday'; - const RECURRING_DAYS_SUNDAY = 'Sunday'; - const RECURRING_DAYS_MONDAY = 'Monday'; - const RECURRING_DAYS_TUESDAY = 'Tuesday'; - const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; - const RECURRING_DAYS_THURSDAY = 'Thursday'; - const RECURRING_DAYS_FRIDAY = 'Friday'; - const RECURRING_DAYS_SATURDAY = 'Saturday'; - + public const RECURRING_DAY_SUNDAY = 'Sunday'; + public const RECURRING_DAY_MONDAY = 'Monday'; + public const RECURRING_DAY_TUESDAY = 'Tuesday'; + public const RECURRING_DAY_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAY_THURSDAY = 'Thursday'; + public const RECURRING_DAY_FRIDAY = 'Friday'; + public const RECURRING_DAY_SATURDAY = 'Saturday'; + public const RECURRING_DAYS_SUNDAY = 'Sunday'; + public const RECURRING_DAYS_MONDAY = 'Monday'; + public const RECURRING_DAYS_TUESDAY = 'Tuesday'; + public const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAYS_THURSDAY = 'Thursday'; + public const RECURRING_DAYS_FRIDAY = 'Friday'; + public const RECURRING_DAYS_SATURDAY = 'Saturday'; - /** * Gets allowable values of the enum * @@ -257,7 +338,7 @@ public function getRecurringDayAllowableValues() self::RECURRING_DAY_SATURDAY, ]; } - + /** * Gets allowable values of the enum * @@ -275,7 +356,6 @@ public function getRecurringDaysAllowableValues() self::RECURRING_DAYS_SATURDAY, ]; } - /** * Associative array for storing property values @@ -292,20 +372,38 @@ public function getRecurringDaysAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['termination_date'] = isset($data['termination_date']) ? $data['termination_date'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['recurring_day'] = isset($data['recurring_day']) ? $data['recurring_day'] : null; - $this->container['recurring_days'] = isset($data['recurring_days']) ? $data['recurring_days'] : null; - $this->container['recurring_days_csv'] = isset($data['recurring_days_csv']) ? $data['recurring_days_csv'] : null; - $this->container['is_all_day'] = isset($data['is_all_day']) ? $data['is_all_day'] : null; - $this->container['view_only'] = isset($data['view_only']) ? $data['view_only'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('termination_date', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('recurring_day', $data ?? [], null); + $this->setIfExists('recurring_days', $data ?? [], null); + $this->setIfExists('recurring_days_csv', $data ?? [], null); + $this->setIfExists('is_all_day', $data ?? [], null); + $this->setIfExists('view_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; } /** @@ -320,7 +418,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDayAllowableValues(); if (!is_null($this->container['recurring_day']) && !in_array($this->container['recurring_day'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_day', must be one of '%s'", + "invalid value '%s' for 'recurring_day', must be one of '%s'", + $this->container['recurring_day'], implode("', '", $allowedValues) ); } @@ -328,7 +427,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDaysAllowableValues(); if (!is_null($this->container['recurring_days']) && !in_array($this->container['recurring_days'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_days', must be one of '%s'", + "invalid value '%s' for 'recurring_days', must be one of '%s'", + $this->container['recurring_days'], implode("', '", $allowedValues) ); } @@ -351,7 +451,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -361,12 +461,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -375,7 +478,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -385,12 +488,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -399,7 +505,7 @@ public function setEmployeeName($employee_name) /** * Gets termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getTerminationDate() { @@ -409,12 +515,15 @@ public function getTerminationDate() /** * Sets termination_date * - * @param \DateTime $termination_date + * @param \DateTime|null $termination_date * - * @return $this + * @return self */ public function setTerminationDate($termination_date) { + if (is_null($termination_date)) { + throw new \InvalidArgumentException('non-nullable termination_date cannot be null'); + } $this->container['termination_date'] = $termination_date; return $this; @@ -423,7 +532,7 @@ public function setTerminationDate($termination_date) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -433,12 +542,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -447,7 +559,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -457,12 +569,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -471,7 +586,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -481,12 +596,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -495,7 +613,7 @@ public function setToDate($to_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -505,12 +623,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -519,7 +640,7 @@ public function setEndDate($end_date) /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -529,12 +650,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -543,7 +667,7 @@ public function setReason($reason) /** * Gets recurring * - * @return bool + * @return bool|null */ public function getRecurring() { @@ -553,12 +677,15 @@ public function getRecurring() /** * Sets recurring * - * @param bool $recurring + * @param bool|null $recurring * - * @return $this + * @return self */ public function setRecurring($recurring) { + if (is_null($recurring)) { + throw new \InvalidArgumentException('non-nullable recurring cannot be null'); + } $this->container['recurring'] = $recurring; return $this; @@ -567,7 +694,7 @@ public function setRecurring($recurring) /** * Gets recurring_day * - * @return string + * @return string|null */ public function getRecurringDay() { @@ -577,17 +704,21 @@ public function getRecurringDay() /** * Sets recurring_day * - * @param string $recurring_day + * @param string|null $recurring_day * - * @return $this + * @return self */ public function setRecurringDay($recurring_day) { + if (is_null($recurring_day)) { + throw new \InvalidArgumentException('non-nullable recurring_day cannot be null'); + } $allowedValues = $this->getRecurringDayAllowableValues(); - if (!is_null($recurring_day) && !in_array($recurring_day, $allowedValues, true)) { + if (!in_array($recurring_day, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_day', must be one of '%s'", + "Invalid value '%s' for 'recurring_day', must be one of '%s'", + $recurring_day, implode("', '", $allowedValues) ) ); @@ -600,7 +731,7 @@ public function setRecurringDay($recurring_day) /** * Gets recurring_days * - * @return string + * @return string|null */ public function getRecurringDays() { @@ -610,17 +741,21 @@ public function getRecurringDays() /** * Sets recurring_days * - * @param string $recurring_days + * @param string|null $recurring_days * - * @return $this + * @return self */ public function setRecurringDays($recurring_days) { + if (is_null($recurring_days)) { + throw new \InvalidArgumentException('non-nullable recurring_days cannot be null'); + } $allowedValues = $this->getRecurringDaysAllowableValues(); - if (!is_null($recurring_days) && !in_array($recurring_days, $allowedValues, true)) { + if (!in_array($recurring_days, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_days', must be one of '%s'", + "Invalid value '%s' for 'recurring_days', must be one of '%s'", + $recurring_days, implode("', '", $allowedValues) ) ); @@ -633,7 +768,7 @@ public function setRecurringDays($recurring_days) /** * Gets recurring_days_csv * - * @return string + * @return string|null */ public function getRecurringDaysCsv() { @@ -643,12 +778,15 @@ public function getRecurringDaysCsv() /** * Sets recurring_days_csv * - * @param string $recurring_days_csv + * @param string|null $recurring_days_csv * - * @return $this + * @return self */ public function setRecurringDaysCsv($recurring_days_csv) { + if (is_null($recurring_days_csv)) { + throw new \InvalidArgumentException('non-nullable recurring_days_csv cannot be null'); + } $this->container['recurring_days_csv'] = $recurring_days_csv; return $this; @@ -657,7 +795,7 @@ public function setRecurringDaysCsv($recurring_days_csv) /** * Gets is_all_day * - * @return bool + * @return bool|null */ public function getIsAllDay() { @@ -667,12 +805,15 @@ public function getIsAllDay() /** * Sets is_all_day * - * @param bool $is_all_day + * @param bool|null $is_all_day * - * @return $this + * @return self */ public function setIsAllDay($is_all_day) { + if (is_null($is_all_day)) { + throw new \InvalidArgumentException('non-nullable is_all_day cannot be null'); + } $this->container['is_all_day'] = $is_all_day; return $this; @@ -681,7 +822,7 @@ public function setIsAllDay($is_all_day) /** * Gets view_only * - * @return bool + * @return bool|null */ public function getViewOnly() { @@ -691,12 +832,15 @@ public function getViewOnly() /** * Sets view_only * - * @param bool $view_only + * @param bool|null $view_only * - * @return $this + * @return self */ public function setViewOnly($view_only) { + if (is_null($view_only)) { + throw new \InvalidArgumentException('non-nullable view_only cannot be null'); + } $this->container['view_only'] = $view_only; return $this; @@ -708,7 +852,7 @@ public function setViewOnly($view_only) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -718,22 +862,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -749,11 +894,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -761,13 +919,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/MarkNotesReadViewModel.php b/src/lib/Model/MarkNotesReadViewModel.php index ba58c73..15acb13 100644 --- a/src/lib/Model/MarkNotesReadViewModel.php +++ b/src/lib/Model/MarkNotesReadViewModel.php @@ -2,61 +2,61 @@ /** * MarkNotesReadViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * MarkNotesReadViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class MarkNotesReadViewModel implements ModelInterface, ArrayAccess +class MarkNotesReadViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'MarkNotesReadViewModel'; + protected static $openAPIModelName = 'MarkNotesReadViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'note_ids' => 'int[]', 'read' => 'bool' @@ -66,21 +66,41 @@ class MarkNotesReadViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'note_ids' => 'int32', 'read' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'note_ids' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['note_ids'] = isset($data['note_ids']) ? $data['note_ids'] : null; - $this->container['read'] = isset($data['read']) ? $data['read'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('note_ids', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -229,12 +316,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -243,7 +333,7 @@ public function setEmployeeId($employee_id) /** * Gets note_ids * - * @return int[] + * @return int[]|null */ public function getNoteIds() { @@ -253,12 +343,15 @@ public function getNoteIds() /** * Sets note_ids * - * @param int[] $note_ids + * @param int[]|null $note_ids * - * @return $this + * @return self */ public function setNoteIds($note_ids) { + if (is_null($note_ids)) { + throw new \InvalidArgumentException('non-nullable note_ids cannot be null'); + } $this->container['note_ids'] = $note_ids; return $this; @@ -267,7 +360,7 @@ public function setNoteIds($note_ids) /** * Gets read * - * @return bool + * @return bool|null */ public function getRead() { @@ -277,12 +370,15 @@ public function getRead() /** * Sets read * - * @param bool $read + * @param bool|null $read * - * @return $this + * @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; @@ -294,7 +390,7 @@ public function setRead($read) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/MatchingEmployeeModel.php b/src/lib/Model/MatchingEmployeeModel.php index d9d2308..f31d937 100644 --- a/src/lib/Model/MatchingEmployeeModel.php +++ b/src/lib/Model/MatchingEmployeeModel.php @@ -2,61 +2,61 @@ /** * MatchingEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * MatchingEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class MatchingEmployeeModel implements ModelInterface, ArrayAccess +class MatchingEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'MatchingEmployeeModel'; + protected static $openAPIModelName = 'MatchingEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'external_id' => 'string', 'name' => 'string' @@ -66,21 +66,41 @@ class MatchingEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'external_id' => null, 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'external_id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -253,12 +343,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -267,7 +360,7 @@ public function setExternalId($external_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -277,12 +370,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -294,7 +390,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ModelInterface.php b/src/lib/Model/ModelInterface.php index 53b9ac6..5313896 100644 --- a/src/lib/Model/ModelInterface.php +++ b/src/lib/Model/ModelInterface.php @@ -2,38 +2,37 @@ /** * ModelInterface * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client\Model - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client\Model + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; /** * Interface abstracting model access. * - * @package Swagger\Client\Model - * @author Swagger Codegen team + * @package OpenAPI\Client\Model + * @author OpenAPI Generator team */ interface ModelInterface { @@ -49,14 +48,14 @@ public function getModelName(); * * @return array */ - public static function swaggerTypes(); + public static function openAPITypes(); /** * Array of property to format mappings. Used for (de)serialization * * @return array */ - public static function swaggerFormats(); + public static function openAPIFormats(); /** * Array of attributes where the key is the local name, and the value is the original name @@ -93,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/src/lib/Model/NameIdPair.php b/src/lib/Model/NameIdPair.php index 36f4428..1541ca9 100644 --- a/src/lib/Model/NameIdPair.php +++ b/src/lib/Model/NameIdPair.php @@ -2,61 +2,61 @@ /** * NameIdPair * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NameIdPair Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NameIdPair implements ModelInterface, ArrayAccess +class NameIdPair implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NameIdPair'; + protected static $openAPIModelName = 'NameIdPair'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'string', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class NameIdPair implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => null, 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param string $id + * @param string|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NetToGrossModel.php b/src/lib/Model/NetToGrossModel.php index 53d05ec..7ee1794 100644 --- a/src/lib/Model/NetToGrossModel.php +++ b/src/lib/Model/NetToGrossModel.php @@ -2,81 +2,99 @@ /** * NetToGrossModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NetToGrossModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NetToGrossModel implements ModelInterface, ArrayAccess +class NetToGrossModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NetToGrossModel'; + protected static $openAPIModelName = 'NetToGrossModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'gross_amount' => 'double' + protected static $openAPITypes = [ + 'gross_amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'gross_amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'gross_amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['gross_amount'] = isset($data['gross_amount']) ? $data['gross_amount'] : null; + $this->setIfExists('gross_amount', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets gross_amount * - * @return double + * @return float|null */ public function getGrossAmount() { @@ -217,12 +302,15 @@ public function getGrossAmount() /** * Sets gross_amount * - * @param double $gross_amount + * @param float|null $gross_amount * - * @return $this + * @return self */ public function setGrossAmount($gross_amount) { + if (is_null($gross_amount)) { + throw new \InvalidArgumentException('non-nullable gross_amount cannot be null'); + } $this->container['gross_amount'] = $gross_amount; return $this; @@ -234,7 +322,7 @@ public function setGrossAmount($gross_amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NetToGrossRequest.php b/src/lib/Model/NetToGrossRequest.php index 652dc57..e2a1763 100644 --- a/src/lib/Model/NetToGrossRequest.php +++ b/src/lib/Model/NetToGrossRequest.php @@ -2,62 +2,62 @@ /** * NetToGrossRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NetToGrossRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NetToGrossRequest implements ModelInterface, ArrayAccess +class NetToGrossRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NetToGrossRequest'; + protected static $openAPIModelName = 'NetToGrossRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'net_amount' => 'double', + protected static $openAPITypes = [ + 'net_amount' => 'float', 'pay_category_id' => 'int', 'pay_run_total_id' => 'int' ]; @@ -66,21 +66,41 @@ class NetToGrossRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'net_amount' => 'double', 'pay_category_id' => 'int32', 'pay_run_total_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'net_amount' => false, + 'pay_category_id' => false, + 'pay_run_total_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['net_amount'] = isset($data['net_amount']) ? $data['net_amount'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['pay_run_total_id'] = isset($data['pay_run_total_id']) ? $data['pay_run_total_id'] : null; + $this->setIfExists('net_amount', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('pay_run_total_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets net_amount * - * @return double + * @return float|null */ public function getNetAmount() { @@ -229,12 +316,15 @@ public function getNetAmount() /** * Sets net_amount * - * @param double $net_amount + * @param float|null $net_amount * - * @return $this + * @return self */ public function setNetAmount($net_amount) { + if (is_null($net_amount)) { + throw new \InvalidArgumentException('non-nullable net_amount cannot be null'); + } $this->container['net_amount'] = $net_amount; return $this; @@ -243,7 +333,7 @@ public function setNetAmount($net_amount) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -253,12 +343,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -267,7 +360,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets pay_run_total_id * - * @return int + * @return int|null */ public function getPayRunTotalId() { @@ -277,12 +370,15 @@ public function getPayRunTotalId() /** * Sets pay_run_total_id * - * @param int $pay_run_total_id + * @param int|null $pay_run_total_id * - * @return $this + * @return self */ public function setPayRunTotalId($pay_run_total_id) { + if (is_null($pay_run_total_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_total_id cannot be null'); + } $this->container['pay_run_total_id'] = $pay_run_total_id; return $this; @@ -294,7 +390,7 @@ public function setPayRunTotalId($pay_run_total_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NewUserCreatedModel.php b/src/lib/Model/NewUserCreatedModel.php index 08d376b..4ac7d14 100644 --- a/src/lib/Model/NewUserCreatedModel.php +++ b/src/lib/Model/NewUserCreatedModel.php @@ -2,61 +2,61 @@ /** * NewUserCreatedModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NewUserCreatedModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NewUserCreatedModel implements ModelInterface, ArrayAccess +class NewUserCreatedModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NewUserCreatedModel'; + protected static $openAPIModelName = 'NewUserCreatedModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'username' => 'string', 'display_name' => 'string', @@ -70,8 +70,10 @@ class NewUserCreatedModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'username' => null, 'display_name' => null, @@ -81,14 +83,36 @@ class NewUserCreatedModel implements ModelInterface, ArrayAccess 'email_confirmed' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'username' => false, + 'display_name' => false, + 'time_zone' => false, + 'api_key' => false, + 'email' => false, + 'email_confirmed' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['display_name'] = isset($data['display_name']) ? $data['display_name'] : null; - $this->container['time_zone'] = isset($data['time_zone']) ? $data['time_zone'] : null; - $this->container['api_key'] = isset($data['api_key']) ? $data['api_key'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['email_confirmed'] = isset($data['email_confirmed']) ? $data['email_confirmed'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('time_zone', $data ?? [], null); + $this->setIfExists('api_key', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('email_confirmed', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -253,12 +344,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -267,7 +361,7 @@ public function setId($id) /** * Gets username * - * @return string + * @return string|null */ public function getUsername() { @@ -277,12 +371,15 @@ public function getUsername() /** * Sets username * - * @param string $username + * @param string|null $username * - * @return $this + * @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; @@ -291,7 +388,7 @@ public function setUsername($username) /** * Gets display_name * - * @return string + * @return string|null */ public function getDisplayName() { @@ -301,12 +398,15 @@ public function getDisplayName() /** * Sets display_name * - * @param string $display_name + * @param string|null $display_name * - * @return $this + * @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; @@ -315,7 +415,7 @@ public function setDisplayName($display_name) /** * Gets time_zone * - * @return string + * @return string|null */ public function getTimeZone() { @@ -325,12 +425,15 @@ public function getTimeZone() /** * Sets time_zone * - * @param string $time_zone + * @param string|null $time_zone * - * @return $this + * @return self */ public function setTimeZone($time_zone) { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } $this->container['time_zone'] = $time_zone; return $this; @@ -339,7 +442,7 @@ public function setTimeZone($time_zone) /** * Gets api_key * - * @return string + * @return string|null */ public function getApiKey() { @@ -349,12 +452,15 @@ public function getApiKey() /** * Sets api_key * - * @param string $api_key + * @param string|null $api_key * - * @return $this + * @return self */ public function setApiKey($api_key) { + if (is_null($api_key)) { + throw new \InvalidArgumentException('non-nullable api_key cannot be null'); + } $this->container['api_key'] = $api_key; return $this; @@ -363,7 +469,7 @@ public function setApiKey($api_key) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -373,12 +479,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -387,7 +496,7 @@ public function setEmail($email) /** * Gets email_confirmed * - * @return bool + * @return bool|null */ public function getEmailConfirmed() { @@ -397,12 +506,15 @@ public function getEmailConfirmed() /** * Sets email_confirmed * - * @param bool $email_confirmed + * @param bool|null $email_confirmed * - * @return $this + * @return self */ public function setEmailConfirmed($email_confirmed) { + if (is_null($email_confirmed)) { + throw new \InvalidArgumentException('non-nullable email_confirmed cannot be null'); + } $this->container['email_confirmed'] = $email_confirmed; return $this; @@ -414,7 +526,7 @@ public function setEmailConfirmed($email_confirmed) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NewUserModel.php b/src/lib/Model/NewUserModel.php index 8f65f23..3eda652 100644 --- a/src/lib/Model/NewUserModel.php +++ b/src/lib/Model/NewUserModel.php @@ -2,61 +2,61 @@ /** * NewUserModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NewUserModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NewUserModel implements ModelInterface, ArrayAccess +class NewUserModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NewUserModel'; + protected static $openAPIModelName = 'NewUserModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'username' => 'string', 'display_name' => 'string', 'time_zone' => 'string', @@ -69,8 +69,10 @@ class NewUserModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'username' => null, 'display_name' => null, 'time_zone' => null, @@ -79,14 +81,35 @@ class NewUserModel implements ModelInterface, ArrayAccess 'email_confirmed' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'username' => false, + 'display_name' => false, + 'time_zone' => false, + 'api_only' => false, + 'email' => false, + 'email_confirmed' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['display_name'] = isset($data['display_name']) ? $data['display_name'] : null; - $this->container['time_zone'] = isset($data['time_zone']) ? $data['time_zone'] : null; - $this->container['api_only'] = isset($data['api_only']) ? $data['api_only'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['email_confirmed'] = isset($data['email_confirmed']) ? $data['email_confirmed'] : null; + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('time_zone', $data ?? [], null); + $this->setIfExists('api_only', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('email_confirmed', $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; } /** @@ -255,10 +345,13 @@ public function getUsername() * * @param string $username Required * - * @return $this + * @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; @@ -279,10 +372,13 @@ public function getDisplayName() * * @param string $display_name Required * - * @return $this + * @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; @@ -291,7 +387,7 @@ public function setDisplayName($display_name) /** * Gets time_zone * - * @return string + * @return string|null */ public function getTimeZone() { @@ -301,12 +397,15 @@ public function getTimeZone() /** * Sets time_zone * - * @param string $time_zone + * @param string|null $time_zone * - * @return $this + * @return self */ public function setTimeZone($time_zone) { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } $this->container['time_zone'] = $time_zone; return $this; @@ -315,7 +414,7 @@ public function setTimeZone($time_zone) /** * Gets api_only * - * @return bool + * @return bool|null */ public function getApiOnly() { @@ -325,12 +424,15 @@ public function getApiOnly() /** * Sets api_only * - * @param bool $api_only + * @param bool|null $api_only * - * @return $this + * @return self */ public function setApiOnly($api_only) { + if (is_null($api_only)) { + throw new \InvalidArgumentException('non-nullable api_only cannot be null'); + } $this->container['api_only'] = $api_only; return $this; @@ -339,7 +441,7 @@ public function setApiOnly($api_only) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -349,12 +451,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -363,7 +468,7 @@ public function setEmail($email) /** * Gets email_confirmed * - * @return bool + * @return bool|null */ public function getEmailConfirmed() { @@ -373,12 +478,15 @@ public function getEmailConfirmed() /** * Sets email_confirmed * - * @param bool $email_confirmed + * @param bool|null $email_confirmed * - * @return $this + * @return self */ public function setEmailConfirmed($email_confirmed) { + if (is_null($email_confirmed)) { + throw new \InvalidArgumentException('non-nullable email_confirmed cannot be null'); + } $this->container['email_confirmed'] = $email_confirmed; return $this; @@ -390,7 +498,7 @@ public function setEmailConfirmed($email_confirmed) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -400,22 +508,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -431,11 +540,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -443,13 +565,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NominalClassification.php b/src/lib/Model/NominalClassification.php index 865ab2f..58448b1 100644 --- a/src/lib/Model/NominalClassification.php +++ b/src/lib/Model/NominalClassification.php @@ -2,61 +2,61 @@ /** * NominalClassification * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NominalClassification Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NominalClassification implements ModelInterface, ArrayAccess +class NominalClassification implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NominalClassification'; + protected static $openAPIModelName = 'NominalClassification'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'rank' => 'int', 'name' => 'string' @@ -66,21 +66,41 @@ class NominalClassification implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'rank' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'rank' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['rank'] = isset($data['rank']) ? $data['rank'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('rank', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets rank * - * @return int + * @return int|null */ public function getRank() { @@ -253,12 +343,15 @@ public function getRank() /** * Sets rank * - * @param int $rank + * @param int|null $rank * - * @return $this + * @return self */ public function setRank($rank) { + if (is_null($rank)) { + throw new \InvalidArgumentException('non-nullable rank cannot be null'); + } $this->container['rank'] = $rank; return $this; @@ -267,7 +360,7 @@ public function setRank($rank) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -277,12 +370,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -294,7 +390,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NominalLeaveCategory.php b/src/lib/Model/NominalLeaveCategory.php index b1be6f3..e510ee0 100644 --- a/src/lib/Model/NominalLeaveCategory.php +++ b/src/lib/Model/NominalLeaveCategory.php @@ -2,61 +2,61 @@ /** * NominalLeaveCategory * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NominalLeaveCategory Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NominalLeaveCategory implements ModelInterface, ArrayAccess +class NominalLeaveCategory implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NominalLeaveCategory'; + protected static $openAPIModelName = 'NominalLeaveCategory'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class NominalLeaveCategory implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NominalLocation.php b/src/lib/Model/NominalLocation.php index de1a634..570fec5 100644 --- a/src/lib/Model/NominalLocation.php +++ b/src/lib/Model/NominalLocation.php @@ -2,61 +2,61 @@ /** * NominalLocation * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NominalLocation Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NominalLocation implements ModelInterface, ArrayAccess +class NominalLocation implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NominalLocation'; + protected static $openAPIModelName = 'NominalLocation'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'state' => 'string' @@ -66,21 +66,41 @@ class NominalLocation implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'state' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -277,12 +370,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -294,7 +390,7 @@ public function setState($state) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NominalWorkType.php b/src/lib/Model/NominalWorkType.php index 2fc0e74..cc6d036 100644 --- a/src/lib/Model/NominalWorkType.php +++ b/src/lib/Model/NominalWorkType.php @@ -2,61 +2,61 @@ /** * NominalWorkType * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NominalWorkType Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NominalWorkType implements ModelInterface, ArrayAccess +class NominalWorkType implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NominalWorkType'; + protected static $openAPIModelName = 'NominalWorkType'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'link_type' => 'string' @@ -66,21 +66,41 @@ class NominalWorkType implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'link_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'link_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,15 +237,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const LINK_TYPE_PAY_CATEGORY = 'PayCategory'; - const LINK_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; - const LINK_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - + public const LINK_TYPE_PAY_CATEGORY = 'PayCategory'; + public const LINK_TYPE_LEAVE_CATEGORY = 'LeaveCategory'; + public const LINK_TYPE_SHIFT_CONDITION = 'ShiftCondition'; - /** * Gets allowable values of the enum * @@ -187,7 +257,6 @@ public function getLinkTypeAllowableValues() self::LINK_TYPE_SHIFT_CONDITION, ]; } - /** * Associative array for storing property values @@ -204,9 +273,27 @@ public function getLinkTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['link_type'] = isset($data['link_type']) ? $data['link_type'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('link_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; } /** @@ -221,7 +308,8 @@ public function listInvalidProperties() $allowedValues = $this->getLinkTypeAllowableValues(); if (!is_null($this->container['link_type']) && !in_array($this->container['link_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'link_type', must be one of '%s'", + "invalid value '%s' for 'link_type', must be one of '%s'", + $this->container['link_type'], implode("', '", $allowedValues) ); } @@ -244,7 +332,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -254,12 +342,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -268,7 +359,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -278,12 +369,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -292,7 +386,7 @@ public function setName($name) /** * Gets link_type * - * @return string + * @return string|null */ public function getLinkType() { @@ -302,17 +396,21 @@ public function getLinkType() /** * Sets link_type * - * @param string $link_type + * @param string|null $link_type * - * @return $this + * @return self */ public function setLinkType($link_type) { + if (is_null($link_type)) { + throw new \InvalidArgumentException('non-nullable link_type cannot be null'); + } $allowedValues = $this->getLinkTypeAllowableValues(); - if (!is_null($link_type) && !in_array($link_type, $allowedValues, true)) { + if (!in_array($link_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'link_type', must be one of '%s'", + "Invalid value '%s' for 'link_type', must be one of '%s'", + $link_type, implode("', '", $allowedValues) ) ); @@ -328,7 +426,7 @@ public function setLinkType($link_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -338,22 +436,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -369,11 +468,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -381,13 +493,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/NumericSelectListItem.php b/src/lib/Model/NumericSelectListItem.php index 05913da..a4647f0 100644 --- a/src/lib/Model/NumericSelectListItem.php +++ b/src/lib/Model/NumericSelectListItem.php @@ -2,61 +2,61 @@ /** * NumericSelectListItem * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * NumericSelectListItem Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class NumericSelectListItem implements ModelInterface, ArrayAccess +class NumericSelectListItem implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'NumericSelectListItem'; + protected static $openAPIModelName = 'NumericSelectListItem'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'value' => 'int', 'text' => 'string' ]; @@ -65,20 +65,39 @@ class NumericSelectListItem implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'value' => 'int64', 'text' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'value' => false, + 'text' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['text'] = isset($data['text']) ? $data['text'] : null; + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('text', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets value * - * @return int + * @return int|null */ public function getValue() { @@ -223,12 +309,15 @@ public function getValue() /** * Sets value * - * @param int $value + * @param int|null $value * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setValue($value) /** * Gets text * - * @return string + * @return string|null */ public function getText() { @@ -247,12 +336,15 @@ public function getText() /** * Sets text * - * @param string $text + * @param string|null $text * - * @return $this + * @return self */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -264,7 +356,7 @@ public function setText($text) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryContext.php b/src/lib/Model/ODataQueryContext.php index 96a87a4..8ffb3de 100644 --- a/src/lib/Model/ODataQueryContext.php +++ b/src/lib/Model/ODataQueryContext.php @@ -2,63 +2,63 @@ /** * ODataQueryContext * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryContext Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryContext implements ModelInterface, ArrayAccess +class ODataQueryContext implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryContext'; + protected static $openAPIModelName = 'ODataQueryContext'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'model' => '\Swagger\Client\Model\IEdmModel', - 'element_type' => '\Swagger\Client\Model\IEdmType', + protected static $openAPITypes = [ + 'model' => '\OpenAPI\Client\Model\IEdmModel', + 'element_type' => '\OpenAPI\Client\Model\IEdmType', 'element_clr_type' => 'string' ]; @@ -66,21 +66,41 @@ class ODataQueryContext implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'model' => null, 'element_type' => null, 'element_clr_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'model' => false, + 'element_type' => false, + 'element_clr_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['model'] = isset($data['model']) ? $data['model'] : null; - $this->container['element_type'] = isset($data['element_type']) ? $data['element_type'] : null; - $this->container['element_clr_type'] = isset($data['element_clr_type']) ? $data['element_clr_type'] : null; + $this->setIfExists('model', $data ?? [], null); + $this->setIfExists('element_type', $data ?? [], null); + $this->setIfExists('element_clr_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets model * - * @return \Swagger\Client\Model\IEdmModel + * @return \OpenAPI\Client\Model\IEdmModel|null */ public function getModel() { @@ -229,12 +316,15 @@ public function getModel() /** * Sets model * - * @param \Swagger\Client\Model\IEdmModel $model + * @param \OpenAPI\Client\Model\IEdmModel|null $model model * - * @return $this + * @return self */ public function setModel($model) { + if (is_null($model)) { + throw new \InvalidArgumentException('non-nullable model cannot be null'); + } $this->container['model'] = $model; return $this; @@ -243,7 +333,7 @@ public function setModel($model) /** * Gets element_type * - * @return \Swagger\Client\Model\IEdmType + * @return \OpenAPI\Client\Model\IEdmType|null */ public function getElementType() { @@ -253,12 +343,15 @@ public function getElementType() /** * Sets element_type * - * @param \Swagger\Client\Model\IEdmType $element_type + * @param \OpenAPI\Client\Model\IEdmType|null $element_type element_type * - * @return $this + * @return self */ public function setElementType($element_type) { + if (is_null($element_type)) { + throw new \InvalidArgumentException('non-nullable element_type cannot be null'); + } $this->container['element_type'] = $element_type; return $this; @@ -267,7 +360,7 @@ public function setElementType($element_type) /** * Gets element_clr_type * - * @return string + * @return string|null */ public function getElementClrType() { @@ -277,12 +370,15 @@ public function getElementClrType() /** * Sets element_clr_type * - * @param string $element_clr_type + * @param string|null $element_clr_type * - * @return $this + * @return self */ public function setElementClrType($element_clr_type) { + if (is_null($element_clr_type)) { + throw new \InvalidArgumentException('non-nullable element_clr_type cannot be null'); + } $this->container['element_clr_type'] = $element_clr_type; return $this; @@ -294,7 +390,7 @@ public function setElementClrType($element_clr_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfAbaDetails.php b/src/lib/Model/ODataQueryOptionsOfAbaDetails.php index 6585940..77c5b07 100644 --- a/src/lib/Model/ODataQueryOptionsOfAbaDetails.php +++ b/src/lib/Model/ODataQueryOptionsOfAbaDetails.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfAbaDetails * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfAbaDetails Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfAbaDetails implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfAbaDetails implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfAbaDetails'; + protected static $openAPIModelName = 'ODataQueryOptionsOfAbaDetails'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfAbaDetails implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfAuUnstructuredEmployeeModel.php b/src/lib/Model/ODataQueryOptionsOfAuUnstructuredEmployeeModel.php index ca4b7e6..346bafc 100644 --- a/src/lib/Model/ODataQueryOptionsOfAuUnstructuredEmployeeModel.php +++ b/src/lib/Model/ODataQueryOptionsOfAuUnstructuredEmployeeModel.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfAuUnstructuredEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfAuUnstructuredEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfAuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfAuUnstructuredEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfAuUnstructuredEmployeeModel'; + protected static $openAPIModelName = 'ODataQueryOptionsOfAuUnstructuredEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfAuUnstructuredEmployeeModel implements ModelInterface, 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfBusiness.php b/src/lib/Model/ODataQueryOptionsOfBusiness.php index 5c38497..a0a97e9 100644 --- a/src/lib/Model/ODataQueryOptionsOfBusiness.php +++ b/src/lib/Model/ODataQueryOptionsOfBusiness.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfBusiness * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfBusiness Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfBusiness implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfBusiness implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfBusiness'; + protected static $openAPIModelName = 'ODataQueryOptionsOfBusiness'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfBusiness implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfDeductionCategory.php b/src/lib/Model/ODataQueryOptionsOfDeductionCategory.php index 9819ea2..fa7fd9c 100644 --- a/src/lib/Model/ODataQueryOptionsOfDeductionCategory.php +++ b/src/lib/Model/ODataQueryOptionsOfDeductionCategory.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfDeductionCategory * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfDeductionCategory Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfDeductionCategory implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfDeductionCategory implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfDeductionCategory'; + protected static $openAPIModelName = 'ODataQueryOptionsOfDeductionCategory'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfDeductionCategory implements ModelInterface, ArrayAcces 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfEmployee.php b/src/lib/Model/ODataQueryOptionsOfEmployee.php index 18a8353..a8d658a 100644 --- a/src/lib/Model/ODataQueryOptionsOfEmployee.php +++ b/src/lib/Model/ODataQueryOptionsOfEmployee.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfEmployee * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfEmployee Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfEmployee implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfEmployee implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfEmployee'; + protected static $openAPIModelName = 'ODataQueryOptionsOfEmployee'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfEmployee implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseCategory.php b/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseCategory.php index ebaf9b5..5922f3e 100644 --- a/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseCategory.php +++ b/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseCategory.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfEmployeeExpenseCategory * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfEmployeeExpenseCategory Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfEmployeeExpenseCategory implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfEmployeeExpenseCategory implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfEmployeeExpenseCategory'; + protected static $openAPIModelName = 'ODataQueryOptionsOfEmployeeExpenseCategory'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfEmployeeExpenseCategory implements ModelInterface, Arra 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseRequest.php b/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseRequest.php index 92f85cc..661d862 100644 --- a/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseRequest.php +++ b/src/lib/Model/ODataQueryOptionsOfEmployeeExpenseRequest.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfEmployeeExpenseRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfEmployeeExpenseRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfEmployeeExpenseRequest implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfEmployeeExpenseRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfEmployeeExpenseRequest'; + protected static $openAPIModelName = 'ODataQueryOptionsOfEmployeeExpenseRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfEmployeeExpenseRequest implements ModelInterface, Array 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfEmployerLiabilityCategory.php b/src/lib/Model/ODataQueryOptionsOfEmployerLiabilityCategory.php index 92823d2..9ec5448 100644 --- a/src/lib/Model/ODataQueryOptionsOfEmployerLiabilityCategory.php +++ b/src/lib/Model/ODataQueryOptionsOfEmployerLiabilityCategory.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfEmployerLiabilityCategory * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfEmployerLiabilityCategory Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfEmployerLiabilityCategory implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfEmployerLiabilityCategory implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfEmployerLiabilityCategory'; + protected static $openAPIModelName = 'ODataQueryOptionsOfEmployerLiabilityCategory'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfEmployerLiabilityCategory implements ModelInterface, Ar 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfEmployingEntity.php b/src/lib/Model/ODataQueryOptionsOfEmployingEntity.php index 8917925..feadf58 100644 --- a/src/lib/Model/ODataQueryOptionsOfEmployingEntity.php +++ b/src/lib/Model/ODataQueryOptionsOfEmployingEntity.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfEmployingEntity * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfEmployingEntity Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfEmployingEntity implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfEmployingEntity implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfEmployingEntity'; + protected static $openAPIModelName = 'ODataQueryOptionsOfEmployingEntity'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfEmployingEntity implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfEmploymentAgreement.php b/src/lib/Model/ODataQueryOptionsOfEmploymentAgreement.php index a2b9fc6..6fd192c 100644 --- a/src/lib/Model/ODataQueryOptionsOfEmploymentAgreement.php +++ b/src/lib/Model/ODataQueryOptionsOfEmploymentAgreement.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfEmploymentAgreement * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfEmploymentAgreement Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfEmploymentAgreement implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfEmploymentAgreement implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfEmploymentAgreement'; + protected static $openAPIModelName = 'ODataQueryOptionsOfEmploymentAgreement'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfEmploymentAgreement implements ModelInterface, ArrayAcc 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfHourLeaveRequestQueryModel.php b/src/lib/Model/ODataQueryOptionsOfHourLeaveRequestQueryModel.php index 3f067e2..ad81c6d 100644 --- a/src/lib/Model/ODataQueryOptionsOfHourLeaveRequestQueryModel.php +++ b/src/lib/Model/ODataQueryOptionsOfHourLeaveRequestQueryModel.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfHourLeaveRequestQueryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfHourLeaveRequestQueryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfHourLeaveRequestQueryModel implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfHourLeaveRequestQueryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfHourLeaveRequestQueryModel'; + protected static $openAPIModelName = 'ODataQueryOptionsOfHourLeaveRequestQueryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfHourLeaveRequestQueryModel implements ModelInterface, A 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfLeaveAllowanceTemplate.php b/src/lib/Model/ODataQueryOptionsOfLeaveAllowanceTemplate.php index c71d573..abe012b 100644 --- a/src/lib/Model/ODataQueryOptionsOfLeaveAllowanceTemplate.php +++ b/src/lib/Model/ODataQueryOptionsOfLeaveAllowanceTemplate.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfLeaveAllowanceTemplate * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfLeaveAllowanceTemplate Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfLeaveAllowanceTemplate implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfLeaveAllowanceTemplate implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfLeaveAllowanceTemplate'; + protected static $openAPIModelName = 'ODataQueryOptionsOfLeaveAllowanceTemplate'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfLeaveAllowanceTemplate implements ModelInterface, Array 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfLeaveCategory.php b/src/lib/Model/ODataQueryOptionsOfLeaveCategory.php index 6ef05b7..eb0516e 100644 --- a/src/lib/Model/ODataQueryOptionsOfLeaveCategory.php +++ b/src/lib/Model/ODataQueryOptionsOfLeaveCategory.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfLeaveCategory * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfLeaveCategory Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfLeaveCategory implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfLeaveCategory implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfLeaveCategory'; + protected static $openAPIModelName = 'ODataQueryOptionsOfLeaveCategory'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfLeaveCategory implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfLocation.php b/src/lib/Model/ODataQueryOptionsOfLocation.php index 47f3dd6..68a6fe7 100644 --- a/src/lib/Model/ODataQueryOptionsOfLocation.php +++ b/src/lib/Model/ODataQueryOptionsOfLocation.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfLocation * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfLocation Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfLocation implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfLocation implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfLocation'; + protected static $openAPIModelName = 'ODataQueryOptionsOfLocation'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfLocation implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfPayCategory.php b/src/lib/Model/ODataQueryOptionsOfPayCategory.php index 3f3fabd..c47408f 100644 --- a/src/lib/Model/ODataQueryOptionsOfPayCategory.php +++ b/src/lib/Model/ODataQueryOptionsOfPayCategory.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfPayCategory * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfPayCategory Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfPayCategory implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfPayCategory implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfPayCategory'; + protected static $openAPIModelName = 'ODataQueryOptionsOfPayCategory'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfPayCategory implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfPayCycle.php b/src/lib/Model/ODataQueryOptionsOfPayCycle.php index a292238..f3d46ff 100644 --- a/src/lib/Model/ODataQueryOptionsOfPayCycle.php +++ b/src/lib/Model/ODataQueryOptionsOfPayCycle.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfPayCycle * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfPayCycle Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfPayCycle implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfPayCycle implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfPayCycle'; + protected static $openAPIModelName = 'ODataQueryOptionsOfPayCycle'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfPayCycle implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfPayRateTemplate.php b/src/lib/Model/ODataQueryOptionsOfPayRateTemplate.php index 1874a18..fac76ef 100644 --- a/src/lib/Model/ODataQueryOptionsOfPayRateTemplate.php +++ b/src/lib/Model/ODataQueryOptionsOfPayRateTemplate.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfPayRateTemplate * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfPayRateTemplate Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfPayRateTemplate implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfPayRateTemplate implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfPayRateTemplate'; + protected static $openAPIModelName = 'ODataQueryOptionsOfPayRateTemplate'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfPayRateTemplate implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfPayRun.php b/src/lib/Model/ODataQueryOptionsOfPayRun.php index 8084d2d..c1e4a1d 100644 --- a/src/lib/Model/ODataQueryOptionsOfPayRun.php +++ b/src/lib/Model/ODataQueryOptionsOfPayRun.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfPayRun * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfPayRun Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfPayRun implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfPayRun implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfPayRun'; + protected static $openAPIModelName = 'ODataQueryOptionsOfPayRun'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfPayRun implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfPaygPaymentSummarySnapshot.php b/src/lib/Model/ODataQueryOptionsOfPaygPaymentSummarySnapshot.php index 75f8e7f..e22fb01 100644 --- a/src/lib/Model/ODataQueryOptionsOfPaygPaymentSummarySnapshot.php +++ b/src/lib/Model/ODataQueryOptionsOfPaygPaymentSummarySnapshot.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfPaygPaymentSummarySnapshot * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfPaygPaymentSummarySnapshot Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfPaygPaymentSummarySnapshot implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfPaygPaymentSummarySnapshot implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfPaygPaymentSummarySnapshot'; + protected static $openAPIModelName = 'ODataQueryOptionsOfPaygPaymentSummarySnapshot'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfPaygPaymentSummarySnapshot implements ModelInterface, A 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfQualification.php b/src/lib/Model/ODataQueryOptionsOfQualification.php index 27f8b00..e6f7270 100644 --- a/src/lib/Model/ODataQueryOptionsOfQualification.php +++ b/src/lib/Model/ODataQueryOptionsOfQualification.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfQualification * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfQualification Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfQualification implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfQualification implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfQualification'; + protected static $openAPIModelName = 'ODataQueryOptionsOfQualification'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfQualification implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfReportingDimension.php b/src/lib/Model/ODataQueryOptionsOfReportingDimension.php index 6e6ddf1..a68c922 100644 --- a/src/lib/Model/ODataQueryOptionsOfReportingDimension.php +++ b/src/lib/Model/ODataQueryOptionsOfReportingDimension.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfReportingDimension * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfReportingDimension Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfReportingDimension implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfReportingDimension implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfReportingDimension'; + protected static $openAPIModelName = 'ODataQueryOptionsOfReportingDimension'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfReportingDimension implements ModelInterface, ArrayAcce 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfReportingDimensionValue.php b/src/lib/Model/ODataQueryOptionsOfReportingDimensionValue.php index 06b472c..0558b5f 100644 --- a/src/lib/Model/ODataQueryOptionsOfReportingDimensionValue.php +++ b/src/lib/Model/ODataQueryOptionsOfReportingDimensionValue.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfReportingDimensionValue * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfReportingDimensionValue Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfReportingDimensionValue implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfReportingDimensionValue implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfReportingDimensionValue'; + protected static $openAPIModelName = 'ODataQueryOptionsOfReportingDimensionValue'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfReportingDimensionValue implements ModelInterface, Arra 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfSelfManagedSuperFund.php b/src/lib/Model/ODataQueryOptionsOfSelfManagedSuperFund.php index 2baf79e..05a9edf 100644 --- a/src/lib/Model/ODataQueryOptionsOfSelfManagedSuperFund.php +++ b/src/lib/Model/ODataQueryOptionsOfSelfManagedSuperFund.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfSelfManagedSuperFund * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfSelfManagedSuperFund Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfSelfManagedSuperFund implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfSelfManagedSuperFund implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfSelfManagedSuperFund'; + protected static $openAPIModelName = 'ODataQueryOptionsOfSelfManagedSuperFund'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfSelfManagedSuperFund implements ModelInterface, ArrayAc 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfTimesheetLine.php b/src/lib/Model/ODataQueryOptionsOfTimesheetLine.php index efbcb18..70312ec 100644 --- a/src/lib/Model/ODataQueryOptionsOfTimesheetLine.php +++ b/src/lib/Model/ODataQueryOptionsOfTimesheetLine.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfTimesheetLine * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfTimesheetLine Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfTimesheetLine implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfTimesheetLine implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfTimesheetLine'; + protected static $openAPIModelName = 'ODataQueryOptionsOfTimesheetLine'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfTimesheetLine implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryOptionsOfWorkType.php b/src/lib/Model/ODataQueryOptionsOfWorkType.php index 1669de2..d293adb 100644 --- a/src/lib/Model/ODataQueryOptionsOfWorkType.php +++ b/src/lib/Model/ODataQueryOptionsOfWorkType.php @@ -2,81 +2,83 @@ /** * ODataQueryOptionsOfWorkType * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataQueryOptionsOfWorkType Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataQueryOptionsOfWorkType implements ModelInterface, ArrayAccess +class ODataQueryOptionsOfWorkType implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataQueryOptionsOfWorkType'; + protected static $openAPIModelName = 'ODataQueryOptionsOfWorkType'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'if_match' => 'object', 'if_none_match' => 'object', - 'context' => '\Swagger\Client\Model\ODataQueryContext', + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'request' => 'object', - 'raw_values' => '\Swagger\Client\Model\ODataRawQueryOptions', - 'select_expand' => '\Swagger\Client\Model\SelectExpandQueryOption', - 'filter' => '\Swagger\Client\Model\FilterQueryOption', - 'order_by' => '\Swagger\Client\Model\OrderByQueryOption', - 'skip' => '\Swagger\Client\Model\SkipQueryOption', - 'top' => '\Swagger\Client\Model\TopQueryOption', - 'inline_count' => '\Swagger\Client\Model\InlineCountQueryOption', - 'validator' => '\Swagger\Client\Model\ODataQueryValidator' + 'raw_values' => '\OpenAPI\Client\Model\ODataRawQueryOptions', + 'select_expand' => '\OpenAPI\Client\Model\SelectExpandQueryOption', + 'filter' => '\OpenAPI\Client\Model\FilterQueryOption', + 'order_by' => '\OpenAPI\Client\Model\OrderByQueryOption', + 'skip' => '\OpenAPI\Client\Model\SkipQueryOption', + 'top' => '\OpenAPI\Client\Model\TopQueryOption', + 'inline_count' => '\OpenAPI\Client\Model\InlineCountQueryOption', + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'if_match' => null, 'if_none_match' => null, 'context' => null, @@ -91,14 +93,41 @@ class ODataQueryOptionsOfWorkType implements ModelInterface, ArrayAccess 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'if_match' => false, + 'if_none_match' => false, + 'context' => false, + 'request' => false, + 'raw_values' => false, + 'select_expand' => false, + 'filter' => false, + 'order_by' => false, + 'skip' => false, + 'top' => false, + 'inline_count' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['if_match'] = isset($data['if_match']) ? $data['if_match'] : null; - $this->container['if_none_match'] = isset($data['if_none_match']) ? $data['if_none_match'] : null; - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['request'] = isset($data['request']) ? $data['request'] : null; - $this->container['raw_values'] = isset($data['raw_values']) ? $data['raw_values'] : null; - $this->container['select_expand'] = isset($data['select_expand']) ? $data['select_expand'] : null; - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('if_match', $data ?? [], null); + $this->setIfExists('if_none_match', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('request', $data ?? [], null); + $this->setIfExists('raw_values', $data ?? [], null); + $this->setIfExists('select_expand', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets if_match * - * @return object + * @return object|null */ public function getIfMatch() { @@ -283,12 +379,15 @@ public function getIfMatch() /** * Sets if_match * - * @param object $if_match + * @param object|null $if_match * - * @return $this + * @return self */ public function setIfMatch($if_match) { + if (is_null($if_match)) { + throw new \InvalidArgumentException('non-nullable if_match cannot be null'); + } $this->container['if_match'] = $if_match; return $this; @@ -297,7 +396,7 @@ public function setIfMatch($if_match) /** * Gets if_none_match * - * @return object + * @return object|null */ public function getIfNoneMatch() { @@ -307,12 +406,15 @@ public function getIfNoneMatch() /** * Sets if_none_match * - * @param object $if_none_match + * @param object|null $if_none_match * - * @return $this + * @return self */ public function setIfNoneMatch($if_none_match) { + if (is_null($if_none_match)) { + throw new \InvalidArgumentException('non-nullable if_none_match cannot be null'); + } $this->container['if_none_match'] = $if_none_match; return $this; @@ -321,7 +423,7 @@ public function setIfNoneMatch($if_none_match) /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -331,12 +433,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,7 +450,7 @@ public function setContext($context) /** * Gets request * - * @return object + * @return object|null */ public function getRequest() { @@ -355,12 +460,15 @@ public function getRequest() /** * Sets request * - * @param object $request + * @param object|null $request * - * @return $this + * @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; @@ -369,7 +477,7 @@ public function setRequest($request) /** * Gets raw_values * - * @return \Swagger\Client\Model\ODataRawQueryOptions + * @return \OpenAPI\Client\Model\ODataRawQueryOptions|null */ public function getRawValues() { @@ -379,12 +487,15 @@ public function getRawValues() /** * Sets raw_values * - * @param \Swagger\Client\Model\ODataRawQueryOptions $raw_values + * @param \OpenAPI\Client\Model\ODataRawQueryOptions|null $raw_values raw_values * - * @return $this + * @return self */ public function setRawValues($raw_values) { + if (is_null($raw_values)) { + throw new \InvalidArgumentException('non-nullable raw_values cannot be null'); + } $this->container['raw_values'] = $raw_values; return $this; @@ -393,7 +504,7 @@ public function setRawValues($raw_values) /** * Gets select_expand * - * @return \Swagger\Client\Model\SelectExpandQueryOption + * @return \OpenAPI\Client\Model\SelectExpandQueryOption|null */ public function getSelectExpand() { @@ -403,12 +514,15 @@ public function getSelectExpand() /** * Sets select_expand * - * @param \Swagger\Client\Model\SelectExpandQueryOption $select_expand + * @param \OpenAPI\Client\Model\SelectExpandQueryOption|null $select_expand select_expand * - * @return $this + * @return self */ public function setSelectExpand($select_expand) { + if (is_null($select_expand)) { + throw new \InvalidArgumentException('non-nullable select_expand cannot be null'); + } $this->container['select_expand'] = $select_expand; return $this; @@ -417,7 +531,7 @@ public function setSelectExpand($select_expand) /** * Gets filter * - * @return \Swagger\Client\Model\FilterQueryOption + * @return \OpenAPI\Client\Model\FilterQueryOption|null */ public function getFilter() { @@ -427,12 +541,15 @@ public function getFilter() /** * Sets filter * - * @param \Swagger\Client\Model\FilterQueryOption $filter + * @param \OpenAPI\Client\Model\FilterQueryOption|null $filter filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -441,7 +558,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return \Swagger\Client\Model\OrderByQueryOption + * @return \OpenAPI\Client\Model\OrderByQueryOption|null */ public function getOrderBy() { @@ -451,12 +568,15 @@ public function getOrderBy() /** * Sets order_by * - * @param \Swagger\Client\Model\OrderByQueryOption $order_by + * @param \OpenAPI\Client\Model\OrderByQueryOption|null $order_by order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -465,7 +585,7 @@ public function setOrderBy($order_by) /** * Gets skip * - * @return \Swagger\Client\Model\SkipQueryOption + * @return \OpenAPI\Client\Model\SkipQueryOption|null */ public function getSkip() { @@ -475,12 +595,15 @@ public function getSkip() /** * Sets skip * - * @param \Swagger\Client\Model\SkipQueryOption $skip + * @param \OpenAPI\Client\Model\SkipQueryOption|null $skip skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -489,7 +612,7 @@ public function setSkip($skip) /** * Gets top * - * @return \Swagger\Client\Model\TopQueryOption + * @return \OpenAPI\Client\Model\TopQueryOption|null */ public function getTop() { @@ -499,12 +622,15 @@ public function getTop() /** * Sets top * - * @param \Swagger\Client\Model\TopQueryOption $top + * @param \OpenAPI\Client\Model\TopQueryOption|null $top top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -513,7 +639,7 @@ public function setTop($top) /** * Gets inline_count * - * @return \Swagger\Client\Model\InlineCountQueryOption + * @return \OpenAPI\Client\Model\InlineCountQueryOption|null */ public function getInlineCount() { @@ -523,12 +649,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param \Swagger\Client\Model\InlineCountQueryOption $inline_count + * @param \OpenAPI\Client\Model\InlineCountQueryOption|null $inline_count inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -537,7 +666,7 @@ public function setInlineCount($inline_count) /** * Gets validator * - * @return \Swagger\Client\Model\ODataQueryValidator + * @return object|null */ public function getValidator() { @@ -547,12 +676,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\ODataQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -564,7 +696,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ODataQueryValidator.php b/src/lib/Model/ODataQueryValidator.php deleted file mode 100644 index 3fef1ca..0000000 --- a/src/lib/Model/ODataQueryValidator.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/ODataRawQueryOptions.php b/src/lib/Model/ODataRawQueryOptions.php index c234873..98e73cf 100644 --- a/src/lib/Model/ODataRawQueryOptions.php +++ b/src/lib/Model/ODataRawQueryOptions.php @@ -2,61 +2,61 @@ /** * ODataRawQueryOptions * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ODataRawQueryOptions Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ODataRawQueryOptions implements ModelInterface, ArrayAccess +class ODataRawQueryOptions implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ODataRawQueryOptions'; + protected static $openAPIModelName = 'ODataRawQueryOptions'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'filter' => 'string', 'order_by' => 'string', 'top' => 'string', @@ -72,8 +72,10 @@ class ODataRawQueryOptions implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'filter' => null, 'order_by' => null, 'top' => null, @@ -85,14 +87,38 @@ class ODataRawQueryOptions implements ModelInterface, ArrayAccess 'skip_token' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filter' => false, + 'order_by' => false, + 'top' => false, + 'skip' => false, + 'select' => false, + 'expand' => false, + 'inline_count' => false, + 'format' => false, + 'skip_token' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filter'] = isset($data['filter']) ? $data['filter'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; - $this->container['top'] = isset($data['top']) ? $data['top'] : null; - $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; - $this->container['select'] = isset($data['select']) ? $data['select'] : null; - $this->container['expand'] = isset($data['expand']) ? $data['expand'] : null; - $this->container['inline_count'] = isset($data['inline_count']) ? $data['inline_count'] : null; - $this->container['format'] = isset($data['format']) ? $data['format'] : null; - $this->container['skip_token'] = isset($data['skip_token']) ? $data['skip_token'] : null; + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('top', $data ?? [], null); + $this->setIfExists('skip', $data ?? [], null); + $this->setIfExists('select', $data ?? [], null); + $this->setIfExists('expand', $data ?? [], null); + $this->setIfExists('inline_count', $data ?? [], null); + $this->setIfExists('format', $data ?? [], null); + $this->setIfExists('skip_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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets filter * - * @return string + * @return string|null */ public function getFilter() { @@ -265,12 +358,15 @@ public function getFilter() /** * Sets filter * - * @param string $filter + * @param string|null $filter * - * @return $this + * @return self */ public function setFilter($filter) { + if (is_null($filter)) { + throw new \InvalidArgumentException('non-nullable filter cannot be null'); + } $this->container['filter'] = $filter; return $this; @@ -279,7 +375,7 @@ public function setFilter($filter) /** * Gets order_by * - * @return string + * @return string|null */ public function getOrderBy() { @@ -289,12 +385,15 @@ public function getOrderBy() /** * Sets order_by * - * @param string $order_by + * @param string|null $order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $this->container['order_by'] = $order_by; return $this; @@ -303,7 +402,7 @@ public function setOrderBy($order_by) /** * Gets top * - * @return string + * @return string|null */ public function getTop() { @@ -313,12 +412,15 @@ public function getTop() /** * Sets top * - * @param string $top + * @param string|null $top * - * @return $this + * @return self */ public function setTop($top) { + if (is_null($top)) { + throw new \InvalidArgumentException('non-nullable top cannot be null'); + } $this->container['top'] = $top; return $this; @@ -327,7 +429,7 @@ public function setTop($top) /** * Gets skip * - * @return string + * @return string|null */ public function getSkip() { @@ -337,12 +439,15 @@ public function getSkip() /** * Sets skip * - * @param string $skip + * @param string|null $skip * - * @return $this + * @return self */ public function setSkip($skip) { + if (is_null($skip)) { + throw new \InvalidArgumentException('non-nullable skip cannot be null'); + } $this->container['skip'] = $skip; return $this; @@ -351,7 +456,7 @@ public function setSkip($skip) /** * Gets select * - * @return string + * @return string|null */ public function getSelect() { @@ -361,12 +466,15 @@ public function getSelect() /** * Sets select * - * @param string $select + * @param string|null $select * - * @return $this + * @return self */ public function setSelect($select) { + if (is_null($select)) { + throw new \InvalidArgumentException('non-nullable select cannot be null'); + } $this->container['select'] = $select; return $this; @@ -375,7 +483,7 @@ public function setSelect($select) /** * Gets expand * - * @return string + * @return string|null */ public function getExpand() { @@ -385,12 +493,15 @@ public function getExpand() /** * Sets expand * - * @param string $expand + * @param string|null $expand * - * @return $this + * @return self */ public function setExpand($expand) { + if (is_null($expand)) { + throw new \InvalidArgumentException('non-nullable expand cannot be null'); + } $this->container['expand'] = $expand; return $this; @@ -399,7 +510,7 @@ public function setExpand($expand) /** * Gets inline_count * - * @return string + * @return string|null */ public function getInlineCount() { @@ -409,12 +520,15 @@ public function getInlineCount() /** * Sets inline_count * - * @param string $inline_count + * @param string|null $inline_count * - * @return $this + * @return self */ public function setInlineCount($inline_count) { + if (is_null($inline_count)) { + throw new \InvalidArgumentException('non-nullable inline_count cannot be null'); + } $this->container['inline_count'] = $inline_count; return $this; @@ -423,7 +537,7 @@ public function setInlineCount($inline_count) /** * Gets format * - * @return string + * @return string|null */ public function getFormat() { @@ -433,12 +547,15 @@ public function getFormat() /** * Sets format * - * @param string $format + * @param string|null $format * - * @return $this + * @return self */ public function setFormat($format) { + if (is_null($format)) { + throw new \InvalidArgumentException('non-nullable format cannot be null'); + } $this->container['format'] = $format; return $this; @@ -447,7 +564,7 @@ public function setFormat($format) /** * Gets skip_token * - * @return string + * @return string|null */ public function getSkipToken() { @@ -457,12 +574,15 @@ public function getSkipToken() /** * Sets skip_token * - * @param string $skip_token + * @param string|null $skip_token * - * @return $this + * @return self */ public function setSkipToken($skip_token) { + if (is_null($skip_token)) { + throw new \InvalidArgumentException('non-nullable skip_token cannot be null'); + } $this->container['skip_token'] = $skip_token; return $this; @@ -474,7 +594,7 @@ public function setSkipToken($skip_token) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/OpeningBalancesEtpModel.php b/src/lib/Model/OpeningBalancesEtpModel.php index 4aaaf50..3200e8d 100644 --- a/src/lib/Model/OpeningBalancesEtpModel.php +++ b/src/lib/Model/OpeningBalancesEtpModel.php @@ -2,66 +2,66 @@ /** * OpeningBalancesEtpModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * OpeningBalancesEtpModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class OpeningBalancesEtpModel implements ModelInterface, ArrayAccess +class OpeningBalancesEtpModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'OpeningBalancesEtpModel'; + protected static $openAPIModelName = 'OpeningBalancesEtpModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'etp_type' => 'string', - 'tax_free_component' => 'double', - 'taxable_component' => 'double', - 'tax_withheld' => 'double', + 'tax_free_component' => 'float', + 'taxable_component' => 'float', + 'tax_withheld' => 'float', 'is_amended' => 'bool', 'payment_date' => '\DateTime', 'generate_payment_summary' => 'bool' @@ -71,8 +71,10 @@ class OpeningBalancesEtpModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'etp_type' => null, 'tax_free_component' => 'double', @@ -83,14 +85,37 @@ class OpeningBalancesEtpModel implements ModelInterface, ArrayAccess 'generate_payment_summary' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'etp_type' => false, + 'tax_free_component' => false, + 'taxable_component' => false, + 'tax_withheld' => false, + 'is_amended' => false, + 'payment_date' => false, + 'generate_payment_summary' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -190,16 +267,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ETP_TYPE_O = 'O'; - const ETP_TYPE_P = 'P'; - const ETP_TYPE_R = 'R'; - const ETP_TYPE_S = 'S'; - + public const ETP_TYPE_O = 'O'; + public const ETP_TYPE_P = 'P'; + public const ETP_TYPE_R = 'R'; + public const ETP_TYPE_S = 'S'; - /** * Gets allowable values of the enum * @@ -214,7 +289,6 @@ public function getEtpTypeAllowableValues() self::ETP_TYPE_S, ]; } - /** * Associative array for storing property values @@ -231,14 +305,32 @@ public function getEtpTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['etp_type'] = isset($data['etp_type']) ? $data['etp_type'] : null; - $this->container['tax_free_component'] = isset($data['tax_free_component']) ? $data['tax_free_component'] : null; - $this->container['taxable_component'] = isset($data['taxable_component']) ? $data['taxable_component'] : null; - $this->container['tax_withheld'] = isset($data['tax_withheld']) ? $data['tax_withheld'] : null; - $this->container['is_amended'] = isset($data['is_amended']) ? $data['is_amended'] : null; - $this->container['payment_date'] = isset($data['payment_date']) ? $data['payment_date'] : null; - $this->container['generate_payment_summary'] = isset($data['generate_payment_summary']) ? $data['generate_payment_summary'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('etp_type', $data ?? [], null); + $this->setIfExists('tax_free_component', $data ?? [], null); + $this->setIfExists('taxable_component', $data ?? [], null); + $this->setIfExists('tax_withheld', $data ?? [], null); + $this->setIfExists('is_amended', $data ?? [], null); + $this->setIfExists('payment_date', $data ?? [], null); + $this->setIfExists('generate_payment_summary', $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; } /** @@ -253,7 +345,8 @@ public function listInvalidProperties() $allowedValues = $this->getEtpTypeAllowableValues(); if (!is_null($this->container['etp_type']) && !in_array($this->container['etp_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'etp_type', must be one of '%s'", + "invalid value '%s' for 'etp_type', must be one of '%s'", + $this->container['etp_type'], implode("', '", $allowedValues) ); } @@ -276,7 +369,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -286,12 +379,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -300,7 +396,7 @@ public function setId($id) /** * Gets etp_type * - * @return string + * @return string|null */ public function getEtpType() { @@ -310,17 +406,21 @@ public function getEtpType() /** * Sets etp_type * - * @param string $etp_type + * @param string|null $etp_type * - * @return $this + * @return self */ public function setEtpType($etp_type) { + if (is_null($etp_type)) { + throw new \InvalidArgumentException('non-nullable etp_type cannot be null'); + } $allowedValues = $this->getEtpTypeAllowableValues(); - if (!is_null($etp_type) && !in_array($etp_type, $allowedValues, true)) { + if (!in_array($etp_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'etp_type', must be one of '%s'", + "Invalid value '%s' for 'etp_type', must be one of '%s'", + $etp_type, implode("', '", $allowedValues) ) ); @@ -333,7 +433,7 @@ public function setEtpType($etp_type) /** * Gets tax_free_component * - * @return double + * @return float|null */ public function getTaxFreeComponent() { @@ -343,12 +443,15 @@ public function getTaxFreeComponent() /** * Sets tax_free_component * - * @param double $tax_free_component + * @param float|null $tax_free_component * - * @return $this + * @return self */ public function setTaxFreeComponent($tax_free_component) { + if (is_null($tax_free_component)) { + throw new \InvalidArgumentException('non-nullable tax_free_component cannot be null'); + } $this->container['tax_free_component'] = $tax_free_component; return $this; @@ -357,7 +460,7 @@ public function setTaxFreeComponent($tax_free_component) /** * Gets taxable_component * - * @return double + * @return float|null */ public function getTaxableComponent() { @@ -367,12 +470,15 @@ public function getTaxableComponent() /** * Sets taxable_component * - * @param double $taxable_component + * @param float|null $taxable_component * - * @return $this + * @return self */ public function setTaxableComponent($taxable_component) { + if (is_null($taxable_component)) { + throw new \InvalidArgumentException('non-nullable taxable_component cannot be null'); + } $this->container['taxable_component'] = $taxable_component; return $this; @@ -381,7 +487,7 @@ public function setTaxableComponent($taxable_component) /** * Gets tax_withheld * - * @return double + * @return float|null */ public function getTaxWithheld() { @@ -391,12 +497,15 @@ public function getTaxWithheld() /** * Sets tax_withheld * - * @param double $tax_withheld + * @param float|null $tax_withheld * - * @return $this + * @return self */ public function setTaxWithheld($tax_withheld) { + if (is_null($tax_withheld)) { + throw new \InvalidArgumentException('non-nullable tax_withheld cannot be null'); + } $this->container['tax_withheld'] = $tax_withheld; return $this; @@ -405,7 +514,7 @@ public function setTaxWithheld($tax_withheld) /** * Gets is_amended * - * @return bool + * @return bool|null */ public function getIsAmended() { @@ -415,12 +524,15 @@ public function getIsAmended() /** * Sets is_amended * - * @param bool $is_amended + * @param bool|null $is_amended * - * @return $this + * @return self */ public function setIsAmended($is_amended) { + if (is_null($is_amended)) { + throw new \InvalidArgumentException('non-nullable is_amended cannot be null'); + } $this->container['is_amended'] = $is_amended; return $this; @@ -429,7 +541,7 @@ public function setIsAmended($is_amended) /** * Gets payment_date * - * @return \DateTime + * @return \DateTime|null */ public function getPaymentDate() { @@ -439,12 +551,15 @@ public function getPaymentDate() /** * Sets payment_date * - * @param \DateTime $payment_date + * @param \DateTime|null $payment_date * - * @return $this + * @return self */ public function setPaymentDate($payment_date) { + if (is_null($payment_date)) { + throw new \InvalidArgumentException('non-nullable payment_date cannot be null'); + } $this->container['payment_date'] = $payment_date; return $this; @@ -453,7 +568,7 @@ public function setPaymentDate($payment_date) /** * Gets generate_payment_summary * - * @return bool + * @return bool|null */ public function getGeneratePaymentSummary() { @@ -463,12 +578,15 @@ public function getGeneratePaymentSummary() /** * Sets generate_payment_summary * - * @param bool $generate_payment_summary + * @param bool|null $generate_payment_summary * - * @return $this + * @return self */ public function setGeneratePaymentSummary($generate_payment_summary) { + if (is_null($generate_payment_summary)) { + throw new \InvalidArgumentException('non-nullable generate_payment_summary cannot be null'); + } $this->container['generate_payment_summary'] = $generate_payment_summary; return $this; @@ -480,7 +598,7 @@ public function setGeneratePaymentSummary($generate_payment_summary) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -490,22 +608,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -521,11 +640,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -533,13 +665,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/OrderByClause.php b/src/lib/Model/OrderByClause.php index 538d532..e77dbda 100644 --- a/src/lib/Model/OrderByClause.php +++ b/src/lib/Model/OrderByClause.php @@ -2,74 +2,76 @@ /** * OrderByClause * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * OrderByClause Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class OrderByClause implements ModelInterface, ArrayAccess +class OrderByClause implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'OrderByClause'; + protected static $openAPIModelName = 'OrderByClause'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'then_by' => '\Swagger\Client\Model\OrderByClause', - 'expression' => '\Swagger\Client\Model\SingleValueNode', + protected static $openAPITypes = [ + 'then_by' => '\OpenAPI\Client\Model\OrderByClause', + 'expression' => '\OpenAPI\Client\Model\SingleValueNode', 'direction' => 'string', - 'range_variable' => '\Swagger\Client\Model\RangeVariable', - 'item_type' => '\Swagger\Client\Model\IEdmTypeReference' + 'range_variable' => '\OpenAPI\Client\Model\RangeVariable', + 'item_type' => '\OpenAPI\Client\Model\IEdmTypeReference' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'then_by' => null, 'expression' => null, 'direction' => null, @@ -77,14 +79,34 @@ class OrderByClause implements ModelInterface, ArrayAccess 'item_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'then_by' => false, + 'expression' => false, + 'direction' => false, + 'range_variable' => false, + 'item_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,14 +249,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const DIRECTION_ASCENDING = 'Ascending'; - const DIRECTION_DESCENDING = 'Descending'; - + public const DIRECTION_ASCENDING = 'Ascending'; + public const DIRECTION_DESCENDING = 'Descending'; - /** * Gets allowable values of the enum * @@ -195,7 +267,6 @@ public function getDirectionAllowableValues() self::DIRECTION_DESCENDING, ]; } - /** * Associative array for storing property values @@ -212,11 +283,29 @@ public function getDirectionAllowableValues() */ public function __construct(array $data = null) { - $this->container['then_by'] = isset($data['then_by']) ? $data['then_by'] : null; - $this->container['expression'] = isset($data['expression']) ? $data['expression'] : null; - $this->container['direction'] = isset($data['direction']) ? $data['direction'] : null; - $this->container['range_variable'] = isset($data['range_variable']) ? $data['range_variable'] : null; - $this->container['item_type'] = isset($data['item_type']) ? $data['item_type'] : null; + $this->setIfExists('then_by', $data ?? [], null); + $this->setIfExists('expression', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('range_variable', $data ?? [], null); + $this->setIfExists('item_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; } /** @@ -231,7 +320,8 @@ public function listInvalidProperties() $allowedValues = $this->getDirectionAllowableValues(); if (!is_null($this->container['direction']) && !in_array($this->container['direction'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'direction', must be one of '%s'", + "invalid value '%s' for 'direction', must be one of '%s'", + $this->container['direction'], implode("', '", $allowedValues) ); } @@ -254,7 +344,7 @@ public function valid() /** * Gets then_by * - * @return \Swagger\Client\Model\OrderByClause + * @return \OpenAPI\Client\Model\OrderByClause|null */ public function getThenBy() { @@ -264,12 +354,15 @@ public function getThenBy() /** * Sets then_by * - * @param \Swagger\Client\Model\OrderByClause $then_by + * @param \OpenAPI\Client\Model\OrderByClause|null $then_by then_by * - * @return $this + * @return self */ public function setThenBy($then_by) { + if (is_null($then_by)) { + throw new \InvalidArgumentException('non-nullable then_by cannot be null'); + } $this->container['then_by'] = $then_by; return $this; @@ -278,7 +371,7 @@ public function setThenBy($then_by) /** * Gets expression * - * @return \Swagger\Client\Model\SingleValueNode + * @return \OpenAPI\Client\Model\SingleValueNode|null */ public function getExpression() { @@ -288,12 +381,15 @@ public function getExpression() /** * Sets expression * - * @param \Swagger\Client\Model\SingleValueNode $expression + * @param \OpenAPI\Client\Model\SingleValueNode|null $expression expression * - * @return $this + * @return self */ public function setExpression($expression) { + if (is_null($expression)) { + throw new \InvalidArgumentException('non-nullable expression cannot be null'); + } $this->container['expression'] = $expression; return $this; @@ -302,7 +398,7 @@ public function setExpression($expression) /** * Gets direction * - * @return string + * @return string|null */ public function getDirection() { @@ -312,17 +408,21 @@ public function getDirection() /** * Sets direction * - * @param string $direction + * @param string|null $direction * - * @return $this + * @return self */ public function setDirection($direction) { + if (is_null($direction)) { + throw new \InvalidArgumentException('non-nullable direction cannot be null'); + } $allowedValues = $this->getDirectionAllowableValues(); - if (!is_null($direction) && !in_array($direction, $allowedValues, true)) { + if (!in_array($direction, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'direction', must be one of '%s'", + "Invalid value '%s' for 'direction', must be one of '%s'", + $direction, implode("', '", $allowedValues) ) ); @@ -335,7 +435,7 @@ public function setDirection($direction) /** * Gets range_variable * - * @return \Swagger\Client\Model\RangeVariable + * @return \OpenAPI\Client\Model\RangeVariable|null */ public function getRangeVariable() { @@ -345,12 +445,15 @@ public function getRangeVariable() /** * Sets range_variable * - * @param \Swagger\Client\Model\RangeVariable $range_variable + * @param \OpenAPI\Client\Model\RangeVariable|null $range_variable range_variable * - * @return $this + * @return self */ public function setRangeVariable($range_variable) { + if (is_null($range_variable)) { + throw new \InvalidArgumentException('non-nullable range_variable cannot be null'); + } $this->container['range_variable'] = $range_variable; return $this; @@ -359,7 +462,7 @@ public function setRangeVariable($range_variable) /** * Gets item_type * - * @return \Swagger\Client\Model\IEdmTypeReference + * @return \OpenAPI\Client\Model\IEdmTypeReference|null */ public function getItemType() { @@ -369,12 +472,15 @@ public function getItemType() /** * Sets item_type * - * @param \Swagger\Client\Model\IEdmTypeReference $item_type + * @param \OpenAPI\Client\Model\IEdmTypeReference|null $item_type item_type * - * @return $this + * @return self */ public function setItemType($item_type) { + if (is_null($item_type)) { + throw new \InvalidArgumentException('non-nullable item_type cannot be null'); + } $this->container['item_type'] = $item_type; return $this; @@ -386,7 +492,7 @@ public function setItemType($item_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -396,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -439,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/OrderByNode.php b/src/lib/Model/OrderByNode.php index d22fe07..ceaf45c 100644 --- a/src/lib/Model/OrderByNode.php +++ b/src/lib/Model/OrderByNode.php @@ -2,61 +2,61 @@ /** * OrderByNode * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * OrderByNode Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class OrderByNode implements ModelInterface, ArrayAccess +class OrderByNode implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'OrderByNode'; + protected static $openAPIModelName = 'OrderByNode'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'direction' => 'string' ]; @@ -64,19 +64,37 @@ class OrderByNode implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'direction' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'direction' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,14 +225,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const DIRECTION_ASCENDING = 'Ascending'; - const DIRECTION_DESCENDING = 'Descending'; - + public const DIRECTION_ASCENDING = 'Ascending'; + public const DIRECTION_DESCENDING = 'Descending'; - /** * Gets allowable values of the enum * @@ -175,7 +243,6 @@ public function getDirectionAllowableValues() self::DIRECTION_DESCENDING, ]; } - /** * Associative array for storing property values @@ -192,7 +259,25 @@ public function getDirectionAllowableValues() */ public function __construct(array $data = null) { - $this->container['direction'] = isset($data['direction']) ? $data['direction'] : null; + $this->setIfExists('direction', $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; } /** @@ -207,7 +292,8 @@ public function listInvalidProperties() $allowedValues = $this->getDirectionAllowableValues(); if (!is_null($this->container['direction']) && !in_array($this->container['direction'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'direction', must be one of '%s'", + "invalid value '%s' for 'direction', must be one of '%s'", + $this->container['direction'], implode("', '", $allowedValues) ); } @@ -230,7 +316,7 @@ public function valid() /** * Gets direction * - * @return string + * @return string|null */ public function getDirection() { @@ -240,17 +326,21 @@ public function getDirection() /** * Sets direction * - * @param string $direction + * @param string|null $direction * - * @return $this + * @return self */ public function setDirection($direction) { + if (is_null($direction)) { + throw new \InvalidArgumentException('non-nullable direction cannot be null'); + } $allowedValues = $this->getDirectionAllowableValues(); - if (!is_null($direction) && !in_array($direction, $allowedValues, true)) { + if (!in_array($direction, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'direction', must be one of '%s'", + "Invalid value '%s' for 'direction', must be one of '%s'", + $direction, implode("', '", $allowedValues) ) ); @@ -266,7 +356,7 @@ public function setDirection($direction) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -276,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -307,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -319,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/OrderByQueryOption.php b/src/lib/Model/OrderByQueryOption.php index e0b8685..958995f 100644 --- a/src/lib/Model/OrderByQueryOption.php +++ b/src/lib/Model/OrderByQueryOption.php @@ -2,74 +2,76 @@ /** * OrderByQueryOption * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * OrderByQueryOption Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class OrderByQueryOption implements ModelInterface, ArrayAccess +class OrderByQueryOption implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'OrderByQueryOption'; + protected static $openAPIModelName = 'OrderByQueryOption'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'context' => '\Swagger\Client\Model\ODataQueryContext', - 'order_by_nodes' => '\Swagger\Client\Model\OrderByNode[]', + protected static $openAPITypes = [ + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', + 'order_by_nodes' => '\OpenAPI\Client\Model\OrderByNode[]', 'raw_value' => 'string', - 'validator' => '\Swagger\Client\Model\OrderByQueryValidator', - 'order_by_clause' => '\Swagger\Client\Model\OrderByClause' + 'validator' => 'object', + 'order_by_clause' => '\OpenAPI\Client\Model\OrderByClause' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'context' => null, 'order_by_nodes' => null, 'raw_value' => null, @@ -77,14 +79,34 @@ class OrderByQueryOption implements ModelInterface, ArrayAccess 'order_by_clause' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'context' => false, + 'order_by_nodes' => false, + 'raw_value' => false, + 'validator' => false, + 'order_by_clause' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['order_by_nodes'] = isset($data['order_by_nodes']) ? $data['order_by_nodes'] : null; - $this->container['raw_value'] = isset($data['raw_value']) ? $data['raw_value'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; - $this->container['order_by_clause'] = isset($data['order_by_clause']) ? $data['order_by_clause'] : null; + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('order_by_nodes', $data ?? [], null); + $this->setIfExists('raw_value', $data ?? [], null); + $this->setIfExists('validator', $data ?? [], null); + $this->setIfExists('order_by_clause', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -241,12 +330,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -255,7 +347,7 @@ public function setContext($context) /** * Gets order_by_nodes * - * @return \Swagger\Client\Model\OrderByNode[] + * @return \OpenAPI\Client\Model\OrderByNode[]|null */ public function getOrderByNodes() { @@ -265,12 +357,15 @@ public function getOrderByNodes() /** * Sets order_by_nodes * - * @param \Swagger\Client\Model\OrderByNode[] $order_by_nodes + * @param \OpenAPI\Client\Model\OrderByNode[]|null $order_by_nodes * - * @return $this + * @return self */ public function setOrderByNodes($order_by_nodes) { + if (is_null($order_by_nodes)) { + throw new \InvalidArgumentException('non-nullable order_by_nodes cannot be null'); + } $this->container['order_by_nodes'] = $order_by_nodes; return $this; @@ -279,7 +374,7 @@ public function setOrderByNodes($order_by_nodes) /** * Gets raw_value * - * @return string + * @return string|null */ public function getRawValue() { @@ -289,12 +384,15 @@ public function getRawValue() /** * Sets raw_value * - * @param string $raw_value + * @param string|null $raw_value * - * @return $this + * @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; @@ -303,7 +401,7 @@ public function setRawValue($raw_value) /** * Gets validator * - * @return \Swagger\Client\Model\OrderByQueryValidator + * @return object|null */ public function getValidator() { @@ -313,12 +411,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\OrderByQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -327,7 +428,7 @@ public function setValidator($validator) /** * Gets order_by_clause * - * @return \Swagger\Client\Model\OrderByClause + * @return \OpenAPI\Client\Model\OrderByClause|null */ public function getOrderByClause() { @@ -337,12 +438,15 @@ public function getOrderByClause() /** * Sets order_by_clause * - * @param \Swagger\Client\Model\OrderByClause $order_by_clause + * @param \OpenAPI\Client\Model\OrderByClause|null $order_by_clause order_by_clause * - * @return $this + * @return self */ public function setOrderByClause($order_by_clause) { + if (is_null($order_by_clause)) { + throw new \InvalidArgumentException('non-nullable order_by_clause cannot be null'); + } $this->container['order_by_clause'] = $order_by_clause; return $this; @@ -354,7 +458,7 @@ public function setOrderByClause($order_by_clause) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/OrderByQueryValidator.php b/src/lib/Model/OrderByQueryValidator.php deleted file mode 100644 index e693b42..0000000 --- a/src/lib/Model/OrderByQueryValidator.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/OrdinaryTimeEarningsReportRequestModel.php b/src/lib/Model/OrdinaryTimeEarningsReportRequestModel.php index e3301b7..beda7b3 100644 --- a/src/lib/Model/OrdinaryTimeEarningsReportRequestModel.php +++ b/src/lib/Model/OrdinaryTimeEarningsReportRequestModel.php @@ -2,61 +2,61 @@ /** * OrdinaryTimeEarningsReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * OrdinaryTimeEarningsReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class OrdinaryTimeEarningsReportRequestModel implements ModelInterface, ArrayAccess +class OrdinaryTimeEarningsReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'OrdinaryTimeEarningsReportRequestModel'; + protected static $openAPIModelName = 'OrdinaryTimeEarningsReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_schedule_id' => 'int', 'employing_entity_id' => 'int', 'financial_year_ending' => 'int' @@ -66,21 +66,41 @@ class OrdinaryTimeEarningsReportRequestModel implements ModelInterface, ArrayAcc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_schedule_id' => 'int32', 'employing_entity_id' => 'int32', 'financial_year_ending' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_schedule_id' => false, + 'employing_entity_id' => false, + 'financial_year_ending' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; - $this->container['financial_year_ending'] = isset($data['financial_year_ending']) ? $data['financial_year_ending'] : null; + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('employing_entity_id', $data ?? [], null); + $this->setIfExists('financial_year_ending', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -229,12 +316,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -243,7 +333,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -253,12 +343,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -267,7 +360,7 @@ public function setEmployingEntityId($employing_entity_id) /** * Gets financial_year_ending * - * @return int + * @return int|null */ public function getFinancialYearEnding() { @@ -277,12 +370,15 @@ public function getFinancialYearEnding() /** * Sets financial_year_ending * - * @param int $financial_year_ending + * @param int|null $financial_year_ending * - * @return $this + * @return self */ public function setFinancialYearEnding($financial_year_ending) { + if (is_null($financial_year_ending)) { + throw new \InvalidArgumentException('non-nullable financial_year_ending cannot be null'); + } $this->container['financial_year_ending'] = $financial_year_ending; return $this; @@ -294,7 +390,7 @@ public function setFinancialYearEnding($financial_year_ending) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/OtherAmounts.php b/src/lib/Model/OtherAmounts.php index 88eebba..b08b68d 100644 --- a/src/lib/Model/OtherAmounts.php +++ b/src/lib/Model/OtherAmounts.php @@ -2,85 +2,105 @@ /** * OtherAmounts * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * OtherAmounts Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class OtherAmounts implements ModelInterface, ArrayAccess +class OtherAmounts implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'OtherAmounts'; + protected static $openAPIModelName = 'OtherAmounts'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'work_place_giving' => 'double', - 'exempt_foreign_exempt_income' => 'double', - 'deductible_amount_of_undeducted_annuity_price' => 'double' + protected static $openAPITypes = [ + 'work_place_giving' => 'float', + 'exempt_foreign_exempt_income' => 'float', + 'deductible_amount_of_undeducted_annuity_price' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'work_place_giving' => 'double', 'exempt_foreign_exempt_income' => 'double', 'deductible_amount_of_undeducted_annuity_price' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'work_place_giving' => false, + 'exempt_foreign_exempt_income' => false, + 'deductible_amount_of_undeducted_annuity_price' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['work_place_giving'] = isset($data['work_place_giving']) ? $data['work_place_giving'] : null; - $this->container['exempt_foreign_exempt_income'] = isset($data['exempt_foreign_exempt_income']) ? $data['exempt_foreign_exempt_income'] : null; - $this->container['deductible_amount_of_undeducted_annuity_price'] = isset($data['deductible_amount_of_undeducted_annuity_price']) ? $data['deductible_amount_of_undeducted_annuity_price'] : null; + $this->setIfExists('work_place_giving', $data ?? [], null); + $this->setIfExists('exempt_foreign_exempt_income', $data ?? [], null); + $this->setIfExists('deductible_amount_of_undeducted_annuity_price', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets work_place_giving * - * @return double + * @return float|null */ public function getWorkPlaceGiving() { @@ -229,12 +316,15 @@ public function getWorkPlaceGiving() /** * Sets work_place_giving * - * @param double $work_place_giving + * @param float|null $work_place_giving * - * @return $this + * @return self */ public function setWorkPlaceGiving($work_place_giving) { + if (is_null($work_place_giving)) { + throw new \InvalidArgumentException('non-nullable work_place_giving cannot be null'); + } $this->container['work_place_giving'] = $work_place_giving; return $this; @@ -243,7 +333,7 @@ public function setWorkPlaceGiving($work_place_giving) /** * Gets exempt_foreign_exempt_income * - * @return double + * @return float|null */ public function getExemptForeignExemptIncome() { @@ -253,12 +343,15 @@ public function getExemptForeignExemptIncome() /** * Sets exempt_foreign_exempt_income * - * @param double $exempt_foreign_exempt_income + * @param float|null $exempt_foreign_exempt_income * - * @return $this + * @return self */ public function setExemptForeignExemptIncome($exempt_foreign_exempt_income) { + if (is_null($exempt_foreign_exempt_income)) { + throw new \InvalidArgumentException('non-nullable exempt_foreign_exempt_income cannot be null'); + } $this->container['exempt_foreign_exempt_income'] = $exempt_foreign_exempt_income; return $this; @@ -267,7 +360,7 @@ public function setExemptForeignExemptIncome($exempt_foreign_exempt_income) /** * Gets deductible_amount_of_undeducted_annuity_price * - * @return double + * @return float|null */ public function getDeductibleAmountOfUndeductedAnnuityPrice() { @@ -277,12 +370,15 @@ public function getDeductibleAmountOfUndeductedAnnuityPrice() /** * Sets deductible_amount_of_undeducted_annuity_price * - * @param double $deductible_amount_of_undeducted_annuity_price + * @param float|null $deductible_amount_of_undeducted_annuity_price * - * @return $this + * @return self */ public function setDeductibleAmountOfUndeductedAnnuityPrice($deductible_amount_of_undeducted_annuity_price) { + if (is_null($deductible_amount_of_undeducted_annuity_price)) { + throw new \InvalidArgumentException('non-nullable deductible_amount_of_undeducted_annuity_price cannot be null'); + } $this->container['deductible_amount_of_undeducted_annuity_price'] = $deductible_amount_of_undeducted_annuity_price; return $this; @@ -294,7 +390,7 @@ public function setDeductibleAmountOfUndeductedAnnuityPrice($deductible_amount_o * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PagedResultModelOfManagerExpenseRequestModel.php b/src/lib/Model/PagedResultModelOfManagerExpenseRequestModel.php index 51d2380..f21a782 100644 --- a/src/lib/Model/PagedResultModelOfManagerExpenseRequestModel.php +++ b/src/lib/Model/PagedResultModelOfManagerExpenseRequestModel.php @@ -2,64 +2,64 @@ /** * PagedResultModelOfManagerExpenseRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PagedResultModelOfManagerExpenseRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PagedResultModelOfManagerExpenseRequestModel implements ModelInterface, ArrayAccess +class PagedResultModelOfManagerExpenseRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PagedResultModelOfManagerExpenseRequestModel'; + protected static $openAPIModelName = 'PagedResultModelOfManagerExpenseRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'item_count_future' => '\Swagger\Client\Model\IFutureValueOfInt32', + protected static $openAPITypes = [ + 'item_count_future' => '\OpenAPI\Client\Model\IFutureValueOfInt32', 'item_count' => 'int', - 'items' => '\Swagger\Client\Model\ManagerExpenseRequestModel[]', + 'items' => '\OpenAPI\Client\Model\ManagerExpenseRequestModel[]', 'current_page' => 'int', 'page_size' => 'int', 'page_count' => 'int' @@ -69,8 +69,10 @@ class PagedResultModelOfManagerExpenseRequestModel implements ModelInterface, Ar * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'item_count_future' => null, 'item_count' => 'int32', 'items' => null, @@ -79,14 +81,35 @@ class PagedResultModelOfManagerExpenseRequestModel implements ModelInterface, Ar 'page_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'item_count_future' => false, + 'item_count' => false, + 'items' => false, + 'current_page' => false, + 'page_size' => false, + 'page_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['item_count_future'] = isset($data['item_count_future']) ? $data['item_count_future'] : null; - $this->container['item_count'] = isset($data['item_count']) ? $data['item_count'] : null; - $this->container['items'] = isset($data['items']) ? $data['items'] : null; - $this->container['current_page'] = isset($data['current_page']) ? $data['current_page'] : null; - $this->container['page_size'] = isset($data['page_size']) ? $data['page_size'] : null; - $this->container['page_count'] = isset($data['page_count']) ? $data['page_count'] : null; + $this->setIfExists('item_count_future', $data ?? [], null); + $this->setIfExists('item_count', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('current_page', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('page_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets item_count_future * - * @return \Swagger\Client\Model\IFutureValueOfInt32 + * @return \OpenAPI\Client\Model\IFutureValueOfInt32|null */ public function getItemCountFuture() { @@ -247,12 +337,15 @@ public function getItemCountFuture() /** * Sets item_count_future * - * @param \Swagger\Client\Model\IFutureValueOfInt32 $item_count_future + * @param \OpenAPI\Client\Model\IFutureValueOfInt32|null $item_count_future item_count_future * - * @return $this + * @return self */ public function setItemCountFuture($item_count_future) { + if (is_null($item_count_future)) { + throw new \InvalidArgumentException('non-nullable item_count_future cannot be null'); + } $this->container['item_count_future'] = $item_count_future; return $this; @@ -261,7 +354,7 @@ public function setItemCountFuture($item_count_future) /** * Gets item_count * - * @return int + * @return int|null */ public function getItemCount() { @@ -271,12 +364,15 @@ public function getItemCount() /** * Sets item_count * - * @param int $item_count + * @param int|null $item_count * - * @return $this + * @return self */ public function setItemCount($item_count) { + if (is_null($item_count)) { + throw new \InvalidArgumentException('non-nullable item_count cannot be null'); + } $this->container['item_count'] = $item_count; return $this; @@ -285,7 +381,7 @@ public function setItemCount($item_count) /** * Gets items * - * @return \Swagger\Client\Model\ManagerExpenseRequestModel[] + * @return \OpenAPI\Client\Model\ManagerExpenseRequestModel[]|null */ public function getItems() { @@ -295,12 +391,15 @@ public function getItems() /** * Sets items * - * @param \Swagger\Client\Model\ManagerExpenseRequestModel[] $items + * @param \OpenAPI\Client\Model\ManagerExpenseRequestModel[]|null $items * - * @return $this + * @return self */ public function setItems($items) { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; @@ -309,7 +408,7 @@ public function setItems($items) /** * Gets current_page * - * @return int + * @return int|null */ public function getCurrentPage() { @@ -319,12 +418,15 @@ public function getCurrentPage() /** * Sets current_page * - * @param int $current_page + * @param int|null $current_page * - * @return $this + * @return self */ public function setCurrentPage($current_page) { + if (is_null($current_page)) { + throw new \InvalidArgumentException('non-nullable current_page cannot be null'); + } $this->container['current_page'] = $current_page; return $this; @@ -333,7 +435,7 @@ public function setCurrentPage($current_page) /** * Gets page_size * - * @return int + * @return int|null */ public function getPageSize() { @@ -343,12 +445,15 @@ public function getPageSize() /** * Sets page_size * - * @param int $page_size + * @param int|null $page_size * - * @return $this + * @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; @@ -357,7 +462,7 @@ public function setPageSize($page_size) /** * Gets page_count * - * @return int + * @return int|null */ public function getPageCount() { @@ -367,12 +472,15 @@ public function getPageCount() /** * Sets page_count * - * @param int $page_count + * @param int|null $page_count * - * @return $this + * @return self */ public function setPageCount($page_count) { + if (is_null($page_count)) { + throw new \InvalidArgumentException('non-nullable page_count cannot be null'); + } $this->container['page_count'] = $page_count; return $this; @@ -384,7 +492,7 @@ public function setPageCount($page_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PagedResultModelOfManagerTimesheetLineModel.php b/src/lib/Model/PagedResultModelOfManagerTimesheetLineModel.php index e96f612..609f2e5 100644 --- a/src/lib/Model/PagedResultModelOfManagerTimesheetLineModel.php +++ b/src/lib/Model/PagedResultModelOfManagerTimesheetLineModel.php @@ -2,64 +2,64 @@ /** * PagedResultModelOfManagerTimesheetLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PagedResultModelOfManagerTimesheetLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PagedResultModelOfManagerTimesheetLineModel implements ModelInterface, ArrayAccess +class PagedResultModelOfManagerTimesheetLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PagedResultModelOfManagerTimesheetLineModel'; + protected static $openAPIModelName = 'PagedResultModelOfManagerTimesheetLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'item_count_future' => '\Swagger\Client\Model\IFutureValueOfInt32', + protected static $openAPITypes = [ + 'item_count_future' => '\OpenAPI\Client\Model\IFutureValueOfInt32', 'item_count' => 'int', - 'items' => '\Swagger\Client\Model\ManagerTimesheetLineModel[]', + 'items' => '\OpenAPI\Client\Model\ManagerTimesheetLineModel[]', 'current_page' => 'int', 'page_size' => 'int', 'page_count' => 'int' @@ -69,8 +69,10 @@ class PagedResultModelOfManagerTimesheetLineModel implements ModelInterface, Arr * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'item_count_future' => null, 'item_count' => 'int32', 'items' => null, @@ -79,14 +81,35 @@ class PagedResultModelOfManagerTimesheetLineModel implements ModelInterface, Arr 'page_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'item_count_future' => false, + 'item_count' => false, + 'items' => false, + 'current_page' => false, + 'page_size' => false, + 'page_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['item_count_future'] = isset($data['item_count_future']) ? $data['item_count_future'] : null; - $this->container['item_count'] = isset($data['item_count']) ? $data['item_count'] : null; - $this->container['items'] = isset($data['items']) ? $data['items'] : null; - $this->container['current_page'] = isset($data['current_page']) ? $data['current_page'] : null; - $this->container['page_size'] = isset($data['page_size']) ? $data['page_size'] : null; - $this->container['page_count'] = isset($data['page_count']) ? $data['page_count'] : null; + $this->setIfExists('item_count_future', $data ?? [], null); + $this->setIfExists('item_count', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('current_page', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('page_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets item_count_future * - * @return \Swagger\Client\Model\IFutureValueOfInt32 + * @return \OpenAPI\Client\Model\IFutureValueOfInt32|null */ public function getItemCountFuture() { @@ -247,12 +337,15 @@ public function getItemCountFuture() /** * Sets item_count_future * - * @param \Swagger\Client\Model\IFutureValueOfInt32 $item_count_future + * @param \OpenAPI\Client\Model\IFutureValueOfInt32|null $item_count_future item_count_future * - * @return $this + * @return self */ public function setItemCountFuture($item_count_future) { + if (is_null($item_count_future)) { + throw new \InvalidArgumentException('non-nullable item_count_future cannot be null'); + } $this->container['item_count_future'] = $item_count_future; return $this; @@ -261,7 +354,7 @@ public function setItemCountFuture($item_count_future) /** * Gets item_count * - * @return int + * @return int|null */ public function getItemCount() { @@ -271,12 +364,15 @@ public function getItemCount() /** * Sets item_count * - * @param int $item_count + * @param int|null $item_count * - * @return $this + * @return self */ public function setItemCount($item_count) { + if (is_null($item_count)) { + throw new \InvalidArgumentException('non-nullable item_count cannot be null'); + } $this->container['item_count'] = $item_count; return $this; @@ -285,7 +381,7 @@ public function setItemCount($item_count) /** * Gets items * - * @return \Swagger\Client\Model\ManagerTimesheetLineModel[] + * @return \OpenAPI\Client\Model\ManagerTimesheetLineModel[]|null */ public function getItems() { @@ -295,12 +391,15 @@ public function getItems() /** * Sets items * - * @param \Swagger\Client\Model\ManagerTimesheetLineModel[] $items + * @param \OpenAPI\Client\Model\ManagerTimesheetLineModel[]|null $items * - * @return $this + * @return self */ public function setItems($items) { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; @@ -309,7 +408,7 @@ public function setItems($items) /** * Gets current_page * - * @return int + * @return int|null */ public function getCurrentPage() { @@ -319,12 +418,15 @@ public function getCurrentPage() /** * Sets current_page * - * @param int $current_page + * @param int|null $current_page * - * @return $this + * @return self */ public function setCurrentPage($current_page) { + if (is_null($current_page)) { + throw new \InvalidArgumentException('non-nullable current_page cannot be null'); + } $this->container['current_page'] = $current_page; return $this; @@ -333,7 +435,7 @@ public function setCurrentPage($current_page) /** * Gets page_size * - * @return int + * @return int|null */ public function getPageSize() { @@ -343,12 +445,15 @@ public function getPageSize() /** * Sets page_size * - * @param int $page_size + * @param int|null $page_size * - * @return $this + * @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; @@ -357,7 +462,7 @@ public function setPageSize($page_size) /** * Gets page_count * - * @return int + * @return int|null */ public function getPageCount() { @@ -367,12 +472,15 @@ public function getPageCount() /** * Sets page_count * - * @param int $page_count + * @param int|null $page_count * - * @return $this + * @return self */ public function setPageCount($page_count) { + if (is_null($page_count)) { + throw new \InvalidArgumentException('non-nullable page_count cannot be null'); + } $this->container['page_count'] = $page_count; return $this; @@ -384,7 +492,7 @@ public function setPageCount($page_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PagedResultModelOfSuburbModel.php b/src/lib/Model/PagedResultModelOfSuburbModel.php index 8122ffb..e779941 100644 --- a/src/lib/Model/PagedResultModelOfSuburbModel.php +++ b/src/lib/Model/PagedResultModelOfSuburbModel.php @@ -2,64 +2,64 @@ /** * PagedResultModelOfSuburbModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PagedResultModelOfSuburbModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PagedResultModelOfSuburbModel implements ModelInterface, ArrayAccess +class PagedResultModelOfSuburbModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PagedResultModelOfSuburbModel'; + protected static $openAPIModelName = 'PagedResultModelOfSuburbModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'item_count_future' => '\Swagger\Client\Model\IFutureValueOfInt32', + protected static $openAPITypes = [ + 'item_count_future' => '\OpenAPI\Client\Model\IFutureValueOfInt32', 'item_count' => 'int', - 'items' => '\Swagger\Client\Model\SuburbModel[]', + 'items' => '\OpenAPI\Client\Model\SuburbModel[]', 'current_page' => 'int', 'page_size' => 'int', 'page_count' => 'int' @@ -69,8 +69,10 @@ class PagedResultModelOfSuburbModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'item_count_future' => null, 'item_count' => 'int32', 'items' => null, @@ -79,14 +81,35 @@ class PagedResultModelOfSuburbModel implements ModelInterface, ArrayAccess 'page_count' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'item_count_future' => false, + 'item_count' => false, + 'items' => false, + 'current_page' => false, + 'page_size' => false, + 'page_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['item_count_future'] = isset($data['item_count_future']) ? $data['item_count_future'] : null; - $this->container['item_count'] = isset($data['item_count']) ? $data['item_count'] : null; - $this->container['items'] = isset($data['items']) ? $data['items'] : null; - $this->container['current_page'] = isset($data['current_page']) ? $data['current_page'] : null; - $this->container['page_size'] = isset($data['page_size']) ? $data['page_size'] : null; - $this->container['page_count'] = isset($data['page_count']) ? $data['page_count'] : null; + $this->setIfExists('item_count_future', $data ?? [], null); + $this->setIfExists('item_count', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('current_page', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('page_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets item_count_future * - * @return \Swagger\Client\Model\IFutureValueOfInt32 + * @return \OpenAPI\Client\Model\IFutureValueOfInt32|null */ public function getItemCountFuture() { @@ -247,12 +337,15 @@ public function getItemCountFuture() /** * Sets item_count_future * - * @param \Swagger\Client\Model\IFutureValueOfInt32 $item_count_future + * @param \OpenAPI\Client\Model\IFutureValueOfInt32|null $item_count_future item_count_future * - * @return $this + * @return self */ public function setItemCountFuture($item_count_future) { + if (is_null($item_count_future)) { + throw new \InvalidArgumentException('non-nullable item_count_future cannot be null'); + } $this->container['item_count_future'] = $item_count_future; return $this; @@ -261,7 +354,7 @@ public function setItemCountFuture($item_count_future) /** * Gets item_count * - * @return int + * @return int|null */ public function getItemCount() { @@ -271,12 +364,15 @@ public function getItemCount() /** * Sets item_count * - * @param int $item_count + * @param int|null $item_count * - * @return $this + * @return self */ public function setItemCount($item_count) { + if (is_null($item_count)) { + throw new \InvalidArgumentException('non-nullable item_count cannot be null'); + } $this->container['item_count'] = $item_count; return $this; @@ -285,7 +381,7 @@ public function setItemCount($item_count) /** * Gets items * - * @return \Swagger\Client\Model\SuburbModel[] + * @return \OpenAPI\Client\Model\SuburbModel[]|null */ public function getItems() { @@ -295,12 +391,15 @@ public function getItems() /** * Sets items * - * @param \Swagger\Client\Model\SuburbModel[] $items + * @param \OpenAPI\Client\Model\SuburbModel[]|null $items * - * @return $this + * @return self */ public function setItems($items) { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; @@ -309,7 +408,7 @@ public function setItems($items) /** * Gets current_page * - * @return int + * @return int|null */ public function getCurrentPage() { @@ -319,12 +418,15 @@ public function getCurrentPage() /** * Sets current_page * - * @param int $current_page + * @param int|null $current_page * - * @return $this + * @return self */ public function setCurrentPage($current_page) { + if (is_null($current_page)) { + throw new \InvalidArgumentException('non-nullable current_page cannot be null'); + } $this->container['current_page'] = $current_page; return $this; @@ -333,7 +435,7 @@ public function setCurrentPage($current_page) /** * Gets page_size * - * @return int + * @return int|null */ public function getPageSize() { @@ -343,12 +445,15 @@ public function getPageSize() /** * Sets page_size * - * @param int $page_size + * @param int|null $page_size * - * @return $this + * @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; @@ -357,7 +462,7 @@ public function setPageSize($page_size) /** * Gets page_count * - * @return int + * @return int|null */ public function getPageCount() { @@ -367,12 +472,15 @@ public function getPageCount() /** * Sets page_count * - * @param int $page_count + * @param int|null $page_count * - * @return $this + * @return self */ public function setPageCount($page_count) { + if (is_null($page_count)) { + throw new \InvalidArgumentException('non-nullable page_count cannot be null'); + } $this->container['page_count'] = $page_count; return $this; @@ -384,7 +492,7 @@ public function setPageCount($page_count) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PartiallyAppliedLeaveRequestBannerModel.php b/src/lib/Model/PartiallyAppliedLeaveRequestBannerModel.php index 7a8d3f1..de90693 100644 --- a/src/lib/Model/PartiallyAppliedLeaveRequestBannerModel.php +++ b/src/lib/Model/PartiallyAppliedLeaveRequestBannerModel.php @@ -2,61 +2,61 @@ /** * PartiallyAppliedLeaveRequestBannerModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PartiallyAppliedLeaveRequestBannerModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PartiallyAppliedLeaveRequestBannerModel implements ModelInterface, ArrayAccess +class PartiallyAppliedLeaveRequestBannerModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PartiallyAppliedLeaveRequestBannerModel'; + protected static $openAPIModelName = 'PartiallyAppliedLeaveRequestBannerModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'header' => 'string', 'items' => 'string[]' ]; @@ -65,20 +65,39 @@ class PartiallyAppliedLeaveRequestBannerModel implements ModelInterface, ArrayAc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'header' => null, 'items' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'header' => false, + 'items' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['header'] = isset($data['header']) ? $data['header'] : null; - $this->container['items'] = isset($data['items']) ? $data['items'] : null; + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('items', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets header * - * @return string + * @return string|null */ public function getHeader() { @@ -223,12 +309,15 @@ public function getHeader() /** * Sets header * - * @param string $header + * @param string|null $header * - * @return $this + * @return self */ public function setHeader($header) { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } $this->container['header'] = $header; return $this; @@ -237,7 +326,7 @@ public function setHeader($header) /** * Gets items * - * @return string[] + * @return string[]|null */ public function getItems() { @@ -247,12 +336,15 @@ public function getItems() /** * Sets items * - * @param string[] $items + * @param string[]|null $items * - * @return $this + * @return self */ public function setItems($items) { + if (is_null($items)) { + throw new \InvalidArgumentException('non-nullable items cannot be null'); + } $this->container['items'] = $items; return $this; @@ -264,7 +356,7 @@ public function setItems($items) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayCategoriesReportRequestModel.php b/src/lib/Model/PayCategoriesReportRequestModel.php index 9a9c6fa..c18ce1f 100644 --- a/src/lib/Model/PayCategoriesReportRequestModel.php +++ b/src/lib/Model/PayCategoriesReportRequestModel.php @@ -2,61 +2,61 @@ /** * PayCategoriesReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayCategoriesReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayCategoriesReportRequestModel implements ModelInterface, ArrayAccess +class PayCategoriesReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayCategoriesReportRequestModel'; + protected static $openAPIModelName = 'PayCategoriesReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_schedule_id' => 'int', 'employee_id' => 'int', 'group_by_earnings_location' => 'bool', @@ -70,8 +70,10 @@ class PayCategoriesReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_schedule_id' => 'int32', 'employee_id' => 'int32', 'group_by_earnings_location' => null, @@ -81,14 +83,36 @@ class PayCategoriesReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_schedule_id' => false, + 'employee_id' => false, + 'group_by_earnings_location' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['group_by_earnings_location'] = isset($data['group_by_earnings_location']) ? $data['group_by_earnings_location'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('group_by_earnings_location', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -253,12 +344,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -267,7 +361,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -277,12 +371,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -291,7 +388,7 @@ public function setEmployeeId($employee_id) /** * Gets group_by_earnings_location * - * @return bool + * @return bool|null */ public function getGroupByEarningsLocation() { @@ -301,12 +398,15 @@ public function getGroupByEarningsLocation() /** * Sets group_by_earnings_location * - * @param bool $group_by_earnings_location + * @param bool|null $group_by_earnings_location * - * @return $this + * @return self */ public function setGroupByEarningsLocation($group_by_earnings_location) { + if (is_null($group_by_earnings_location)) { + throw new \InvalidArgumentException('non-nullable group_by_earnings_location cannot be null'); + } $this->container['group_by_earnings_location'] = $group_by_earnings_location; return $this; @@ -315,7 +415,7 @@ public function setGroupByEarningsLocation($group_by_earnings_location) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -325,12 +425,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -339,7 +442,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -349,12 +452,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -363,7 +469,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -373,12 +479,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -387,7 +496,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -397,12 +506,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -414,7 +526,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayConditionRuleSetModel.php b/src/lib/Model/PayConditionRuleSetModel.php index 484a2fc..8a831ea 100644 --- a/src/lib/Model/PayConditionRuleSetModel.php +++ b/src/lib/Model/PayConditionRuleSetModel.php @@ -2,61 +2,61 @@ /** * PayConditionRuleSetModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayConditionRuleSetModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayConditionRuleSetModel implements ModelInterface, ArrayAccess +class PayConditionRuleSetModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayConditionRuleSetModel'; + protected static $openAPIModelName = 'PayConditionRuleSetModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'description' => 'string', @@ -74,8 +74,10 @@ class PayConditionRuleSetModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'description' => null, @@ -89,14 +91,40 @@ class PayConditionRuleSetModel implements ModelInterface, ArrayAccess 'disabled_rules' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'description' => false, + 'period_type' => false, + 'day_of_week_ending' => false, + 'day_of_month_ending' => false, + 'period_ending' => false, + 'shift_consolidation_option' => false, + 'shift_consolidation_threshold' => false, + 'rules_json' => false, + 'disabled_rules' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,23 +285,21 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const PERIOD_TYPE_WEEKLY = 'Weekly'; - const PERIOD_TYPE_FORTNIGHTLY = 'Fortnightly'; - const PERIOD_TYPE_MONTHLY = 'Monthly'; - const PERIOD_TYPE_CALENDAR_MONTH = 'CalendarMonth'; - const PERIOD_TYPE_FOUR_WEEKLY = 'FourWeekly'; - const PERIOD_TYPE_SIX_WEEKLY = 'SixWeekly'; - const PERIOD_TYPE_THREE_WEEKLY = 'ThreeWeekly'; - const PERIOD_TYPE_EIGHT_WEEKLY = 'EightWeekly'; - const SHIFT_CONSOLIDATION_OPTION_NONE = 'None'; - const SHIFT_CONSOLIDATION_OPTION_DURATION = 'Duration'; - const SHIFT_CONSOLIDATION_OPTION_SAME_DAY = 'SameDay'; - + public const PERIOD_TYPE_WEEKLY = 'Weekly'; + public const PERIOD_TYPE_FORTNIGHTLY = 'Fortnightly'; + public const PERIOD_TYPE_MONTHLY = 'Monthly'; + public const PERIOD_TYPE_CALENDAR_MONTH = 'CalendarMonth'; + public const PERIOD_TYPE_FOUR_WEEKLY = 'FourWeekly'; + public const PERIOD_TYPE_SIX_WEEKLY = 'SixWeekly'; + public const PERIOD_TYPE_THREE_WEEKLY = 'ThreeWeekly'; + public const PERIOD_TYPE_EIGHT_WEEKLY = 'EightWeekly'; + public const SHIFT_CONSOLIDATION_OPTION_NONE = 'None'; + public const SHIFT_CONSOLIDATION_OPTION_DURATION = 'Duration'; + public const SHIFT_CONSOLIDATION_OPTION_SAME_DAY = 'SameDay'; - /** * Gets allowable values of the enum * @@ -240,7 +318,7 @@ public function getPeriodTypeAllowableValues() self::PERIOD_TYPE_EIGHT_WEEKLY, ]; } - + /** * Gets allowable values of the enum * @@ -254,7 +332,6 @@ public function getShiftConsolidationOptionAllowableValues() self::SHIFT_CONSOLIDATION_OPTION_SAME_DAY, ]; } - /** * Associative array for storing property values @@ -271,17 +348,35 @@ public function getShiftConsolidationOptionAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['period_type'] = isset($data['period_type']) ? $data['period_type'] : null; - $this->container['day_of_week_ending'] = isset($data['day_of_week_ending']) ? $data['day_of_week_ending'] : null; - $this->container['day_of_month_ending'] = isset($data['day_of_month_ending']) ? $data['day_of_month_ending'] : null; - $this->container['period_ending'] = isset($data['period_ending']) ? $data['period_ending'] : null; - $this->container['shift_consolidation_option'] = isset($data['shift_consolidation_option']) ? $data['shift_consolidation_option'] : null; - $this->container['shift_consolidation_threshold'] = isset($data['shift_consolidation_threshold']) ? $data['shift_consolidation_threshold'] : null; - $this->container['rules_json'] = isset($data['rules_json']) ? $data['rules_json'] : null; - $this->container['disabled_rules'] = isset($data['disabled_rules']) ? $data['disabled_rules'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('period_type', $data ?? [], null); + $this->setIfExists('day_of_week_ending', $data ?? [], null); + $this->setIfExists('day_of_month_ending', $data ?? [], null); + $this->setIfExists('period_ending', $data ?? [], null); + $this->setIfExists('shift_consolidation_option', $data ?? [], null); + $this->setIfExists('shift_consolidation_threshold', $data ?? [], null); + $this->setIfExists('rules_json', $data ?? [], null); + $this->setIfExists('disabled_rules', $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; } /** @@ -296,7 +391,8 @@ public function listInvalidProperties() $allowedValues = $this->getPeriodTypeAllowableValues(); if (!is_null($this->container['period_type']) && !in_array($this->container['period_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'period_type', must be one of '%s'", + "invalid value '%s' for 'period_type', must be one of '%s'", + $this->container['period_type'], implode("', '", $allowedValues) ); } @@ -304,7 +400,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftConsolidationOptionAllowableValues(); if (!is_null($this->container['shift_consolidation_option']) && !in_array($this->container['shift_consolidation_option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_consolidation_option', must be one of '%s'", + "invalid value '%s' for 'shift_consolidation_option', must be one of '%s'", + $this->container['shift_consolidation_option'], implode("', '", $allowedValues) ); } @@ -327,7 +424,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -337,12 +434,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -351,7 +451,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -361,12 +461,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -375,7 +478,7 @@ public function setName($name) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -385,12 +488,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -399,7 +505,7 @@ public function setDescription($description) /** * Gets period_type * - * @return string + * @return string|null */ public function getPeriodType() { @@ -409,17 +515,21 @@ public function getPeriodType() /** * Sets period_type * - * @param string $period_type + * @param string|null $period_type * - * @return $this + * @return self */ public function setPeriodType($period_type) { + if (is_null($period_type)) { + throw new \InvalidArgumentException('non-nullable period_type cannot be null'); + } $allowedValues = $this->getPeriodTypeAllowableValues(); - if (!is_null($period_type) && !in_array($period_type, $allowedValues, true)) { + if (!in_array($period_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'period_type', must be one of '%s'", + "Invalid value '%s' for 'period_type', must be one of '%s'", + $period_type, implode("', '", $allowedValues) ) ); @@ -432,7 +542,7 @@ public function setPeriodType($period_type) /** * Gets day_of_week_ending * - * @return int + * @return int|null */ public function getDayOfWeekEnding() { @@ -442,12 +552,15 @@ public function getDayOfWeekEnding() /** * Sets day_of_week_ending * - * @param int $day_of_week_ending + * @param int|null $day_of_week_ending * - * @return $this + * @return self */ public function setDayOfWeekEnding($day_of_week_ending) { + if (is_null($day_of_week_ending)) { + throw new \InvalidArgumentException('non-nullable day_of_week_ending cannot be null'); + } $this->container['day_of_week_ending'] = $day_of_week_ending; return $this; @@ -456,7 +569,7 @@ public function setDayOfWeekEnding($day_of_week_ending) /** * Gets day_of_month_ending * - * @return int + * @return int|null */ public function getDayOfMonthEnding() { @@ -466,12 +579,15 @@ public function getDayOfMonthEnding() /** * Sets day_of_month_ending * - * @param int $day_of_month_ending + * @param int|null $day_of_month_ending * - * @return $this + * @return self */ public function setDayOfMonthEnding($day_of_month_ending) { + if (is_null($day_of_month_ending)) { + throw new \InvalidArgumentException('non-nullable day_of_month_ending cannot be null'); + } $this->container['day_of_month_ending'] = $day_of_month_ending; return $this; @@ -480,7 +596,7 @@ public function setDayOfMonthEnding($day_of_month_ending) /** * Gets period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPeriodEnding() { @@ -490,12 +606,15 @@ public function getPeriodEnding() /** * Sets period_ending * - * @param \DateTime $period_ending + * @param \DateTime|null $period_ending * - * @return $this + * @return self */ public function setPeriodEnding($period_ending) { + if (is_null($period_ending)) { + throw new \InvalidArgumentException('non-nullable period_ending cannot be null'); + } $this->container['period_ending'] = $period_ending; return $this; @@ -504,7 +623,7 @@ public function setPeriodEnding($period_ending) /** * Gets shift_consolidation_option * - * @return string + * @return string|null */ public function getShiftConsolidationOption() { @@ -514,17 +633,21 @@ public function getShiftConsolidationOption() /** * Sets shift_consolidation_option * - * @param string $shift_consolidation_option + * @param string|null $shift_consolidation_option * - * @return $this + * @return self */ public function setShiftConsolidationOption($shift_consolidation_option) { + if (is_null($shift_consolidation_option)) { + throw new \InvalidArgumentException('non-nullable shift_consolidation_option cannot be null'); + } $allowedValues = $this->getShiftConsolidationOptionAllowableValues(); - if (!is_null($shift_consolidation_option) && !in_array($shift_consolidation_option, $allowedValues, true)) { + if (!in_array($shift_consolidation_option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_consolidation_option', must be one of '%s'", + "Invalid value '%s' for 'shift_consolidation_option', must be one of '%s'", + $shift_consolidation_option, implode("', '", $allowedValues) ) ); @@ -537,7 +660,7 @@ public function setShiftConsolidationOption($shift_consolidation_option) /** * Gets shift_consolidation_threshold * - * @return string + * @return string|null */ public function getShiftConsolidationThreshold() { @@ -547,12 +670,15 @@ public function getShiftConsolidationThreshold() /** * Sets shift_consolidation_threshold * - * @param string $shift_consolidation_threshold + * @param string|null $shift_consolidation_threshold * - * @return $this + * @return self */ public function setShiftConsolidationThreshold($shift_consolidation_threshold) { + if (is_null($shift_consolidation_threshold)) { + throw new \InvalidArgumentException('non-nullable shift_consolidation_threshold cannot be null'); + } $this->container['shift_consolidation_threshold'] = $shift_consolidation_threshold; return $this; @@ -561,7 +687,7 @@ public function setShiftConsolidationThreshold($shift_consolidation_threshold) /** * Gets rules_json * - * @return string + * @return string|null */ public function getRulesJson() { @@ -571,12 +697,15 @@ public function getRulesJson() /** * Sets rules_json * - * @param string $rules_json + * @param string|null $rules_json * - * @return $this + * @return self */ public function setRulesJson($rules_json) { + if (is_null($rules_json)) { + throw new \InvalidArgumentException('non-nullable rules_json cannot be null'); + } $this->container['rules_json'] = $rules_json; return $this; @@ -585,7 +714,7 @@ public function setRulesJson($rules_json) /** * Gets disabled_rules * - * @return string[] + * @return string[]|null */ public function getDisabledRules() { @@ -595,12 +724,15 @@ public function getDisabledRules() /** * Sets disabled_rules * - * @param string[] $disabled_rules + * @param string[]|null $disabled_rules * - * @return $this + * @return self */ public function setDisabledRules($disabled_rules) { + if (is_null($disabled_rules)) { + throw new \InvalidArgumentException('non-nullable disabled_rules cannot be null'); + } $this->container['disabled_rules'] = $disabled_rules; return $this; @@ -612,7 +744,7 @@ public function setDisabledRules($disabled_rules) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -622,22 +754,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -653,11 +786,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -665,13 +811,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRateScheduleModel.php b/src/lib/Model/PayRateScheduleModel.php index 7c4a03f..2159daf 100644 --- a/src/lib/Model/PayRateScheduleModel.php +++ b/src/lib/Model/PayRateScheduleModel.php @@ -2,64 +2,64 @@ /** * PayRateScheduleModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRateScheduleModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRateScheduleModel implements ModelInterface, ArrayAccess +class PayRateScheduleModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRateScheduleModel'; + protected static $openAPIModelName = 'PayRateScheduleModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', - 'rate' => 'double', + 'rate' => 'float', 'rate_unit' => 'string', 'commencement_date' => '\DateTime' ]; @@ -68,8 +68,10 @@ class PayRateScheduleModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'rate' => 'double', @@ -77,14 +79,34 @@ class PayRateScheduleModel implements ModelInterface, ArrayAccess 'commencement_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'rate' => false, + 'rate_unit' => false, + 'commencement_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['rate_unit'] = isset($data['rate_unit']) ? $data['rate_unit'] : null; - $this->container['commencement_date'] = isset($data['commencement_date']) ? $data['commencement_date'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('rate_unit', $data ?? [], null); + $this->setIfExists('commencement_date', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -241,12 +330,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -265,12 +357,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -279,7 +374,7 @@ public function setEmployeeId($employee_id) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -289,12 +384,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -303,7 +401,7 @@ public function setRate($rate) /** * Gets rate_unit * - * @return string + * @return string|null */ public function getRateUnit() { @@ -313,12 +411,15 @@ public function getRateUnit() /** * Sets rate_unit * - * @param string $rate_unit + * @param string|null $rate_unit * - * @return $this + * @return self */ public function setRateUnit($rate_unit) { + if (is_null($rate_unit)) { + throw new \InvalidArgumentException('non-nullable rate_unit cannot be null'); + } $this->container['rate_unit'] = $rate_unit; return $this; @@ -327,7 +428,7 @@ public function setRateUnit($rate_unit) /** * Gets commencement_date * - * @return \DateTime + * @return \DateTime|null */ public function getCommencementDate() { @@ -337,12 +438,15 @@ public function getCommencementDate() /** * Sets commencement_date * - * @param \DateTime $commencement_date + * @param \DateTime|null $commencement_date * - * @return $this + * @return self */ public function setCommencementDate($commencement_date) { + if (is_null($commencement_date)) { + throw new \InvalidArgumentException('non-nullable commencement_date cannot be null'); + } $this->container['commencement_date'] = $commencement_date; return $this; @@ -354,7 +458,7 @@ public function setCommencementDate($commencement_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRateTemplateModel.php b/src/lib/Model/PayRateTemplateModel.php index 3aff683..667d561 100644 --- a/src/lib/Model/PayRateTemplateModel.php +++ b/src/lib/Model/PayRateTemplateModel.php @@ -2,69 +2,69 @@ /** * PayRateTemplateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRateTemplateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRateTemplateModel implements ModelInterface, ArrayAccess +class PayRateTemplateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRateTemplateModel'; + protected static $openAPIModelName = 'PayRateTemplateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'primary_pay_category_id' => 'int', - 'super_threshold_amount' => 'double', - 'pay_categories' => '\Swagger\Client\Model\PayRateTemplatePayCategoryModel[]', + 'super_threshold_amount' => 'float', + 'pay_categories' => '\OpenAPI\Client\Model\PayRateTemplatePayCategoryModel[]', 'external_id' => 'string', 'source' => 'string', - 'maximum_quarterly_super_contributions_base' => 'double', + 'maximum_quarterly_super_contributions_base' => 'float', 'reapply_to_linked_employees' => 'bool' ]; @@ -72,8 +72,10 @@ class PayRateTemplateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'primary_pay_category_id' => 'int32', @@ -85,14 +87,38 @@ class PayRateTemplateModel implements ModelInterface, ArrayAccess 'reapply_to_linked_employees' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'primary_pay_category_id' => false, + 'super_threshold_amount' => false, + 'pay_categories' => false, + 'external_id' => false, + 'source' => false, + 'maximum_quarterly_super_contributions_base' => false, + 'reapply_to_linked_employees' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['primary_pay_category_id'] = isset($data['primary_pay_category_id']) ? $data['primary_pay_category_id'] : null; - $this->container['super_threshold_amount'] = isset($data['super_threshold_amount']) ? $data['super_threshold_amount'] : null; - $this->container['pay_categories'] = isset($data['pay_categories']) ? $data['pay_categories'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['maximum_quarterly_super_contributions_base'] = isset($data['maximum_quarterly_super_contributions_base']) ? $data['maximum_quarterly_super_contributions_base'] : null; - $this->container['reapply_to_linked_employees'] = isset($data['reapply_to_linked_employees']) ? $data['reapply_to_linked_employees'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('primary_pay_category_id', $data ?? [], null); + $this->setIfExists('super_threshold_amount', $data ?? [], null); + $this->setIfExists('pay_categories', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('maximum_quarterly_super_contributions_base', $data ?? [], null); + $this->setIfExists('reapply_to_linked_employees', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +358,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +375,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -289,12 +385,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -303,7 +402,7 @@ public function setName($name) /** * Gets primary_pay_category_id * - * @return int + * @return int|null */ public function getPrimaryPayCategoryId() { @@ -313,12 +412,15 @@ public function getPrimaryPayCategoryId() /** * Sets primary_pay_category_id * - * @param int $primary_pay_category_id + * @param int|null $primary_pay_category_id * - * @return $this + * @return self */ public function setPrimaryPayCategoryId($primary_pay_category_id) { + if (is_null($primary_pay_category_id)) { + throw new \InvalidArgumentException('non-nullable primary_pay_category_id cannot be null'); + } $this->container['primary_pay_category_id'] = $primary_pay_category_id; return $this; @@ -327,7 +429,7 @@ public function setPrimaryPayCategoryId($primary_pay_category_id) /** * Gets super_threshold_amount * - * @return double + * @return float|null */ public function getSuperThresholdAmount() { @@ -337,12 +439,15 @@ public function getSuperThresholdAmount() /** * Sets super_threshold_amount * - * @param double $super_threshold_amount + * @param float|null $super_threshold_amount * - * @return $this + * @return self */ public function setSuperThresholdAmount($super_threshold_amount) { + if (is_null($super_threshold_amount)) { + throw new \InvalidArgumentException('non-nullable super_threshold_amount cannot be null'); + } $this->container['super_threshold_amount'] = $super_threshold_amount; return $this; @@ -351,7 +456,7 @@ public function setSuperThresholdAmount($super_threshold_amount) /** * Gets pay_categories * - * @return \Swagger\Client\Model\PayRateTemplatePayCategoryModel[] + * @return \OpenAPI\Client\Model\PayRateTemplatePayCategoryModel[]|null */ public function getPayCategories() { @@ -361,12 +466,15 @@ public function getPayCategories() /** * Sets pay_categories * - * @param \Swagger\Client\Model\PayRateTemplatePayCategoryModel[] $pay_categories + * @param \OpenAPI\Client\Model\PayRateTemplatePayCategoryModel[]|null $pay_categories * - * @return $this + * @return self */ public function setPayCategories($pay_categories) { + if (is_null($pay_categories)) { + throw new \InvalidArgumentException('non-nullable pay_categories cannot be null'); + } $this->container['pay_categories'] = $pay_categories; return $this; @@ -375,7 +483,7 @@ public function setPayCategories($pay_categories) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -385,12 +493,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -399,7 +510,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -409,12 +520,15 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $this->container['source'] = $source; return $this; @@ -423,7 +537,7 @@ public function setSource($source) /** * Gets maximum_quarterly_super_contributions_base * - * @return double + * @return float|null */ public function getMaximumQuarterlySuperContributionsBase() { @@ -433,12 +547,15 @@ public function getMaximumQuarterlySuperContributionsBase() /** * Sets maximum_quarterly_super_contributions_base * - * @param double $maximum_quarterly_super_contributions_base + * @param float|null $maximum_quarterly_super_contributions_base * - * @return $this + * @return self */ public function setMaximumQuarterlySuperContributionsBase($maximum_quarterly_super_contributions_base) { + if (is_null($maximum_quarterly_super_contributions_base)) { + throw new \InvalidArgumentException('non-nullable maximum_quarterly_super_contributions_base cannot be null'); + } $this->container['maximum_quarterly_super_contributions_base'] = $maximum_quarterly_super_contributions_base; return $this; @@ -447,7 +564,7 @@ public function setMaximumQuarterlySuperContributionsBase($maximum_quarterly_sup /** * Gets reapply_to_linked_employees * - * @return bool + * @return bool|null */ public function getReapplyToLinkedEmployees() { @@ -457,12 +574,15 @@ public function getReapplyToLinkedEmployees() /** * Sets reapply_to_linked_employees * - * @param bool $reapply_to_linked_employees + * @param bool|null $reapply_to_linked_employees * - * @return $this + * @return self */ public function setReapplyToLinkedEmployees($reapply_to_linked_employees) { + if (is_null($reapply_to_linked_employees)) { + throw new \InvalidArgumentException('non-nullable reapply_to_linked_employees cannot be null'); + } $this->container['reapply_to_linked_employees'] = $reapply_to_linked_employees; return $this; @@ -474,7 +594,7 @@ public function setReapplyToLinkedEmployees($reapply_to_linked_employees) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRateTemplatePayCategoryExportModel.php b/src/lib/Model/PayRateTemplatePayCategoryExportModel.php index 60cc44c..e327797 100644 --- a/src/lib/Model/PayRateTemplatePayCategoryExportModel.php +++ b/src/lib/Model/PayRateTemplatePayCategoryExportModel.php @@ -2,87 +2,108 @@ /** * PayRateTemplatePayCategoryExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRateTemplatePayCategoryExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRateTemplatePayCategoryExportModel implements ModelInterface, ArrayAccess +class PayRateTemplatePayCategoryExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRateTemplatePayCategoryExportModel'; + protected static $openAPIModelName = 'PayRateTemplatePayCategoryExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_category_id' => 'int', - 'user_supplied_rate' => 'double', - 'calculated_rate' => 'double', - 'standard_weekly_hours' => 'double' + 'user_supplied_rate' => 'float', + 'calculated_rate' => 'float', + 'standard_weekly_hours' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_category_id' => 'int32', 'user_supplied_rate' => 'double', 'calculated_rate' => 'double', 'standard_weekly_hours' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_category_id' => false, + 'user_supplied_rate' => false, + 'calculated_rate' => false, + 'standard_weekly_hours' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['user_supplied_rate'] = isset($data['user_supplied_rate']) ? $data['user_supplied_rate'] : null; - $this->container['calculated_rate'] = isset($data['calculated_rate']) ? $data['calculated_rate'] : null; - $this->container['standard_weekly_hours'] = isset($data['standard_weekly_hours']) ? $data['standard_weekly_hours'] : null; + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('user_supplied_rate', $data ?? [], null); + $this->setIfExists('calculated_rate', $data ?? [], null); + $this->setIfExists('standard_weekly_hours', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -235,12 +323,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -249,7 +340,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets user_supplied_rate * - * @return double + * @return float|null */ public function getUserSuppliedRate() { @@ -259,12 +350,15 @@ public function getUserSuppliedRate() /** * Sets user_supplied_rate * - * @param double $user_supplied_rate + * @param float|null $user_supplied_rate * - * @return $this + * @return self */ public function setUserSuppliedRate($user_supplied_rate) { + if (is_null($user_supplied_rate)) { + throw new \InvalidArgumentException('non-nullable user_supplied_rate cannot be null'); + } $this->container['user_supplied_rate'] = $user_supplied_rate; return $this; @@ -273,7 +367,7 @@ public function setUserSuppliedRate($user_supplied_rate) /** * Gets calculated_rate * - * @return double + * @return float|null */ public function getCalculatedRate() { @@ -283,12 +377,15 @@ public function getCalculatedRate() /** * Sets calculated_rate * - * @param double $calculated_rate + * @param float|null $calculated_rate * - * @return $this + * @return self */ public function setCalculatedRate($calculated_rate) { + if (is_null($calculated_rate)) { + throw new \InvalidArgumentException('non-nullable calculated_rate cannot be null'); + } $this->container['calculated_rate'] = $calculated_rate; return $this; @@ -297,7 +394,7 @@ public function setCalculatedRate($calculated_rate) /** * Gets standard_weekly_hours * - * @return double + * @return float|null */ public function getStandardWeeklyHours() { @@ -307,12 +404,15 @@ public function getStandardWeeklyHours() /** * Sets standard_weekly_hours * - * @param double $standard_weekly_hours + * @param float|null $standard_weekly_hours * - * @return $this + * @return self */ public function setStandardWeeklyHours($standard_weekly_hours) { + if (is_null($standard_weekly_hours)) { + throw new \InvalidArgumentException('non-nullable standard_weekly_hours cannot be null'); + } $this->container['standard_weekly_hours'] = $standard_weekly_hours; return $this; @@ -324,7 +424,7 @@ public function setStandardWeeklyHours($standard_weekly_hours) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRateTemplatePayCategoryModel.php b/src/lib/Model/PayRateTemplatePayCategoryModel.php index 7efbbc9..39a98db 100644 --- a/src/lib/Model/PayRateTemplatePayCategoryModel.php +++ b/src/lib/Model/PayRateTemplatePayCategoryModel.php @@ -2,75 +2,77 @@ /** * PayRateTemplatePayCategoryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRateTemplatePayCategoryModel Class Doc Comment * * @category Class * @description TODO: Can we get away with not having UserSuppliedRate and CalculatedRate? can we just have 'Rate' and work (which is interpreted as UserSuppliedRate) and determine calculated rate from there? - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRateTemplatePayCategoryModel implements ModelInterface, ArrayAccess +class PayRateTemplatePayCategoryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRateTemplatePayCategoryModel'; + protected static $openAPIModelName = 'PayRateTemplatePayCategoryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_category_id' => 'int', - 'user_supplied_rate' => 'double', - 'calculated_rate' => 'double', - 'standard_weekly_hours' => 'double', - 'super_rate' => 'double' + 'user_supplied_rate' => 'float', + 'calculated_rate' => 'float', + 'standard_weekly_hours' => 'float', + 'super_rate' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_category_id' => 'int32', 'user_supplied_rate' => 'double', 'calculated_rate' => 'double', @@ -78,14 +80,34 @@ class PayRateTemplatePayCategoryModel implements ModelInterface, ArrayAccess 'super_rate' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_category_id' => false, + 'user_supplied_rate' => false, + 'calculated_rate' => false, + 'standard_weekly_hours' => false, + 'super_rate' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -93,9 +115,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -176,12 +250,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -198,11 +269,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['user_supplied_rate'] = isset($data['user_supplied_rate']) ? $data['user_supplied_rate'] : null; - $this->container['calculated_rate'] = isset($data['calculated_rate']) ? $data['calculated_rate'] : null; - $this->container['standard_weekly_hours'] = isset($data['standard_weekly_hours']) ? $data['standard_weekly_hours'] : null; - $this->container['super_rate'] = isset($data['super_rate']) ? $data['super_rate'] : null; + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('user_supplied_rate', $data ?? [], null); + $this->setIfExists('calculated_rate', $data ?? [], null); + $this->setIfExists('standard_weekly_hours', $data ?? [], null); + $this->setIfExists('super_rate', $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; } /** @@ -232,7 +321,7 @@ public function valid() /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -242,12 +331,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -256,7 +348,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets user_supplied_rate * - * @return double + * @return float|null */ public function getUserSuppliedRate() { @@ -266,12 +358,15 @@ public function getUserSuppliedRate() /** * Sets user_supplied_rate * - * @param double $user_supplied_rate + * @param float|null $user_supplied_rate * - * @return $this + * @return self */ public function setUserSuppliedRate($user_supplied_rate) { + if (is_null($user_supplied_rate)) { + throw new \InvalidArgumentException('non-nullable user_supplied_rate cannot be null'); + } $this->container['user_supplied_rate'] = $user_supplied_rate; return $this; @@ -280,7 +375,7 @@ public function setUserSuppliedRate($user_supplied_rate) /** * Gets calculated_rate * - * @return double + * @return float|null */ public function getCalculatedRate() { @@ -290,12 +385,15 @@ public function getCalculatedRate() /** * Sets calculated_rate * - * @param double $calculated_rate + * @param float|null $calculated_rate * - * @return $this + * @return self */ public function setCalculatedRate($calculated_rate) { + if (is_null($calculated_rate)) { + throw new \InvalidArgumentException('non-nullable calculated_rate cannot be null'); + } $this->container['calculated_rate'] = $calculated_rate; return $this; @@ -304,7 +402,7 @@ public function setCalculatedRate($calculated_rate) /** * Gets standard_weekly_hours * - * @return double + * @return float|null */ public function getStandardWeeklyHours() { @@ -314,12 +412,15 @@ public function getStandardWeeklyHours() /** * Sets standard_weekly_hours * - * @param double $standard_weekly_hours + * @param float|null $standard_weekly_hours * - * @return $this + * @return self */ public function setStandardWeeklyHours($standard_weekly_hours) { + if (is_null($standard_weekly_hours)) { + throw new \InvalidArgumentException('non-nullable standard_weekly_hours cannot be null'); + } $this->container['standard_weekly_hours'] = $standard_weekly_hours; return $this; @@ -328,7 +429,7 @@ public function setStandardWeeklyHours($standard_weekly_hours) /** * Gets super_rate * - * @return double + * @return float|null */ public function getSuperRate() { @@ -338,12 +439,15 @@ public function getSuperRate() /** * Sets super_rate * - * @param double $super_rate + * @param float|null $super_rate * - * @return $this + * @return self */ public function setSuperRate($super_rate) { + if (is_null($super_rate)) { + throw new \InvalidArgumentException('non-nullable super_rate cannot be null'); + } $this->container['super_rate'] = $super_rate; return $this; @@ -355,7 +459,7 @@ public function setSuperRate($super_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -365,22 +469,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -396,11 +501,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -408,13 +526,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunCreateRequest.php b/src/lib/Model/PayRunCreateRequest.php index 72bb188..a1b3075 100644 --- a/src/lib/Model/PayRunCreateRequest.php +++ b/src/lib/Model/PayRunCreateRequest.php @@ -2,61 +2,61 @@ /** * PayRunCreateRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunCreateRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunCreateRequest implements ModelInterface, ArrayAccess +class PayRunCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunCreateRequest'; + protected static $openAPIModelName = 'PayRunCreateRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_schedule_id' => 'int', 'pay_period_ending' => '\DateTime', 'date_paid' => '\DateTime', @@ -71,8 +71,10 @@ class PayRunCreateRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_schedule_id' => 'int32', 'pay_period_ending' => 'date-time', 'date_paid' => 'date-time', @@ -83,14 +85,37 @@ class PayRunCreateRequest implements ModelInterface, ArrayAccess 'adhoc' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_schedule_id' => false, + 'pay_period_ending' => false, + 'date_paid' => false, + 'timesheet_import_option' => false, + 'external_id' => false, + 'callback_url' => false, + 'create_with_empty_pays' => false, + 'adhoc' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,15 +267,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TIMESHEET_IMPORT_OPTION_NONE = 'None'; - const TIMESHEET_IMPORT_OPTION_THIS_PAY_PERIOD = 'ThisPayPeriod'; - const TIMESHEET_IMPORT_OPTION_ALL_OUTSTANDING = 'AllOutstanding'; - + public const TIMESHEET_IMPORT_OPTION_NONE = 'None'; + public const TIMESHEET_IMPORT_OPTION_THIS_PAY_PERIOD = 'ThisPayPeriod'; + public const TIMESHEET_IMPORT_OPTION_ALL_OUTSTANDING = 'AllOutstanding'; - /** * Gets allowable values of the enum * @@ -212,7 +287,6 @@ public function getTimesheetImportOptionAllowableValues() self::TIMESHEET_IMPORT_OPTION_ALL_OUTSTANDING, ]; } - /** * Associative array for storing property values @@ -229,14 +303,32 @@ public function getTimesheetImportOptionAllowableValues() */ public function __construct(array $data = null) { - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['pay_period_ending'] = isset($data['pay_period_ending']) ? $data['pay_period_ending'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['timesheet_import_option'] = isset($data['timesheet_import_option']) ? $data['timesheet_import_option'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['callback_url'] = isset($data['callback_url']) ? $data['callback_url'] : null; - $this->container['create_with_empty_pays'] = isset($data['create_with_empty_pays']) ? $data['create_with_empty_pays'] : null; - $this->container['adhoc'] = isset($data['adhoc']) ? $data['adhoc'] : null; + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('pay_period_ending', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('timesheet_import_option', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('create_with_empty_pays', $data ?? [], null); + $this->setIfExists('adhoc', $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; } /** @@ -251,7 +343,8 @@ public function listInvalidProperties() $allowedValues = $this->getTimesheetImportOptionAllowableValues(); if (!is_null($this->container['timesheet_import_option']) && !in_array($this->container['timesheet_import_option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'timesheet_import_option', must be one of '%s'", + "invalid value '%s' for 'timesheet_import_option', must be one of '%s'", + $this->container['timesheet_import_option'], implode("', '", $allowedValues) ); } @@ -274,7 +367,7 @@ public function valid() /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -284,12 +377,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -298,7 +394,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets pay_period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodEnding() { @@ -308,12 +404,15 @@ public function getPayPeriodEnding() /** * Sets pay_period_ending * - * @param \DateTime $pay_period_ending + * @param \DateTime|null $pay_period_ending * - * @return $this + * @return self */ public function setPayPeriodEnding($pay_period_ending) { + if (is_null($pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable pay_period_ending cannot be null'); + } $this->container['pay_period_ending'] = $pay_period_ending; return $this; @@ -322,7 +421,7 @@ public function setPayPeriodEnding($pay_period_ending) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -332,12 +431,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -346,7 +448,7 @@ public function setDatePaid($date_paid) /** * Gets timesheet_import_option * - * @return string + * @return string|null */ public function getTimesheetImportOption() { @@ -356,17 +458,21 @@ public function getTimesheetImportOption() /** * Sets timesheet_import_option * - * @param string $timesheet_import_option + * @param string|null $timesheet_import_option * - * @return $this + * @return self */ public function setTimesheetImportOption($timesheet_import_option) { + if (is_null($timesheet_import_option)) { + throw new \InvalidArgumentException('non-nullable timesheet_import_option cannot be null'); + } $allowedValues = $this->getTimesheetImportOptionAllowableValues(); - if (!is_null($timesheet_import_option) && !in_array($timesheet_import_option, $allowedValues, true)) { + if (!in_array($timesheet_import_option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'timesheet_import_option', must be one of '%s'", + "Invalid value '%s' for 'timesheet_import_option', must be one of '%s'", + $timesheet_import_option, implode("', '", $allowedValues) ) ); @@ -379,7 +485,7 @@ public function setTimesheetImportOption($timesheet_import_option) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -389,12 +495,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -403,7 +512,7 @@ public function setExternalId($external_id) /** * Gets callback_url * - * @return string + * @return string|null */ public function getCallbackUrl() { @@ -413,12 +522,15 @@ public function getCallbackUrl() /** * Sets callback_url * - * @param string $callback_url + * @param string|null $callback_url * - * @return $this + * @return self */ public function setCallbackUrl($callback_url) { + if (is_null($callback_url)) { + throw new \InvalidArgumentException('non-nullable callback_url cannot be null'); + } $this->container['callback_url'] = $callback_url; return $this; @@ -427,7 +539,7 @@ public function setCallbackUrl($callback_url) /** * Gets create_with_empty_pays * - * @return bool + * @return bool|null */ public function getCreateWithEmptyPays() { @@ -437,12 +549,15 @@ public function getCreateWithEmptyPays() /** * Sets create_with_empty_pays * - * @param bool $create_with_empty_pays + * @param bool|null $create_with_empty_pays * - * @return $this + * @return self */ public function setCreateWithEmptyPays($create_with_empty_pays) { + if (is_null($create_with_empty_pays)) { + throw new \InvalidArgumentException('non-nullable create_with_empty_pays cannot be null'); + } $this->container['create_with_empty_pays'] = $create_with_empty_pays; return $this; @@ -451,7 +566,7 @@ public function setCreateWithEmptyPays($create_with_empty_pays) /** * Gets adhoc * - * @return bool + * @return bool|null */ public function getAdhoc() { @@ -461,12 +576,15 @@ public function getAdhoc() /** * Sets adhoc * - * @param bool $adhoc + * @param bool|null $adhoc * - * @return $this + * @return self */ public function setAdhoc($adhoc) { + if (is_null($adhoc)) { + throw new \InvalidArgumentException('non-nullable adhoc cannot be null'); + } $this->container['adhoc'] = $adhoc; return $this; @@ -478,7 +596,7 @@ public function setAdhoc($adhoc) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -488,22 +606,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -519,11 +638,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -531,13 +663,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunEmployeeExpenseResponse.php b/src/lib/Model/PayRunEmployeeExpenseResponse.php index f2ad26e..fcc8446 100644 --- a/src/lib/Model/PayRunEmployeeExpenseResponse.php +++ b/src/lib/Model/PayRunEmployeeExpenseResponse.php @@ -2,62 +2,62 @@ /** * PayRunEmployeeExpenseResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunEmployeeExpenseResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunEmployeeExpenseResponse implements ModelInterface, ArrayAccess +class PayRunEmployeeExpenseResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunEmployeeExpenseResponse'; + protected static $openAPIModelName = 'PayRunEmployeeExpenseResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'employee_expenses' => 'map[string,\Swagger\Client\Model\EmployeeExpenseModel[]]', + protected static $openAPITypes = [ + 'employee_expenses' => 'array', 'pay_run_id' => 'int' ]; @@ -65,20 +65,39 @@ class PayRunEmployeeExpenseResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_expenses' => null, 'pay_run_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_expenses' => false, + 'pay_run_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_expenses'] = isset($data['employee_expenses']) ? $data['employee_expenses'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; + $this->setIfExists('employee_expenses', $data ?? [], null); + $this->setIfExists('pay_run_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets employee_expenses * - * @return map[string,\Swagger\Client\Model\EmployeeExpenseModel[]] + * @return array|null */ public function getEmployeeExpenses() { @@ -223,12 +309,15 @@ public function getEmployeeExpenses() /** * Sets employee_expenses * - * @param map[string,\Swagger\Client\Model\EmployeeExpenseModel[]] $employee_expenses + * @param array|null $employee_expenses * - * @return $this + * @return self */ public function setEmployeeExpenses($employee_expenses) { + if (is_null($employee_expenses)) { + throw new \InvalidArgumentException('non-nullable employee_expenses cannot be null'); + } $this->container['employee_expenses'] = $employee_expenses; return $this; @@ -237,7 +326,7 @@ public function setEmployeeExpenses($employee_expenses) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -247,12 +336,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -264,7 +356,7 @@ public function setPayRunId($pay_run_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunEmployerLiabilityResponse.php b/src/lib/Model/PayRunEmployerLiabilityResponse.php index ac2260a..1163fb0 100644 --- a/src/lib/Model/PayRunEmployerLiabilityResponse.php +++ b/src/lib/Model/PayRunEmployerLiabilityResponse.php @@ -2,62 +2,62 @@ /** * PayRunEmployerLiabilityResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunEmployerLiabilityResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunEmployerLiabilityResponse implements ModelInterface, ArrayAccess +class PayRunEmployerLiabilityResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunEmployerLiabilityResponse'; + protected static $openAPIModelName = 'PayRunEmployerLiabilityResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'employer_liabilities' => 'map[string,\Swagger\Client\Model\EmployerLiabilityModel[]]', + protected static $openAPITypes = [ + 'employer_liabilities' => 'array', 'pay_run_id' => 'int' ]; @@ -65,20 +65,39 @@ class PayRunEmployerLiabilityResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employer_liabilities' => null, 'pay_run_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employer_liabilities' => false, + 'pay_run_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employer_liabilities'] = isset($data['employer_liabilities']) ? $data['employer_liabilities'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; + $this->setIfExists('employer_liabilities', $data ?? [], null); + $this->setIfExists('pay_run_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets employer_liabilities * - * @return map[string,\Swagger\Client\Model\EmployerLiabilityModel[]] + * @return array|null */ public function getEmployerLiabilities() { @@ -223,12 +309,15 @@ public function getEmployerLiabilities() /** * Sets employer_liabilities * - * @param map[string,\Swagger\Client\Model\EmployerLiabilityModel[]] $employer_liabilities + * @param array|null $employer_liabilities * - * @return $this + * @return self */ public function setEmployerLiabilities($employer_liabilities) { + if (is_null($employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities cannot be null'); + } $this->container['employer_liabilities'] = $employer_liabilities; return $this; @@ -237,7 +326,7 @@ public function setEmployerLiabilities($employer_liabilities) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -247,12 +336,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -264,7 +356,7 @@ public function setPayRunId($pay_run_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunFinaliseDefaultSettingsModel.php b/src/lib/Model/PayRunFinaliseDefaultSettingsModel.php index b5ce781..bfdb590 100644 --- a/src/lib/Model/PayRunFinaliseDefaultSettingsModel.php +++ b/src/lib/Model/PayRunFinaliseDefaultSettingsModel.php @@ -2,61 +2,61 @@ /** * PayRunFinaliseDefaultSettingsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunFinaliseDefaultSettingsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunFinaliseDefaultSettingsModel implements ModelInterface, ArrayAccess +class PayRunFinaliseDefaultSettingsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunFinaliseDefaultSettingsModel'; + protected static $openAPIModelName = 'PayRunFinaliseDefaultSettingsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'export_journals' => 'string', 'export_journals_timeline' => 'string', 'export_journals_day' => 'int', @@ -85,8 +85,10 @@ class PayRunFinaliseDefaultSettingsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'export_journals' => null, 'export_journals_timeline' => null, 'export_journals_day' => 'int32', @@ -111,14 +113,51 @@ class PayRunFinaliseDefaultSettingsModel implements ModelInterface, ArrayAccess 'report_packs_to_run' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'export_journals' => false, + 'export_journals_timeline' => false, + 'export_journals_day' => false, + 'export_journals_time_of_day' => false, + 'lodge_pay_run' => false, + 'lodge_pay_run_day' => false, + 'lodge_pay_run_timeline' => false, + 'lodge_pay_run_time_of_day' => false, + 'publish_pay_slips_day' => false, + 'publish_pay_slips_timeline' => false, + 'publish_pay_slips' => false, + 'publish_pay_slips_time_of_day' => false, + 'suppress_notifications' => false, + 'submit_to_pension_sync' => false, + 'submit_to_pension_sync_timeline' => false, + 'submit_to_pension_sync_day' => false, + 'submit_to_pension_sync_time_of_day' => false, + 'run_report_packs' => false, + 'run_report_packs_timeline' => false, + 'run_report_packs_day' => false, + 'run_report_packs_time_of_day' => false, + 'report_packs_to_run' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -126,9 +165,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -260,42 +351,40 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const EXPORT_JOURNALS_MANUAL = 'Manual'; - const EXPORT_JOURNALS_IMMEDIATE = 'Immediate'; - const EXPORT_JOURNALS_SCHEDULED = 'Scheduled'; - const EXPORT_JOURNALS_TIMELINE_BEFORE = 'Before'; - const EXPORT_JOURNALS_TIMELINE_AFTER = 'After'; - const EXPORT_JOURNALS_TIMELINE_ON = 'On'; - const LODGE_PAY_RUN_MANUAL = 'Manual'; - const LODGE_PAY_RUN_IMMEDIATE = 'Immediate'; - const LODGE_PAY_RUN_SCHEDULED = 'Scheduled'; - const LODGE_PAY_RUN_TIMELINE_BEFORE = 'Before'; - const LODGE_PAY_RUN_TIMELINE_AFTER = 'After'; - const LODGE_PAY_RUN_TIMELINE_ON = 'On'; - const PUBLISH_PAY_SLIPS_TIMELINE_BEFORE = 'Before'; - const PUBLISH_PAY_SLIPS_TIMELINE_AFTER = 'After'; - const PUBLISH_PAY_SLIPS_TIMELINE_ON = 'On'; - const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; - const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; - const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; - const SUBMIT_TO_PENSION_SYNC_MANUAL = 'Manual'; - const SUBMIT_TO_PENSION_SYNC_IMMEDIATE = 'Immediate'; - const SUBMIT_TO_PENSION_SYNC_SCHEDULED = 'Scheduled'; - const SUBMIT_TO_PENSION_SYNC_TIMELINE_BEFORE = 'Before'; - const SUBMIT_TO_PENSION_SYNC_TIMELINE_AFTER = 'After'; - const SUBMIT_TO_PENSION_SYNC_TIMELINE_ON = 'On'; - const RUN_REPORT_PACKS_MANUAL = 'Manual'; - const RUN_REPORT_PACKS_IMMEDIATE = 'Immediate'; - const RUN_REPORT_PACKS_SCHEDULED = 'Scheduled'; - const RUN_REPORT_PACKS_TIMELINE_BEFORE = 'Before'; - const RUN_REPORT_PACKS_TIMELINE_AFTER = 'After'; - const RUN_REPORT_PACKS_TIMELINE_ON = 'On'; - - - + return self::$openAPIModelName; + } + + public const EXPORT_JOURNALS_MANUAL = 'Manual'; + public const EXPORT_JOURNALS_IMMEDIATE = 'Immediate'; + public const EXPORT_JOURNALS_SCHEDULED = 'Scheduled'; + public const EXPORT_JOURNALS_TIMELINE_BEFORE = 'Before'; + public const EXPORT_JOURNALS_TIMELINE_AFTER = 'After'; + public const EXPORT_JOURNALS_TIMELINE_ON = 'On'; + public const LODGE_PAY_RUN_MANUAL = 'Manual'; + public const LODGE_PAY_RUN_IMMEDIATE = 'Immediate'; + public const LODGE_PAY_RUN_SCHEDULED = 'Scheduled'; + public const LODGE_PAY_RUN_TIMELINE_BEFORE = 'Before'; + public const LODGE_PAY_RUN_TIMELINE_AFTER = 'After'; + public const LODGE_PAY_RUN_TIMELINE_ON = 'On'; + public const PUBLISH_PAY_SLIPS_TIMELINE_BEFORE = 'Before'; + public const PUBLISH_PAY_SLIPS_TIMELINE_AFTER = 'After'; + public const PUBLISH_PAY_SLIPS_TIMELINE_ON = 'On'; + public const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; + public const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; + public const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; + public const SUBMIT_TO_PENSION_SYNC_MANUAL = 'Manual'; + public const SUBMIT_TO_PENSION_SYNC_IMMEDIATE = 'Immediate'; + public const SUBMIT_TO_PENSION_SYNC_SCHEDULED = 'Scheduled'; + public const SUBMIT_TO_PENSION_SYNC_TIMELINE_BEFORE = 'Before'; + public const SUBMIT_TO_PENSION_SYNC_TIMELINE_AFTER = 'After'; + public const SUBMIT_TO_PENSION_SYNC_TIMELINE_ON = 'On'; + public const RUN_REPORT_PACKS_MANUAL = 'Manual'; + public const RUN_REPORT_PACKS_IMMEDIATE = 'Immediate'; + public const RUN_REPORT_PACKS_SCHEDULED = 'Scheduled'; + public const RUN_REPORT_PACKS_TIMELINE_BEFORE = 'Before'; + public const RUN_REPORT_PACKS_TIMELINE_AFTER = 'After'; + public const RUN_REPORT_PACKS_TIMELINE_ON = 'On'; + /** * Gets allowable values of the enum * @@ -309,7 +398,7 @@ public function getExportJournalsAllowableValues() self::EXPORT_JOURNALS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -323,7 +412,7 @@ public function getExportJournalsTimelineAllowableValues() self::EXPORT_JOURNALS_TIMELINE_ON, ]; } - + /** * Gets allowable values of the enum * @@ -337,7 +426,7 @@ public function getLodgePayRunAllowableValues() self::LODGE_PAY_RUN_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -351,7 +440,7 @@ public function getLodgePayRunTimelineAllowableValues() self::LODGE_PAY_RUN_TIMELINE_ON, ]; } - + /** * Gets allowable values of the enum * @@ -365,7 +454,7 @@ public function getPublishPaySlipsTimelineAllowableValues() self::PUBLISH_PAY_SLIPS_TIMELINE_ON, ]; } - + /** * Gets allowable values of the enum * @@ -379,7 +468,7 @@ public function getPublishPaySlipsAllowableValues() self::PUBLISH_PAY_SLIPS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -393,7 +482,7 @@ public function getSubmitToPensionSyncAllowableValues() self::SUBMIT_TO_PENSION_SYNC_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -407,7 +496,7 @@ public function getSubmitToPensionSyncTimelineAllowableValues() self::SUBMIT_TO_PENSION_SYNC_TIMELINE_ON, ]; } - + /** * Gets allowable values of the enum * @@ -421,7 +510,7 @@ public function getRunReportPacksAllowableValues() self::RUN_REPORT_PACKS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -435,7 +524,6 @@ public function getRunReportPacksTimelineAllowableValues() self::RUN_REPORT_PACKS_TIMELINE_ON, ]; } - /** * Associative array for storing property values @@ -452,28 +540,46 @@ public function getRunReportPacksTimelineAllowableValues() */ public function __construct(array $data = null) { - $this->container['export_journals'] = isset($data['export_journals']) ? $data['export_journals'] : null; - $this->container['export_journals_timeline'] = isset($data['export_journals_timeline']) ? $data['export_journals_timeline'] : null; - $this->container['export_journals_day'] = isset($data['export_journals_day']) ? $data['export_journals_day'] : null; - $this->container['export_journals_time_of_day'] = isset($data['export_journals_time_of_day']) ? $data['export_journals_time_of_day'] : null; - $this->container['lodge_pay_run'] = isset($data['lodge_pay_run']) ? $data['lodge_pay_run'] : null; - $this->container['lodge_pay_run_day'] = isset($data['lodge_pay_run_day']) ? $data['lodge_pay_run_day'] : null; - $this->container['lodge_pay_run_timeline'] = isset($data['lodge_pay_run_timeline']) ? $data['lodge_pay_run_timeline'] : null; - $this->container['lodge_pay_run_time_of_day'] = isset($data['lodge_pay_run_time_of_day']) ? $data['lodge_pay_run_time_of_day'] : null; - $this->container['publish_pay_slips_day'] = isset($data['publish_pay_slips_day']) ? $data['publish_pay_slips_day'] : null; - $this->container['publish_pay_slips_timeline'] = isset($data['publish_pay_slips_timeline']) ? $data['publish_pay_slips_timeline'] : null; - $this->container['publish_pay_slips'] = isset($data['publish_pay_slips']) ? $data['publish_pay_slips'] : null; - $this->container['publish_pay_slips_time_of_day'] = isset($data['publish_pay_slips_time_of_day']) ? $data['publish_pay_slips_time_of_day'] : null; - $this->container['suppress_notifications'] = isset($data['suppress_notifications']) ? $data['suppress_notifications'] : null; - $this->container['submit_to_pension_sync'] = isset($data['submit_to_pension_sync']) ? $data['submit_to_pension_sync'] : null; - $this->container['submit_to_pension_sync_timeline'] = isset($data['submit_to_pension_sync_timeline']) ? $data['submit_to_pension_sync_timeline'] : null; - $this->container['submit_to_pension_sync_day'] = isset($data['submit_to_pension_sync_day']) ? $data['submit_to_pension_sync_day'] : null; - $this->container['submit_to_pension_sync_time_of_day'] = isset($data['submit_to_pension_sync_time_of_day']) ? $data['submit_to_pension_sync_time_of_day'] : null; - $this->container['run_report_packs'] = isset($data['run_report_packs']) ? $data['run_report_packs'] : null; - $this->container['run_report_packs_timeline'] = isset($data['run_report_packs_timeline']) ? $data['run_report_packs_timeline'] : null; - $this->container['run_report_packs_day'] = isset($data['run_report_packs_day']) ? $data['run_report_packs_day'] : null; - $this->container['run_report_packs_time_of_day'] = isset($data['run_report_packs_time_of_day']) ? $data['run_report_packs_time_of_day'] : null; - $this->container['report_packs_to_run'] = isset($data['report_packs_to_run']) ? $data['report_packs_to_run'] : null; + $this->setIfExists('export_journals', $data ?? [], null); + $this->setIfExists('export_journals_timeline', $data ?? [], null); + $this->setIfExists('export_journals_day', $data ?? [], null); + $this->setIfExists('export_journals_time_of_day', $data ?? [], null); + $this->setIfExists('lodge_pay_run', $data ?? [], null); + $this->setIfExists('lodge_pay_run_day', $data ?? [], null); + $this->setIfExists('lodge_pay_run_timeline', $data ?? [], null); + $this->setIfExists('lodge_pay_run_time_of_day', $data ?? [], null); + $this->setIfExists('publish_pay_slips_day', $data ?? [], null); + $this->setIfExists('publish_pay_slips_timeline', $data ?? [], null); + $this->setIfExists('publish_pay_slips', $data ?? [], null); + $this->setIfExists('publish_pay_slips_time_of_day', $data ?? [], null); + $this->setIfExists('suppress_notifications', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync_timeline', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync_day', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync_time_of_day', $data ?? [], null); + $this->setIfExists('run_report_packs', $data ?? [], null); + $this->setIfExists('run_report_packs_timeline', $data ?? [], null); + $this->setIfExists('run_report_packs_day', $data ?? [], null); + $this->setIfExists('run_report_packs_time_of_day', $data ?? [], null); + $this->setIfExists('report_packs_to_run', $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; } /** @@ -488,7 +594,8 @@ public function listInvalidProperties() $allowedValues = $this->getExportJournalsAllowableValues(); if (!is_null($this->container['export_journals']) && !in_array($this->container['export_journals'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'export_journals', must be one of '%s'", + "invalid value '%s' for 'export_journals', must be one of '%s'", + $this->container['export_journals'], implode("', '", $allowedValues) ); } @@ -496,7 +603,8 @@ public function listInvalidProperties() $allowedValues = $this->getExportJournalsTimelineAllowableValues(); if (!is_null($this->container['export_journals_timeline']) && !in_array($this->container['export_journals_timeline'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'export_journals_timeline', must be one of '%s'", + "invalid value '%s' for 'export_journals_timeline', must be one of '%s'", + $this->container['export_journals_timeline'], implode("', '", $allowedValues) ); } @@ -504,7 +612,8 @@ public function listInvalidProperties() $allowedValues = $this->getLodgePayRunAllowableValues(); if (!is_null($this->container['lodge_pay_run']) && !in_array($this->container['lodge_pay_run'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'lodge_pay_run', must be one of '%s'", + "invalid value '%s' for 'lodge_pay_run', must be one of '%s'", + $this->container['lodge_pay_run'], implode("', '", $allowedValues) ); } @@ -512,7 +621,8 @@ public function listInvalidProperties() $allowedValues = $this->getLodgePayRunTimelineAllowableValues(); if (!is_null($this->container['lodge_pay_run_timeline']) && !in_array($this->container['lodge_pay_run_timeline'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'lodge_pay_run_timeline', must be one of '%s'", + "invalid value '%s' for 'lodge_pay_run_timeline', must be one of '%s'", + $this->container['lodge_pay_run_timeline'], implode("', '", $allowedValues) ); } @@ -520,7 +630,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPaySlipsTimelineAllowableValues(); if (!is_null($this->container['publish_pay_slips_timeline']) && !in_array($this->container['publish_pay_slips_timeline'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_pay_slips_timeline', must be one of '%s'", + "invalid value '%s' for 'publish_pay_slips_timeline', must be one of '%s'", + $this->container['publish_pay_slips_timeline'], implode("', '", $allowedValues) ); } @@ -528,7 +639,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPaySlipsAllowableValues(); if (!is_null($this->container['publish_pay_slips']) && !in_array($this->container['publish_pay_slips'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_pay_slips', must be one of '%s'", + "invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $this->container['publish_pay_slips'], implode("', '", $allowedValues) ); } @@ -536,7 +648,8 @@ public function listInvalidProperties() $allowedValues = $this->getSubmitToPensionSyncAllowableValues(); if (!is_null($this->container['submit_to_pension_sync']) && !in_array($this->container['submit_to_pension_sync'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'submit_to_pension_sync', must be one of '%s'", + "invalid value '%s' for 'submit_to_pension_sync', must be one of '%s'", + $this->container['submit_to_pension_sync'], implode("', '", $allowedValues) ); } @@ -544,7 +657,8 @@ public function listInvalidProperties() $allowedValues = $this->getSubmitToPensionSyncTimelineAllowableValues(); if (!is_null($this->container['submit_to_pension_sync_timeline']) && !in_array($this->container['submit_to_pension_sync_timeline'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'submit_to_pension_sync_timeline', must be one of '%s'", + "invalid value '%s' for 'submit_to_pension_sync_timeline', must be one of '%s'", + $this->container['submit_to_pension_sync_timeline'], implode("', '", $allowedValues) ); } @@ -552,7 +666,8 @@ public function listInvalidProperties() $allowedValues = $this->getRunReportPacksAllowableValues(); if (!is_null($this->container['run_report_packs']) && !in_array($this->container['run_report_packs'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'run_report_packs', must be one of '%s'", + "invalid value '%s' for 'run_report_packs', must be one of '%s'", + $this->container['run_report_packs'], implode("', '", $allowedValues) ); } @@ -560,7 +675,8 @@ public function listInvalidProperties() $allowedValues = $this->getRunReportPacksTimelineAllowableValues(); if (!is_null($this->container['run_report_packs_timeline']) && !in_array($this->container['run_report_packs_timeline'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'run_report_packs_timeline', must be one of '%s'", + "invalid value '%s' for 'run_report_packs_timeline', must be one of '%s'", + $this->container['run_report_packs_timeline'], implode("', '", $allowedValues) ); } @@ -583,7 +699,7 @@ public function valid() /** * Gets export_journals * - * @return string + * @return string|null */ public function getExportJournals() { @@ -593,17 +709,21 @@ public function getExportJournals() /** * Sets export_journals * - * @param string $export_journals + * @param string|null $export_journals * - * @return $this + * @return self */ public function setExportJournals($export_journals) { + if (is_null($export_journals)) { + throw new \InvalidArgumentException('non-nullable export_journals cannot be null'); + } $allowedValues = $this->getExportJournalsAllowableValues(); - if (!is_null($export_journals) && !in_array($export_journals, $allowedValues, true)) { + if (!in_array($export_journals, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'export_journals', must be one of '%s'", + "Invalid value '%s' for 'export_journals', must be one of '%s'", + $export_journals, implode("', '", $allowedValues) ) ); @@ -616,7 +736,7 @@ public function setExportJournals($export_journals) /** * Gets export_journals_timeline * - * @return string + * @return string|null */ public function getExportJournalsTimeline() { @@ -626,17 +746,21 @@ public function getExportJournalsTimeline() /** * Sets export_journals_timeline * - * @param string $export_journals_timeline + * @param string|null $export_journals_timeline * - * @return $this + * @return self */ public function setExportJournalsTimeline($export_journals_timeline) { + if (is_null($export_journals_timeline)) { + throw new \InvalidArgumentException('non-nullable export_journals_timeline cannot be null'); + } $allowedValues = $this->getExportJournalsTimelineAllowableValues(); - if (!is_null($export_journals_timeline) && !in_array($export_journals_timeline, $allowedValues, true)) { + if (!in_array($export_journals_timeline, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'export_journals_timeline', must be one of '%s'", + "Invalid value '%s' for 'export_journals_timeline', must be one of '%s'", + $export_journals_timeline, implode("', '", $allowedValues) ) ); @@ -649,7 +773,7 @@ public function setExportJournalsTimeline($export_journals_timeline) /** * Gets export_journals_day * - * @return int + * @return int|null */ public function getExportJournalsDay() { @@ -659,12 +783,15 @@ public function getExportJournalsDay() /** * Sets export_journals_day * - * @param int $export_journals_day + * @param int|null $export_journals_day * - * @return $this + * @return self */ public function setExportJournalsDay($export_journals_day) { + if (is_null($export_journals_day)) { + throw new \InvalidArgumentException('non-nullable export_journals_day cannot be null'); + } $this->container['export_journals_day'] = $export_journals_day; return $this; @@ -673,7 +800,7 @@ public function setExportJournalsDay($export_journals_day) /** * Gets export_journals_time_of_day * - * @return string + * @return string|null */ public function getExportJournalsTimeOfDay() { @@ -683,12 +810,15 @@ public function getExportJournalsTimeOfDay() /** * Sets export_journals_time_of_day * - * @param string $export_journals_time_of_day + * @param string|null $export_journals_time_of_day * - * @return $this + * @return self */ public function setExportJournalsTimeOfDay($export_journals_time_of_day) { + if (is_null($export_journals_time_of_day)) { + throw new \InvalidArgumentException('non-nullable export_journals_time_of_day cannot be null'); + } $this->container['export_journals_time_of_day'] = $export_journals_time_of_day; return $this; @@ -697,7 +827,7 @@ public function setExportJournalsTimeOfDay($export_journals_time_of_day) /** * Gets lodge_pay_run * - * @return string + * @return string|null */ public function getLodgePayRun() { @@ -707,17 +837,21 @@ public function getLodgePayRun() /** * Sets lodge_pay_run * - * @param string $lodge_pay_run + * @param string|null $lodge_pay_run * - * @return $this + * @return self */ public function setLodgePayRun($lodge_pay_run) { + if (is_null($lodge_pay_run)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run cannot be null'); + } $allowedValues = $this->getLodgePayRunAllowableValues(); - if (!is_null($lodge_pay_run) && !in_array($lodge_pay_run, $allowedValues, true)) { + if (!in_array($lodge_pay_run, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'lodge_pay_run', must be one of '%s'", + "Invalid value '%s' for 'lodge_pay_run', must be one of '%s'", + $lodge_pay_run, implode("', '", $allowedValues) ) ); @@ -730,7 +864,7 @@ public function setLodgePayRun($lodge_pay_run) /** * Gets lodge_pay_run_day * - * @return int + * @return int|null */ public function getLodgePayRunDay() { @@ -740,12 +874,15 @@ public function getLodgePayRunDay() /** * Sets lodge_pay_run_day * - * @param int $lodge_pay_run_day + * @param int|null $lodge_pay_run_day * - * @return $this + * @return self */ public function setLodgePayRunDay($lodge_pay_run_day) { + if (is_null($lodge_pay_run_day)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_day cannot be null'); + } $this->container['lodge_pay_run_day'] = $lodge_pay_run_day; return $this; @@ -754,7 +891,7 @@ public function setLodgePayRunDay($lodge_pay_run_day) /** * Gets lodge_pay_run_timeline * - * @return string + * @return string|null */ public function getLodgePayRunTimeline() { @@ -764,17 +901,21 @@ public function getLodgePayRunTimeline() /** * Sets lodge_pay_run_timeline * - * @param string $lodge_pay_run_timeline + * @param string|null $lodge_pay_run_timeline * - * @return $this + * @return self */ public function setLodgePayRunTimeline($lodge_pay_run_timeline) { + if (is_null($lodge_pay_run_timeline)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_timeline cannot be null'); + } $allowedValues = $this->getLodgePayRunTimelineAllowableValues(); - if (!is_null($lodge_pay_run_timeline) && !in_array($lodge_pay_run_timeline, $allowedValues, true)) { + if (!in_array($lodge_pay_run_timeline, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'lodge_pay_run_timeline', must be one of '%s'", + "Invalid value '%s' for 'lodge_pay_run_timeline', must be one of '%s'", + $lodge_pay_run_timeline, implode("', '", $allowedValues) ) ); @@ -787,7 +928,7 @@ public function setLodgePayRunTimeline($lodge_pay_run_timeline) /** * Gets lodge_pay_run_time_of_day * - * @return string + * @return string|null */ public function getLodgePayRunTimeOfDay() { @@ -797,12 +938,15 @@ public function getLodgePayRunTimeOfDay() /** * Sets lodge_pay_run_time_of_day * - * @param string $lodge_pay_run_time_of_day + * @param string|null $lodge_pay_run_time_of_day * - * @return $this + * @return self */ public function setLodgePayRunTimeOfDay($lodge_pay_run_time_of_day) { + if (is_null($lodge_pay_run_time_of_day)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_time_of_day cannot be null'); + } $this->container['lodge_pay_run_time_of_day'] = $lodge_pay_run_time_of_day; return $this; @@ -811,7 +955,7 @@ public function setLodgePayRunTimeOfDay($lodge_pay_run_time_of_day) /** * Gets publish_pay_slips_day * - * @return int + * @return int|null */ public function getPublishPaySlipsDay() { @@ -821,12 +965,15 @@ public function getPublishPaySlipsDay() /** * Sets publish_pay_slips_day * - * @param int $publish_pay_slips_day + * @param int|null $publish_pay_slips_day * - * @return $this + * @return self */ public function setPublishPaySlipsDay($publish_pay_slips_day) { + if (is_null($publish_pay_slips_day)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_day cannot be null'); + } $this->container['publish_pay_slips_day'] = $publish_pay_slips_day; return $this; @@ -835,7 +982,7 @@ public function setPublishPaySlipsDay($publish_pay_slips_day) /** * Gets publish_pay_slips_timeline * - * @return string + * @return string|null */ public function getPublishPaySlipsTimeline() { @@ -845,17 +992,21 @@ public function getPublishPaySlipsTimeline() /** * Sets publish_pay_slips_timeline * - * @param string $publish_pay_slips_timeline + * @param string|null $publish_pay_slips_timeline * - * @return $this + * @return self */ public function setPublishPaySlipsTimeline($publish_pay_slips_timeline) { + if (is_null($publish_pay_slips_timeline)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_timeline cannot be null'); + } $allowedValues = $this->getPublishPaySlipsTimelineAllowableValues(); - if (!is_null($publish_pay_slips_timeline) && !in_array($publish_pay_slips_timeline, $allowedValues, true)) { + if (!in_array($publish_pay_slips_timeline, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_pay_slips_timeline', must be one of '%s'", + "Invalid value '%s' for 'publish_pay_slips_timeline', must be one of '%s'", + $publish_pay_slips_timeline, implode("', '", $allowedValues) ) ); @@ -868,7 +1019,7 @@ public function setPublishPaySlipsTimeline($publish_pay_slips_timeline) /** * Gets publish_pay_slips * - * @return string + * @return string|null */ public function getPublishPaySlips() { @@ -878,17 +1029,21 @@ public function getPublishPaySlips() /** * Sets publish_pay_slips * - * @param string $publish_pay_slips + * @param string|null $publish_pay_slips * - * @return $this + * @return self */ public function setPublishPaySlips($publish_pay_slips) { + if (is_null($publish_pay_slips)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips cannot be null'); + } $allowedValues = $this->getPublishPaySlipsAllowableValues(); - if (!is_null($publish_pay_slips) && !in_array($publish_pay_slips, $allowedValues, true)) { + if (!in_array($publish_pay_slips, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_pay_slips', must be one of '%s'", + "Invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $publish_pay_slips, implode("', '", $allowedValues) ) ); @@ -901,7 +1056,7 @@ public function setPublishPaySlips($publish_pay_slips) /** * Gets publish_pay_slips_time_of_day * - * @return string + * @return string|null */ public function getPublishPaySlipsTimeOfDay() { @@ -911,12 +1066,15 @@ public function getPublishPaySlipsTimeOfDay() /** * Sets publish_pay_slips_time_of_day * - * @param string $publish_pay_slips_time_of_day + * @param string|null $publish_pay_slips_time_of_day * - * @return $this + * @return self */ public function setPublishPaySlipsTimeOfDay($publish_pay_slips_time_of_day) { + if (is_null($publish_pay_slips_time_of_day)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_time_of_day cannot be null'); + } $this->container['publish_pay_slips_time_of_day'] = $publish_pay_slips_time_of_day; return $this; @@ -925,7 +1083,7 @@ public function setPublishPaySlipsTimeOfDay($publish_pay_slips_time_of_day) /** * Gets suppress_notifications * - * @return bool + * @return bool|null */ public function getSuppressNotifications() { @@ -935,12 +1093,15 @@ public function getSuppressNotifications() /** * Sets suppress_notifications * - * @param bool $suppress_notifications + * @param bool|null $suppress_notifications * - * @return $this + * @return self */ public function setSuppressNotifications($suppress_notifications) { + if (is_null($suppress_notifications)) { + throw new \InvalidArgumentException('non-nullable suppress_notifications cannot be null'); + } $this->container['suppress_notifications'] = $suppress_notifications; return $this; @@ -949,7 +1110,7 @@ public function setSuppressNotifications($suppress_notifications) /** * Gets submit_to_pension_sync * - * @return string + * @return string|null */ public function getSubmitToPensionSync() { @@ -959,17 +1120,21 @@ public function getSubmitToPensionSync() /** * Sets submit_to_pension_sync * - * @param string $submit_to_pension_sync + * @param string|null $submit_to_pension_sync * - * @return $this + * @return self */ public function setSubmitToPensionSync($submit_to_pension_sync) { + if (is_null($submit_to_pension_sync)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync cannot be null'); + } $allowedValues = $this->getSubmitToPensionSyncAllowableValues(); - if (!is_null($submit_to_pension_sync) && !in_array($submit_to_pension_sync, $allowedValues, true)) { + if (!in_array($submit_to_pension_sync, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'submit_to_pension_sync', must be one of '%s'", + "Invalid value '%s' for 'submit_to_pension_sync', must be one of '%s'", + $submit_to_pension_sync, implode("', '", $allowedValues) ) ); @@ -982,7 +1147,7 @@ public function setSubmitToPensionSync($submit_to_pension_sync) /** * Gets submit_to_pension_sync_timeline * - * @return string + * @return string|null */ public function getSubmitToPensionSyncTimeline() { @@ -992,17 +1157,21 @@ public function getSubmitToPensionSyncTimeline() /** * Sets submit_to_pension_sync_timeline * - * @param string $submit_to_pension_sync_timeline + * @param string|null $submit_to_pension_sync_timeline * - * @return $this + * @return self */ public function setSubmitToPensionSyncTimeline($submit_to_pension_sync_timeline) { + if (is_null($submit_to_pension_sync_timeline)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync_timeline cannot be null'); + } $allowedValues = $this->getSubmitToPensionSyncTimelineAllowableValues(); - if (!is_null($submit_to_pension_sync_timeline) && !in_array($submit_to_pension_sync_timeline, $allowedValues, true)) { + if (!in_array($submit_to_pension_sync_timeline, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'submit_to_pension_sync_timeline', must be one of '%s'", + "Invalid value '%s' for 'submit_to_pension_sync_timeline', must be one of '%s'", + $submit_to_pension_sync_timeline, implode("', '", $allowedValues) ) ); @@ -1015,7 +1184,7 @@ public function setSubmitToPensionSyncTimeline($submit_to_pension_sync_timeline) /** * Gets submit_to_pension_sync_day * - * @return int + * @return int|null */ public function getSubmitToPensionSyncDay() { @@ -1025,12 +1194,15 @@ public function getSubmitToPensionSyncDay() /** * Sets submit_to_pension_sync_day * - * @param int $submit_to_pension_sync_day + * @param int|null $submit_to_pension_sync_day * - * @return $this + * @return self */ public function setSubmitToPensionSyncDay($submit_to_pension_sync_day) { + if (is_null($submit_to_pension_sync_day)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync_day cannot be null'); + } $this->container['submit_to_pension_sync_day'] = $submit_to_pension_sync_day; return $this; @@ -1039,7 +1211,7 @@ public function setSubmitToPensionSyncDay($submit_to_pension_sync_day) /** * Gets submit_to_pension_sync_time_of_day * - * @return string + * @return string|null */ public function getSubmitToPensionSyncTimeOfDay() { @@ -1049,12 +1221,15 @@ public function getSubmitToPensionSyncTimeOfDay() /** * Sets submit_to_pension_sync_time_of_day * - * @param string $submit_to_pension_sync_time_of_day + * @param string|null $submit_to_pension_sync_time_of_day * - * @return $this + * @return self */ public function setSubmitToPensionSyncTimeOfDay($submit_to_pension_sync_time_of_day) { + if (is_null($submit_to_pension_sync_time_of_day)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync_time_of_day cannot be null'); + } $this->container['submit_to_pension_sync_time_of_day'] = $submit_to_pension_sync_time_of_day; return $this; @@ -1063,7 +1238,7 @@ public function setSubmitToPensionSyncTimeOfDay($submit_to_pension_sync_time_of_ /** * Gets run_report_packs * - * @return string + * @return string|null */ public function getRunReportPacks() { @@ -1073,17 +1248,21 @@ public function getRunReportPacks() /** * Sets run_report_packs * - * @param string $run_report_packs + * @param string|null $run_report_packs * - * @return $this + * @return self */ public function setRunReportPacks($run_report_packs) { + if (is_null($run_report_packs)) { + throw new \InvalidArgumentException('non-nullable run_report_packs cannot be null'); + } $allowedValues = $this->getRunReportPacksAllowableValues(); - if (!is_null($run_report_packs) && !in_array($run_report_packs, $allowedValues, true)) { + if (!in_array($run_report_packs, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'run_report_packs', must be one of '%s'", + "Invalid value '%s' for 'run_report_packs', must be one of '%s'", + $run_report_packs, implode("', '", $allowedValues) ) ); @@ -1096,7 +1275,7 @@ public function setRunReportPacks($run_report_packs) /** * Gets run_report_packs_timeline * - * @return string + * @return string|null */ public function getRunReportPacksTimeline() { @@ -1106,17 +1285,21 @@ public function getRunReportPacksTimeline() /** * Sets run_report_packs_timeline * - * @param string $run_report_packs_timeline + * @param string|null $run_report_packs_timeline * - * @return $this + * @return self */ public function setRunReportPacksTimeline($run_report_packs_timeline) { + if (is_null($run_report_packs_timeline)) { + throw new \InvalidArgumentException('non-nullable run_report_packs_timeline cannot be null'); + } $allowedValues = $this->getRunReportPacksTimelineAllowableValues(); - if (!is_null($run_report_packs_timeline) && !in_array($run_report_packs_timeline, $allowedValues, true)) { + if (!in_array($run_report_packs_timeline, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'run_report_packs_timeline', must be one of '%s'", + "Invalid value '%s' for 'run_report_packs_timeline', must be one of '%s'", + $run_report_packs_timeline, implode("', '", $allowedValues) ) ); @@ -1129,7 +1312,7 @@ public function setRunReportPacksTimeline($run_report_packs_timeline) /** * Gets run_report_packs_day * - * @return int + * @return int|null */ public function getRunReportPacksDay() { @@ -1139,12 +1322,15 @@ public function getRunReportPacksDay() /** * Sets run_report_packs_day * - * @param int $run_report_packs_day + * @param int|null $run_report_packs_day * - * @return $this + * @return self */ public function setRunReportPacksDay($run_report_packs_day) { + if (is_null($run_report_packs_day)) { + throw new \InvalidArgumentException('non-nullable run_report_packs_day cannot be null'); + } $this->container['run_report_packs_day'] = $run_report_packs_day; return $this; @@ -1153,7 +1339,7 @@ public function setRunReportPacksDay($run_report_packs_day) /** * Gets run_report_packs_time_of_day * - * @return string + * @return string|null */ public function getRunReportPacksTimeOfDay() { @@ -1163,12 +1349,15 @@ public function getRunReportPacksTimeOfDay() /** * Sets run_report_packs_time_of_day * - * @param string $run_report_packs_time_of_day + * @param string|null $run_report_packs_time_of_day * - * @return $this + * @return self */ public function setRunReportPacksTimeOfDay($run_report_packs_time_of_day) { + if (is_null($run_report_packs_time_of_day)) { + throw new \InvalidArgumentException('non-nullable run_report_packs_time_of_day cannot be null'); + } $this->container['run_report_packs_time_of_day'] = $run_report_packs_time_of_day; return $this; @@ -1177,7 +1366,7 @@ public function setRunReportPacksTimeOfDay($run_report_packs_time_of_day) /** * Gets report_packs_to_run * - * @return int[] + * @return int[]|null */ public function getReportPacksToRun() { @@ -1187,12 +1376,15 @@ public function getReportPacksToRun() /** * Sets report_packs_to_run * - * @param int[] $report_packs_to_run + * @param int[]|null $report_packs_to_run * - * @return $this + * @return self */ public function setReportPacksToRun($report_packs_to_run) { + if (is_null($report_packs_to_run)) { + throw new \InvalidArgumentException('non-nullable report_packs_to_run cannot be null'); + } $this->container['report_packs_to_run'] = $report_packs_to_run; return $this; @@ -1204,7 +1396,7 @@ public function setReportPacksToRun($report_packs_to_run) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1214,22 +1406,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1245,11 +1438,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1257,13 +1463,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunFinaliseResult.php b/src/lib/Model/PayRunFinaliseResult.php index ebd6211..f2daf6e 100644 --- a/src/lib/Model/PayRunFinaliseResult.php +++ b/src/lib/Model/PayRunFinaliseResult.php @@ -2,65 +2,65 @@ /** * PayRunFinaliseResult * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunFinaliseResult Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunFinaliseResult implements ModelInterface, ArrayAccess +class PayRunFinaliseResult implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunFinaliseResult'; + protected static $openAPIModelName = 'PayRunFinaliseResult'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'journal_export_result' => '\Swagger\Client\Model\JournalExportResult', + protected static $openAPITypes = [ + 'journal_export_result' => '\OpenAPI\Client\Model\JournalExportResult', 'journal_export_failed_message' => 'string', 'removed_employees' => 'int[]', - 'notifications' => '\Swagger\Client\Model\PaySlipNotificationResponse', + 'notifications' => '\OpenAPI\Client\Model\PaySlipNotificationResponse', 'pay_slips_published' => 'bool', 'publish_preference' => 'string', 'date_paid' => '\DateTime', @@ -88,8 +88,10 @@ class PayRunFinaliseResult implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'journal_export_result' => null, 'journal_export_failed_message' => null, 'removed_employees' => 'int32', @@ -117,14 +119,54 @@ class PayRunFinaliseResult implements ModelInterface, ArrayAccess 'is_first_finalisation' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'journal_export_result' => false, + 'journal_export_failed_message' => false, + 'removed_employees' => false, + 'notifications' => false, + 'pay_slips_published' => false, + 'publish_preference' => false, + 'date_paid' => false, + 'export_journals_preference' => false, + 'publish_pay_slips_scheduled_date_time_utc' => false, + 'pay_run_lodgement_job_id' => false, + 'pension_sync_job_id' => false, + 'active_employees' => false, + 'publish_pay_slips' => false, + 'publish_preference_time_of_day' => false, + 'export_journals' => false, + 'export_journals_scheduled_date_time_utc' => false, + 'lodge_pay_run' => false, + 'lodge_pay_run_scheduled_date_time_utc' => false, + 'run_report_packs' => false, + 'run_report_packs_scheduled_date_time_utc' => false, + 'are_report_packs_processed' => false, + 'selected_report_packs' => false, + 'submit_to_pension_sync' => false, + 'submit_to_pension_sync_scheduled_date_time_utc' => false, + 'is_first_finalisation' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -132,9 +174,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -275,30 +369,28 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const PUBLISH_PREFERENCE_MANUAL = 'Manual'; - const PUBLISH_PREFERENCE_IMMEDIATE = 'Immediate'; - const PUBLISH_PREFERENCE_SCHEDULED = 'Scheduled'; - const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; - const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; - const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; - const EXPORT_JOURNALS_MANUAL = 'Manual'; - const EXPORT_JOURNALS_IMMEDIATE = 'Immediate'; - const EXPORT_JOURNALS_SCHEDULED = 'Scheduled'; - const LODGE_PAY_RUN_MANUAL = 'Manual'; - const LODGE_PAY_RUN_IMMEDIATE = 'Immediate'; - const LODGE_PAY_RUN_SCHEDULED = 'Scheduled'; - const RUN_REPORT_PACKS_MANUAL = 'Manual'; - const RUN_REPORT_PACKS_IMMEDIATE = 'Immediate'; - const RUN_REPORT_PACKS_SCHEDULED = 'Scheduled'; - const SUBMIT_TO_PENSION_SYNC_MANUAL = 'Manual'; - const SUBMIT_TO_PENSION_SYNC_IMMEDIATE = 'Immediate'; - const SUBMIT_TO_PENSION_SYNC_SCHEDULED = 'Scheduled'; - - - + return self::$openAPIModelName; + } + + public const PUBLISH_PREFERENCE_MANUAL = 'Manual'; + public const PUBLISH_PREFERENCE_IMMEDIATE = 'Immediate'; + public const PUBLISH_PREFERENCE_SCHEDULED = 'Scheduled'; + public const PUBLISH_PAY_SLIPS_MANUAL = 'Manual'; + public const PUBLISH_PAY_SLIPS_IMMEDIATE = 'Immediate'; + public const PUBLISH_PAY_SLIPS_SCHEDULED = 'Scheduled'; + public const EXPORT_JOURNALS_MANUAL = 'Manual'; + public const EXPORT_JOURNALS_IMMEDIATE = 'Immediate'; + public const EXPORT_JOURNALS_SCHEDULED = 'Scheduled'; + public const LODGE_PAY_RUN_MANUAL = 'Manual'; + public const LODGE_PAY_RUN_IMMEDIATE = 'Immediate'; + public const LODGE_PAY_RUN_SCHEDULED = 'Scheduled'; + public const RUN_REPORT_PACKS_MANUAL = 'Manual'; + public const RUN_REPORT_PACKS_IMMEDIATE = 'Immediate'; + public const RUN_REPORT_PACKS_SCHEDULED = 'Scheduled'; + public const SUBMIT_TO_PENSION_SYNC_MANUAL = 'Manual'; + public const SUBMIT_TO_PENSION_SYNC_IMMEDIATE = 'Immediate'; + public const SUBMIT_TO_PENSION_SYNC_SCHEDULED = 'Scheduled'; + /** * Gets allowable values of the enum * @@ -312,7 +404,7 @@ public function getPublishPreferenceAllowableValues() self::PUBLISH_PREFERENCE_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -326,7 +418,7 @@ public function getPublishPaySlipsAllowableValues() self::PUBLISH_PAY_SLIPS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -340,7 +432,7 @@ public function getExportJournalsAllowableValues() self::EXPORT_JOURNALS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -354,7 +446,7 @@ public function getLodgePayRunAllowableValues() self::LODGE_PAY_RUN_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -368,7 +460,7 @@ public function getRunReportPacksAllowableValues() self::RUN_REPORT_PACKS_SCHEDULED, ]; } - + /** * Gets allowable values of the enum * @@ -382,7 +474,6 @@ public function getSubmitToPensionSyncAllowableValues() self::SUBMIT_TO_PENSION_SYNC_SCHEDULED, ]; } - /** * Associative array for storing property values @@ -399,31 +490,49 @@ public function getSubmitToPensionSyncAllowableValues() */ public function __construct(array $data = null) { - $this->container['journal_export_result'] = isset($data['journal_export_result']) ? $data['journal_export_result'] : null; - $this->container['journal_export_failed_message'] = isset($data['journal_export_failed_message']) ? $data['journal_export_failed_message'] : null; - $this->container['removed_employees'] = isset($data['removed_employees']) ? $data['removed_employees'] : null; - $this->container['notifications'] = isset($data['notifications']) ? $data['notifications'] : null; - $this->container['pay_slips_published'] = isset($data['pay_slips_published']) ? $data['pay_slips_published'] : null; - $this->container['publish_preference'] = isset($data['publish_preference']) ? $data['publish_preference'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['export_journals_preference'] = isset($data['export_journals_preference']) ? $data['export_journals_preference'] : null; - $this->container['publish_pay_slips_scheduled_date_time_utc'] = isset($data['publish_pay_slips_scheduled_date_time_utc']) ? $data['publish_pay_slips_scheduled_date_time_utc'] : null; - $this->container['pay_run_lodgement_job_id'] = isset($data['pay_run_lodgement_job_id']) ? $data['pay_run_lodgement_job_id'] : null; - $this->container['pension_sync_job_id'] = isset($data['pension_sync_job_id']) ? $data['pension_sync_job_id'] : null; - $this->container['active_employees'] = isset($data['active_employees']) ? $data['active_employees'] : null; - $this->container['publish_pay_slips'] = isset($data['publish_pay_slips']) ? $data['publish_pay_slips'] : null; - $this->container['publish_preference_time_of_day'] = isset($data['publish_preference_time_of_day']) ? $data['publish_preference_time_of_day'] : null; - $this->container['export_journals'] = isset($data['export_journals']) ? $data['export_journals'] : null; - $this->container['export_journals_scheduled_date_time_utc'] = isset($data['export_journals_scheduled_date_time_utc']) ? $data['export_journals_scheduled_date_time_utc'] : null; - $this->container['lodge_pay_run'] = isset($data['lodge_pay_run']) ? $data['lodge_pay_run'] : null; - $this->container['lodge_pay_run_scheduled_date_time_utc'] = isset($data['lodge_pay_run_scheduled_date_time_utc']) ? $data['lodge_pay_run_scheduled_date_time_utc'] : null; - $this->container['run_report_packs'] = isset($data['run_report_packs']) ? $data['run_report_packs'] : null; - $this->container['run_report_packs_scheduled_date_time_utc'] = isset($data['run_report_packs_scheduled_date_time_utc']) ? $data['run_report_packs_scheduled_date_time_utc'] : null; - $this->container['are_report_packs_processed'] = isset($data['are_report_packs_processed']) ? $data['are_report_packs_processed'] : null; - $this->container['selected_report_packs'] = isset($data['selected_report_packs']) ? $data['selected_report_packs'] : null; - $this->container['submit_to_pension_sync'] = isset($data['submit_to_pension_sync']) ? $data['submit_to_pension_sync'] : null; - $this->container['submit_to_pension_sync_scheduled_date_time_utc'] = isset($data['submit_to_pension_sync_scheduled_date_time_utc']) ? $data['submit_to_pension_sync_scheduled_date_time_utc'] : null; - $this->container['is_first_finalisation'] = isset($data['is_first_finalisation']) ? $data['is_first_finalisation'] : null; + $this->setIfExists('journal_export_result', $data ?? [], null); + $this->setIfExists('journal_export_failed_message', $data ?? [], null); + $this->setIfExists('removed_employees', $data ?? [], null); + $this->setIfExists('notifications', $data ?? [], null); + $this->setIfExists('pay_slips_published', $data ?? [], null); + $this->setIfExists('publish_preference', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('export_journals_preference', $data ?? [], null); + $this->setIfExists('publish_pay_slips_scheduled_date_time_utc', $data ?? [], null); + $this->setIfExists('pay_run_lodgement_job_id', $data ?? [], null); + $this->setIfExists('pension_sync_job_id', $data ?? [], null); + $this->setIfExists('active_employees', $data ?? [], null); + $this->setIfExists('publish_pay_slips', $data ?? [], null); + $this->setIfExists('publish_preference_time_of_day', $data ?? [], null); + $this->setIfExists('export_journals', $data ?? [], null); + $this->setIfExists('export_journals_scheduled_date_time_utc', $data ?? [], null); + $this->setIfExists('lodge_pay_run', $data ?? [], null); + $this->setIfExists('lodge_pay_run_scheduled_date_time_utc', $data ?? [], null); + $this->setIfExists('run_report_packs', $data ?? [], null); + $this->setIfExists('run_report_packs_scheduled_date_time_utc', $data ?? [], null); + $this->setIfExists('are_report_packs_processed', $data ?? [], null); + $this->setIfExists('selected_report_packs', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync', $data ?? [], null); + $this->setIfExists('submit_to_pension_sync_scheduled_date_time_utc', $data ?? [], null); + $this->setIfExists('is_first_finalisation', $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; } /** @@ -438,7 +547,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPreferenceAllowableValues(); if (!is_null($this->container['publish_preference']) && !in_array($this->container['publish_preference'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_preference', must be one of '%s'", + "invalid value '%s' for 'publish_preference', must be one of '%s'", + $this->container['publish_preference'], implode("', '", $allowedValues) ); } @@ -446,7 +556,8 @@ public function listInvalidProperties() $allowedValues = $this->getPublishPaySlipsAllowableValues(); if (!is_null($this->container['publish_pay_slips']) && !in_array($this->container['publish_pay_slips'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'publish_pay_slips', must be one of '%s'", + "invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $this->container['publish_pay_slips'], implode("', '", $allowedValues) ); } @@ -454,7 +565,8 @@ public function listInvalidProperties() $allowedValues = $this->getExportJournalsAllowableValues(); if (!is_null($this->container['export_journals']) && !in_array($this->container['export_journals'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'export_journals', must be one of '%s'", + "invalid value '%s' for 'export_journals', must be one of '%s'", + $this->container['export_journals'], implode("', '", $allowedValues) ); } @@ -462,7 +574,8 @@ public function listInvalidProperties() $allowedValues = $this->getLodgePayRunAllowableValues(); if (!is_null($this->container['lodge_pay_run']) && !in_array($this->container['lodge_pay_run'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'lodge_pay_run', must be one of '%s'", + "invalid value '%s' for 'lodge_pay_run', must be one of '%s'", + $this->container['lodge_pay_run'], implode("', '", $allowedValues) ); } @@ -470,7 +583,8 @@ public function listInvalidProperties() $allowedValues = $this->getRunReportPacksAllowableValues(); if (!is_null($this->container['run_report_packs']) && !in_array($this->container['run_report_packs'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'run_report_packs', must be one of '%s'", + "invalid value '%s' for 'run_report_packs', must be one of '%s'", + $this->container['run_report_packs'], implode("', '", $allowedValues) ); } @@ -478,7 +592,8 @@ public function listInvalidProperties() $allowedValues = $this->getSubmitToPensionSyncAllowableValues(); if (!is_null($this->container['submit_to_pension_sync']) && !in_array($this->container['submit_to_pension_sync'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'submit_to_pension_sync', must be one of '%s'", + "invalid value '%s' for 'submit_to_pension_sync', must be one of '%s'", + $this->container['submit_to_pension_sync'], implode("', '", $allowedValues) ); } @@ -501,7 +616,7 @@ public function valid() /** * Gets journal_export_result * - * @return \Swagger\Client\Model\JournalExportResult + * @return \OpenAPI\Client\Model\JournalExportResult|null */ public function getJournalExportResult() { @@ -511,12 +626,15 @@ public function getJournalExportResult() /** * Sets journal_export_result * - * @param \Swagger\Client\Model\JournalExportResult $journal_export_result + * @param \OpenAPI\Client\Model\JournalExportResult|null $journal_export_result journal_export_result * - * @return $this + * @return self */ public function setJournalExportResult($journal_export_result) { + if (is_null($journal_export_result)) { + throw new \InvalidArgumentException('non-nullable journal_export_result cannot be null'); + } $this->container['journal_export_result'] = $journal_export_result; return $this; @@ -525,7 +643,7 @@ public function setJournalExportResult($journal_export_result) /** * Gets journal_export_failed_message * - * @return string + * @return string|null */ public function getJournalExportFailedMessage() { @@ -535,12 +653,15 @@ public function getJournalExportFailedMessage() /** * Sets journal_export_failed_message * - * @param string $journal_export_failed_message + * @param string|null $journal_export_failed_message * - * @return $this + * @return self */ public function setJournalExportFailedMessage($journal_export_failed_message) { + if (is_null($journal_export_failed_message)) { + throw new \InvalidArgumentException('non-nullable journal_export_failed_message cannot be null'); + } $this->container['journal_export_failed_message'] = $journal_export_failed_message; return $this; @@ -549,7 +670,7 @@ public function setJournalExportFailedMessage($journal_export_failed_message) /** * Gets removed_employees * - * @return int[] + * @return int[]|null */ public function getRemovedEmployees() { @@ -559,12 +680,15 @@ public function getRemovedEmployees() /** * Sets removed_employees * - * @param int[] $removed_employees + * @param int[]|null $removed_employees * - * @return $this + * @return self */ public function setRemovedEmployees($removed_employees) { + if (is_null($removed_employees)) { + throw new \InvalidArgumentException('non-nullable removed_employees cannot be null'); + } $this->container['removed_employees'] = $removed_employees; return $this; @@ -573,7 +697,7 @@ public function setRemovedEmployees($removed_employees) /** * Gets notifications * - * @return \Swagger\Client\Model\PaySlipNotificationResponse + * @return \OpenAPI\Client\Model\PaySlipNotificationResponse|null */ public function getNotifications() { @@ -583,12 +707,15 @@ public function getNotifications() /** * Sets notifications * - * @param \Swagger\Client\Model\PaySlipNotificationResponse $notifications + * @param \OpenAPI\Client\Model\PaySlipNotificationResponse|null $notifications notifications * - * @return $this + * @return self */ public function setNotifications($notifications) { + if (is_null($notifications)) { + throw new \InvalidArgumentException('non-nullable notifications cannot be null'); + } $this->container['notifications'] = $notifications; return $this; @@ -597,7 +724,7 @@ public function setNotifications($notifications) /** * Gets pay_slips_published * - * @return bool + * @return bool|null */ public function getPaySlipsPublished() { @@ -607,12 +734,15 @@ public function getPaySlipsPublished() /** * Sets pay_slips_published * - * @param bool $pay_slips_published + * @param bool|null $pay_slips_published * - * @return $this + * @return self */ public function setPaySlipsPublished($pay_slips_published) { + if (is_null($pay_slips_published)) { + throw new \InvalidArgumentException('non-nullable pay_slips_published cannot be null'); + } $this->container['pay_slips_published'] = $pay_slips_published; return $this; @@ -621,7 +751,7 @@ public function setPaySlipsPublished($pay_slips_published) /** * Gets publish_preference * - * @return string + * @return string|null */ public function getPublishPreference() { @@ -631,17 +761,21 @@ public function getPublishPreference() /** * Sets publish_preference * - * @param string $publish_preference + * @param string|null $publish_preference * - * @return $this + * @return self */ public function setPublishPreference($publish_preference) { + if (is_null($publish_preference)) { + throw new \InvalidArgumentException('non-nullable publish_preference cannot be null'); + } $allowedValues = $this->getPublishPreferenceAllowableValues(); - if (!is_null($publish_preference) && !in_array($publish_preference, $allowedValues, true)) { + if (!in_array($publish_preference, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_preference', must be one of '%s'", + "Invalid value '%s' for 'publish_preference', must be one of '%s'", + $publish_preference, implode("', '", $allowedValues) ) ); @@ -654,7 +788,7 @@ public function setPublishPreference($publish_preference) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -664,12 +798,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -678,7 +815,7 @@ public function setDatePaid($date_paid) /** * Gets export_journals_preference * - * @return bool + * @return bool|null */ public function getExportJournalsPreference() { @@ -688,12 +825,15 @@ public function getExportJournalsPreference() /** * Sets export_journals_preference * - * @param bool $export_journals_preference + * @param bool|null $export_journals_preference * - * @return $this + * @return self */ public function setExportJournalsPreference($export_journals_preference) { + if (is_null($export_journals_preference)) { + throw new \InvalidArgumentException('non-nullable export_journals_preference cannot be null'); + } $this->container['export_journals_preference'] = $export_journals_preference; return $this; @@ -702,7 +842,7 @@ public function setExportJournalsPreference($export_journals_preference) /** * Gets publish_pay_slips_scheduled_date_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getPublishPaySlipsScheduledDateTimeUtc() { @@ -712,12 +852,15 @@ public function getPublishPaySlipsScheduledDateTimeUtc() /** * Sets publish_pay_slips_scheduled_date_time_utc * - * @param \DateTime $publish_pay_slips_scheduled_date_time_utc + * @param \DateTime|null $publish_pay_slips_scheduled_date_time_utc * - * @return $this + * @return self */ public function setPublishPaySlipsScheduledDateTimeUtc($publish_pay_slips_scheduled_date_time_utc) { + if (is_null($publish_pay_slips_scheduled_date_time_utc)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_scheduled_date_time_utc cannot be null'); + } $this->container['publish_pay_slips_scheduled_date_time_utc'] = $publish_pay_slips_scheduled_date_time_utc; return $this; @@ -726,7 +869,7 @@ public function setPublishPaySlipsScheduledDateTimeUtc($publish_pay_slips_schedu /** * Gets pay_run_lodgement_job_id * - * @return string + * @return string|null */ public function getPayRunLodgementJobId() { @@ -736,12 +879,15 @@ public function getPayRunLodgementJobId() /** * Sets pay_run_lodgement_job_id * - * @param string $pay_run_lodgement_job_id + * @param string|null $pay_run_lodgement_job_id * - * @return $this + * @return self */ public function setPayRunLodgementJobId($pay_run_lodgement_job_id) { + if (is_null($pay_run_lodgement_job_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_lodgement_job_id cannot be null'); + } $this->container['pay_run_lodgement_job_id'] = $pay_run_lodgement_job_id; return $this; @@ -750,7 +896,7 @@ public function setPayRunLodgementJobId($pay_run_lodgement_job_id) /** * Gets pension_sync_job_id * - * @return string + * @return string|null */ public function getPensionSyncJobId() { @@ -760,12 +906,15 @@ public function getPensionSyncJobId() /** * Sets pension_sync_job_id * - * @param string $pension_sync_job_id + * @param string|null $pension_sync_job_id * - * @return $this + * @return self */ public function setPensionSyncJobId($pension_sync_job_id) { + if (is_null($pension_sync_job_id)) { + throw new \InvalidArgumentException('non-nullable pension_sync_job_id cannot be null'); + } $this->container['pension_sync_job_id'] = $pension_sync_job_id; return $this; @@ -774,7 +923,7 @@ public function setPensionSyncJobId($pension_sync_job_id) /** * Gets active_employees * - * @return int + * @return int|null */ public function getActiveEmployees() { @@ -784,12 +933,15 @@ public function getActiveEmployees() /** * Sets active_employees * - * @param int $active_employees + * @param int|null $active_employees * - * @return $this + * @return self */ public function setActiveEmployees($active_employees) { + if (is_null($active_employees)) { + throw new \InvalidArgumentException('non-nullable active_employees cannot be null'); + } $this->container['active_employees'] = $active_employees; return $this; @@ -798,7 +950,7 @@ public function setActiveEmployees($active_employees) /** * Gets publish_pay_slips * - * @return string + * @return string|null */ public function getPublishPaySlips() { @@ -808,17 +960,21 @@ public function getPublishPaySlips() /** * Sets publish_pay_slips * - * @param string $publish_pay_slips + * @param string|null $publish_pay_slips * - * @return $this + * @return self */ public function setPublishPaySlips($publish_pay_slips) { + if (is_null($publish_pay_slips)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips cannot be null'); + } $allowedValues = $this->getPublishPaySlipsAllowableValues(); - if (!is_null($publish_pay_slips) && !in_array($publish_pay_slips, $allowedValues, true)) { + if (!in_array($publish_pay_slips, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'publish_pay_slips', must be one of '%s'", + "Invalid value '%s' for 'publish_pay_slips', must be one of '%s'", + $publish_pay_slips, implode("', '", $allowedValues) ) ); @@ -831,7 +987,7 @@ public function setPublishPaySlips($publish_pay_slips) /** * Gets publish_preference_time_of_day * - * @return string + * @return string|null */ public function getPublishPreferenceTimeOfDay() { @@ -841,12 +997,15 @@ public function getPublishPreferenceTimeOfDay() /** * Sets publish_preference_time_of_day * - * @param string $publish_preference_time_of_day + * @param string|null $publish_preference_time_of_day * - * @return $this + * @return self */ public function setPublishPreferenceTimeOfDay($publish_preference_time_of_day) { + if (is_null($publish_preference_time_of_day)) { + throw new \InvalidArgumentException('non-nullable publish_preference_time_of_day cannot be null'); + } $this->container['publish_preference_time_of_day'] = $publish_preference_time_of_day; return $this; @@ -855,7 +1014,7 @@ public function setPublishPreferenceTimeOfDay($publish_preference_time_of_day) /** * Gets export_journals * - * @return string + * @return string|null */ public function getExportJournals() { @@ -865,17 +1024,21 @@ public function getExportJournals() /** * Sets export_journals * - * @param string $export_journals + * @param string|null $export_journals * - * @return $this + * @return self */ public function setExportJournals($export_journals) { + if (is_null($export_journals)) { + throw new \InvalidArgumentException('non-nullable export_journals cannot be null'); + } $allowedValues = $this->getExportJournalsAllowableValues(); - if (!is_null($export_journals) && !in_array($export_journals, $allowedValues, true)) { + if (!in_array($export_journals, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'export_journals', must be one of '%s'", + "Invalid value '%s' for 'export_journals', must be one of '%s'", + $export_journals, implode("', '", $allowedValues) ) ); @@ -888,7 +1051,7 @@ public function setExportJournals($export_journals) /** * Gets export_journals_scheduled_date_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getExportJournalsScheduledDateTimeUtc() { @@ -898,12 +1061,15 @@ public function getExportJournalsScheduledDateTimeUtc() /** * Sets export_journals_scheduled_date_time_utc * - * @param \DateTime $export_journals_scheduled_date_time_utc + * @param \DateTime|null $export_journals_scheduled_date_time_utc * - * @return $this + * @return self */ public function setExportJournalsScheduledDateTimeUtc($export_journals_scheduled_date_time_utc) { + if (is_null($export_journals_scheduled_date_time_utc)) { + throw new \InvalidArgumentException('non-nullable export_journals_scheduled_date_time_utc cannot be null'); + } $this->container['export_journals_scheduled_date_time_utc'] = $export_journals_scheduled_date_time_utc; return $this; @@ -912,7 +1078,7 @@ public function setExportJournalsScheduledDateTimeUtc($export_journals_scheduled /** * Gets lodge_pay_run * - * @return string + * @return string|null */ public function getLodgePayRun() { @@ -922,17 +1088,21 @@ public function getLodgePayRun() /** * Sets lodge_pay_run * - * @param string $lodge_pay_run + * @param string|null $lodge_pay_run * - * @return $this + * @return self */ public function setLodgePayRun($lodge_pay_run) { + if (is_null($lodge_pay_run)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run cannot be null'); + } $allowedValues = $this->getLodgePayRunAllowableValues(); - if (!is_null($lodge_pay_run) && !in_array($lodge_pay_run, $allowedValues, true)) { + if (!in_array($lodge_pay_run, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'lodge_pay_run', must be one of '%s'", + "Invalid value '%s' for 'lodge_pay_run', must be one of '%s'", + $lodge_pay_run, implode("', '", $allowedValues) ) ); @@ -945,7 +1115,7 @@ public function setLodgePayRun($lodge_pay_run) /** * Gets lodge_pay_run_scheduled_date_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getLodgePayRunScheduledDateTimeUtc() { @@ -955,12 +1125,15 @@ public function getLodgePayRunScheduledDateTimeUtc() /** * Sets lodge_pay_run_scheduled_date_time_utc * - * @param \DateTime $lodge_pay_run_scheduled_date_time_utc + * @param \DateTime|null $lodge_pay_run_scheduled_date_time_utc * - * @return $this + * @return self */ public function setLodgePayRunScheduledDateTimeUtc($lodge_pay_run_scheduled_date_time_utc) { + if (is_null($lodge_pay_run_scheduled_date_time_utc)) { + throw new \InvalidArgumentException('non-nullable lodge_pay_run_scheduled_date_time_utc cannot be null'); + } $this->container['lodge_pay_run_scheduled_date_time_utc'] = $lodge_pay_run_scheduled_date_time_utc; return $this; @@ -969,7 +1142,7 @@ public function setLodgePayRunScheduledDateTimeUtc($lodge_pay_run_scheduled_date /** * Gets run_report_packs * - * @return string + * @return string|null */ public function getRunReportPacks() { @@ -979,17 +1152,21 @@ public function getRunReportPacks() /** * Sets run_report_packs * - * @param string $run_report_packs + * @param string|null $run_report_packs * - * @return $this + * @return self */ public function setRunReportPacks($run_report_packs) { + if (is_null($run_report_packs)) { + throw new \InvalidArgumentException('non-nullable run_report_packs cannot be null'); + } $allowedValues = $this->getRunReportPacksAllowableValues(); - if (!is_null($run_report_packs) && !in_array($run_report_packs, $allowedValues, true)) { + if (!in_array($run_report_packs, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'run_report_packs', must be one of '%s'", + "Invalid value '%s' for 'run_report_packs', must be one of '%s'", + $run_report_packs, implode("', '", $allowedValues) ) ); @@ -1002,7 +1179,7 @@ public function setRunReportPacks($run_report_packs) /** * Gets run_report_packs_scheduled_date_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRunReportPacksScheduledDateTimeUtc() { @@ -1012,12 +1189,15 @@ public function getRunReportPacksScheduledDateTimeUtc() /** * Sets run_report_packs_scheduled_date_time_utc * - * @param \DateTime $run_report_packs_scheduled_date_time_utc + * @param \DateTime|null $run_report_packs_scheduled_date_time_utc * - * @return $this + * @return self */ public function setRunReportPacksScheduledDateTimeUtc($run_report_packs_scheduled_date_time_utc) { + if (is_null($run_report_packs_scheduled_date_time_utc)) { + throw new \InvalidArgumentException('non-nullable run_report_packs_scheduled_date_time_utc cannot be null'); + } $this->container['run_report_packs_scheduled_date_time_utc'] = $run_report_packs_scheduled_date_time_utc; return $this; @@ -1026,7 +1206,7 @@ public function setRunReportPacksScheduledDateTimeUtc($run_report_packs_schedule /** * Gets are_report_packs_processed * - * @return bool + * @return bool|null */ public function getAreReportPacksProcessed() { @@ -1036,12 +1216,15 @@ public function getAreReportPacksProcessed() /** * Sets are_report_packs_processed * - * @param bool $are_report_packs_processed + * @param bool|null $are_report_packs_processed * - * @return $this + * @return self */ public function setAreReportPacksProcessed($are_report_packs_processed) { + if (is_null($are_report_packs_processed)) { + throw new \InvalidArgumentException('non-nullable are_report_packs_processed cannot be null'); + } $this->container['are_report_packs_processed'] = $are_report_packs_processed; return $this; @@ -1050,7 +1233,7 @@ public function setAreReportPacksProcessed($are_report_packs_processed) /** * Gets selected_report_packs * - * @return string[] + * @return string[]|null */ public function getSelectedReportPacks() { @@ -1060,12 +1243,15 @@ public function getSelectedReportPacks() /** * Sets selected_report_packs * - * @param string[] $selected_report_packs + * @param string[]|null $selected_report_packs * - * @return $this + * @return self */ public function setSelectedReportPacks($selected_report_packs) { + if (is_null($selected_report_packs)) { + throw new \InvalidArgumentException('non-nullable selected_report_packs cannot be null'); + } $this->container['selected_report_packs'] = $selected_report_packs; return $this; @@ -1074,7 +1260,7 @@ public function setSelectedReportPacks($selected_report_packs) /** * Gets submit_to_pension_sync * - * @return string + * @return string|null */ public function getSubmitToPensionSync() { @@ -1084,17 +1270,21 @@ public function getSubmitToPensionSync() /** * Sets submit_to_pension_sync * - * @param string $submit_to_pension_sync + * @param string|null $submit_to_pension_sync * - * @return $this + * @return self */ public function setSubmitToPensionSync($submit_to_pension_sync) { + if (is_null($submit_to_pension_sync)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync cannot be null'); + } $allowedValues = $this->getSubmitToPensionSyncAllowableValues(); - if (!is_null($submit_to_pension_sync) && !in_array($submit_to_pension_sync, $allowedValues, true)) { + if (!in_array($submit_to_pension_sync, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'submit_to_pension_sync', must be one of '%s'", + "Invalid value '%s' for 'submit_to_pension_sync', must be one of '%s'", + $submit_to_pension_sync, implode("', '", $allowedValues) ) ); @@ -1107,7 +1297,7 @@ public function setSubmitToPensionSync($submit_to_pension_sync) /** * Gets submit_to_pension_sync_scheduled_date_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getSubmitToPensionSyncScheduledDateTimeUtc() { @@ -1117,12 +1307,15 @@ public function getSubmitToPensionSyncScheduledDateTimeUtc() /** * Sets submit_to_pension_sync_scheduled_date_time_utc * - * @param \DateTime $submit_to_pension_sync_scheduled_date_time_utc + * @param \DateTime|null $submit_to_pension_sync_scheduled_date_time_utc * - * @return $this + * @return self */ public function setSubmitToPensionSyncScheduledDateTimeUtc($submit_to_pension_sync_scheduled_date_time_utc) { + if (is_null($submit_to_pension_sync_scheduled_date_time_utc)) { + throw new \InvalidArgumentException('non-nullable submit_to_pension_sync_scheduled_date_time_utc cannot be null'); + } $this->container['submit_to_pension_sync_scheduled_date_time_utc'] = $submit_to_pension_sync_scheduled_date_time_utc; return $this; @@ -1131,7 +1324,7 @@ public function setSubmitToPensionSyncScheduledDateTimeUtc($submit_to_pension_sy /** * Gets is_first_finalisation * - * @return bool + * @return bool|null */ public function getIsFirstFinalisation() { @@ -1141,12 +1334,15 @@ public function getIsFirstFinalisation() /** * Sets is_first_finalisation * - * @param bool $is_first_finalisation + * @param bool|null $is_first_finalisation * - * @return $this + * @return self */ public function setIsFirstFinalisation($is_first_finalisation) { + if (is_null($is_first_finalisation)) { + throw new \InvalidArgumentException('non-nullable is_first_finalisation cannot be null'); + } $this->container['is_first_finalisation'] = $is_first_finalisation; return $this; @@ -1158,7 +1354,7 @@ public function setIsFirstFinalisation($is_first_finalisation) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1168,22 +1364,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1199,11 +1396,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1211,13 +1421,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunInclusionsReportRequestModel.php b/src/lib/Model/PayRunInclusionsReportRequestModel.php index 31c4370..0e22560 100644 --- a/src/lib/Model/PayRunInclusionsReportRequestModel.php +++ b/src/lib/Model/PayRunInclusionsReportRequestModel.php @@ -2,61 +2,61 @@ /** * PayRunInclusionsReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunInclusionsReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunInclusionsReportRequestModel implements ModelInterface, ArrayAccess +class PayRunInclusionsReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunInclusionsReportRequestModel'; + protected static $openAPIModelName = 'PayRunInclusionsReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'status' => 'string', 'from_date' => '\DateTime', @@ -69,8 +69,10 @@ class PayRunInclusionsReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'status' => null, 'from_date' => 'date-time', @@ -79,14 +81,35 @@ class PayRunInclusionsReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'status' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,15 +255,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_ALL = 'All'; - const STATUS_ACTIVE = 'Active'; - const STATUS_EXPIRED = 'Expired'; - + public const STATUS_ALL = 'All'; + public const STATUS_ACTIVE = 'Active'; + public const STATUS_EXPIRED = 'Expired'; - /** * Gets allowable values of the enum * @@ -202,7 +275,6 @@ public function getStatusAllowableValues() self::STATUS_EXPIRED, ]; } - /** * Associative array for storing property values @@ -219,12 +291,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -239,7 +329,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -262,7 +353,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -272,12 +363,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -286,7 +380,7 @@ public function setEmployeeId($employee_id) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -296,17 +390,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -319,7 +417,7 @@ public function setStatus($status) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -329,12 +427,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -343,7 +444,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -353,12 +454,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -367,7 +471,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -377,12 +481,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -391,7 +498,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -401,12 +508,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -418,7 +528,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -428,22 +538,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -459,11 +570,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -471,13 +595,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunJobModel.php b/src/lib/Model/PayRunJobModel.php index a2faf75..0792ec3 100644 --- a/src/lib/Model/PayRunJobModel.php +++ b/src/lib/Model/PayRunJobModel.php @@ -2,61 +2,61 @@ /** * PayRunJobModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunJobModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunJobModel implements ModelInterface, ArrayAccess +class PayRunJobModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunJobModel'; + protected static $openAPIModelName = 'PayRunJobModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_id' => 'int', 'job_id' => 'string' ]; @@ -65,20 +65,39 @@ class PayRunJobModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_id' => 'int32', 'job_id' => 'uuid' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_id' => false, + 'job_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['job_id'] = isset($data['job_id']) ? $data['job_id'] : null; + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('job_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -223,12 +309,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -237,7 +326,7 @@ public function setPayRunId($pay_run_id) /** * Gets job_id * - * @return string + * @return string|null */ public function getJobId() { @@ -247,12 +336,15 @@ public function getJobId() /** * Sets job_id * - * @param string $job_id + * @param string|null $job_id * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setJobId($job_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunJobStatusModel.php b/src/lib/Model/PayRunJobStatusModel.php index fb5318b..d2900df 100644 --- a/src/lib/Model/PayRunJobStatusModel.php +++ b/src/lib/Model/PayRunJobStatusModel.php @@ -2,61 +2,61 @@ /** * PayRunJobStatusModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunJobStatusModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunJobStatusModel implements ModelInterface, ArrayAccess +class PayRunJobStatusModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunJobStatusModel'; + protected static $openAPIModelName = 'PayRunJobStatusModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_id' => 'int', 'status' => 'string', 'external_id' => 'string', @@ -67,22 +67,43 @@ class PayRunJobStatusModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_id' => 'int32', 'status' => null, 'external_id' => null, 'additional_info' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_id' => false, + 'status' => false, + 'external_id' => false, + 'additional_info' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['additional_info'] = isset($data['additional_info']) ? $data['additional_info'] : null; + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('additional_info', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -235,12 +323,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -249,7 +340,7 @@ public function setPayRunId($pay_run_id) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -259,12 +350,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -273,7 +367,7 @@ public function setStatus($status) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -283,12 +377,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -297,7 +394,7 @@ public function setExternalId($external_id) /** * Gets additional_info * - * @return string + * @return string|null */ public function getAdditionalInfo() { @@ -307,12 +404,15 @@ public function getAdditionalInfo() /** * Sets additional_info * - * @param string $additional_info + * @param string|null $additional_info * - * @return $this + * @return self */ public function setAdditionalInfo($additional_info) { + if (is_null($additional_info)) { + throw new \InvalidArgumentException('non-nullable additional_info cannot be null'); + } $this->container['additional_info'] = $additional_info; return $this; @@ -324,7 +424,7 @@ public function setAdditionalInfo($additional_info) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunModel.php b/src/lib/Model/PayRunModel.php index b9a7044..0ec1ee2 100644 --- a/src/lib/Model/PayRunModel.php +++ b/src/lib/Model/PayRunModel.php @@ -2,61 +2,61 @@ /** * PayRunModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunModel implements ModelInterface, ArrayAccess +class PayRunModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunModel'; + protected static $openAPIModelName = 'PayRunModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'date_finalised' => '\DateTime', 'pay_schedule_id' => 'int', @@ -73,8 +73,10 @@ class PayRunModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'date_finalised' => 'date-time', 'pay_schedule_id' => 'int32', @@ -87,14 +89,39 @@ class PayRunModel implements ModelInterface, ArrayAccess 'external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date_finalised' => false, + 'pay_schedule_id' => false, + 'pay_period_starting' => false, + 'pay_period_ending' => false, + 'date_paid' => false, + 'is_finalised' => false, + 'pay_slips_published' => false, + 'notation' => false, + 'external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['date_finalised'] = isset($data['date_finalised']) ? $data['date_finalised'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['pay_period_starting'] = isset($data['pay_period_starting']) ? $data['pay_period_starting'] : null; - $this->container['pay_period_ending'] = isset($data['pay_period_ending']) ? $data['pay_period_ending'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['is_finalised'] = isset($data['is_finalised']) ? $data['is_finalised'] : null; - $this->container['pay_slips_published'] = isset($data['pay_slips_published']) ? $data['pay_slips_published'] : null; - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('date_finalised', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('pay_period_starting', $data ?? [], null); + $this->setIfExists('pay_period_ending', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('is_finalised', $data ?? [], null); + $this->setIfExists('pay_slips_published', $data ?? [], null); + $this->setIfExists('notation', $data ?? [], null); + $this->setIfExists('external_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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets date_finalised * - * @return \DateTime + * @return \DateTime|null */ public function getDateFinalised() { @@ -295,12 +392,15 @@ public function getDateFinalised() /** * Sets date_finalised * - * @param \DateTime $date_finalised + * @param \DateTime|null $date_finalised * - * @return $this + * @return self */ public function setDateFinalised($date_finalised) { + if (is_null($date_finalised)) { + throw new \InvalidArgumentException('non-nullable date_finalised cannot be null'); + } $this->container['date_finalised'] = $date_finalised; return $this; @@ -309,7 +409,7 @@ public function setDateFinalised($date_finalised) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -319,12 +419,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -333,7 +436,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets pay_period_starting * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodStarting() { @@ -343,12 +446,15 @@ public function getPayPeriodStarting() /** * Sets pay_period_starting * - * @param \DateTime $pay_period_starting + * @param \DateTime|null $pay_period_starting * - * @return $this + * @return self */ public function setPayPeriodStarting($pay_period_starting) { + if (is_null($pay_period_starting)) { + throw new \InvalidArgumentException('non-nullable pay_period_starting cannot be null'); + } $this->container['pay_period_starting'] = $pay_period_starting; return $this; @@ -357,7 +463,7 @@ public function setPayPeriodStarting($pay_period_starting) /** * Gets pay_period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodEnding() { @@ -367,12 +473,15 @@ public function getPayPeriodEnding() /** * Sets pay_period_ending * - * @param \DateTime $pay_period_ending + * @param \DateTime|null $pay_period_ending * - * @return $this + * @return self */ public function setPayPeriodEnding($pay_period_ending) { + if (is_null($pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable pay_period_ending cannot be null'); + } $this->container['pay_period_ending'] = $pay_period_ending; return $this; @@ -381,7 +490,7 @@ public function setPayPeriodEnding($pay_period_ending) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -391,12 +500,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -405,7 +517,7 @@ public function setDatePaid($date_paid) /** * Gets is_finalised * - * @return bool + * @return bool|null */ public function getIsFinalised() { @@ -415,12 +527,15 @@ public function getIsFinalised() /** * Sets is_finalised * - * @param bool $is_finalised + * @param bool|null $is_finalised * - * @return $this + * @return self */ public function setIsFinalised($is_finalised) { + if (is_null($is_finalised)) { + throw new \InvalidArgumentException('non-nullable is_finalised cannot be null'); + } $this->container['is_finalised'] = $is_finalised; return $this; @@ -429,7 +544,7 @@ public function setIsFinalised($is_finalised) /** * Gets pay_slips_published * - * @return bool + * @return bool|null */ public function getPaySlipsPublished() { @@ -439,12 +554,15 @@ public function getPaySlipsPublished() /** * Sets pay_slips_published * - * @param bool $pay_slips_published + * @param bool|null $pay_slips_published * - * @return $this + * @return self */ public function setPaySlipsPublished($pay_slips_published) { + if (is_null($pay_slips_published)) { + throw new \InvalidArgumentException('non-nullable pay_slips_published cannot be null'); + } $this->container['pay_slips_published'] = $pay_slips_published; return $this; @@ -453,7 +571,7 @@ public function setPaySlipsPublished($pay_slips_published) /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -463,12 +581,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -477,7 +598,7 @@ public function setNotation($notation) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -487,12 +608,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -504,7 +628,7 @@ public function setExternalId($external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunNotationModel.php b/src/lib/Model/PayRunNotationModel.php index fc13e34..03b6564 100644 --- a/src/lib/Model/PayRunNotationModel.php +++ b/src/lib/Model/PayRunNotationModel.php @@ -2,61 +2,61 @@ /** * PayRunNotationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunNotationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunNotationModel implements ModelInterface, ArrayAccess +class PayRunNotationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunNotationModel'; + protected static $openAPIModelName = 'PayRunNotationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notation' => 'string' ]; @@ -64,19 +64,37 @@ class PayRunNotationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notation' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notation' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; + $this->setIfExists('notation', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -217,12 +302,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -234,7 +322,7 @@ public function setNotation($notation) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunPaygAdjustmentResponse.php b/src/lib/Model/PayRunPaygAdjustmentResponse.php index 22f3ebe..a03cd5d 100644 --- a/src/lib/Model/PayRunPaygAdjustmentResponse.php +++ b/src/lib/Model/PayRunPaygAdjustmentResponse.php @@ -2,62 +2,62 @@ /** * PayRunPaygAdjustmentResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunPaygAdjustmentResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunPaygAdjustmentResponse implements ModelInterface, ArrayAccess +class PayRunPaygAdjustmentResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunPaygAdjustmentResponse'; + protected static $openAPIModelName = 'PayRunPaygAdjustmentResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg_adjustments' => 'map[string,\Swagger\Client\Model\PaygAdjustmentModel[]]', + protected static $openAPITypes = [ + 'payg_adjustments' => 'array', 'pay_run_id' => 'int' ]; @@ -65,20 +65,39 @@ class PayRunPaygAdjustmentResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg_adjustments' => null, 'pay_run_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg_adjustments' => false, + 'pay_run_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['payg_adjustments'] = isset($data['payg_adjustments']) ? $data['payg_adjustments'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; + $this->setIfExists('payg_adjustments', $data ?? [], null); + $this->setIfExists('pay_run_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets payg_adjustments * - * @return map[string,\Swagger\Client\Model\PaygAdjustmentModel[]] + * @return array|null */ public function getPaygAdjustments() { @@ -223,12 +309,15 @@ public function getPaygAdjustments() /** * Sets payg_adjustments * - * @param map[string,\Swagger\Client\Model\PaygAdjustmentModel[]] $payg_adjustments + * @param array|null $payg_adjustments * - * @return $this + * @return self */ public function setPaygAdjustments($payg_adjustments) { + if (is_null($payg_adjustments)) { + throw new \InvalidArgumentException('non-nullable payg_adjustments cannot be null'); + } $this->container['payg_adjustments'] = $payg_adjustments; return $this; @@ -237,7 +326,7 @@ public function setPaygAdjustments($payg_adjustments) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -247,12 +336,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -264,7 +356,7 @@ public function setPayRunId($pay_run_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunSummaryModel.php b/src/lib/Model/PayRunSummaryModel.php index 12107d4..b64d03f 100644 --- a/src/lib/Model/PayRunSummaryModel.php +++ b/src/lib/Model/PayRunSummaryModel.php @@ -2,64 +2,64 @@ /** * PayRunSummaryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunSummaryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunSummaryModel implements ModelInterface, ArrayAccess +class PayRunSummaryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunSummaryModel'; + protected static $openAPIModelName = 'PayRunSummaryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'total_hours' => 'double', - 'total_net_wages' => 'double', - 'total_gross_wages' => 'double', + protected static $openAPITypes = [ + 'total_hours' => 'float', + 'total_net_wages' => 'float', + 'total_gross_wages' => 'float', 'id' => 'int', 'date_finalised' => '\DateTime', 'pay_schedule_id' => 'int', @@ -76,8 +76,10 @@ class PayRunSummaryModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'total_hours' => 'double', 'total_net_wages' => 'double', 'total_gross_wages' => 'double', @@ -93,14 +95,42 @@ class PayRunSummaryModel implements ModelInterface, ArrayAccess 'external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total_hours' => false, + 'total_net_wages' => false, + 'total_gross_wages' => false, + 'id' => false, + 'date_finalised' => false, + 'pay_schedule_id' => false, + 'pay_period_starting' => false, + 'pay_period_ending' => false, + 'date_paid' => false, + 'is_finalised' => false, + 'pay_slips_published' => false, + 'notation' => false, + 'external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -215,12 +297,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -237,19 +316,37 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['total_net_wages'] = isset($data['total_net_wages']) ? $data['total_net_wages'] : null; - $this->container['total_gross_wages'] = isset($data['total_gross_wages']) ? $data['total_gross_wages'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['date_finalised'] = isset($data['date_finalised']) ? $data['date_finalised'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['pay_period_starting'] = isset($data['pay_period_starting']) ? $data['pay_period_starting'] : null; - $this->container['pay_period_ending'] = isset($data['pay_period_ending']) ? $data['pay_period_ending'] : null; - $this->container['date_paid'] = isset($data['date_paid']) ? $data['date_paid'] : null; - $this->container['is_finalised'] = isset($data['is_finalised']) ? $data['is_finalised'] : null; - $this->container['pay_slips_published'] = isset($data['pay_slips_published']) ? $data['pay_slips_published'] : null; - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('total_net_wages', $data ?? [], null); + $this->setIfExists('total_gross_wages', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('date_finalised', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('pay_period_starting', $data ?? [], null); + $this->setIfExists('pay_period_ending', $data ?? [], null); + $this->setIfExists('date_paid', $data ?? [], null); + $this->setIfExists('is_finalised', $data ?? [], null); + $this->setIfExists('pay_slips_published', $data ?? [], null); + $this->setIfExists('notation', $data ?? [], null); + $this->setIfExists('external_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; } /** @@ -279,7 +376,7 @@ public function valid() /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -289,12 +386,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -303,7 +403,7 @@ public function setTotalHours($total_hours) /** * Gets total_net_wages * - * @return double + * @return float|null */ public function getTotalNetWages() { @@ -313,12 +413,15 @@ public function getTotalNetWages() /** * Sets total_net_wages * - * @param double $total_net_wages + * @param float|null $total_net_wages * - * @return $this + * @return self */ public function setTotalNetWages($total_net_wages) { + if (is_null($total_net_wages)) { + throw new \InvalidArgumentException('non-nullable total_net_wages cannot be null'); + } $this->container['total_net_wages'] = $total_net_wages; return $this; @@ -327,7 +430,7 @@ public function setTotalNetWages($total_net_wages) /** * Gets total_gross_wages * - * @return double + * @return float|null */ public function getTotalGrossWages() { @@ -337,12 +440,15 @@ public function getTotalGrossWages() /** * Sets total_gross_wages * - * @param double $total_gross_wages + * @param float|null $total_gross_wages * - * @return $this + * @return self */ public function setTotalGrossWages($total_gross_wages) { + if (is_null($total_gross_wages)) { + throw new \InvalidArgumentException('non-nullable total_gross_wages cannot be null'); + } $this->container['total_gross_wages'] = $total_gross_wages; return $this; @@ -351,7 +457,7 @@ public function setTotalGrossWages($total_gross_wages) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -361,12 +467,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -375,7 +484,7 @@ public function setId($id) /** * Gets date_finalised * - * @return \DateTime + * @return \DateTime|null */ public function getDateFinalised() { @@ -385,12 +494,15 @@ public function getDateFinalised() /** * Sets date_finalised * - * @param \DateTime $date_finalised + * @param \DateTime|null $date_finalised * - * @return $this + * @return self */ public function setDateFinalised($date_finalised) { + if (is_null($date_finalised)) { + throw new \InvalidArgumentException('non-nullable date_finalised cannot be null'); + } $this->container['date_finalised'] = $date_finalised; return $this; @@ -399,7 +511,7 @@ public function setDateFinalised($date_finalised) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -409,12 +521,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -423,7 +538,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets pay_period_starting * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodStarting() { @@ -433,12 +548,15 @@ public function getPayPeriodStarting() /** * Sets pay_period_starting * - * @param \DateTime $pay_period_starting + * @param \DateTime|null $pay_period_starting * - * @return $this + * @return self */ public function setPayPeriodStarting($pay_period_starting) { + if (is_null($pay_period_starting)) { + throw new \InvalidArgumentException('non-nullable pay_period_starting cannot be null'); + } $this->container['pay_period_starting'] = $pay_period_starting; return $this; @@ -447,7 +565,7 @@ public function setPayPeriodStarting($pay_period_starting) /** * Gets pay_period_ending * - * @return \DateTime + * @return \DateTime|null */ public function getPayPeriodEnding() { @@ -457,12 +575,15 @@ public function getPayPeriodEnding() /** * Sets pay_period_ending * - * @param \DateTime $pay_period_ending + * @param \DateTime|null $pay_period_ending * - * @return $this + * @return self */ public function setPayPeriodEnding($pay_period_ending) { + if (is_null($pay_period_ending)) { + throw new \InvalidArgumentException('non-nullable pay_period_ending cannot be null'); + } $this->container['pay_period_ending'] = $pay_period_ending; return $this; @@ -471,7 +592,7 @@ public function setPayPeriodEnding($pay_period_ending) /** * Gets date_paid * - * @return \DateTime + * @return \DateTime|null */ public function getDatePaid() { @@ -481,12 +602,15 @@ public function getDatePaid() /** * Sets date_paid * - * @param \DateTime $date_paid + * @param \DateTime|null $date_paid * - * @return $this + * @return self */ public function setDatePaid($date_paid) { + if (is_null($date_paid)) { + throw new \InvalidArgumentException('non-nullable date_paid cannot be null'); + } $this->container['date_paid'] = $date_paid; return $this; @@ -495,7 +619,7 @@ public function setDatePaid($date_paid) /** * Gets is_finalised * - * @return bool + * @return bool|null */ public function getIsFinalised() { @@ -505,12 +629,15 @@ public function getIsFinalised() /** * Sets is_finalised * - * @param bool $is_finalised + * @param bool|null $is_finalised * - * @return $this + * @return self */ public function setIsFinalised($is_finalised) { + if (is_null($is_finalised)) { + throw new \InvalidArgumentException('non-nullable is_finalised cannot be null'); + } $this->container['is_finalised'] = $is_finalised; return $this; @@ -519,7 +646,7 @@ public function setIsFinalised($is_finalised) /** * Gets pay_slips_published * - * @return bool + * @return bool|null */ public function getPaySlipsPublished() { @@ -529,12 +656,15 @@ public function getPaySlipsPublished() /** * Sets pay_slips_published * - * @param bool $pay_slips_published + * @param bool|null $pay_slips_published * - * @return $this + * @return self */ public function setPaySlipsPublished($pay_slips_published) { + if (is_null($pay_slips_published)) { + throw new \InvalidArgumentException('non-nullable pay_slips_published cannot be null'); + } $this->container['pay_slips_published'] = $pay_slips_published; return $this; @@ -543,7 +673,7 @@ public function setPaySlipsPublished($pay_slips_published) /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -553,12 +683,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -567,7 +700,7 @@ public function setNotation($notation) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -577,12 +710,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -594,7 +730,7 @@ public function setExternalId($external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -604,22 +740,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -635,11 +772,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -647,13 +797,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunSuperAdjustmentResponse.php b/src/lib/Model/PayRunSuperAdjustmentResponse.php index e3e6fba..6992cfa 100644 --- a/src/lib/Model/PayRunSuperAdjustmentResponse.php +++ b/src/lib/Model/PayRunSuperAdjustmentResponse.php @@ -2,62 +2,62 @@ /** * PayRunSuperAdjustmentResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunSuperAdjustmentResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunSuperAdjustmentResponse implements ModelInterface, ArrayAccess +class PayRunSuperAdjustmentResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunSuperAdjustmentResponse'; + protected static $openAPIModelName = 'PayRunSuperAdjustmentResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super_adjustments' => 'map[string,\Swagger\Client\Model\SuperAdjustmentModel[]]', + protected static $openAPITypes = [ + 'super_adjustments' => 'array', 'pay_run_id' => 'int' ]; @@ -65,20 +65,39 @@ class PayRunSuperAdjustmentResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_adjustments' => null, 'pay_run_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_adjustments' => false, + 'pay_run_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['super_adjustments'] = isset($data['super_adjustments']) ? $data['super_adjustments'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; + $this->setIfExists('super_adjustments', $data ?? [], null); + $this->setIfExists('pay_run_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets super_adjustments * - * @return map[string,\Swagger\Client\Model\SuperAdjustmentModel[]] + * @return array|null */ public function getSuperAdjustments() { @@ -223,12 +309,15 @@ public function getSuperAdjustments() /** * Sets super_adjustments * - * @param map[string,\Swagger\Client\Model\SuperAdjustmentModel[]] $super_adjustments + * @param array|null $super_adjustments * - * @return $this + * @return self */ public function setSuperAdjustments($super_adjustments) { + if (is_null($super_adjustments)) { + throw new \InvalidArgumentException('non-nullable super_adjustments cannot be null'); + } $this->container['super_adjustments'] = $super_adjustments; return $this; @@ -237,7 +326,7 @@ public function setSuperAdjustments($super_adjustments) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -247,12 +336,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -264,7 +356,7 @@ public function setPayRunId($pay_run_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunTotalModel.php b/src/lib/Model/PayRunTotalModel.php index be04e46..a12ad80 100644 --- a/src/lib/Model/PayRunTotalModel.php +++ b/src/lib/Model/PayRunTotalModel.php @@ -2,122 +2,124 @@ /** * PayRunTotalModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunTotalModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunTotalModel implements ModelInterface, ArrayAccess +class PayRunTotalModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunTotalModel'; + protected static $openAPIModelName = 'PayRunTotalModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', - 'total_hours' => 'double', - 'gross_earnings' => 'double', - 'pre_tax_deductions' => 'double', - 'taxable_earnings' => 'double', - 'post_tax_deductions' => 'double', - 'net_earnings' => 'double', - 'total_employee_expenses' => 'double', - 'total_employer_liabilities' => 'double', + 'total_hours' => 'float', + 'gross_earnings' => 'float', + 'pre_tax_deductions' => 'float', + 'taxable_earnings' => 'float', + 'post_tax_deductions' => 'float', + 'net_earnings' => 'float', + 'total_employee_expenses' => 'float', + 'total_employer_liabilities' => 'float', 'is_published' => 'bool', 'pay_run_id' => 'int', 'notes' => 'string', 'notation' => 'string', - 'payg_withheld' => 'double', - 'sfss_withheld' => 'double', - 'help_withheld' => 'double', - 'super_contribution' => 'double', - 'employer_contribution' => 'double', - 'kiwi_saver_employee_contribution' => 'double', - 'kiwi_saver_employer_contribution' => 'double', - 'esct_contribution' => 'double', - 'student_loan_amount' => 'double', - 'post_grad_loan_amount' => 'double', - 'student_loan_additional_mandatory_amount' => 'double', - 'student_loan_additional_voluntary_amount' => 'double', - 'acc_levy_amount' => 'double', - 'cpf_employer_contribution_amount' => 'double', - 'cpf_employee_contribution_amount' => 'double', - 'employer_voluntary_cpf_amount' => 'double', - 'employer_voluntary_medi_save_amount' => 'double', - 'sdl_contribution_amount' => 'double', - 'employer_pension_contribution' => 'double', - 'employee_pension_contribution' => 'double', - 'employee_national_insurance_contribution' => 'double', - 'employer_national_insurance_contribution' => 'double', - 'employee_pensionable_earnings' => 'double', - 'employer_pensionable_earnings' => 'double', - 'termination_payment_ni_exempt' => 'double', - 'termination_payment_employer_ni' => 'double', - 'nic_class1_a' => 'double', + 'payg_withheld' => 'float', + 'sfss_withheld' => 'float', + 'help_withheld' => 'float', + 'super_contribution' => 'float', + 'employer_contribution' => 'float', + 'kiwi_saver_employee_contribution' => 'float', + 'kiwi_saver_employer_contribution' => 'float', + 'esct_contribution' => 'float', + 'student_loan_amount' => 'float', + 'post_grad_loan_amount' => 'float', + 'student_loan_additional_mandatory_amount' => 'float', + 'student_loan_additional_voluntary_amount' => 'float', + 'acc_levy_amount' => 'float', + 'cpf_employer_contribution_amount' => 'float', + 'cpf_employee_contribution_amount' => 'float', + 'employer_voluntary_cpf_amount' => 'float', + 'employer_voluntary_medi_save_amount' => 'float', + 'sdl_contribution_amount' => 'float', + 'employer_pension_contribution' => 'float', + 'employee_pension_contribution' => 'float', + 'employee_national_insurance_contribution' => 'float', + 'employer_national_insurance_contribution' => 'float', + 'employee_pensionable_earnings' => 'float', + 'employer_pensionable_earnings' => 'float', + 'termination_payment_ni_exempt' => 'float', + 'termination_payment_employer_ni' => 'float', + 'nic_class1_a' => 'float', 'enrolled_in_pension_scheme' => 'bool', 'deferral_date' => '\DateTime', - 'bik_taxable_amount' => 'double', - 'bik_tax_exempt_amount' => 'double', - 'cp38_amount' => 'double', - 'pcb_borne_by_employer_amount' => 'double', - 'epf_employer_amount' => 'double', - 'epf_employee_amount' => 'double', - 'eis_employer_amount' => 'double', - 'eis_employee_amount' => 'double', - 'socso_employer_amount' => 'double', - 'socso_employee_amount' => 'double', - 'hrdf_amount' => 'double' + 'bik_taxable_amount' => 'float', + 'bik_tax_exempt_amount' => 'float', + 'cp38_amount' => 'float', + 'pcb_borne_by_employer_amount' => 'float', + 'epf_employer_amount' => 'float', + 'epf_employee_amount' => 'float', + 'eis_employer_amount' => 'float', + 'eis_employee_amount' => 'float', + 'socso_employer_amount' => 'float', + 'socso_employee_amount' => 'float', + 'hrdf_amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'total_hours' => 'double', 'gross_earnings' => 'double', @@ -173,14 +175,82 @@ class PayRunTotalModel implements ModelInterface, ArrayAccess 'hrdf_amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'total_hours' => false, + 'gross_earnings' => false, + 'pre_tax_deductions' => false, + 'taxable_earnings' => false, + 'post_tax_deductions' => false, + 'net_earnings' => false, + 'total_employee_expenses' => false, + 'total_employer_liabilities' => false, + 'is_published' => false, + 'pay_run_id' => false, + 'notes' => false, + 'notation' => false, + 'payg_withheld' => false, + 'sfss_withheld' => false, + 'help_withheld' => false, + 'super_contribution' => false, + 'employer_contribution' => false, + 'kiwi_saver_employee_contribution' => false, + 'kiwi_saver_employer_contribution' => false, + 'esct_contribution' => false, + 'student_loan_amount' => false, + 'post_grad_loan_amount' => false, + 'student_loan_additional_mandatory_amount' => false, + 'student_loan_additional_voluntary_amount' => false, + 'acc_levy_amount' => false, + 'cpf_employer_contribution_amount' => false, + 'cpf_employee_contribution_amount' => false, + 'employer_voluntary_cpf_amount' => false, + 'employer_voluntary_medi_save_amount' => false, + 'sdl_contribution_amount' => false, + 'employer_pension_contribution' => false, + 'employee_pension_contribution' => false, + 'employee_national_insurance_contribution' => false, + 'employer_national_insurance_contribution' => false, + 'employee_pensionable_earnings' => false, + 'employer_pensionable_earnings' => false, + 'termination_payment_ni_exempt' => false, + 'termination_payment_employer_ni' => false, + 'nic_class1_a' => false, + 'enrolled_in_pension_scheme' => false, + 'deferral_date' => false, + 'bik_taxable_amount' => false, + 'bik_tax_exempt_amount' => false, + 'cp38_amount' => false, + 'pcb_borne_by_employer_amount' => false, + 'epf_employer_amount' => false, + 'epf_employee_amount' => false, + 'eis_employer_amount' => false, + 'eis_employee_amount' => false, + 'socso_employer_amount' => false, + 'socso_employee_amount' => false, + 'hrdf_amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -188,9 +258,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -415,12 +537,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -437,59 +556,77 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['total_hours'] = isset($data['total_hours']) ? $data['total_hours'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['pre_tax_deductions'] = isset($data['pre_tax_deductions']) ? $data['pre_tax_deductions'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['post_tax_deductions'] = isset($data['post_tax_deductions']) ? $data['post_tax_deductions'] : null; - $this->container['net_earnings'] = isset($data['net_earnings']) ? $data['net_earnings'] : null; - $this->container['total_employee_expenses'] = isset($data['total_employee_expenses']) ? $data['total_employee_expenses'] : null; - $this->container['total_employer_liabilities'] = isset($data['total_employer_liabilities']) ? $data['total_employer_liabilities'] : null; - $this->container['is_published'] = isset($data['is_published']) ? $data['is_published'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; - $this->container['payg_withheld'] = isset($data['payg_withheld']) ? $data['payg_withheld'] : null; - $this->container['sfss_withheld'] = isset($data['sfss_withheld']) ? $data['sfss_withheld'] : null; - $this->container['help_withheld'] = isset($data['help_withheld']) ? $data['help_withheld'] : null; - $this->container['super_contribution'] = isset($data['super_contribution']) ? $data['super_contribution'] : null; - $this->container['employer_contribution'] = isset($data['employer_contribution']) ? $data['employer_contribution'] : null; - $this->container['kiwi_saver_employee_contribution'] = isset($data['kiwi_saver_employee_contribution']) ? $data['kiwi_saver_employee_contribution'] : null; - $this->container['kiwi_saver_employer_contribution'] = isset($data['kiwi_saver_employer_contribution']) ? $data['kiwi_saver_employer_contribution'] : null; - $this->container['esct_contribution'] = isset($data['esct_contribution']) ? $data['esct_contribution'] : null; - $this->container['student_loan_amount'] = isset($data['student_loan_amount']) ? $data['student_loan_amount'] : null; - $this->container['post_grad_loan_amount'] = isset($data['post_grad_loan_amount']) ? $data['post_grad_loan_amount'] : null; - $this->container['student_loan_additional_mandatory_amount'] = isset($data['student_loan_additional_mandatory_amount']) ? $data['student_loan_additional_mandatory_amount'] : null; - $this->container['student_loan_additional_voluntary_amount'] = isset($data['student_loan_additional_voluntary_amount']) ? $data['student_loan_additional_voluntary_amount'] : null; - $this->container['acc_levy_amount'] = isset($data['acc_levy_amount']) ? $data['acc_levy_amount'] : null; - $this->container['cpf_employer_contribution_amount'] = isset($data['cpf_employer_contribution_amount']) ? $data['cpf_employer_contribution_amount'] : null; - $this->container['cpf_employee_contribution_amount'] = isset($data['cpf_employee_contribution_amount']) ? $data['cpf_employee_contribution_amount'] : null; - $this->container['employer_voluntary_cpf_amount'] = isset($data['employer_voluntary_cpf_amount']) ? $data['employer_voluntary_cpf_amount'] : null; - $this->container['employer_voluntary_medi_save_amount'] = isset($data['employer_voluntary_medi_save_amount']) ? $data['employer_voluntary_medi_save_amount'] : null; - $this->container['sdl_contribution_amount'] = isset($data['sdl_contribution_amount']) ? $data['sdl_contribution_amount'] : null; - $this->container['employer_pension_contribution'] = isset($data['employer_pension_contribution']) ? $data['employer_pension_contribution'] : null; - $this->container['employee_pension_contribution'] = isset($data['employee_pension_contribution']) ? $data['employee_pension_contribution'] : null; - $this->container['employee_national_insurance_contribution'] = isset($data['employee_national_insurance_contribution']) ? $data['employee_national_insurance_contribution'] : null; - $this->container['employer_national_insurance_contribution'] = isset($data['employer_national_insurance_contribution']) ? $data['employer_national_insurance_contribution'] : null; - $this->container['employee_pensionable_earnings'] = isset($data['employee_pensionable_earnings']) ? $data['employee_pensionable_earnings'] : null; - $this->container['employer_pensionable_earnings'] = isset($data['employer_pensionable_earnings']) ? $data['employer_pensionable_earnings'] : null; - $this->container['termination_payment_ni_exempt'] = isset($data['termination_payment_ni_exempt']) ? $data['termination_payment_ni_exempt'] : null; - $this->container['termination_payment_employer_ni'] = isset($data['termination_payment_employer_ni']) ? $data['termination_payment_employer_ni'] : null; - $this->container['nic_class1_a'] = isset($data['nic_class1_a']) ? $data['nic_class1_a'] : null; - $this->container['enrolled_in_pension_scheme'] = isset($data['enrolled_in_pension_scheme']) ? $data['enrolled_in_pension_scheme'] : null; - $this->container['deferral_date'] = isset($data['deferral_date']) ? $data['deferral_date'] : null; - $this->container['bik_taxable_amount'] = isset($data['bik_taxable_amount']) ? $data['bik_taxable_amount'] : null; - $this->container['bik_tax_exempt_amount'] = isset($data['bik_tax_exempt_amount']) ? $data['bik_tax_exempt_amount'] : null; - $this->container['cp38_amount'] = isset($data['cp38_amount']) ? $data['cp38_amount'] : null; - $this->container['pcb_borne_by_employer_amount'] = isset($data['pcb_borne_by_employer_amount']) ? $data['pcb_borne_by_employer_amount'] : null; - $this->container['epf_employer_amount'] = isset($data['epf_employer_amount']) ? $data['epf_employer_amount'] : null; - $this->container['epf_employee_amount'] = isset($data['epf_employee_amount']) ? $data['epf_employee_amount'] : null; - $this->container['eis_employer_amount'] = isset($data['eis_employer_amount']) ? $data['eis_employer_amount'] : null; - $this->container['eis_employee_amount'] = isset($data['eis_employee_amount']) ? $data['eis_employee_amount'] : null; - $this->container['socso_employer_amount'] = isset($data['socso_employer_amount']) ? $data['socso_employer_amount'] : null; - $this->container['socso_employee_amount'] = isset($data['socso_employee_amount']) ? $data['socso_employee_amount'] : null; - $this->container['hrdf_amount'] = isset($data['hrdf_amount']) ? $data['hrdf_amount'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('total_hours', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('pre_tax_deductions', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('post_tax_deductions', $data ?? [], null); + $this->setIfExists('net_earnings', $data ?? [], null); + $this->setIfExists('total_employee_expenses', $data ?? [], null); + $this->setIfExists('total_employer_liabilities', $data ?? [], null); + $this->setIfExists('is_published', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('notation', $data ?? [], null); + $this->setIfExists('payg_withheld', $data ?? [], null); + $this->setIfExists('sfss_withheld', $data ?? [], null); + $this->setIfExists('help_withheld', $data ?? [], null); + $this->setIfExists('super_contribution', $data ?? [], null); + $this->setIfExists('employer_contribution', $data ?? [], null); + $this->setIfExists('kiwi_saver_employee_contribution', $data ?? [], null); + $this->setIfExists('kiwi_saver_employer_contribution', $data ?? [], null); + $this->setIfExists('esct_contribution', $data ?? [], null); + $this->setIfExists('student_loan_amount', $data ?? [], null); + $this->setIfExists('post_grad_loan_amount', $data ?? [], null); + $this->setIfExists('student_loan_additional_mandatory_amount', $data ?? [], null); + $this->setIfExists('student_loan_additional_voluntary_amount', $data ?? [], null); + $this->setIfExists('acc_levy_amount', $data ?? [], null); + $this->setIfExists('cpf_employer_contribution_amount', $data ?? [], null); + $this->setIfExists('cpf_employee_contribution_amount', $data ?? [], null); + $this->setIfExists('employer_voluntary_cpf_amount', $data ?? [], null); + $this->setIfExists('employer_voluntary_medi_save_amount', $data ?? [], null); + $this->setIfExists('sdl_contribution_amount', $data ?? [], null); + $this->setIfExists('employer_pension_contribution', $data ?? [], null); + $this->setIfExists('employee_pension_contribution', $data ?? [], null); + $this->setIfExists('employee_national_insurance_contribution', $data ?? [], null); + $this->setIfExists('employer_national_insurance_contribution', $data ?? [], null); + $this->setIfExists('employee_pensionable_earnings', $data ?? [], null); + $this->setIfExists('employer_pensionable_earnings', $data ?? [], null); + $this->setIfExists('termination_payment_ni_exempt', $data ?? [], null); + $this->setIfExists('termination_payment_employer_ni', $data ?? [], null); + $this->setIfExists('nic_class1_a', $data ?? [], null); + $this->setIfExists('enrolled_in_pension_scheme', $data ?? [], null); + $this->setIfExists('deferral_date', $data ?? [], null); + $this->setIfExists('bik_taxable_amount', $data ?? [], null); + $this->setIfExists('bik_tax_exempt_amount', $data ?? [], null); + $this->setIfExists('cp38_amount', $data ?? [], null); + $this->setIfExists('pcb_borne_by_employer_amount', $data ?? [], null); + $this->setIfExists('epf_employer_amount', $data ?? [], null); + $this->setIfExists('epf_employee_amount', $data ?? [], null); + $this->setIfExists('eis_employer_amount', $data ?? [], null); + $this->setIfExists('eis_employee_amount', $data ?? [], null); + $this->setIfExists('socso_employer_amount', $data ?? [], null); + $this->setIfExists('socso_employee_amount', $data ?? [], null); + $this->setIfExists('hrdf_amount', $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; } /** @@ -519,7 +656,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -529,12 +666,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -543,7 +683,7 @@ public function setId($id) /** * Gets total_hours * - * @return double + * @return float|null */ public function getTotalHours() { @@ -553,12 +693,15 @@ public function getTotalHours() /** * Sets total_hours * - * @param double $total_hours + * @param float|null $total_hours * - * @return $this + * @return self */ public function setTotalHours($total_hours) { + if (is_null($total_hours)) { + throw new \InvalidArgumentException('non-nullable total_hours cannot be null'); + } $this->container['total_hours'] = $total_hours; return $this; @@ -567,7 +710,7 @@ public function setTotalHours($total_hours) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -577,12 +720,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -591,7 +737,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets pre_tax_deductions * - * @return double + * @return float|null */ public function getPreTaxDeductions() { @@ -601,12 +747,15 @@ public function getPreTaxDeductions() /** * Sets pre_tax_deductions * - * @param double $pre_tax_deductions + * @param float|null $pre_tax_deductions * - * @return $this + * @return self */ public function setPreTaxDeductions($pre_tax_deductions) { + if (is_null($pre_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deductions cannot be null'); + } $this->container['pre_tax_deductions'] = $pre_tax_deductions; return $this; @@ -615,7 +764,7 @@ public function setPreTaxDeductions($pre_tax_deductions) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -625,12 +774,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -639,7 +791,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets post_tax_deductions * - * @return double + * @return float|null */ public function getPostTaxDeductions() { @@ -649,12 +801,15 @@ public function getPostTaxDeductions() /** * Sets post_tax_deductions * - * @param double $post_tax_deductions + * @param float|null $post_tax_deductions * - * @return $this + * @return self */ public function setPostTaxDeductions($post_tax_deductions) { + if (is_null($post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable post_tax_deductions cannot be null'); + } $this->container['post_tax_deductions'] = $post_tax_deductions; return $this; @@ -663,7 +818,7 @@ public function setPostTaxDeductions($post_tax_deductions) /** * Gets net_earnings * - * @return double + * @return float|null */ public function getNetEarnings() { @@ -673,12 +828,15 @@ public function getNetEarnings() /** * Sets net_earnings * - * @param double $net_earnings + * @param float|null $net_earnings * - * @return $this + * @return self */ public function setNetEarnings($net_earnings) { + if (is_null($net_earnings)) { + throw new \InvalidArgumentException('non-nullable net_earnings cannot be null'); + } $this->container['net_earnings'] = $net_earnings; return $this; @@ -687,7 +845,7 @@ public function setNetEarnings($net_earnings) /** * Gets total_employee_expenses * - * @return double + * @return float|null */ public function getTotalEmployeeExpenses() { @@ -697,12 +855,15 @@ public function getTotalEmployeeExpenses() /** * Sets total_employee_expenses * - * @param double $total_employee_expenses + * @param float|null $total_employee_expenses * - * @return $this + * @return self */ public function setTotalEmployeeExpenses($total_employee_expenses) { + if (is_null($total_employee_expenses)) { + throw new \InvalidArgumentException('non-nullable total_employee_expenses cannot be null'); + } $this->container['total_employee_expenses'] = $total_employee_expenses; return $this; @@ -711,7 +872,7 @@ public function setTotalEmployeeExpenses($total_employee_expenses) /** * Gets total_employer_liabilities * - * @return double + * @return float|null */ public function getTotalEmployerLiabilities() { @@ -721,12 +882,15 @@ public function getTotalEmployerLiabilities() /** * Sets total_employer_liabilities * - * @param double $total_employer_liabilities + * @param float|null $total_employer_liabilities * - * @return $this + * @return self */ public function setTotalEmployerLiabilities($total_employer_liabilities) { + if (is_null($total_employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable total_employer_liabilities cannot be null'); + } $this->container['total_employer_liabilities'] = $total_employer_liabilities; return $this; @@ -735,7 +899,7 @@ public function setTotalEmployerLiabilities($total_employer_liabilities) /** * Gets is_published * - * @return bool + * @return bool|null */ public function getIsPublished() { @@ -745,12 +909,15 @@ public function getIsPublished() /** * Sets is_published * - * @param bool $is_published + * @param bool|null $is_published * - * @return $this + * @return self */ public function setIsPublished($is_published) { + if (is_null($is_published)) { + throw new \InvalidArgumentException('non-nullable is_published cannot be null'); + } $this->container['is_published'] = $is_published; return $this; @@ -759,7 +926,7 @@ public function setIsPublished($is_published) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -769,12 +936,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -783,7 +953,7 @@ public function setPayRunId($pay_run_id) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -793,12 +963,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -807,7 +980,7 @@ public function setNotes($notes) /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -817,12 +990,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -831,7 +1007,7 @@ public function setNotation($notation) /** * Gets payg_withheld * - * @return double + * @return float|null */ public function getPaygWithheld() { @@ -841,12 +1017,15 @@ public function getPaygWithheld() /** * Sets payg_withheld * - * @param double $payg_withheld + * @param float|null $payg_withheld * - * @return $this + * @return self */ public function setPaygWithheld($payg_withheld) { + if (is_null($payg_withheld)) { + throw new \InvalidArgumentException('non-nullable payg_withheld cannot be null'); + } $this->container['payg_withheld'] = $payg_withheld; return $this; @@ -855,7 +1034,7 @@ public function setPaygWithheld($payg_withheld) /** * Gets sfss_withheld * - * @return double + * @return float|null */ public function getSfssWithheld() { @@ -865,12 +1044,15 @@ public function getSfssWithheld() /** * Sets sfss_withheld * - * @param double $sfss_withheld + * @param float|null $sfss_withheld * - * @return $this + * @return self */ public function setSfssWithheld($sfss_withheld) { + if (is_null($sfss_withheld)) { + throw new \InvalidArgumentException('non-nullable sfss_withheld cannot be null'); + } $this->container['sfss_withheld'] = $sfss_withheld; return $this; @@ -879,7 +1061,7 @@ public function setSfssWithheld($sfss_withheld) /** * Gets help_withheld * - * @return double + * @return float|null */ public function getHelpWithheld() { @@ -889,12 +1071,15 @@ public function getHelpWithheld() /** * Sets help_withheld * - * @param double $help_withheld + * @param float|null $help_withheld * - * @return $this + * @return self */ public function setHelpWithheld($help_withheld) { + if (is_null($help_withheld)) { + throw new \InvalidArgumentException('non-nullable help_withheld cannot be null'); + } $this->container['help_withheld'] = $help_withheld; return $this; @@ -903,7 +1088,7 @@ public function setHelpWithheld($help_withheld) /** * Gets super_contribution * - * @return double + * @return float|null */ public function getSuperContribution() { @@ -913,12 +1098,15 @@ public function getSuperContribution() /** * Sets super_contribution * - * @param double $super_contribution + * @param float|null $super_contribution * - * @return $this + * @return self */ public function setSuperContribution($super_contribution) { + if (is_null($super_contribution)) { + throw new \InvalidArgumentException('non-nullable super_contribution cannot be null'); + } $this->container['super_contribution'] = $super_contribution; return $this; @@ -927,7 +1115,7 @@ public function setSuperContribution($super_contribution) /** * Gets employer_contribution * - * @return double + * @return float|null */ public function getEmployerContribution() { @@ -937,12 +1125,15 @@ public function getEmployerContribution() /** * Sets employer_contribution * - * @param double $employer_contribution + * @param float|null $employer_contribution * - * @return $this + * @return self */ public function setEmployerContribution($employer_contribution) { + if (is_null($employer_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_contribution cannot be null'); + } $this->container['employer_contribution'] = $employer_contribution; return $this; @@ -951,7 +1142,7 @@ public function setEmployerContribution($employer_contribution) /** * Gets kiwi_saver_employee_contribution * - * @return double + * @return float|null */ public function getKiwiSaverEmployeeContribution() { @@ -961,12 +1152,15 @@ public function getKiwiSaverEmployeeContribution() /** * Sets kiwi_saver_employee_contribution * - * @param double $kiwi_saver_employee_contribution + * @param float|null $kiwi_saver_employee_contribution * - * @return $this + * @return self */ public function setKiwiSaverEmployeeContribution($kiwi_saver_employee_contribution) { + if (is_null($kiwi_saver_employee_contribution)) { + throw new \InvalidArgumentException('non-nullable kiwi_saver_employee_contribution cannot be null'); + } $this->container['kiwi_saver_employee_contribution'] = $kiwi_saver_employee_contribution; return $this; @@ -975,7 +1169,7 @@ public function setKiwiSaverEmployeeContribution($kiwi_saver_employee_contributi /** * Gets kiwi_saver_employer_contribution * - * @return double + * @return float|null */ public function getKiwiSaverEmployerContribution() { @@ -985,12 +1179,15 @@ public function getKiwiSaverEmployerContribution() /** * Sets kiwi_saver_employer_contribution * - * @param double $kiwi_saver_employer_contribution + * @param float|null $kiwi_saver_employer_contribution * - * @return $this + * @return self */ public function setKiwiSaverEmployerContribution($kiwi_saver_employer_contribution) { + if (is_null($kiwi_saver_employer_contribution)) { + throw new \InvalidArgumentException('non-nullable kiwi_saver_employer_contribution cannot be null'); + } $this->container['kiwi_saver_employer_contribution'] = $kiwi_saver_employer_contribution; return $this; @@ -999,7 +1196,7 @@ public function setKiwiSaverEmployerContribution($kiwi_saver_employer_contributi /** * Gets esct_contribution * - * @return double + * @return float|null */ public function getEsctContribution() { @@ -1009,12 +1206,15 @@ public function getEsctContribution() /** * Sets esct_contribution * - * @param double $esct_contribution + * @param float|null $esct_contribution * - * @return $this + * @return self */ public function setEsctContribution($esct_contribution) { + if (is_null($esct_contribution)) { + throw new \InvalidArgumentException('non-nullable esct_contribution cannot be null'); + } $this->container['esct_contribution'] = $esct_contribution; return $this; @@ -1023,7 +1223,7 @@ public function setEsctContribution($esct_contribution) /** * Gets student_loan_amount * - * @return double + * @return float|null */ public function getStudentLoanAmount() { @@ -1033,12 +1233,15 @@ public function getStudentLoanAmount() /** * Sets student_loan_amount * - * @param double $student_loan_amount + * @param float|null $student_loan_amount * - * @return $this + * @return self */ public function setStudentLoanAmount($student_loan_amount) { + if (is_null($student_loan_amount)) { + throw new \InvalidArgumentException('non-nullable student_loan_amount cannot be null'); + } $this->container['student_loan_amount'] = $student_loan_amount; return $this; @@ -1047,7 +1250,7 @@ public function setStudentLoanAmount($student_loan_amount) /** * Gets post_grad_loan_amount * - * @return double + * @return float|null */ public function getPostGradLoanAmount() { @@ -1057,12 +1260,15 @@ public function getPostGradLoanAmount() /** * Sets post_grad_loan_amount * - * @param double $post_grad_loan_amount + * @param float|null $post_grad_loan_amount * - * @return $this + * @return self */ public function setPostGradLoanAmount($post_grad_loan_amount) { + if (is_null($post_grad_loan_amount)) { + throw new \InvalidArgumentException('non-nullable post_grad_loan_amount cannot be null'); + } $this->container['post_grad_loan_amount'] = $post_grad_loan_amount; return $this; @@ -1071,7 +1277,7 @@ public function setPostGradLoanAmount($post_grad_loan_amount) /** * Gets student_loan_additional_mandatory_amount * - * @return double + * @return float|null */ public function getStudentLoanAdditionalMandatoryAmount() { @@ -1081,12 +1287,15 @@ public function getStudentLoanAdditionalMandatoryAmount() /** * Sets student_loan_additional_mandatory_amount * - * @param double $student_loan_additional_mandatory_amount + * @param float|null $student_loan_additional_mandatory_amount * - * @return $this + * @return self */ public function setStudentLoanAdditionalMandatoryAmount($student_loan_additional_mandatory_amount) { + if (is_null($student_loan_additional_mandatory_amount)) { + throw new \InvalidArgumentException('non-nullable student_loan_additional_mandatory_amount cannot be null'); + } $this->container['student_loan_additional_mandatory_amount'] = $student_loan_additional_mandatory_amount; return $this; @@ -1095,7 +1304,7 @@ public function setStudentLoanAdditionalMandatoryAmount($student_loan_additional /** * Gets student_loan_additional_voluntary_amount * - * @return double + * @return float|null */ public function getStudentLoanAdditionalVoluntaryAmount() { @@ -1105,12 +1314,15 @@ public function getStudentLoanAdditionalVoluntaryAmount() /** * Sets student_loan_additional_voluntary_amount * - * @param double $student_loan_additional_voluntary_amount + * @param float|null $student_loan_additional_voluntary_amount * - * @return $this + * @return self */ public function setStudentLoanAdditionalVoluntaryAmount($student_loan_additional_voluntary_amount) { + if (is_null($student_loan_additional_voluntary_amount)) { + throw new \InvalidArgumentException('non-nullable student_loan_additional_voluntary_amount cannot be null'); + } $this->container['student_loan_additional_voluntary_amount'] = $student_loan_additional_voluntary_amount; return $this; @@ -1119,7 +1331,7 @@ public function setStudentLoanAdditionalVoluntaryAmount($student_loan_additional /** * Gets acc_levy_amount * - * @return double + * @return float|null */ public function getAccLevyAmount() { @@ -1129,12 +1341,15 @@ public function getAccLevyAmount() /** * Sets acc_levy_amount * - * @param double $acc_levy_amount + * @param float|null $acc_levy_amount * - * @return $this + * @return self */ public function setAccLevyAmount($acc_levy_amount) { + if (is_null($acc_levy_amount)) { + throw new \InvalidArgumentException('non-nullable acc_levy_amount cannot be null'); + } $this->container['acc_levy_amount'] = $acc_levy_amount; return $this; @@ -1143,7 +1358,7 @@ public function setAccLevyAmount($acc_levy_amount) /** * Gets cpf_employer_contribution_amount * - * @return double + * @return float|null */ public function getCpfEmployerContributionAmount() { @@ -1153,12 +1368,15 @@ public function getCpfEmployerContributionAmount() /** * Sets cpf_employer_contribution_amount * - * @param double $cpf_employer_contribution_amount + * @param float|null $cpf_employer_contribution_amount * - * @return $this + * @return self */ public function setCpfEmployerContributionAmount($cpf_employer_contribution_amount) { + if (is_null($cpf_employer_contribution_amount)) { + throw new \InvalidArgumentException('non-nullable cpf_employer_contribution_amount cannot be null'); + } $this->container['cpf_employer_contribution_amount'] = $cpf_employer_contribution_amount; return $this; @@ -1167,7 +1385,7 @@ public function setCpfEmployerContributionAmount($cpf_employer_contribution_amou /** * Gets cpf_employee_contribution_amount * - * @return double + * @return float|null */ public function getCpfEmployeeContributionAmount() { @@ -1177,12 +1395,15 @@ public function getCpfEmployeeContributionAmount() /** * Sets cpf_employee_contribution_amount * - * @param double $cpf_employee_contribution_amount + * @param float|null $cpf_employee_contribution_amount * - * @return $this + * @return self */ public function setCpfEmployeeContributionAmount($cpf_employee_contribution_amount) { + if (is_null($cpf_employee_contribution_amount)) { + throw new \InvalidArgumentException('non-nullable cpf_employee_contribution_amount cannot be null'); + } $this->container['cpf_employee_contribution_amount'] = $cpf_employee_contribution_amount; return $this; @@ -1191,7 +1412,7 @@ public function setCpfEmployeeContributionAmount($cpf_employee_contribution_amou /** * Gets employer_voluntary_cpf_amount * - * @return double + * @return float|null */ public function getEmployerVoluntaryCpfAmount() { @@ -1201,12 +1422,15 @@ public function getEmployerVoluntaryCpfAmount() /** * Sets employer_voluntary_cpf_amount * - * @param double $employer_voluntary_cpf_amount + * @param float|null $employer_voluntary_cpf_amount * - * @return $this + * @return self */ public function setEmployerVoluntaryCpfAmount($employer_voluntary_cpf_amount) { + if (is_null($employer_voluntary_cpf_amount)) { + throw new \InvalidArgumentException('non-nullable employer_voluntary_cpf_amount cannot be null'); + } $this->container['employer_voluntary_cpf_amount'] = $employer_voluntary_cpf_amount; return $this; @@ -1215,7 +1439,7 @@ public function setEmployerVoluntaryCpfAmount($employer_voluntary_cpf_amount) /** * Gets employer_voluntary_medi_save_amount * - * @return double + * @return float|null */ public function getEmployerVoluntaryMediSaveAmount() { @@ -1225,12 +1449,15 @@ public function getEmployerVoluntaryMediSaveAmount() /** * Sets employer_voluntary_medi_save_amount * - * @param double $employer_voluntary_medi_save_amount + * @param float|null $employer_voluntary_medi_save_amount * - * @return $this + * @return self */ public function setEmployerVoluntaryMediSaveAmount($employer_voluntary_medi_save_amount) { + if (is_null($employer_voluntary_medi_save_amount)) { + throw new \InvalidArgumentException('non-nullable employer_voluntary_medi_save_amount cannot be null'); + } $this->container['employer_voluntary_medi_save_amount'] = $employer_voluntary_medi_save_amount; return $this; @@ -1239,7 +1466,7 @@ public function setEmployerVoluntaryMediSaveAmount($employer_voluntary_medi_save /** * Gets sdl_contribution_amount * - * @return double + * @return float|null */ public function getSdlContributionAmount() { @@ -1249,12 +1476,15 @@ public function getSdlContributionAmount() /** * Sets sdl_contribution_amount * - * @param double $sdl_contribution_amount + * @param float|null $sdl_contribution_amount * - * @return $this + * @return self */ public function setSdlContributionAmount($sdl_contribution_amount) { + if (is_null($sdl_contribution_amount)) { + throw new \InvalidArgumentException('non-nullable sdl_contribution_amount cannot be null'); + } $this->container['sdl_contribution_amount'] = $sdl_contribution_amount; return $this; @@ -1263,7 +1493,7 @@ public function setSdlContributionAmount($sdl_contribution_amount) /** * Gets employer_pension_contribution * - * @return double + * @return float|null */ public function getEmployerPensionContribution() { @@ -1273,12 +1503,15 @@ public function getEmployerPensionContribution() /** * Sets employer_pension_contribution * - * @param double $employer_pension_contribution + * @param float|null $employer_pension_contribution * - * @return $this + * @return self */ public function setEmployerPensionContribution($employer_pension_contribution) { + if (is_null($employer_pension_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_pension_contribution cannot be null'); + } $this->container['employer_pension_contribution'] = $employer_pension_contribution; return $this; @@ -1287,7 +1520,7 @@ public function setEmployerPensionContribution($employer_pension_contribution) /** * Gets employee_pension_contribution * - * @return double + * @return float|null */ public function getEmployeePensionContribution() { @@ -1297,12 +1530,15 @@ public function getEmployeePensionContribution() /** * Sets employee_pension_contribution * - * @param double $employee_pension_contribution + * @param float|null $employee_pension_contribution * - * @return $this + * @return self */ public function setEmployeePensionContribution($employee_pension_contribution) { + if (is_null($employee_pension_contribution)) { + throw new \InvalidArgumentException('non-nullable employee_pension_contribution cannot be null'); + } $this->container['employee_pension_contribution'] = $employee_pension_contribution; return $this; @@ -1311,7 +1547,7 @@ public function setEmployeePensionContribution($employee_pension_contribution) /** * Gets employee_national_insurance_contribution * - * @return double + * @return float|null */ public function getEmployeeNationalInsuranceContribution() { @@ -1321,12 +1557,15 @@ public function getEmployeeNationalInsuranceContribution() /** * Sets employee_national_insurance_contribution * - * @param double $employee_national_insurance_contribution + * @param float|null $employee_national_insurance_contribution * - * @return $this + * @return self */ public function setEmployeeNationalInsuranceContribution($employee_national_insurance_contribution) { + if (is_null($employee_national_insurance_contribution)) { + throw new \InvalidArgumentException('non-nullable employee_national_insurance_contribution cannot be null'); + } $this->container['employee_national_insurance_contribution'] = $employee_national_insurance_contribution; return $this; @@ -1335,7 +1574,7 @@ public function setEmployeeNationalInsuranceContribution($employee_national_insu /** * Gets employer_national_insurance_contribution * - * @return double + * @return float|null */ public function getEmployerNationalInsuranceContribution() { @@ -1345,12 +1584,15 @@ public function getEmployerNationalInsuranceContribution() /** * Sets employer_national_insurance_contribution * - * @param double $employer_national_insurance_contribution + * @param float|null $employer_national_insurance_contribution * - * @return $this + * @return self */ public function setEmployerNationalInsuranceContribution($employer_national_insurance_contribution) { + if (is_null($employer_national_insurance_contribution)) { + throw new \InvalidArgumentException('non-nullable employer_national_insurance_contribution cannot be null'); + } $this->container['employer_national_insurance_contribution'] = $employer_national_insurance_contribution; return $this; @@ -1359,7 +1601,7 @@ public function setEmployerNationalInsuranceContribution($employer_national_insu /** * Gets employee_pensionable_earnings * - * @return double + * @return float|null */ public function getEmployeePensionableEarnings() { @@ -1369,12 +1611,15 @@ public function getEmployeePensionableEarnings() /** * Sets employee_pensionable_earnings * - * @param double $employee_pensionable_earnings + * @param float|null $employee_pensionable_earnings * - * @return $this + * @return self */ public function setEmployeePensionableEarnings($employee_pensionable_earnings) { + if (is_null($employee_pensionable_earnings)) { + throw new \InvalidArgumentException('non-nullable employee_pensionable_earnings cannot be null'); + } $this->container['employee_pensionable_earnings'] = $employee_pensionable_earnings; return $this; @@ -1383,7 +1628,7 @@ public function setEmployeePensionableEarnings($employee_pensionable_earnings) /** * Gets employer_pensionable_earnings * - * @return double + * @return float|null */ public function getEmployerPensionableEarnings() { @@ -1393,12 +1638,15 @@ public function getEmployerPensionableEarnings() /** * Sets employer_pensionable_earnings * - * @param double $employer_pensionable_earnings + * @param float|null $employer_pensionable_earnings * - * @return $this + * @return self */ public function setEmployerPensionableEarnings($employer_pensionable_earnings) { + if (is_null($employer_pensionable_earnings)) { + throw new \InvalidArgumentException('non-nullable employer_pensionable_earnings cannot be null'); + } $this->container['employer_pensionable_earnings'] = $employer_pensionable_earnings; return $this; @@ -1407,7 +1655,7 @@ public function setEmployerPensionableEarnings($employer_pensionable_earnings) /** * Gets termination_payment_ni_exempt * - * @return double + * @return float|null */ public function getTerminationPaymentNiExempt() { @@ -1417,12 +1665,15 @@ public function getTerminationPaymentNiExempt() /** * Sets termination_payment_ni_exempt * - * @param double $termination_payment_ni_exempt + * @param float|null $termination_payment_ni_exempt * - * @return $this + * @return self */ public function setTerminationPaymentNiExempt($termination_payment_ni_exempt) { + if (is_null($termination_payment_ni_exempt)) { + throw new \InvalidArgumentException('non-nullable termination_payment_ni_exempt cannot be null'); + } $this->container['termination_payment_ni_exempt'] = $termination_payment_ni_exempt; return $this; @@ -1431,7 +1682,7 @@ public function setTerminationPaymentNiExempt($termination_payment_ni_exempt) /** * Gets termination_payment_employer_ni * - * @return double + * @return float|null */ public function getTerminationPaymentEmployerNi() { @@ -1441,12 +1692,15 @@ public function getTerminationPaymentEmployerNi() /** * Sets termination_payment_employer_ni * - * @param double $termination_payment_employer_ni + * @param float|null $termination_payment_employer_ni * - * @return $this + * @return self */ public function setTerminationPaymentEmployerNi($termination_payment_employer_ni) { + if (is_null($termination_payment_employer_ni)) { + throw new \InvalidArgumentException('non-nullable termination_payment_employer_ni cannot be null'); + } $this->container['termination_payment_employer_ni'] = $termination_payment_employer_ni; return $this; @@ -1455,7 +1709,7 @@ public function setTerminationPaymentEmployerNi($termination_payment_employer_ni /** * Gets nic_class1_a * - * @return double + * @return float|null */ public function getNicClass1A() { @@ -1465,12 +1719,15 @@ public function getNicClass1A() /** * Sets nic_class1_a * - * @param double $nic_class1_a + * @param float|null $nic_class1_a * - * @return $this + * @return self */ public function setNicClass1A($nic_class1_a) { + if (is_null($nic_class1_a)) { + throw new \InvalidArgumentException('non-nullable nic_class1_a cannot be null'); + } $this->container['nic_class1_a'] = $nic_class1_a; return $this; @@ -1479,7 +1736,7 @@ public function setNicClass1A($nic_class1_a) /** * Gets enrolled_in_pension_scheme * - * @return bool + * @return bool|null */ public function getEnrolledInPensionScheme() { @@ -1489,12 +1746,15 @@ public function getEnrolledInPensionScheme() /** * Sets enrolled_in_pension_scheme * - * @param bool $enrolled_in_pension_scheme + * @param bool|null $enrolled_in_pension_scheme * - * @return $this + * @return self */ public function setEnrolledInPensionScheme($enrolled_in_pension_scheme) { + if (is_null($enrolled_in_pension_scheme)) { + throw new \InvalidArgumentException('non-nullable enrolled_in_pension_scheme cannot be null'); + } $this->container['enrolled_in_pension_scheme'] = $enrolled_in_pension_scheme; return $this; @@ -1503,7 +1763,7 @@ public function setEnrolledInPensionScheme($enrolled_in_pension_scheme) /** * Gets deferral_date * - * @return \DateTime + * @return \DateTime|null */ public function getDeferralDate() { @@ -1513,12 +1773,15 @@ public function getDeferralDate() /** * Sets deferral_date * - * @param \DateTime $deferral_date + * @param \DateTime|null $deferral_date * - * @return $this + * @return self */ public function setDeferralDate($deferral_date) { + if (is_null($deferral_date)) { + throw new \InvalidArgumentException('non-nullable deferral_date cannot be null'); + } $this->container['deferral_date'] = $deferral_date; return $this; @@ -1527,7 +1790,7 @@ public function setDeferralDate($deferral_date) /** * Gets bik_taxable_amount * - * @return double + * @return float|null */ public function getBikTaxableAmount() { @@ -1537,12 +1800,15 @@ public function getBikTaxableAmount() /** * Sets bik_taxable_amount * - * @param double $bik_taxable_amount + * @param float|null $bik_taxable_amount * - * @return $this + * @return self */ public function setBikTaxableAmount($bik_taxable_amount) { + if (is_null($bik_taxable_amount)) { + throw new \InvalidArgumentException('non-nullable bik_taxable_amount cannot be null'); + } $this->container['bik_taxable_amount'] = $bik_taxable_amount; return $this; @@ -1551,7 +1817,7 @@ public function setBikTaxableAmount($bik_taxable_amount) /** * Gets bik_tax_exempt_amount * - * @return double + * @return float|null */ public function getBikTaxExemptAmount() { @@ -1561,12 +1827,15 @@ public function getBikTaxExemptAmount() /** * Sets bik_tax_exempt_amount * - * @param double $bik_tax_exempt_amount + * @param float|null $bik_tax_exempt_amount * - * @return $this + * @return self */ public function setBikTaxExemptAmount($bik_tax_exempt_amount) { + if (is_null($bik_tax_exempt_amount)) { + throw new \InvalidArgumentException('non-nullable bik_tax_exempt_amount cannot be null'); + } $this->container['bik_tax_exempt_amount'] = $bik_tax_exempt_amount; return $this; @@ -1575,7 +1844,7 @@ public function setBikTaxExemptAmount($bik_tax_exempt_amount) /** * Gets cp38_amount * - * @return double + * @return float|null */ public function getCp38Amount() { @@ -1585,12 +1854,15 @@ public function getCp38Amount() /** * Sets cp38_amount * - * @param double $cp38_amount + * @param float|null $cp38_amount * - * @return $this + * @return self */ public function setCp38Amount($cp38_amount) { + if (is_null($cp38_amount)) { + throw new \InvalidArgumentException('non-nullable cp38_amount cannot be null'); + } $this->container['cp38_amount'] = $cp38_amount; return $this; @@ -1599,7 +1871,7 @@ public function setCp38Amount($cp38_amount) /** * Gets pcb_borne_by_employer_amount * - * @return double + * @return float|null */ public function getPcbBorneByEmployerAmount() { @@ -1609,12 +1881,15 @@ public function getPcbBorneByEmployerAmount() /** * Sets pcb_borne_by_employer_amount * - * @param double $pcb_borne_by_employer_amount + * @param float|null $pcb_borne_by_employer_amount * - * @return $this + * @return self */ public function setPcbBorneByEmployerAmount($pcb_borne_by_employer_amount) { + if (is_null($pcb_borne_by_employer_amount)) { + throw new \InvalidArgumentException('non-nullable pcb_borne_by_employer_amount cannot be null'); + } $this->container['pcb_borne_by_employer_amount'] = $pcb_borne_by_employer_amount; return $this; @@ -1623,7 +1898,7 @@ public function setPcbBorneByEmployerAmount($pcb_borne_by_employer_amount) /** * Gets epf_employer_amount * - * @return double + * @return float|null */ public function getEpfEmployerAmount() { @@ -1633,12 +1908,15 @@ public function getEpfEmployerAmount() /** * Sets epf_employer_amount * - * @param double $epf_employer_amount + * @param float|null $epf_employer_amount * - * @return $this + * @return self */ public function setEpfEmployerAmount($epf_employer_amount) { + if (is_null($epf_employer_amount)) { + throw new \InvalidArgumentException('non-nullable epf_employer_amount cannot be null'); + } $this->container['epf_employer_amount'] = $epf_employer_amount; return $this; @@ -1647,7 +1925,7 @@ public function setEpfEmployerAmount($epf_employer_amount) /** * Gets epf_employee_amount * - * @return double + * @return float|null */ public function getEpfEmployeeAmount() { @@ -1657,12 +1935,15 @@ public function getEpfEmployeeAmount() /** * Sets epf_employee_amount * - * @param double $epf_employee_amount + * @param float|null $epf_employee_amount * - * @return $this + * @return self */ public function setEpfEmployeeAmount($epf_employee_amount) { + if (is_null($epf_employee_amount)) { + throw new \InvalidArgumentException('non-nullable epf_employee_amount cannot be null'); + } $this->container['epf_employee_amount'] = $epf_employee_amount; return $this; @@ -1671,7 +1952,7 @@ public function setEpfEmployeeAmount($epf_employee_amount) /** * Gets eis_employer_amount * - * @return double + * @return float|null */ public function getEisEmployerAmount() { @@ -1681,12 +1962,15 @@ public function getEisEmployerAmount() /** * Sets eis_employer_amount * - * @param double $eis_employer_amount + * @param float|null $eis_employer_amount * - * @return $this + * @return self */ public function setEisEmployerAmount($eis_employer_amount) { + if (is_null($eis_employer_amount)) { + throw new \InvalidArgumentException('non-nullable eis_employer_amount cannot be null'); + } $this->container['eis_employer_amount'] = $eis_employer_amount; return $this; @@ -1695,7 +1979,7 @@ public function setEisEmployerAmount($eis_employer_amount) /** * Gets eis_employee_amount * - * @return double + * @return float|null */ public function getEisEmployeeAmount() { @@ -1705,12 +1989,15 @@ public function getEisEmployeeAmount() /** * Sets eis_employee_amount * - * @param double $eis_employee_amount + * @param float|null $eis_employee_amount * - * @return $this + * @return self */ public function setEisEmployeeAmount($eis_employee_amount) { + if (is_null($eis_employee_amount)) { + throw new \InvalidArgumentException('non-nullable eis_employee_amount cannot be null'); + } $this->container['eis_employee_amount'] = $eis_employee_amount; return $this; @@ -1719,7 +2006,7 @@ public function setEisEmployeeAmount($eis_employee_amount) /** * Gets socso_employer_amount * - * @return double + * @return float|null */ public function getSocsoEmployerAmount() { @@ -1729,12 +2016,15 @@ public function getSocsoEmployerAmount() /** * Sets socso_employer_amount * - * @param double $socso_employer_amount + * @param float|null $socso_employer_amount * - * @return $this + * @return self */ public function setSocsoEmployerAmount($socso_employer_amount) { + if (is_null($socso_employer_amount)) { + throw new \InvalidArgumentException('non-nullable socso_employer_amount cannot be null'); + } $this->container['socso_employer_amount'] = $socso_employer_amount; return $this; @@ -1743,7 +2033,7 @@ public function setSocsoEmployerAmount($socso_employer_amount) /** * Gets socso_employee_amount * - * @return double + * @return float|null */ public function getSocsoEmployeeAmount() { @@ -1753,12 +2043,15 @@ public function getSocsoEmployeeAmount() /** * Sets socso_employee_amount * - * @param double $socso_employee_amount + * @param float|null $socso_employee_amount * - * @return $this + * @return self */ public function setSocsoEmployeeAmount($socso_employee_amount) { + if (is_null($socso_employee_amount)) { + throw new \InvalidArgumentException('non-nullable socso_employee_amount cannot be null'); + } $this->container['socso_employee_amount'] = $socso_employee_amount; return $this; @@ -1767,7 +2060,7 @@ public function setSocsoEmployeeAmount($socso_employee_amount) /** * Gets hrdf_amount * - * @return double + * @return float|null */ public function getHrdfAmount() { @@ -1777,12 +2070,15 @@ public function getHrdfAmount() /** * Sets hrdf_amount * - * @param double $hrdf_amount + * @param float|null $hrdf_amount * - * @return $this + * @return self */ public function setHrdfAmount($hrdf_amount) { + if (is_null($hrdf_amount)) { + throw new \InvalidArgumentException('non-nullable hrdf_amount cannot be null'); + } $this->container['hrdf_amount'] = $hrdf_amount; return $this; @@ -1794,7 +2090,7 @@ public function setHrdfAmount($hrdf_amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1804,22 +2100,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1835,11 +2132,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1847,13 +2157,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunTotalNotationModel.php b/src/lib/Model/PayRunTotalNotationModel.php index 54f8c12..8f3b50d 100644 --- a/src/lib/Model/PayRunTotalNotationModel.php +++ b/src/lib/Model/PayRunTotalNotationModel.php @@ -2,61 +2,61 @@ /** * PayRunTotalNotationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunTotalNotationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunTotalNotationModel implements ModelInterface, ArrayAccess +class PayRunTotalNotationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunTotalNotationModel'; + protected static $openAPIModelName = 'PayRunTotalNotationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notation' => 'string' ]; @@ -64,19 +64,37 @@ class PayRunTotalNotationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notation' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notation' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notation'] = isset($data['notation']) ? $data['notation'] : null; + $this->setIfExists('notation', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets notation * - * @return string + * @return string|null */ public function getNotation() { @@ -217,12 +302,15 @@ public function getNotation() /** * Sets notation * - * @param string $notation + * @param string|null $notation * - * @return $this + * @return self */ public function setNotation($notation) { + if (is_null($notation)) { + throw new \InvalidArgumentException('non-nullable notation cannot be null'); + } $this->container['notation'] = $notation; return $this; @@ -234,7 +322,7 @@ public function setNotation($notation) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunUnlockRequest.php b/src/lib/Model/PayRunUnlockRequest.php index e822cc2..3efb0e4 100644 --- a/src/lib/Model/PayRunUnlockRequest.php +++ b/src/lib/Model/PayRunUnlockRequest.php @@ -2,61 +2,61 @@ /** * PayRunUnlockRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunUnlockRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunUnlockRequest implements ModelInterface, ArrayAccess +class PayRunUnlockRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunUnlockRequest'; + protected static $openAPIModelName = 'PayRunUnlockRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'comments' => 'string' ]; @@ -64,19 +64,37 @@ class PayRunUnlockRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'comments' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'comments' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; + $this->setIfExists('comments', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -217,12 +302,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -234,7 +322,7 @@ public function setComments($comments) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunWarningDto.php b/src/lib/Model/PayRunWarningDto.php index d3ebb77..c41cc92 100644 --- a/src/lib/Model/PayRunWarningDto.php +++ b/src/lib/Model/PayRunWarningDto.php @@ -2,61 +2,61 @@ /** * PayRunWarningDto * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunWarningDto Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunWarningDto implements ModelInterface, ArrayAccess +class PayRunWarningDto implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunWarningDto'; + protected static $openAPIModelName = 'PayRunWarningDto'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'warning_type' => 'string', 'employee_id' => 'int', 'warning' => 'string', @@ -72,8 +72,10 @@ class PayRunWarningDto implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'warning_type' => null, 'employee_id' => 'int32', 'warning' => null, @@ -85,14 +87,38 @@ class PayRunWarningDto implements ModelInterface, ArrayAccess 'formatted_warning_message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'warning_type' => false, + 'employee_id' => false, + 'warning' => false, + 'employee_name' => false, + 'pay_run_total_id' => false, + 'meta_data' => false, + 'meta_data_json' => false, + 'employee_external_id' => false, + 'formatted_warning_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -195,94 +273,92 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const WARNING_TYPE_PAYMENT_FILE = 'PaymentFile'; - const WARNING_TYPE_MORE_LEAVE_THAN_ACCRUED = 'MoreLeaveThanAccrued'; - const WARNING_TYPE_UNPAID_EARNINGS = 'UnpaidEarnings'; - const WARNING_TYPE_BIRTHDAY = 'Birthday'; - const WARNING_TYPE_ANNIVERSARY = 'Anniversary'; - const WARNING_TYPE_NEGATIVE_EARNINGS = 'NegativeEarnings'; - const WARNING_TYPE_PREVIOUSLY_TERMINATED = 'PreviouslyTerminated'; - const WARNING_TYPE_TERMINATED_WITH_EXPENSE_REIMBURSEMENTS = 'TerminatedWithExpenseReimbursements'; - const WARNING_TYPE_EXPIRED_QUALIFICATION = 'ExpiredQualification'; - const WARNING_TYPE_DUPLICATE_EARNINGS_LINES = 'DuplicateEarningsLines'; - const WARNING_TYPE_TAX_CODE_MISSING = 'TaxCodeMissing'; - const WARNING_TYPE_BPAY = 'Bpay'; - const WARNING_TYPE_LEAVE_YEAR_CAP_REACHED = 'LeaveYearCapReached'; - const WARNING_TYPE_AUTO_ENROLMENT_CHANGES = 'AutoEnrolmentChanges'; - const WARNING_TYPE_EMPLOYEE_PENSION_CONTRIBUTION_REFUND = 'EmployeePensionContributionRefund'; - const WARNING_TYPE_PENSION_SCHEME_REQUIRES_AUTHORIZATION = 'PensionSchemeRequiresAuthorization'; - const WARNING_TYPE_UK_TAX_CODE_UPDATE = 'UkTaxCodeUpdate'; - const WARNING_TYPE_UK_TAX_CODE_UPDATE_ERROR = 'UkTaxCodeUpdateError'; - const WARNING_TYPE_NINO_UNKNOWN = 'NINOUnknown'; - const WARNING_TYPE_PRO_RATA_EARNINGS = 'ProRataEarnings'; - const WARNING_TYPE_HMRC_LATE_REASON_WARNING = 'HmrcLateReasonWarning'; - const WARNING_TYPE_BELOW_MINIMUM_WAGE = 'BelowMinimumWage'; - const WARNING_TYPE_EXPIRED_SPECIAL_TAX_RATE = 'ExpiredSpecialTaxRate'; - const WARNING_TYPE_EXPIRED_STUDENT_LOAN_RATE = 'ExpiredStudentLoanRate'; - const WARNING_TYPE_PENDING_LEAVE_REQUEST = 'PendingLeaveRequest'; - const WARNING_TYPE_LEAVE_REQUEST_BEYOND_PAY_PERIOD = 'LeaveRequestBeyondPayPeriod'; - const WARNING_TYPE_PRECEDING_LEAVE_REQUEST = 'PrecedingLeaveRequest'; - const WARNING_TYPE_INCOMPLETE_PAY_RUN_TASKS = 'IncompletePayRunTasks'; - const WARNING_TYPE_PENDING_EXPENSE_REQUESTS = 'PendingExpenseRequests'; - const WARNING_TYPE_PAY_DAY_FILING = 'PayDayFiling'; - const WARNING_TYPE_PAY_DAY_FILING_AMENDMENT = 'PayDayFilingAmendment'; - const WARNING_TYPE_EMPLOYEE_INFORMATION = 'EmployeeInformation'; - const WARNING_TYPE_IRD_SETTINGS = 'IrdSettings'; - const WARNING_TYPE_AUTO_UPDATED_NI_CATEGORY = 'AutoUpdatedNICategory'; - const WARNING_TYPE_UK_STUDENT_LOAN_UPDATE = 'UkStudentLoanUpdate'; - const WARNING_TYPE_PENSION_PROVIDER_DOES_NOT_ALLOW_OVERSEAS_ADDRESS = 'PensionProviderDoesNotAllowOverseasAddress'; - const WARNING_TYPE_MISSING_LEAVE_YEAR_ENTITLEMENT = 'MissingLeaveYearEntitlement'; - const WARNING_TYPE_LEAVE_REQUEST_UNIT_TYPE_MISMATCH = 'LeaveRequestUnitTypeMismatch'; - const WARNING_TYPE_EXPIRED_NRIC = 'ExpiredNric'; - const WARNING_TYPE_EXCESS_OVERTIME = 'ExcessOvertime'; - const WARNING_TYPE_FOREIGN_EMPLOYEE = 'ForeignEmployee'; - const WARNING_TYPE_EXCESS_DEDUCTIONS = 'ExcessDeductions'; - const WARNING_TYPE_TERMINATED_FOREIGN_EMPLOYEE = 'TerminatedForeignEmployee'; - const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED = 'StatutoryPaymentApplied'; - const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED_PREVIOUS = 'StatutoryPaymentAppliedPrevious'; - const WARNING_TYPE_NATIONAL_INSURANCE_VALIDATIONS = 'NationalInsuranceValidations'; - const WARNING_TYPE_MIXED_OFFSETS = 'MixedOffsets'; - const WARNING_TYPE_PENDING_SAP_PAYMENT = 'PendingSapPayment'; - const WARNING_TYPE_SCHEDULED_UPDATE_APPLIED = 'ScheduledUpdateApplied'; - const WARNING_TYPE_PENSION_SETTINGS_UPDATED = 'PensionSettingsUpdated'; - const WARNING_TYPE_TAX_RELIEF_THRESHOLD_EXCEEDED = 'TaxReliefThresholdExceeded'; - const WARNING_TYPE_UK_NOT_NOTICE_UPDATE = 'UkNotNoticeUpdate'; - const WARNING_TYPE_EARNINGS_AUTOMATICALLY_ADJUSTED = 'EarningsAutomaticallyAdjusted'; - const WARNING_TYPE_EARNINGS_REQUIRE_ADJUSTMENT = 'EarningsRequireAdjustment'; - const WARNING_TYPE_UK_TAX_CODE_P9_UPDATE = 'UkTaxCodeP9Update'; - const WARNING_TYPE_HRDF_EMPLOYEE_WARNING = 'HrdfEmployeeWarning'; - const WARNING_TYPE_NEW_PAYROLLED_BENEFITS = 'NewPayrolledBenefits'; - const WARNING_TYPE_SUBMIT_TERMINATED_EMPLOYEE_TO_HMRC = 'SubmitTerminatedEmployeeToHmrc'; - const WARNING_TYPE_SUPER_RECONCILIATION_PREVIOUS_PAY_RUN = 'SuperReconciliationPreviousPayRun'; - const WARNING_TYPE_SUPER_RECONCILIATION_THIS_PAY_RUN = 'SuperReconciliationThisPayRun'; - const WARNING_TYPE_MORE_THAN28_DAYS_WITHOUT_TFN_QUOTED = 'MoreThan28DaysWithoutTfnQuoted'; - const WARNING_TYPE_BACK_CALCULATIONS_APPLIED = 'BackCalculationsApplied'; - const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_PREVIOUS_PAY_RUN = 'LeaveAccrualReconciliationPreviousPayRun'; - const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_THIS_PAY_RUN = 'LeaveAccrualReconciliationThisPayRun'; - const WARNING_TYPE_PUBLIC_HOLIDAY_AUTOMATION = 'PublicHolidayAutomation'; - const WARNING_TYPE_CIS_SUBCONTRACTOR_REQUIRES_VERIFICATION = 'CisSubcontractorRequiresVerification'; - const WARNING_TYPE_ITN_REQUIRES_UPDATE = 'ItnRequiresUpdate'; - const WARNING_TYPE_CIS_SUBCONTRACTOR_LAST_PAYMENT_DATE = 'CisSubcontractorLastPaymentDate'; - const WARNING_TYPE_CIS_SUBCONTRACTOR_UNMATCHED = 'CisSubcontractorUnmatched'; - const WARNING_TYPE_CPF_REFUND_REQUIRED = 'CpfRefundRequired'; - const WARNING_TYPE_CPF_YEAR_END_RECALCULATION_REQUIRED = 'CpfYearEndRecalculationRequired'; - const WARNING_TYPE_TAX_CODE_DISPLAY_NAME_TOO_LONG = 'TaxCodeDisplayNameTooLong'; - const WARNING_TYPE_TIMESHEET_OUT_OF_SEQUENCE = 'TimesheetOutOfSequence'; - const WARNING_TYPE_EXPIRED_CONTRACTOR_TAX_RATE = 'ExpiredContractorTaxRate'; - const WARNING_TYPE_CONCURRENT_PAY_RUN = 'ConcurrentPayRun'; - const WARNING_TYPE_STUDENT_LOAN_ADJUSTMENT = 'StudentLoanAdjustment'; - const WARNING_TYPE_UNPAID_LEAVE_WITH_AVAILABLE_BALANCE = 'UnpaidLeaveWithAvailableBalance'; - const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED = 'OccupationalLeaveApplied'; - const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED_PREVIOUS = 'OccupationalLeaveAppliedPrevious'; - const WARNING_TYPE_OCCUPATIONAL_LEAVE_ENTITLEMENT_EXHAUSTED = 'OccupationalLeaveEntitlementExhausted'; - const WARNING_TYPE_ANNUAL_LEAVE_CASHED_OUT = 'AnnualLeaveCashedOut'; - const WARNING_TYPE_EMPLOYEE_HAS_TAKEN_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'EmployeeHasTakenPaidFamilyAndDomesticViolenceLeave'; - - - + return self::$openAPIModelName; + } + + public const WARNING_TYPE_PAYMENT_FILE = 'PaymentFile'; + public const WARNING_TYPE_MORE_LEAVE_THAN_ACCRUED = 'MoreLeaveThanAccrued'; + public const WARNING_TYPE_UNPAID_EARNINGS = 'UnpaidEarnings'; + public const WARNING_TYPE_BIRTHDAY = 'Birthday'; + public const WARNING_TYPE_ANNIVERSARY = 'Anniversary'; + public const WARNING_TYPE_NEGATIVE_EARNINGS = 'NegativeEarnings'; + public const WARNING_TYPE_PREVIOUSLY_TERMINATED = 'PreviouslyTerminated'; + public const WARNING_TYPE_TERMINATED_WITH_EXPENSE_REIMBURSEMENTS = 'TerminatedWithExpenseReimbursements'; + public const WARNING_TYPE_EXPIRED_QUALIFICATION = 'ExpiredQualification'; + public const WARNING_TYPE_DUPLICATE_EARNINGS_LINES = 'DuplicateEarningsLines'; + public const WARNING_TYPE_TAX_CODE_MISSING = 'TaxCodeMissing'; + public const WARNING_TYPE_BPAY = 'Bpay'; + public const WARNING_TYPE_LEAVE_YEAR_CAP_REACHED = 'LeaveYearCapReached'; + public const WARNING_TYPE_AUTO_ENROLMENT_CHANGES = 'AutoEnrolmentChanges'; + public const WARNING_TYPE_EMPLOYEE_PENSION_CONTRIBUTION_REFUND = 'EmployeePensionContributionRefund'; + public const WARNING_TYPE_PENSION_SCHEME_REQUIRES_AUTHORIZATION = 'PensionSchemeRequiresAuthorization'; + public const WARNING_TYPE_UK_TAX_CODE_UPDATE = 'UkTaxCodeUpdate'; + public const WARNING_TYPE_UK_TAX_CODE_UPDATE_ERROR = 'UkTaxCodeUpdateError'; + public const WARNING_TYPE_NINO_UNKNOWN = 'NINOUnknown'; + public const WARNING_TYPE_PRO_RATA_EARNINGS = 'ProRataEarnings'; + public const WARNING_TYPE_HMRC_LATE_REASON_WARNING = 'HmrcLateReasonWarning'; + public const WARNING_TYPE_BELOW_MINIMUM_WAGE = 'BelowMinimumWage'; + public const WARNING_TYPE_EXPIRED_SPECIAL_TAX_RATE = 'ExpiredSpecialTaxRate'; + public const WARNING_TYPE_EXPIRED_STUDENT_LOAN_RATE = 'ExpiredStudentLoanRate'; + public const WARNING_TYPE_PENDING_LEAVE_REQUEST = 'PendingLeaveRequest'; + public const WARNING_TYPE_LEAVE_REQUEST_BEYOND_PAY_PERIOD = 'LeaveRequestBeyondPayPeriod'; + public const WARNING_TYPE_PRECEDING_LEAVE_REQUEST = 'PrecedingLeaveRequest'; + public const WARNING_TYPE_INCOMPLETE_PAY_RUN_TASKS = 'IncompletePayRunTasks'; + public const WARNING_TYPE_PENDING_EXPENSE_REQUESTS = 'PendingExpenseRequests'; + public const WARNING_TYPE_PAY_DAY_FILING = 'PayDayFiling'; + public const WARNING_TYPE_PAY_DAY_FILING_AMENDMENT = 'PayDayFilingAmendment'; + public const WARNING_TYPE_EMPLOYEE_INFORMATION = 'EmployeeInformation'; + public const WARNING_TYPE_IRD_SETTINGS = 'IrdSettings'; + public const WARNING_TYPE_AUTO_UPDATED_NI_CATEGORY = 'AutoUpdatedNICategory'; + public const WARNING_TYPE_UK_STUDENT_LOAN_UPDATE = 'UkStudentLoanUpdate'; + public const WARNING_TYPE_PENSION_PROVIDER_DOES_NOT_ALLOW_OVERSEAS_ADDRESS = 'PensionProviderDoesNotAllowOverseasAddress'; + public const WARNING_TYPE_MISSING_LEAVE_YEAR_ENTITLEMENT = 'MissingLeaveYearEntitlement'; + public const WARNING_TYPE_LEAVE_REQUEST_UNIT_TYPE_MISMATCH = 'LeaveRequestUnitTypeMismatch'; + public const WARNING_TYPE_EXPIRED_NRIC = 'ExpiredNric'; + public const WARNING_TYPE_EXCESS_OVERTIME = 'ExcessOvertime'; + public const WARNING_TYPE_FOREIGN_EMPLOYEE = 'ForeignEmployee'; + public const WARNING_TYPE_EXCESS_DEDUCTIONS = 'ExcessDeductions'; + public const WARNING_TYPE_TERMINATED_FOREIGN_EMPLOYEE = 'TerminatedForeignEmployee'; + public const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED = 'StatutoryPaymentApplied'; + public const WARNING_TYPE_STATUTORY_PAYMENT_APPLIED_PREVIOUS = 'StatutoryPaymentAppliedPrevious'; + public const WARNING_TYPE_NATIONAL_INSURANCE_VALIDATIONS = 'NationalInsuranceValidations'; + public const WARNING_TYPE_MIXED_OFFSETS = 'MixedOffsets'; + public const WARNING_TYPE_PENDING_SAP_PAYMENT = 'PendingSapPayment'; + public const WARNING_TYPE_SCHEDULED_UPDATE_APPLIED = 'ScheduledUpdateApplied'; + public const WARNING_TYPE_PENSION_SETTINGS_UPDATED = 'PensionSettingsUpdated'; + public const WARNING_TYPE_TAX_RELIEF_THRESHOLD_EXCEEDED = 'TaxReliefThresholdExceeded'; + public const WARNING_TYPE_UK_NOT_NOTICE_UPDATE = 'UkNotNoticeUpdate'; + public const WARNING_TYPE_EARNINGS_AUTOMATICALLY_ADJUSTED = 'EarningsAutomaticallyAdjusted'; + public const WARNING_TYPE_EARNINGS_REQUIRE_ADJUSTMENT = 'EarningsRequireAdjustment'; + public const WARNING_TYPE_UK_TAX_CODE_P9_UPDATE = 'UkTaxCodeP9Update'; + public const WARNING_TYPE_HRDF_EMPLOYEE_WARNING = 'HrdfEmployeeWarning'; + public const WARNING_TYPE_NEW_PAYROLLED_BENEFITS = 'NewPayrolledBenefits'; + public const WARNING_TYPE_SUBMIT_TERMINATED_EMPLOYEE_TO_HMRC = 'SubmitTerminatedEmployeeToHmrc'; + public const WARNING_TYPE_SUPER_RECONCILIATION_PREVIOUS_PAY_RUN = 'SuperReconciliationPreviousPayRun'; + public const WARNING_TYPE_SUPER_RECONCILIATION_THIS_PAY_RUN = 'SuperReconciliationThisPayRun'; + public const WARNING_TYPE_MORE_THAN28_DAYS_WITHOUT_TFN_QUOTED = 'MoreThan28DaysWithoutTfnQuoted'; + public const WARNING_TYPE_BACK_CALCULATIONS_APPLIED = 'BackCalculationsApplied'; + public const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_PREVIOUS_PAY_RUN = 'LeaveAccrualReconciliationPreviousPayRun'; + public const WARNING_TYPE_LEAVE_ACCRUAL_RECONCILIATION_THIS_PAY_RUN = 'LeaveAccrualReconciliationThisPayRun'; + public const WARNING_TYPE_PUBLIC_HOLIDAY_AUTOMATION = 'PublicHolidayAutomation'; + public const WARNING_TYPE_CIS_SUBCONTRACTOR_REQUIRES_VERIFICATION = 'CisSubcontractorRequiresVerification'; + public const WARNING_TYPE_ITN_REQUIRES_UPDATE = 'ItnRequiresUpdate'; + public const WARNING_TYPE_CIS_SUBCONTRACTOR_LAST_PAYMENT_DATE = 'CisSubcontractorLastPaymentDate'; + public const WARNING_TYPE_CIS_SUBCONTRACTOR_UNMATCHED = 'CisSubcontractorUnmatched'; + public const WARNING_TYPE_CPF_REFUND_REQUIRED = 'CpfRefundRequired'; + public const WARNING_TYPE_CPF_YEAR_END_RECALCULATION_REQUIRED = 'CpfYearEndRecalculationRequired'; + public const WARNING_TYPE_TAX_CODE_DISPLAY_NAME_TOO_LONG = 'TaxCodeDisplayNameTooLong'; + public const WARNING_TYPE_TIMESHEET_OUT_OF_SEQUENCE = 'TimesheetOutOfSequence'; + public const WARNING_TYPE_EXPIRED_CONTRACTOR_TAX_RATE = 'ExpiredContractorTaxRate'; + public const WARNING_TYPE_CONCURRENT_PAY_RUN = 'ConcurrentPayRun'; + public const WARNING_TYPE_STUDENT_LOAN_ADJUSTMENT = 'StudentLoanAdjustment'; + public const WARNING_TYPE_UNPAID_LEAVE_WITH_AVAILABLE_BALANCE = 'UnpaidLeaveWithAvailableBalance'; + public const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED = 'OccupationalLeaveApplied'; + public const WARNING_TYPE_OCCUPATIONAL_LEAVE_APPLIED_PREVIOUS = 'OccupationalLeaveAppliedPrevious'; + public const WARNING_TYPE_OCCUPATIONAL_LEAVE_ENTITLEMENT_EXHAUSTED = 'OccupationalLeaveEntitlementExhausted'; + public const WARNING_TYPE_ANNUAL_LEAVE_CASHED_OUT = 'AnnualLeaveCashedOut'; + public const WARNING_TYPE_EMPLOYEE_HAS_TAKEN_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE = 'EmployeeHasTakenPaidFamilyAndDomesticViolenceLeave'; + /** * Gets allowable values of the enum * @@ -375,7 +451,6 @@ public function getWarningTypeAllowableValues() self::WARNING_TYPE_EMPLOYEE_HAS_TAKEN_PAID_FAMILY_AND_DOMESTIC_VIOLENCE_LEAVE, ]; } - /** * Associative array for storing property values @@ -392,15 +467,33 @@ public function getWarningTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['warning_type'] = isset($data['warning_type']) ? $data['warning_type'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['warning'] = isset($data['warning']) ? $data['warning'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['pay_run_total_id'] = isset($data['pay_run_total_id']) ? $data['pay_run_total_id'] : null; - $this->container['meta_data'] = isset($data['meta_data']) ? $data['meta_data'] : null; - $this->container['meta_data_json'] = isset($data['meta_data_json']) ? $data['meta_data_json'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; - $this->container['formatted_warning_message'] = isset($data['formatted_warning_message']) ? $data['formatted_warning_message'] : null; + $this->setIfExists('warning_type', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('warning', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('pay_run_total_id', $data ?? [], null); + $this->setIfExists('meta_data', $data ?? [], null); + $this->setIfExists('meta_data_json', $data ?? [], null); + $this->setIfExists('employee_external_id', $data ?? [], null); + $this->setIfExists('formatted_warning_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; } /** @@ -415,7 +508,8 @@ public function listInvalidProperties() $allowedValues = $this->getWarningTypeAllowableValues(); if (!is_null($this->container['warning_type']) && !in_array($this->container['warning_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'warning_type', must be one of '%s'", + "invalid value '%s' for 'warning_type', must be one of '%s'", + $this->container['warning_type'], implode("', '", $allowedValues) ); } @@ -438,7 +532,7 @@ public function valid() /** * Gets warning_type * - * @return string + * @return string|null */ public function getWarningType() { @@ -448,17 +542,21 @@ public function getWarningType() /** * Sets warning_type * - * @param string $warning_type + * @param string|null $warning_type * - * @return $this + * @return self */ public function setWarningType($warning_type) { + if (is_null($warning_type)) { + throw new \InvalidArgumentException('non-nullable warning_type cannot be null'); + } $allowedValues = $this->getWarningTypeAllowableValues(); - if (!is_null($warning_type) && !in_array($warning_type, $allowedValues, true)) { + if (!in_array($warning_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'warning_type', must be one of '%s'", + "Invalid value '%s' for 'warning_type', must be one of '%s'", + $warning_type, implode("', '", $allowedValues) ) ); @@ -471,7 +569,7 @@ public function setWarningType($warning_type) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -481,12 +579,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -495,7 +596,7 @@ public function setEmployeeId($employee_id) /** * Gets warning * - * @return string + * @return string|null */ public function getWarning() { @@ -505,12 +606,15 @@ public function getWarning() /** * Sets warning * - * @param string $warning + * @param string|null $warning * - * @return $this + * @return self */ public function setWarning($warning) { + if (is_null($warning)) { + throw new \InvalidArgumentException('non-nullable warning cannot be null'); + } $this->container['warning'] = $warning; return $this; @@ -519,7 +623,7 @@ public function setWarning($warning) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -529,12 +633,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -543,7 +650,7 @@ public function setEmployeeName($employee_name) /** * Gets pay_run_total_id * - * @return int + * @return int|null */ public function getPayRunTotalId() { @@ -553,12 +660,15 @@ public function getPayRunTotalId() /** * Sets pay_run_total_id * - * @param int $pay_run_total_id + * @param int|null $pay_run_total_id * - * @return $this + * @return self */ public function setPayRunTotalId($pay_run_total_id) { + if (is_null($pay_run_total_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_total_id cannot be null'); + } $this->container['pay_run_total_id'] = $pay_run_total_id; return $this; @@ -567,7 +677,7 @@ public function setPayRunTotalId($pay_run_total_id) /** * Gets meta_data * - * @return object + * @return object|null */ public function getMetaData() { @@ -577,12 +687,15 @@ public function getMetaData() /** * Sets meta_data * - * @param object $meta_data + * @param object|null $meta_data * - * @return $this + * @return self */ public function setMetaData($meta_data) { + if (is_null($meta_data)) { + throw new \InvalidArgumentException('non-nullable meta_data cannot be null'); + } $this->container['meta_data'] = $meta_data; return $this; @@ -591,7 +704,7 @@ public function setMetaData($meta_data) /** * Gets meta_data_json * - * @return string + * @return string|null */ public function getMetaDataJson() { @@ -601,12 +714,15 @@ public function getMetaDataJson() /** * Sets meta_data_json * - * @param string $meta_data_json + * @param string|null $meta_data_json * - * @return $this + * @return self */ public function setMetaDataJson($meta_data_json) { + if (is_null($meta_data_json)) { + throw new \InvalidArgumentException('non-nullable meta_data_json cannot be null'); + } $this->container['meta_data_json'] = $meta_data_json; return $this; @@ -615,7 +731,7 @@ public function setMetaDataJson($meta_data_json) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -625,12 +741,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -639,7 +758,7 @@ public function setEmployeeExternalId($employee_external_id) /** * Gets formatted_warning_message * - * @return string + * @return string|null */ public function getFormattedWarningMessage() { @@ -649,12 +768,15 @@ public function getFormattedWarningMessage() /** * Sets formatted_warning_message * - * @param string $formatted_warning_message + * @param string|null $formatted_warning_message * - * @return $this + * @return self */ public function setFormattedWarningMessage($formatted_warning_message) { + if (is_null($formatted_warning_message)) { + throw new \InvalidArgumentException('non-nullable formatted_warning_message cannot be null'); + } $this->container['formatted_warning_message'] = $formatted_warning_message; return $this; @@ -666,7 +788,7 @@ public function setFormattedWarningMessage($formatted_warning_message) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -676,22 +798,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -707,11 +830,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -719,13 +855,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunWarningModel.php b/src/lib/Model/PayRunWarningModel.php index e9b283b..b0ed44a 100644 --- a/src/lib/Model/PayRunWarningModel.php +++ b/src/lib/Model/PayRunWarningModel.php @@ -2,61 +2,61 @@ /** * PayRunWarningModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunWarningModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunWarningModel implements ModelInterface, ArrayAccess +class PayRunWarningModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunWarningModel'; + protected static $openAPIModelName = 'PayRunWarningModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'description' => 'string' ]; @@ -65,20 +65,39 @@ class PayRunWarningModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -247,12 +336,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -264,7 +356,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayRunWarningResult.php b/src/lib/Model/PayRunWarningResult.php index 55c2b1c..02b9a48 100644 --- a/src/lib/Model/PayRunWarningResult.php +++ b/src/lib/Model/PayRunWarningResult.php @@ -2,63 +2,63 @@ /** * PayRunWarningResult * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayRunWarningResult Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayRunWarningResult implements ModelInterface, ArrayAccess +class PayRunWarningResult implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayRunWarningResult'; + protected static $openAPIModelName = 'PayRunWarningResult'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'warning_message' => 'string', - 'warnings' => '\Swagger\Client\Model\PayRunWarningDto[]', + 'warnings' => '\OpenAPI\Client\Model\PayRunWarningDto[]', 'template_name' => 'string' ]; @@ -66,21 +66,41 @@ class PayRunWarningResult implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'warning_message' => null, 'warnings' => null, 'template_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'warning_message' => false, + 'warnings' => false, + 'template_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['warning_message'] = isset($data['warning_message']) ? $data['warning_message'] : null; - $this->container['warnings'] = isset($data['warnings']) ? $data['warnings'] : null; - $this->container['template_name'] = isset($data['template_name']) ? $data['template_name'] : null; + $this->setIfExists('warning_message', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); + $this->setIfExists('template_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets warning_message * - * @return string + * @return string|null */ public function getWarningMessage() { @@ -229,12 +316,15 @@ public function getWarningMessage() /** * Sets warning_message * - * @param string $warning_message + * @param string|null $warning_message * - * @return $this + * @return self */ public function setWarningMessage($warning_message) { + if (is_null($warning_message)) { + throw new \InvalidArgumentException('non-nullable warning_message cannot be null'); + } $this->container['warning_message'] = $warning_message; return $this; @@ -243,7 +333,7 @@ public function setWarningMessage($warning_message) /** * Gets warnings * - * @return \Swagger\Client\Model\PayRunWarningDto[] + * @return \OpenAPI\Client\Model\PayRunWarningDto[]|null */ public function getWarnings() { @@ -253,12 +343,15 @@ public function getWarnings() /** * Sets warnings * - * @param \Swagger\Client\Model\PayRunWarningDto[] $warnings + * @param \OpenAPI\Client\Model\PayRunWarningDto[]|null $warnings * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setWarnings($warnings) /** * Gets template_name * - * @return string + * @return string|null */ public function getTemplateName() { @@ -277,12 +370,15 @@ public function getTemplateName() /** * Sets template_name * - * @param string $template_name + * @param string|null $template_name * - * @return $this + * @return self */ public function setTemplateName($template_name) { + if (is_null($template_name)) { + throw new \InvalidArgumentException('non-nullable template_name cannot be null'); + } $this->container['template_name'] = $template_name; return $this; @@ -294,7 +390,7 @@ public function setTemplateName($template_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayScheduleApprovalSettingsModel.php b/src/lib/Model/PayScheduleApprovalSettingsModel.php index 3cbf263..a311c50 100644 --- a/src/lib/Model/PayScheduleApprovalSettingsModel.php +++ b/src/lib/Model/PayScheduleApprovalSettingsModel.php @@ -2,61 +2,61 @@ /** * PayScheduleApprovalSettingsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayScheduleApprovalSettingsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayScheduleApprovalSettingsModel implements ModelInterface, ArrayAccess +class PayScheduleApprovalSettingsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayScheduleApprovalSettingsModel'; + protected static $openAPIModelName = 'PayScheduleApprovalSettingsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'require_approval' => 'bool', 'reminder_day' => 'int', 'notification_template' => 'string', @@ -71,8 +71,10 @@ class PayScheduleApprovalSettingsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'require_approval' => null, 'reminder_day' => 'int32', 'notification_template' => null, @@ -83,14 +85,37 @@ class PayScheduleApprovalSettingsModel implements ModelInterface, ArrayAccess 'approvers_to_notify' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'require_approval' => false, + 'reminder_day' => false, + 'notification_template' => false, + 'notification_subject' => false, + 'reminder_template' => false, + 'reminder_subject' => false, + 'send_reminder' => false, + 'approvers_to_notify' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['require_approval'] = isset($data['require_approval']) ? $data['require_approval'] : null; - $this->container['reminder_day'] = isset($data['reminder_day']) ? $data['reminder_day'] : null; - $this->container['notification_template'] = isset($data['notification_template']) ? $data['notification_template'] : null; - $this->container['notification_subject'] = isset($data['notification_subject']) ? $data['notification_subject'] : null; - $this->container['reminder_template'] = isset($data['reminder_template']) ? $data['reminder_template'] : null; - $this->container['reminder_subject'] = isset($data['reminder_subject']) ? $data['reminder_subject'] : null; - $this->container['send_reminder'] = isset($data['send_reminder']) ? $data['send_reminder'] : null; - $this->container['approvers_to_notify'] = isset($data['approvers_to_notify']) ? $data['approvers_to_notify'] : null; + $this->setIfExists('require_approval', $data ?? [], null); + $this->setIfExists('reminder_day', $data ?? [], null); + $this->setIfExists('notification_template', $data ?? [], null); + $this->setIfExists('notification_subject', $data ?? [], null); + $this->setIfExists('reminder_template', $data ?? [], null); + $this->setIfExists('reminder_subject', $data ?? [], null); + $this->setIfExists('send_reminder', $data ?? [], null); + $this->setIfExists('approvers_to_notify', $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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets require_approval * - * @return bool + * @return bool|null */ public function getRequireApproval() { @@ -259,12 +351,15 @@ public function getRequireApproval() /** * Sets require_approval * - * @param bool $require_approval + * @param bool|null $require_approval * - * @return $this + * @return self */ public function setRequireApproval($require_approval) { + if (is_null($require_approval)) { + throw new \InvalidArgumentException('non-nullable require_approval cannot be null'); + } $this->container['require_approval'] = $require_approval; return $this; @@ -273,7 +368,7 @@ public function setRequireApproval($require_approval) /** * Gets reminder_day * - * @return int + * @return int|null */ public function getReminderDay() { @@ -283,12 +378,15 @@ public function getReminderDay() /** * Sets reminder_day * - * @param int $reminder_day + * @param int|null $reminder_day * - * @return $this + * @return self */ public function setReminderDay($reminder_day) { + if (is_null($reminder_day)) { + throw new \InvalidArgumentException('non-nullable reminder_day cannot be null'); + } $this->container['reminder_day'] = $reminder_day; return $this; @@ -297,7 +395,7 @@ public function setReminderDay($reminder_day) /** * Gets notification_template * - * @return string + * @return string|null */ public function getNotificationTemplate() { @@ -307,12 +405,15 @@ public function getNotificationTemplate() /** * Sets notification_template * - * @param string $notification_template + * @param string|null $notification_template * - * @return $this + * @return self */ public function setNotificationTemplate($notification_template) { + if (is_null($notification_template)) { + throw new \InvalidArgumentException('non-nullable notification_template cannot be null'); + } $this->container['notification_template'] = $notification_template; return $this; @@ -321,7 +422,7 @@ public function setNotificationTemplate($notification_template) /** * Gets notification_subject * - * @return string + * @return string|null */ public function getNotificationSubject() { @@ -331,12 +432,15 @@ public function getNotificationSubject() /** * Sets notification_subject * - * @param string $notification_subject + * @param string|null $notification_subject * - * @return $this + * @return self */ public function setNotificationSubject($notification_subject) { + if (is_null($notification_subject)) { + throw new \InvalidArgumentException('non-nullable notification_subject cannot be null'); + } $this->container['notification_subject'] = $notification_subject; return $this; @@ -345,7 +449,7 @@ public function setNotificationSubject($notification_subject) /** * Gets reminder_template * - * @return string + * @return string|null */ public function getReminderTemplate() { @@ -355,12 +459,15 @@ public function getReminderTemplate() /** * Sets reminder_template * - * @param string $reminder_template + * @param string|null $reminder_template * - * @return $this + * @return self */ public function setReminderTemplate($reminder_template) { + if (is_null($reminder_template)) { + throw new \InvalidArgumentException('non-nullable reminder_template cannot be null'); + } $this->container['reminder_template'] = $reminder_template; return $this; @@ -369,7 +476,7 @@ public function setReminderTemplate($reminder_template) /** * Gets reminder_subject * - * @return string + * @return string|null */ public function getReminderSubject() { @@ -379,12 +486,15 @@ public function getReminderSubject() /** * Sets reminder_subject * - * @param string $reminder_subject + * @param string|null $reminder_subject * - * @return $this + * @return self */ public function setReminderSubject($reminder_subject) { + if (is_null($reminder_subject)) { + throw new \InvalidArgumentException('non-nullable reminder_subject cannot be null'); + } $this->container['reminder_subject'] = $reminder_subject; return $this; @@ -393,7 +503,7 @@ public function setReminderSubject($reminder_subject) /** * Gets send_reminder * - * @return bool + * @return bool|null */ public function getSendReminder() { @@ -403,12 +513,15 @@ public function getSendReminder() /** * Sets send_reminder * - * @param bool $send_reminder + * @param bool|null $send_reminder * - * @return $this + * @return self */ public function setSendReminder($send_reminder) { + if (is_null($send_reminder)) { + throw new \InvalidArgumentException('non-nullable send_reminder cannot be null'); + } $this->container['send_reminder'] = $send_reminder; return $this; @@ -417,7 +530,7 @@ public function setSendReminder($send_reminder) /** * Gets approvers_to_notify * - * @return string[] + * @return string[]|null */ public function getApproversToNotify() { @@ -427,12 +540,15 @@ public function getApproversToNotify() /** * Sets approvers_to_notify * - * @param string[] $approvers_to_notify + * @param string[]|null $approvers_to_notify * - * @return $this + * @return self */ public function setApproversToNotify($approvers_to_notify) { + if (is_null($approvers_to_notify)) { + throw new \InvalidArgumentException('non-nullable approvers_to_notify cannot be null'); + } $this->container['approvers_to_notify'] = $approvers_to_notify; return $this; @@ -444,7 +560,7 @@ public function setApproversToNotify($approvers_to_notify) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayScheduleDateForecastResultApiModel.php b/src/lib/Model/PayScheduleDateForecastResultApiModel.php index 6972fbb..671bf4b 100644 --- a/src/lib/Model/PayScheduleDateForecastResultApiModel.php +++ b/src/lib/Model/PayScheduleDateForecastResultApiModel.php @@ -2,61 +2,61 @@ /** * PayScheduleDateForecastResultApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayScheduleDateForecastResultApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayScheduleDateForecastResultApiModel implements ModelInterface, ArrayAccess +class PayScheduleDateForecastResultApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayScheduleDateForecastResultApiModel'; + protected static $openAPIModelName = 'PayScheduleDateForecastResultApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_schedule_id' => 'int', 'next_scheduled_from_date' => '\DateTime', 'next_scheduled_to_date' => '\DateTime', @@ -67,22 +67,43 @@ class PayScheduleDateForecastResultApiModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_schedule_id' => 'int32', 'next_scheduled_from_date' => 'date-time', 'next_scheduled_to_date' => 'date-time', 'next_scheduled_paid_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_schedule_id' => false, + 'next_scheduled_from_date' => false, + 'next_scheduled_to_date' => false, + 'next_scheduled_paid_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['next_scheduled_from_date'] = isset($data['next_scheduled_from_date']) ? $data['next_scheduled_from_date'] : null; - $this->container['next_scheduled_to_date'] = isset($data['next_scheduled_to_date']) ? $data['next_scheduled_to_date'] : null; - $this->container['next_scheduled_paid_date'] = isset($data['next_scheduled_paid_date']) ? $data['next_scheduled_paid_date'] : null; + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('next_scheduled_from_date', $data ?? [], null); + $this->setIfExists('next_scheduled_to_date', $data ?? [], null); + $this->setIfExists('next_scheduled_paid_date', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -235,12 +323,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -249,7 +340,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets next_scheduled_from_date * - * @return \DateTime + * @return \DateTime|null */ public function getNextScheduledFromDate() { @@ -259,12 +350,15 @@ public function getNextScheduledFromDate() /** * Sets next_scheduled_from_date * - * @param \DateTime $next_scheduled_from_date + * @param \DateTime|null $next_scheduled_from_date * - * @return $this + * @return self */ public function setNextScheduledFromDate($next_scheduled_from_date) { + if (is_null($next_scheduled_from_date)) { + throw new \InvalidArgumentException('non-nullable next_scheduled_from_date cannot be null'); + } $this->container['next_scheduled_from_date'] = $next_scheduled_from_date; return $this; @@ -273,7 +367,7 @@ public function setNextScheduledFromDate($next_scheduled_from_date) /** * Gets next_scheduled_to_date * - * @return \DateTime + * @return \DateTime|null */ public function getNextScheduledToDate() { @@ -283,12 +377,15 @@ public function getNextScheduledToDate() /** * Sets next_scheduled_to_date * - * @param \DateTime $next_scheduled_to_date + * @param \DateTime|null $next_scheduled_to_date * - * @return $this + * @return self */ public function setNextScheduledToDate($next_scheduled_to_date) { + if (is_null($next_scheduled_to_date)) { + throw new \InvalidArgumentException('non-nullable next_scheduled_to_date cannot be null'); + } $this->container['next_scheduled_to_date'] = $next_scheduled_to_date; return $this; @@ -297,7 +394,7 @@ public function setNextScheduledToDate($next_scheduled_to_date) /** * Gets next_scheduled_paid_date * - * @return \DateTime + * @return \DateTime|null */ public function getNextScheduledPaidDate() { @@ -307,12 +404,15 @@ public function getNextScheduledPaidDate() /** * Sets next_scheduled_paid_date * - * @param \DateTime $next_scheduled_paid_date + * @param \DateTime|null $next_scheduled_paid_date * - * @return $this + * @return self */ public function setNextScheduledPaidDate($next_scheduled_paid_date) { + if (is_null($next_scheduled_paid_date)) { + throw new \InvalidArgumentException('non-nullable next_scheduled_paid_date cannot be null'); + } $this->container['next_scheduled_paid_date'] = $next_scheduled_paid_date; return $this; @@ -324,7 +424,7 @@ public function setNextScheduledPaidDate($next_scheduled_paid_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayScheduleMetaDataModel.php b/src/lib/Model/PayScheduleMetaDataModel.php index ac83355..95ca68f 100644 --- a/src/lib/Model/PayScheduleMetaDataModel.php +++ b/src/lib/Model/PayScheduleMetaDataModel.php @@ -2,67 +2,67 @@ /** * PayScheduleMetaDataModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayScheduleMetaDataModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayScheduleMetaDataModel implements ModelInterface, ArrayAccess +class PayScheduleMetaDataModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayScheduleMetaDataModel'; + protected static $openAPIModelName = 'PayScheduleMetaDataModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'pay_run_warnings' => '\Swagger\Client\Model\PayRunWarningModel[]', + protected static $openAPITypes = [ + 'pay_run_warnings' => '\OpenAPI\Client\Model\PayRunWarningModel[]', 'frequencies' => 'string[]', 'employment_selection_strategies' => 'string[]', 'timesheet_import_options' => 'string[]', 'publish_pay_slips_preferences' => 'string[]', - 'report_packs' => '\Swagger\Client\Model\ReportPackModel[]', + 'report_packs' => '\OpenAPI\Client\Model\ReportPackModel[]', 'users_to_notify' => 'string[]' ]; @@ -70,8 +70,10 @@ class PayScheduleMetaDataModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_warnings' => null, 'frequencies' => null, 'employment_selection_strategies' => null, @@ -81,14 +83,36 @@ class PayScheduleMetaDataModel implements ModelInterface, ArrayAccess 'users_to_notify' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_warnings' => false, + 'frequencies' => false, + 'employment_selection_strategies' => false, + 'timesheet_import_options' => false, + 'publish_pay_slips_preferences' => false, + 'report_packs' => false, + 'users_to_notify' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_warnings'] = isset($data['pay_run_warnings']) ? $data['pay_run_warnings'] : null; - $this->container['frequencies'] = isset($data['frequencies']) ? $data['frequencies'] : null; - $this->container['employment_selection_strategies'] = isset($data['employment_selection_strategies']) ? $data['employment_selection_strategies'] : null; - $this->container['timesheet_import_options'] = isset($data['timesheet_import_options']) ? $data['timesheet_import_options'] : null; - $this->container['publish_pay_slips_preferences'] = isset($data['publish_pay_slips_preferences']) ? $data['publish_pay_slips_preferences'] : null; - $this->container['report_packs'] = isset($data['report_packs']) ? $data['report_packs'] : null; - $this->container['users_to_notify'] = isset($data['users_to_notify']) ? $data['users_to_notify'] : null; + $this->setIfExists('pay_run_warnings', $data ?? [], null); + $this->setIfExists('frequencies', $data ?? [], null); + $this->setIfExists('employment_selection_strategies', $data ?? [], null); + $this->setIfExists('timesheet_import_options', $data ?? [], null); + $this->setIfExists('publish_pay_slips_preferences', $data ?? [], null); + $this->setIfExists('report_packs', $data ?? [], null); + $this->setIfExists('users_to_notify', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets pay_run_warnings * - * @return \Swagger\Client\Model\PayRunWarningModel[] + * @return \OpenAPI\Client\Model\PayRunWarningModel[]|null */ public function getPayRunWarnings() { @@ -253,12 +344,15 @@ public function getPayRunWarnings() /** * Sets pay_run_warnings * - * @param \Swagger\Client\Model\PayRunWarningModel[] $pay_run_warnings + * @param \OpenAPI\Client\Model\PayRunWarningModel[]|null $pay_run_warnings * - * @return $this + * @return self */ public function setPayRunWarnings($pay_run_warnings) { + if (is_null($pay_run_warnings)) { + throw new \InvalidArgumentException('non-nullable pay_run_warnings cannot be null'); + } $this->container['pay_run_warnings'] = $pay_run_warnings; return $this; @@ -267,7 +361,7 @@ public function setPayRunWarnings($pay_run_warnings) /** * Gets frequencies * - * @return string[] + * @return string[]|null */ public function getFrequencies() { @@ -277,12 +371,15 @@ public function getFrequencies() /** * Sets frequencies * - * @param string[] $frequencies + * @param string[]|null $frequencies * - * @return $this + * @return self */ public function setFrequencies($frequencies) { + if (is_null($frequencies)) { + throw new \InvalidArgumentException('non-nullable frequencies cannot be null'); + } $this->container['frequencies'] = $frequencies; return $this; @@ -291,7 +388,7 @@ public function setFrequencies($frequencies) /** * Gets employment_selection_strategies * - * @return string[] + * @return string[]|null */ public function getEmploymentSelectionStrategies() { @@ -301,12 +398,15 @@ public function getEmploymentSelectionStrategies() /** * Sets employment_selection_strategies * - * @param string[] $employment_selection_strategies + * @param string[]|null $employment_selection_strategies * - * @return $this + * @return self */ public function setEmploymentSelectionStrategies($employment_selection_strategies) { + if (is_null($employment_selection_strategies)) { + throw new \InvalidArgumentException('non-nullable employment_selection_strategies cannot be null'); + } $this->container['employment_selection_strategies'] = $employment_selection_strategies; return $this; @@ -315,7 +415,7 @@ public function setEmploymentSelectionStrategies($employment_selection_strategie /** * Gets timesheet_import_options * - * @return string[] + * @return string[]|null */ public function getTimesheetImportOptions() { @@ -325,12 +425,15 @@ public function getTimesheetImportOptions() /** * Sets timesheet_import_options * - * @param string[] $timesheet_import_options + * @param string[]|null $timesheet_import_options * - * @return $this + * @return self */ public function setTimesheetImportOptions($timesheet_import_options) { + if (is_null($timesheet_import_options)) { + throw new \InvalidArgumentException('non-nullable timesheet_import_options cannot be null'); + } $this->container['timesheet_import_options'] = $timesheet_import_options; return $this; @@ -339,7 +442,7 @@ public function setTimesheetImportOptions($timesheet_import_options) /** * Gets publish_pay_slips_preferences * - * @return string[] + * @return string[]|null */ public function getPublishPaySlipsPreferences() { @@ -349,12 +452,15 @@ public function getPublishPaySlipsPreferences() /** * Sets publish_pay_slips_preferences * - * @param string[] $publish_pay_slips_preferences + * @param string[]|null $publish_pay_slips_preferences * - * @return $this + * @return self */ public function setPublishPaySlipsPreferences($publish_pay_slips_preferences) { + if (is_null($publish_pay_slips_preferences)) { + throw new \InvalidArgumentException('non-nullable publish_pay_slips_preferences cannot be null'); + } $this->container['publish_pay_slips_preferences'] = $publish_pay_slips_preferences; return $this; @@ -363,7 +469,7 @@ public function setPublishPaySlipsPreferences($publish_pay_slips_preferences) /** * Gets report_packs * - * @return \Swagger\Client\Model\ReportPackModel[] + * @return \OpenAPI\Client\Model\ReportPackModel[]|null */ public function getReportPacks() { @@ -373,12 +479,15 @@ public function getReportPacks() /** * Sets report_packs * - * @param \Swagger\Client\Model\ReportPackModel[] $report_packs + * @param \OpenAPI\Client\Model\ReportPackModel[]|null $report_packs * - * @return $this + * @return self */ public function setReportPacks($report_packs) { + if (is_null($report_packs)) { + throw new \InvalidArgumentException('non-nullable report_packs cannot be null'); + } $this->container['report_packs'] = $report_packs; return $this; @@ -387,7 +496,7 @@ public function setReportPacks($report_packs) /** * Gets users_to_notify * - * @return string[] + * @return string[]|null */ public function getUsersToNotify() { @@ -397,12 +506,15 @@ public function getUsersToNotify() /** * Sets users_to_notify * - * @param string[] $users_to_notify + * @param string[]|null $users_to_notify * - * @return $this + * @return self */ public function setUsersToNotify($users_to_notify) { + if (is_null($users_to_notify)) { + throw new \InvalidArgumentException('non-nullable users_to_notify cannot be null'); + } $this->container['users_to_notify'] = $users_to_notify; return $this; @@ -414,7 +526,7 @@ public function setUsersToNotify($users_to_notify) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaySlipNotificationResponse.php b/src/lib/Model/PaySlipNotificationResponse.php index 9b79d95..39734d6 100644 --- a/src/lib/Model/PaySlipNotificationResponse.php +++ b/src/lib/Model/PaySlipNotificationResponse.php @@ -2,64 +2,64 @@ /** * PaySlipNotificationResponse * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaySlipNotificationResponse Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaySlipNotificationResponse implements ModelInterface, ArrayAccess +class PaySlipNotificationResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaySlipNotificationResponse'; + protected static $openAPIModelName = 'PaySlipNotificationResponse'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'total_email_notifications_sent' => 'int', 'total_sms_notifications_sent' => 'int', - 'errors' => '\Swagger\Client\Model\PayRunWarningResult', + 'errors' => '\OpenAPI\Client\Model\PayRunWarningResult', 'has_partially_sent_notifications' => 'bool' ]; @@ -67,22 +67,43 @@ class PaySlipNotificationResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'total_email_notifications_sent' => 'int32', 'total_sms_notifications_sent' => 'int32', 'errors' => null, 'has_partially_sent_notifications' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total_email_notifications_sent' => false, + 'total_sms_notifications_sent' => false, + 'errors' => false, + 'has_partially_sent_notifications' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total_email_notifications_sent'] = isset($data['total_email_notifications_sent']) ? $data['total_email_notifications_sent'] : null; - $this->container['total_sms_notifications_sent'] = isset($data['total_sms_notifications_sent']) ? $data['total_sms_notifications_sent'] : null; - $this->container['errors'] = isset($data['errors']) ? $data['errors'] : null; - $this->container['has_partially_sent_notifications'] = isset($data['has_partially_sent_notifications']) ? $data['has_partially_sent_notifications'] : null; + $this->setIfExists('total_email_notifications_sent', $data ?? [], null); + $this->setIfExists('total_sms_notifications_sent', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('has_partially_sent_notifications', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets total_email_notifications_sent * - * @return int + * @return int|null */ public function getTotalEmailNotificationsSent() { @@ -235,12 +323,15 @@ public function getTotalEmailNotificationsSent() /** * Sets total_email_notifications_sent * - * @param int $total_email_notifications_sent + * @param int|null $total_email_notifications_sent * - * @return $this + * @return self */ public function setTotalEmailNotificationsSent($total_email_notifications_sent) { + if (is_null($total_email_notifications_sent)) { + throw new \InvalidArgumentException('non-nullable total_email_notifications_sent cannot be null'); + } $this->container['total_email_notifications_sent'] = $total_email_notifications_sent; return $this; @@ -249,7 +340,7 @@ public function setTotalEmailNotificationsSent($total_email_notifications_sent) /** * Gets total_sms_notifications_sent * - * @return int + * @return int|null */ public function getTotalSmsNotificationsSent() { @@ -259,12 +350,15 @@ public function getTotalSmsNotificationsSent() /** * Sets total_sms_notifications_sent * - * @param int $total_sms_notifications_sent + * @param int|null $total_sms_notifications_sent * - * @return $this + * @return self */ public function setTotalSmsNotificationsSent($total_sms_notifications_sent) { + if (is_null($total_sms_notifications_sent)) { + throw new \InvalidArgumentException('non-nullable total_sms_notifications_sent cannot be null'); + } $this->container['total_sms_notifications_sent'] = $total_sms_notifications_sent; return $this; @@ -273,7 +367,7 @@ public function setTotalSmsNotificationsSent($total_sms_notifications_sent) /** * Gets errors * - * @return \Swagger\Client\Model\PayRunWarningResult + * @return \OpenAPI\Client\Model\PayRunWarningResult|null */ public function getErrors() { @@ -283,12 +377,15 @@ public function getErrors() /** * Sets errors * - * @param \Swagger\Client\Model\PayRunWarningResult $errors + * @param \OpenAPI\Client\Model\PayRunWarningResult|null $errors errors * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setErrors($errors) /** * Gets has_partially_sent_notifications * - * @return bool + * @return bool|null */ public function getHasPartiallySentNotifications() { @@ -307,12 +404,15 @@ public function getHasPartiallySentNotifications() /** * Sets has_partially_sent_notifications * - * @param bool $has_partially_sent_notifications + * @param bool|null $has_partially_sent_notifications * - * @return $this + * @return self */ public function setHasPartiallySentNotifications($has_partially_sent_notifications) { + if (is_null($has_partially_sent_notifications)) { + throw new \InvalidArgumentException('non-nullable has_partially_sent_notifications cannot be null'); + } $this->container['has_partially_sent_notifications'] = $has_partially_sent_notifications; return $this; @@ -324,7 +424,7 @@ public function setHasPartiallySentNotifications($has_partially_sent_notificatio * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaySlipReportRequestModel.php b/src/lib/Model/PaySlipReportRequestModel.php index d667814..7b827f9 100644 --- a/src/lib/Model/PaySlipReportRequestModel.php +++ b/src/lib/Model/PaySlipReportRequestModel.php @@ -2,61 +2,61 @@ /** * PaySlipReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaySlipReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaySlipReportRequestModel implements ModelInterface, ArrayAccess +class PaySlipReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaySlipReportRequestModel'; + protected static $openAPIModelName = 'PaySlipReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_id' => 'int', 'employee_id' => 'int', 'location_id' => 'int', @@ -67,22 +67,43 @@ class PaySlipReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_id' => 'int32', 'employee_id' => 'int32', 'location_id' => 'int32', 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_id' => false, + 'employee_id' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -235,12 +323,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -249,7 +340,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -259,12 +350,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -273,7 +367,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -283,12 +377,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -297,7 +394,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -307,12 +404,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -324,7 +424,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaygAdjustmentModel.php b/src/lib/Model/PaygAdjustmentModel.php index 493c062..e91946b 100644 --- a/src/lib/Model/PaygAdjustmentModel.php +++ b/src/lib/Model/PaygAdjustmentModel.php @@ -2,63 +2,63 @@ /** * PaygAdjustmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaygAdjustmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaygAdjustmentModel implements ModelInterface, ArrayAccess +class PaygAdjustmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaygAdjustmentModel'; + protected static $openAPIModelName = 'PaygAdjustmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'id' => 'int', 'external_id' => 'string', 'location_id' => 'string', @@ -72,8 +72,10 @@ class PaygAdjustmentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notes' => null, 'amount' => 'double', 'id' => 'int32', @@ -85,14 +87,38 @@ class PaygAdjustmentModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notes' => false, + 'amount' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -265,12 +358,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -279,7 +375,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -289,12 +385,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -303,7 +402,7 @@ public function setAmount($amount) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -313,12 +412,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -327,7 +429,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -337,12 +439,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -351,7 +456,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -361,12 +466,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -375,7 +483,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -385,12 +493,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -399,7 +510,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -409,12 +520,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -423,7 +537,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -433,12 +547,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -447,7 +564,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -457,12 +574,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -474,7 +594,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaygPaymentSummaryModel.php b/src/lib/Model/PaygPaymentSummaryModel.php index 9eb6ebd..1abef14 100644 --- a/src/lib/Model/PaygPaymentSummaryModel.php +++ b/src/lib/Model/PaygPaymentSummaryModel.php @@ -2,61 +2,61 @@ /** * PaygPaymentSummaryModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaygPaymentSummaryModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaygPaymentSummaryModel implements ModelInterface, ArrayAccess +class PaygPaymentSummaryModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaygPaymentSummaryModel'; + protected static $openAPIModelName = 'PaygPaymentSummaryModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'employing_entity_id' => 'int', 'date_generated' => '\DateTime', @@ -89,12 +89,12 @@ class PaygPaymentSummaryModel implements ModelInterface, ArrayAccess 'lump_sum_e' => 'int', 'lump_sum_a_type' => 'string', 'not_reported_amount' => 'int', - 'allowances' => 'map[string,int]', - 'union_fee_deductions' => 'map[string,int]', + 'allowances' => 'array', + 'union_fee_deductions' => 'array', 'workplace_giving' => 'int', 'exempt_foreign_employment_income' => 'int', 'deductible_amount_of_undeducted_annuity_price' => 'int', - 'other_amounts' => '\Swagger\Client\Model\OtherAmounts[]', + 'other_amounts' => '\OpenAPI\Client\Model\OtherAmounts[]', 'payer_abn' => 'string', 'payer_name' => 'string', 'payer_branch' => 'string', @@ -117,17 +117,19 @@ class PaygPaymentSummaryModel implements ModelInterface, ArrayAccess 'lump_sum_in_arrears_tax_free_component' => 'int', 'is_death_benefit' => 'bool', 'death_benefit_type' => 'string', - 'input_gross_earnings' => 'double', - 'input_pre_tax_deduction_amount' => 'double', - 'total_deductions' => 'double' + 'input_gross_earnings' => 'float', + 'input_pre_tax_deduction_amount' => 'float', + 'total_deductions' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'employing_entity_id' => 'int32', 'date_generated' => 'date-time', @@ -193,14 +195,92 @@ class PaygPaymentSummaryModel implements ModelInterface, ArrayAccess 'total_deductions' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'employing_entity_id' => false, + 'date_generated' => false, + 'payment_summary_type' => false, + 'status' => false, + 'etp_code' => false, + 'is_amended' => false, + 'payee_name' => false, + 'payee_address' => false, + 'payee_address_line2' => false, + 'payee_suburb' => false, + 'payee_post_code' => false, + 'payee_state' => false, + 'payee_country' => false, + 'payment_period_start' => false, + 'payment_period_end' => false, + 'financial_year_start' => false, + 'financial_year_end' => false, + 'payee_tax_file_number' => false, + 'total_tax_withheld' => false, + 'gross_payments' => false, + 'cdep_payments' => false, + 'fringe_benefits' => false, + 'is_exempt_from_fringe_benefits_tax' => false, + 'employer_super_contributions' => false, + 'total_allowances' => false, + 'lump_sum_a' => false, + 'lump_sum_b' => false, + 'lump_sum_d' => false, + 'lump_sum_e' => false, + 'lump_sum_a_type' => false, + 'not_reported_amount' => false, + 'allowances' => false, + 'union_fee_deductions' => false, + 'workplace_giving' => false, + 'exempt_foreign_employment_income' => false, + 'deductible_amount_of_undeducted_annuity_price' => false, + 'other_amounts' => false, + 'payer_abn' => false, + 'payer_name' => false, + 'payer_branch' => false, + 'payer_signatory' => false, + 'payment_date' => false, + 'is_transitional_termination_payment' => false, + 'is_part_of_earlier_payment' => false, + 'taxable_component' => false, + 'tax_free_component' => false, + 'payee_abn' => false, + 'payment_type' => false, + 'gross_payment_type' => false, + 'foreign_tax_paid' => false, + 'taxable_component_taxed_element' => false, + 'taxable_component_untaxed_element' => false, + 'taxable_component_tax_free_component' => false, + 'taxable_component_tax_offset_amount' => false, + 'lump_sum_in_arrears_taxed_element' => false, + 'lump_sum_in_arrears_untaxed_element' => false, + 'lump_sum_in_arrears_tax_free_component' => false, + 'is_death_benefit' => false, + 'death_benefit_type' => false, + 'input_gross_earnings' => false, + 'input_pre_tax_deduction_amount' => false, + 'total_deductions' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -208,9 +288,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -465,22 +597,20 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const PAYMENT_SUMMARY_TYPE_BUSINESS_AND_PERSONAL_SERVICES_INCOME = 'BusinessAndPersonalServicesIncome'; - const PAYMENT_SUMMARY_TYPE_EMPLOYEE_TERMINATION_PAYMENT = 'EmployeeTerminationPayment'; - const PAYMENT_SUMMARY_TYPE_FOREIGN_EMPLOYMENT = 'ForeignEmployment'; - const PAYMENT_SUMMARY_TYPE_INDIVIDUAL_NON_BUSINESS = 'IndividualNonBusiness'; - const PAYMENT_SUMMARY_TYPE_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; - const PAYMENT_SUMMARY_TYPE_SUPERANNUATION_LUMP_SUM = 'SuperannuationLumpSum'; - const PAYMENT_SUMMARY_TYPE_PAY_EVENT = 'PayEvent'; - const STATUS_GENERATED = 'Generated'; - const STATUS_PUBLISHED = 'Published'; - const STATUS_UNPUBLISHED = 'Unpublished'; - + public const PAYMENT_SUMMARY_TYPE_BUSINESS_AND_PERSONAL_SERVICES_INCOME = 'BusinessAndPersonalServicesIncome'; + public const PAYMENT_SUMMARY_TYPE_EMPLOYEE_TERMINATION_PAYMENT = 'EmployeeTerminationPayment'; + public const PAYMENT_SUMMARY_TYPE_FOREIGN_EMPLOYMENT = 'ForeignEmployment'; + public const PAYMENT_SUMMARY_TYPE_INDIVIDUAL_NON_BUSINESS = 'IndividualNonBusiness'; + public const PAYMENT_SUMMARY_TYPE_SUPERANNUATION_INCOME_STREAM = 'SuperannuationIncomeStream'; + public const PAYMENT_SUMMARY_TYPE_SUPERANNUATION_LUMP_SUM = 'SuperannuationLumpSum'; + public const PAYMENT_SUMMARY_TYPE_PAY_EVENT = 'PayEvent'; + public const STATUS_GENERATED = 'Generated'; + public const STATUS_PUBLISHED = 'Published'; + public const STATUS_UNPUBLISHED = 'Unpublished'; - /** * Gets allowable values of the enum * @@ -498,7 +628,7 @@ public function getPaymentSummaryTypeAllowableValues() self::PAYMENT_SUMMARY_TYPE_PAY_EVENT, ]; } - + /** * Gets allowable values of the enum * @@ -512,7 +642,6 @@ public function getStatusAllowableValues() self::STATUS_UNPUBLISHED, ]; } - /** * Associative array for storing property values @@ -529,69 +658,87 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; - $this->container['date_generated'] = isset($data['date_generated']) ? $data['date_generated'] : null; - $this->container['payment_summary_type'] = isset($data['payment_summary_type']) ? $data['payment_summary_type'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['etp_code'] = isset($data['etp_code']) ? $data['etp_code'] : null; - $this->container['is_amended'] = isset($data['is_amended']) ? $data['is_amended'] : null; - $this->container['payee_name'] = isset($data['payee_name']) ? $data['payee_name'] : null; - $this->container['payee_address'] = isset($data['payee_address']) ? $data['payee_address'] : null; - $this->container['payee_address_line2'] = isset($data['payee_address_line2']) ? $data['payee_address_line2'] : null; - $this->container['payee_suburb'] = isset($data['payee_suburb']) ? $data['payee_suburb'] : null; - $this->container['payee_post_code'] = isset($data['payee_post_code']) ? $data['payee_post_code'] : null; - $this->container['payee_state'] = isset($data['payee_state']) ? $data['payee_state'] : null; - $this->container['payee_country'] = isset($data['payee_country']) ? $data['payee_country'] : null; - $this->container['payment_period_start'] = isset($data['payment_period_start']) ? $data['payment_period_start'] : null; - $this->container['payment_period_end'] = isset($data['payment_period_end']) ? $data['payment_period_end'] : null; - $this->container['financial_year_start'] = isset($data['financial_year_start']) ? $data['financial_year_start'] : null; - $this->container['financial_year_end'] = isset($data['financial_year_end']) ? $data['financial_year_end'] : null; - $this->container['payee_tax_file_number'] = isset($data['payee_tax_file_number']) ? $data['payee_tax_file_number'] : null; - $this->container['total_tax_withheld'] = isset($data['total_tax_withheld']) ? $data['total_tax_withheld'] : null; - $this->container['gross_payments'] = isset($data['gross_payments']) ? $data['gross_payments'] : null; - $this->container['cdep_payments'] = isset($data['cdep_payments']) ? $data['cdep_payments'] : null; - $this->container['fringe_benefits'] = isset($data['fringe_benefits']) ? $data['fringe_benefits'] : null; - $this->container['is_exempt_from_fringe_benefits_tax'] = isset($data['is_exempt_from_fringe_benefits_tax']) ? $data['is_exempt_from_fringe_benefits_tax'] : null; - $this->container['employer_super_contributions'] = isset($data['employer_super_contributions']) ? $data['employer_super_contributions'] : null; - $this->container['total_allowances'] = isset($data['total_allowances']) ? $data['total_allowances'] : null; - $this->container['lump_sum_a'] = isset($data['lump_sum_a']) ? $data['lump_sum_a'] : null; - $this->container['lump_sum_b'] = isset($data['lump_sum_b']) ? $data['lump_sum_b'] : null; - $this->container['lump_sum_d'] = isset($data['lump_sum_d']) ? $data['lump_sum_d'] : null; - $this->container['lump_sum_e'] = isset($data['lump_sum_e']) ? $data['lump_sum_e'] : null; - $this->container['lump_sum_a_type'] = isset($data['lump_sum_a_type']) ? $data['lump_sum_a_type'] : null; - $this->container['not_reported_amount'] = isset($data['not_reported_amount']) ? $data['not_reported_amount'] : null; - $this->container['allowances'] = isset($data['allowances']) ? $data['allowances'] : null; - $this->container['union_fee_deductions'] = isset($data['union_fee_deductions']) ? $data['union_fee_deductions'] : null; - $this->container['workplace_giving'] = isset($data['workplace_giving']) ? $data['workplace_giving'] : null; - $this->container['exempt_foreign_employment_income'] = isset($data['exempt_foreign_employment_income']) ? $data['exempt_foreign_employment_income'] : null; - $this->container['deductible_amount_of_undeducted_annuity_price'] = isset($data['deductible_amount_of_undeducted_annuity_price']) ? $data['deductible_amount_of_undeducted_annuity_price'] : null; - $this->container['other_amounts'] = isset($data['other_amounts']) ? $data['other_amounts'] : null; - $this->container['payer_abn'] = isset($data['payer_abn']) ? $data['payer_abn'] : null; - $this->container['payer_name'] = isset($data['payer_name']) ? $data['payer_name'] : null; - $this->container['payer_branch'] = isset($data['payer_branch']) ? $data['payer_branch'] : null; - $this->container['payer_signatory'] = isset($data['payer_signatory']) ? $data['payer_signatory'] : null; - $this->container['payment_date'] = isset($data['payment_date']) ? $data['payment_date'] : null; - $this->container['is_transitional_termination_payment'] = isset($data['is_transitional_termination_payment']) ? $data['is_transitional_termination_payment'] : null; - $this->container['is_part_of_earlier_payment'] = isset($data['is_part_of_earlier_payment']) ? $data['is_part_of_earlier_payment'] : null; - $this->container['taxable_component'] = isset($data['taxable_component']) ? $data['taxable_component'] : null; - $this->container['tax_free_component'] = isset($data['tax_free_component']) ? $data['tax_free_component'] : null; - $this->container['payee_abn'] = isset($data['payee_abn']) ? $data['payee_abn'] : null; - $this->container['payment_type'] = isset($data['payment_type']) ? $data['payment_type'] : null; - $this->container['gross_payment_type'] = isset($data['gross_payment_type']) ? $data['gross_payment_type'] : null; - $this->container['foreign_tax_paid'] = isset($data['foreign_tax_paid']) ? $data['foreign_tax_paid'] : null; - $this->container['taxable_component_taxed_element'] = isset($data['taxable_component_taxed_element']) ? $data['taxable_component_taxed_element'] : null; - $this->container['taxable_component_untaxed_element'] = isset($data['taxable_component_untaxed_element']) ? $data['taxable_component_untaxed_element'] : null; - $this->container['taxable_component_tax_free_component'] = isset($data['taxable_component_tax_free_component']) ? $data['taxable_component_tax_free_component'] : null; - $this->container['taxable_component_tax_offset_amount'] = isset($data['taxable_component_tax_offset_amount']) ? $data['taxable_component_tax_offset_amount'] : null; - $this->container['lump_sum_in_arrears_taxed_element'] = isset($data['lump_sum_in_arrears_taxed_element']) ? $data['lump_sum_in_arrears_taxed_element'] : null; - $this->container['lump_sum_in_arrears_untaxed_element'] = isset($data['lump_sum_in_arrears_untaxed_element']) ? $data['lump_sum_in_arrears_untaxed_element'] : null; - $this->container['lump_sum_in_arrears_tax_free_component'] = isset($data['lump_sum_in_arrears_tax_free_component']) ? $data['lump_sum_in_arrears_tax_free_component'] : null; - $this->container['is_death_benefit'] = isset($data['is_death_benefit']) ? $data['is_death_benefit'] : null; - $this->container['death_benefit_type'] = isset($data['death_benefit_type']) ? $data['death_benefit_type'] : null; - $this->container['input_gross_earnings'] = isset($data['input_gross_earnings']) ? $data['input_gross_earnings'] : null; - $this->container['input_pre_tax_deduction_amount'] = isset($data['input_pre_tax_deduction_amount']) ? $data['input_pre_tax_deduction_amount'] : null; - $this->container['total_deductions'] = isset($data['total_deductions']) ? $data['total_deductions'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employing_entity_id', $data ?? [], null); + $this->setIfExists('date_generated', $data ?? [], null); + $this->setIfExists('payment_summary_type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('etp_code', $data ?? [], null); + $this->setIfExists('is_amended', $data ?? [], null); + $this->setIfExists('payee_name', $data ?? [], null); + $this->setIfExists('payee_address', $data ?? [], null); + $this->setIfExists('payee_address_line2', $data ?? [], null); + $this->setIfExists('payee_suburb', $data ?? [], null); + $this->setIfExists('payee_post_code', $data ?? [], null); + $this->setIfExists('payee_state', $data ?? [], null); + $this->setIfExists('payee_country', $data ?? [], null); + $this->setIfExists('payment_period_start', $data ?? [], null); + $this->setIfExists('payment_period_end', $data ?? [], null); + $this->setIfExists('financial_year_start', $data ?? [], null); + $this->setIfExists('financial_year_end', $data ?? [], null); + $this->setIfExists('payee_tax_file_number', $data ?? [], null); + $this->setIfExists('total_tax_withheld', $data ?? [], null); + $this->setIfExists('gross_payments', $data ?? [], null); + $this->setIfExists('cdep_payments', $data ?? [], null); + $this->setIfExists('fringe_benefits', $data ?? [], null); + $this->setIfExists('is_exempt_from_fringe_benefits_tax', $data ?? [], null); + $this->setIfExists('employer_super_contributions', $data ?? [], null); + $this->setIfExists('total_allowances', $data ?? [], null); + $this->setIfExists('lump_sum_a', $data ?? [], null); + $this->setIfExists('lump_sum_b', $data ?? [], null); + $this->setIfExists('lump_sum_d', $data ?? [], null); + $this->setIfExists('lump_sum_e', $data ?? [], null); + $this->setIfExists('lump_sum_a_type', $data ?? [], null); + $this->setIfExists('not_reported_amount', $data ?? [], null); + $this->setIfExists('allowances', $data ?? [], null); + $this->setIfExists('union_fee_deductions', $data ?? [], null); + $this->setIfExists('workplace_giving', $data ?? [], null); + $this->setIfExists('exempt_foreign_employment_income', $data ?? [], null); + $this->setIfExists('deductible_amount_of_undeducted_annuity_price', $data ?? [], null); + $this->setIfExists('other_amounts', $data ?? [], null); + $this->setIfExists('payer_abn', $data ?? [], null); + $this->setIfExists('payer_name', $data ?? [], null); + $this->setIfExists('payer_branch', $data ?? [], null); + $this->setIfExists('payer_signatory', $data ?? [], null); + $this->setIfExists('payment_date', $data ?? [], null); + $this->setIfExists('is_transitional_termination_payment', $data ?? [], null); + $this->setIfExists('is_part_of_earlier_payment', $data ?? [], null); + $this->setIfExists('taxable_component', $data ?? [], null); + $this->setIfExists('tax_free_component', $data ?? [], null); + $this->setIfExists('payee_abn', $data ?? [], null); + $this->setIfExists('payment_type', $data ?? [], null); + $this->setIfExists('gross_payment_type', $data ?? [], null); + $this->setIfExists('foreign_tax_paid', $data ?? [], null); + $this->setIfExists('taxable_component_taxed_element', $data ?? [], null); + $this->setIfExists('taxable_component_untaxed_element', $data ?? [], null); + $this->setIfExists('taxable_component_tax_free_component', $data ?? [], null); + $this->setIfExists('taxable_component_tax_offset_amount', $data ?? [], null); + $this->setIfExists('lump_sum_in_arrears_taxed_element', $data ?? [], null); + $this->setIfExists('lump_sum_in_arrears_untaxed_element', $data ?? [], null); + $this->setIfExists('lump_sum_in_arrears_tax_free_component', $data ?? [], null); + $this->setIfExists('is_death_benefit', $data ?? [], null); + $this->setIfExists('death_benefit_type', $data ?? [], null); + $this->setIfExists('input_gross_earnings', $data ?? [], null); + $this->setIfExists('input_pre_tax_deduction_amount', $data ?? [], null); + $this->setIfExists('total_deductions', $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; } /** @@ -606,7 +753,8 @@ public function listInvalidProperties() $allowedValues = $this->getPaymentSummaryTypeAllowableValues(); if (!is_null($this->container['payment_summary_type']) && !in_array($this->container['payment_summary_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'payment_summary_type', must be one of '%s'", + "invalid value '%s' for 'payment_summary_type', must be one of '%s'", + $this->container['payment_summary_type'], implode("', '", $allowedValues) ); } @@ -614,7 +762,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -637,7 +786,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -647,12 +796,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -661,7 +813,7 @@ public function setEmployeeId($employee_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -671,12 +823,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -685,7 +840,7 @@ public function setEmployingEntityId($employing_entity_id) /** * Gets date_generated * - * @return \DateTime + * @return \DateTime|null */ public function getDateGenerated() { @@ -695,12 +850,15 @@ public function getDateGenerated() /** * Sets date_generated * - * @param \DateTime $date_generated + * @param \DateTime|null $date_generated * - * @return $this + * @return self */ public function setDateGenerated($date_generated) { + if (is_null($date_generated)) { + throw new \InvalidArgumentException('non-nullable date_generated cannot be null'); + } $this->container['date_generated'] = $date_generated; return $this; @@ -709,7 +867,7 @@ public function setDateGenerated($date_generated) /** * Gets payment_summary_type * - * @return string + * @return string|null */ public function getPaymentSummaryType() { @@ -719,17 +877,21 @@ public function getPaymentSummaryType() /** * Sets payment_summary_type * - * @param string $payment_summary_type + * @param string|null $payment_summary_type * - * @return $this + * @return self */ public function setPaymentSummaryType($payment_summary_type) { + if (is_null($payment_summary_type)) { + throw new \InvalidArgumentException('non-nullable payment_summary_type cannot be null'); + } $allowedValues = $this->getPaymentSummaryTypeAllowableValues(); - if (!is_null($payment_summary_type) && !in_array($payment_summary_type, $allowedValues, true)) { + if (!in_array($payment_summary_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'payment_summary_type', must be one of '%s'", + "Invalid value '%s' for 'payment_summary_type', must be one of '%s'", + $payment_summary_type, implode("', '", $allowedValues) ) ); @@ -742,7 +904,7 @@ public function setPaymentSummaryType($payment_summary_type) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -752,17 +914,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -775,7 +941,7 @@ public function setStatus($status) /** * Gets etp_code * - * @return string + * @return string|null */ public function getEtpCode() { @@ -785,12 +951,15 @@ public function getEtpCode() /** * Sets etp_code * - * @param string $etp_code + * @param string|null $etp_code * - * @return $this + * @return self */ public function setEtpCode($etp_code) { + if (is_null($etp_code)) { + throw new \InvalidArgumentException('non-nullable etp_code cannot be null'); + } $this->container['etp_code'] = $etp_code; return $this; @@ -799,7 +968,7 @@ public function setEtpCode($etp_code) /** * Gets is_amended * - * @return bool + * @return bool|null */ public function getIsAmended() { @@ -809,12 +978,15 @@ public function getIsAmended() /** * Sets is_amended * - * @param bool $is_amended + * @param bool|null $is_amended * - * @return $this + * @return self */ public function setIsAmended($is_amended) { + if (is_null($is_amended)) { + throw new \InvalidArgumentException('non-nullable is_amended cannot be null'); + } $this->container['is_amended'] = $is_amended; return $this; @@ -823,7 +995,7 @@ public function setIsAmended($is_amended) /** * Gets payee_name * - * @return string + * @return string|null */ public function getPayeeName() { @@ -833,12 +1005,15 @@ public function getPayeeName() /** * Sets payee_name * - * @param string $payee_name + * @param string|null $payee_name * - * @return $this + * @return self */ public function setPayeeName($payee_name) { + if (is_null($payee_name)) { + throw new \InvalidArgumentException('non-nullable payee_name cannot be null'); + } $this->container['payee_name'] = $payee_name; return $this; @@ -847,7 +1022,7 @@ public function setPayeeName($payee_name) /** * Gets payee_address * - * @return string + * @return string|null */ public function getPayeeAddress() { @@ -857,12 +1032,15 @@ public function getPayeeAddress() /** * Sets payee_address * - * @param string $payee_address + * @param string|null $payee_address * - * @return $this + * @return self */ public function setPayeeAddress($payee_address) { + if (is_null($payee_address)) { + throw new \InvalidArgumentException('non-nullable payee_address cannot be null'); + } $this->container['payee_address'] = $payee_address; return $this; @@ -871,7 +1049,7 @@ public function setPayeeAddress($payee_address) /** * Gets payee_address_line2 * - * @return string + * @return string|null */ public function getPayeeAddressLine2() { @@ -881,12 +1059,15 @@ public function getPayeeAddressLine2() /** * Sets payee_address_line2 * - * @param string $payee_address_line2 + * @param string|null $payee_address_line2 * - * @return $this + * @return self */ public function setPayeeAddressLine2($payee_address_line2) { + if (is_null($payee_address_line2)) { + throw new \InvalidArgumentException('non-nullable payee_address_line2 cannot be null'); + } $this->container['payee_address_line2'] = $payee_address_line2; return $this; @@ -895,7 +1076,7 @@ public function setPayeeAddressLine2($payee_address_line2) /** * Gets payee_suburb * - * @return string + * @return string|null */ public function getPayeeSuburb() { @@ -905,12 +1086,15 @@ public function getPayeeSuburb() /** * Sets payee_suburb * - * @param string $payee_suburb + * @param string|null $payee_suburb * - * @return $this + * @return self */ public function setPayeeSuburb($payee_suburb) { + if (is_null($payee_suburb)) { + throw new \InvalidArgumentException('non-nullable payee_suburb cannot be null'); + } $this->container['payee_suburb'] = $payee_suburb; return $this; @@ -919,7 +1103,7 @@ public function setPayeeSuburb($payee_suburb) /** * Gets payee_post_code * - * @return string + * @return string|null */ public function getPayeePostCode() { @@ -929,12 +1113,15 @@ public function getPayeePostCode() /** * Sets payee_post_code * - * @param string $payee_post_code + * @param string|null $payee_post_code * - * @return $this + * @return self */ public function setPayeePostCode($payee_post_code) { + if (is_null($payee_post_code)) { + throw new \InvalidArgumentException('non-nullable payee_post_code cannot be null'); + } $this->container['payee_post_code'] = $payee_post_code; return $this; @@ -943,7 +1130,7 @@ public function setPayeePostCode($payee_post_code) /** * Gets payee_state * - * @return string + * @return string|null */ public function getPayeeState() { @@ -953,12 +1140,15 @@ public function getPayeeState() /** * Sets payee_state * - * @param string $payee_state + * @param string|null $payee_state * - * @return $this + * @return self */ public function setPayeeState($payee_state) { + if (is_null($payee_state)) { + throw new \InvalidArgumentException('non-nullable payee_state cannot be null'); + } $this->container['payee_state'] = $payee_state; return $this; @@ -967,7 +1157,7 @@ public function setPayeeState($payee_state) /** * Gets payee_country * - * @return string + * @return string|null */ public function getPayeeCountry() { @@ -977,12 +1167,15 @@ public function getPayeeCountry() /** * Sets payee_country * - * @param string $payee_country + * @param string|null $payee_country * - * @return $this + * @return self */ public function setPayeeCountry($payee_country) { + if (is_null($payee_country)) { + throw new \InvalidArgumentException('non-nullable payee_country cannot be null'); + } $this->container['payee_country'] = $payee_country; return $this; @@ -991,7 +1184,7 @@ public function setPayeeCountry($payee_country) /** * Gets payment_period_start * - * @return \DateTime + * @return \DateTime|null */ public function getPaymentPeriodStart() { @@ -1001,12 +1194,15 @@ public function getPaymentPeriodStart() /** * Sets payment_period_start * - * @param \DateTime $payment_period_start + * @param \DateTime|null $payment_period_start * - * @return $this + * @return self */ public function setPaymentPeriodStart($payment_period_start) { + if (is_null($payment_period_start)) { + throw new \InvalidArgumentException('non-nullable payment_period_start cannot be null'); + } $this->container['payment_period_start'] = $payment_period_start; return $this; @@ -1015,7 +1211,7 @@ public function setPaymentPeriodStart($payment_period_start) /** * Gets payment_period_end * - * @return \DateTime + * @return \DateTime|null */ public function getPaymentPeriodEnd() { @@ -1025,12 +1221,15 @@ public function getPaymentPeriodEnd() /** * Sets payment_period_end * - * @param \DateTime $payment_period_end + * @param \DateTime|null $payment_period_end * - * @return $this + * @return self */ public function setPaymentPeriodEnd($payment_period_end) { + if (is_null($payment_period_end)) { + throw new \InvalidArgumentException('non-nullable payment_period_end cannot be null'); + } $this->container['payment_period_end'] = $payment_period_end; return $this; @@ -1039,7 +1238,7 @@ public function setPaymentPeriodEnd($payment_period_end) /** * Gets financial_year_start * - * @return \DateTime + * @return \DateTime|null */ public function getFinancialYearStart() { @@ -1049,12 +1248,15 @@ public function getFinancialYearStart() /** * Sets financial_year_start * - * @param \DateTime $financial_year_start + * @param \DateTime|null $financial_year_start * - * @return $this + * @return self */ public function setFinancialYearStart($financial_year_start) { + if (is_null($financial_year_start)) { + throw new \InvalidArgumentException('non-nullable financial_year_start cannot be null'); + } $this->container['financial_year_start'] = $financial_year_start; return $this; @@ -1063,7 +1265,7 @@ public function setFinancialYearStart($financial_year_start) /** * Gets financial_year_end * - * @return \DateTime + * @return \DateTime|null */ public function getFinancialYearEnd() { @@ -1073,12 +1275,15 @@ public function getFinancialYearEnd() /** * Sets financial_year_end * - * @param \DateTime $financial_year_end + * @param \DateTime|null $financial_year_end * - * @return $this + * @return self */ public function setFinancialYearEnd($financial_year_end) { + if (is_null($financial_year_end)) { + throw new \InvalidArgumentException('non-nullable financial_year_end cannot be null'); + } $this->container['financial_year_end'] = $financial_year_end; return $this; @@ -1087,7 +1292,7 @@ public function setFinancialYearEnd($financial_year_end) /** * Gets payee_tax_file_number * - * @return string + * @return string|null */ public function getPayeeTaxFileNumber() { @@ -1097,12 +1302,15 @@ public function getPayeeTaxFileNumber() /** * Sets payee_tax_file_number * - * @param string $payee_tax_file_number + * @param string|null $payee_tax_file_number * - * @return $this + * @return self */ public function setPayeeTaxFileNumber($payee_tax_file_number) { + if (is_null($payee_tax_file_number)) { + throw new \InvalidArgumentException('non-nullable payee_tax_file_number cannot be null'); + } $this->container['payee_tax_file_number'] = $payee_tax_file_number; return $this; @@ -1111,7 +1319,7 @@ public function setPayeeTaxFileNumber($payee_tax_file_number) /** * Gets total_tax_withheld * - * @return int + * @return int|null */ public function getTotalTaxWithheld() { @@ -1121,12 +1329,15 @@ public function getTotalTaxWithheld() /** * Sets total_tax_withheld * - * @param int $total_tax_withheld + * @param int|null $total_tax_withheld * - * @return $this + * @return self */ public function setTotalTaxWithheld($total_tax_withheld) { + if (is_null($total_tax_withheld)) { + throw new \InvalidArgumentException('non-nullable total_tax_withheld cannot be null'); + } $this->container['total_tax_withheld'] = $total_tax_withheld; return $this; @@ -1135,7 +1346,7 @@ public function setTotalTaxWithheld($total_tax_withheld) /** * Gets gross_payments * - * @return int + * @return int|null */ public function getGrossPayments() { @@ -1145,12 +1356,15 @@ public function getGrossPayments() /** * Sets gross_payments * - * @param int $gross_payments + * @param int|null $gross_payments * - * @return $this + * @return self */ public function setGrossPayments($gross_payments) { + if (is_null($gross_payments)) { + throw new \InvalidArgumentException('non-nullable gross_payments cannot be null'); + } $this->container['gross_payments'] = $gross_payments; return $this; @@ -1159,7 +1373,7 @@ public function setGrossPayments($gross_payments) /** * Gets cdep_payments * - * @return int + * @return int|null */ public function getCdepPayments() { @@ -1169,12 +1383,15 @@ public function getCdepPayments() /** * Sets cdep_payments * - * @param int $cdep_payments + * @param int|null $cdep_payments * - * @return $this + * @return self */ public function setCdepPayments($cdep_payments) { + if (is_null($cdep_payments)) { + throw new \InvalidArgumentException('non-nullable cdep_payments cannot be null'); + } $this->container['cdep_payments'] = $cdep_payments; return $this; @@ -1183,7 +1400,7 @@ public function setCdepPayments($cdep_payments) /** * Gets fringe_benefits * - * @return int + * @return int|null */ public function getFringeBenefits() { @@ -1193,12 +1410,15 @@ public function getFringeBenefits() /** * Sets fringe_benefits * - * @param int $fringe_benefits + * @param int|null $fringe_benefits * - * @return $this + * @return self */ public function setFringeBenefits($fringe_benefits) { + if (is_null($fringe_benefits)) { + throw new \InvalidArgumentException('non-nullable fringe_benefits cannot be null'); + } $this->container['fringe_benefits'] = $fringe_benefits; return $this; @@ -1207,7 +1427,7 @@ public function setFringeBenefits($fringe_benefits) /** * Gets is_exempt_from_fringe_benefits_tax * - * @return bool + * @return bool|null */ public function getIsExemptFromFringeBenefitsTax() { @@ -1217,12 +1437,15 @@ public function getIsExemptFromFringeBenefitsTax() /** * Sets is_exempt_from_fringe_benefits_tax * - * @param bool $is_exempt_from_fringe_benefits_tax + * @param bool|null $is_exempt_from_fringe_benefits_tax * - * @return $this + * @return self */ public function setIsExemptFromFringeBenefitsTax($is_exempt_from_fringe_benefits_tax) { + if (is_null($is_exempt_from_fringe_benefits_tax)) { + throw new \InvalidArgumentException('non-nullable is_exempt_from_fringe_benefits_tax cannot be null'); + } $this->container['is_exempt_from_fringe_benefits_tax'] = $is_exempt_from_fringe_benefits_tax; return $this; @@ -1231,7 +1454,7 @@ public function setIsExemptFromFringeBenefitsTax($is_exempt_from_fringe_benefits /** * Gets employer_super_contributions * - * @return int + * @return int|null */ public function getEmployerSuperContributions() { @@ -1241,12 +1464,15 @@ public function getEmployerSuperContributions() /** * Sets employer_super_contributions * - * @param int $employer_super_contributions + * @param int|null $employer_super_contributions * - * @return $this + * @return self */ public function setEmployerSuperContributions($employer_super_contributions) { + if (is_null($employer_super_contributions)) { + throw new \InvalidArgumentException('non-nullable employer_super_contributions cannot be null'); + } $this->container['employer_super_contributions'] = $employer_super_contributions; return $this; @@ -1255,7 +1481,7 @@ public function setEmployerSuperContributions($employer_super_contributions) /** * Gets total_allowances * - * @return int + * @return int|null */ public function getTotalAllowances() { @@ -1265,12 +1491,15 @@ public function getTotalAllowances() /** * Sets total_allowances * - * @param int $total_allowances + * @param int|null $total_allowances * - * @return $this + * @return self */ public function setTotalAllowances($total_allowances) { + if (is_null($total_allowances)) { + throw new \InvalidArgumentException('non-nullable total_allowances cannot be null'); + } $this->container['total_allowances'] = $total_allowances; return $this; @@ -1279,7 +1508,7 @@ public function setTotalAllowances($total_allowances) /** * Gets lump_sum_a * - * @return int + * @return int|null */ public function getLumpSumA() { @@ -1289,12 +1518,15 @@ public function getLumpSumA() /** * Sets lump_sum_a * - * @param int $lump_sum_a + * @param int|null $lump_sum_a * - * @return $this + * @return self */ public function setLumpSumA($lump_sum_a) { + if (is_null($lump_sum_a)) { + throw new \InvalidArgumentException('non-nullable lump_sum_a cannot be null'); + } $this->container['lump_sum_a'] = $lump_sum_a; return $this; @@ -1303,7 +1535,7 @@ public function setLumpSumA($lump_sum_a) /** * Gets lump_sum_b * - * @return int + * @return int|null */ public function getLumpSumB() { @@ -1313,12 +1545,15 @@ public function getLumpSumB() /** * Sets lump_sum_b * - * @param int $lump_sum_b + * @param int|null $lump_sum_b * - * @return $this + * @return self */ public function setLumpSumB($lump_sum_b) { + if (is_null($lump_sum_b)) { + throw new \InvalidArgumentException('non-nullable lump_sum_b cannot be null'); + } $this->container['lump_sum_b'] = $lump_sum_b; return $this; @@ -1327,7 +1562,7 @@ public function setLumpSumB($lump_sum_b) /** * Gets lump_sum_d * - * @return int + * @return int|null */ public function getLumpSumD() { @@ -1337,12 +1572,15 @@ public function getLumpSumD() /** * Sets lump_sum_d * - * @param int $lump_sum_d + * @param int|null $lump_sum_d * - * @return $this + * @return self */ public function setLumpSumD($lump_sum_d) { + if (is_null($lump_sum_d)) { + throw new \InvalidArgumentException('non-nullable lump_sum_d cannot be null'); + } $this->container['lump_sum_d'] = $lump_sum_d; return $this; @@ -1351,7 +1589,7 @@ public function setLumpSumD($lump_sum_d) /** * Gets lump_sum_e * - * @return int + * @return int|null */ public function getLumpSumE() { @@ -1361,12 +1599,15 @@ public function getLumpSumE() /** * Sets lump_sum_e * - * @param int $lump_sum_e + * @param int|null $lump_sum_e * - * @return $this + * @return self */ public function setLumpSumE($lump_sum_e) { + if (is_null($lump_sum_e)) { + throw new \InvalidArgumentException('non-nullable lump_sum_e cannot be null'); + } $this->container['lump_sum_e'] = $lump_sum_e; return $this; @@ -1375,7 +1616,7 @@ public function setLumpSumE($lump_sum_e) /** * Gets lump_sum_a_type * - * @return string + * @return string|null */ public function getLumpSumAType() { @@ -1385,12 +1626,15 @@ public function getLumpSumAType() /** * Sets lump_sum_a_type * - * @param string $lump_sum_a_type + * @param string|null $lump_sum_a_type * - * @return $this + * @return self */ public function setLumpSumAType($lump_sum_a_type) { + if (is_null($lump_sum_a_type)) { + throw new \InvalidArgumentException('non-nullable lump_sum_a_type cannot be null'); + } $this->container['lump_sum_a_type'] = $lump_sum_a_type; return $this; @@ -1399,7 +1643,7 @@ public function setLumpSumAType($lump_sum_a_type) /** * Gets not_reported_amount * - * @return int + * @return int|null */ public function getNotReportedAmount() { @@ -1409,12 +1653,15 @@ public function getNotReportedAmount() /** * Sets not_reported_amount * - * @param int $not_reported_amount + * @param int|null $not_reported_amount * - * @return $this + * @return self */ public function setNotReportedAmount($not_reported_amount) { + if (is_null($not_reported_amount)) { + throw new \InvalidArgumentException('non-nullable not_reported_amount cannot be null'); + } $this->container['not_reported_amount'] = $not_reported_amount; return $this; @@ -1423,7 +1670,7 @@ public function setNotReportedAmount($not_reported_amount) /** * Gets allowances * - * @return map[string,int] + * @return array|null */ public function getAllowances() { @@ -1433,12 +1680,15 @@ public function getAllowances() /** * Sets allowances * - * @param map[string,int] $allowances + * @param array|null $allowances * - * @return $this + * @return self */ public function setAllowances($allowances) { + if (is_null($allowances)) { + throw new \InvalidArgumentException('non-nullable allowances cannot be null'); + } $this->container['allowances'] = $allowances; return $this; @@ -1447,7 +1697,7 @@ public function setAllowances($allowances) /** * Gets union_fee_deductions * - * @return map[string,int] + * @return array|null */ public function getUnionFeeDeductions() { @@ -1457,12 +1707,15 @@ public function getUnionFeeDeductions() /** * Sets union_fee_deductions * - * @param map[string,int] $union_fee_deductions + * @param array|null $union_fee_deductions * - * @return $this + * @return self */ public function setUnionFeeDeductions($union_fee_deductions) { + if (is_null($union_fee_deductions)) { + throw new \InvalidArgumentException('non-nullable union_fee_deductions cannot be null'); + } $this->container['union_fee_deductions'] = $union_fee_deductions; return $this; @@ -1471,7 +1724,7 @@ public function setUnionFeeDeductions($union_fee_deductions) /** * Gets workplace_giving * - * @return int + * @return int|null */ public function getWorkplaceGiving() { @@ -1481,12 +1734,15 @@ public function getWorkplaceGiving() /** * Sets workplace_giving * - * @param int $workplace_giving + * @param int|null $workplace_giving * - * @return $this + * @return self */ public function setWorkplaceGiving($workplace_giving) { + if (is_null($workplace_giving)) { + throw new \InvalidArgumentException('non-nullable workplace_giving cannot be null'); + } $this->container['workplace_giving'] = $workplace_giving; return $this; @@ -1495,7 +1751,7 @@ public function setWorkplaceGiving($workplace_giving) /** * Gets exempt_foreign_employment_income * - * @return int + * @return int|null */ public function getExemptForeignEmploymentIncome() { @@ -1505,12 +1761,15 @@ public function getExemptForeignEmploymentIncome() /** * Sets exempt_foreign_employment_income * - * @param int $exempt_foreign_employment_income + * @param int|null $exempt_foreign_employment_income * - * @return $this + * @return self */ public function setExemptForeignEmploymentIncome($exempt_foreign_employment_income) { + if (is_null($exempt_foreign_employment_income)) { + throw new \InvalidArgumentException('non-nullable exempt_foreign_employment_income cannot be null'); + } $this->container['exempt_foreign_employment_income'] = $exempt_foreign_employment_income; return $this; @@ -1519,7 +1778,7 @@ public function setExemptForeignEmploymentIncome($exempt_foreign_employment_inco /** * Gets deductible_amount_of_undeducted_annuity_price * - * @return int + * @return int|null */ public function getDeductibleAmountOfUndeductedAnnuityPrice() { @@ -1529,12 +1788,15 @@ public function getDeductibleAmountOfUndeductedAnnuityPrice() /** * Sets deductible_amount_of_undeducted_annuity_price * - * @param int $deductible_amount_of_undeducted_annuity_price + * @param int|null $deductible_amount_of_undeducted_annuity_price * - * @return $this + * @return self */ public function setDeductibleAmountOfUndeductedAnnuityPrice($deductible_amount_of_undeducted_annuity_price) { + if (is_null($deductible_amount_of_undeducted_annuity_price)) { + throw new \InvalidArgumentException('non-nullable deductible_amount_of_undeducted_annuity_price cannot be null'); + } $this->container['deductible_amount_of_undeducted_annuity_price'] = $deductible_amount_of_undeducted_annuity_price; return $this; @@ -1543,7 +1805,7 @@ public function setDeductibleAmountOfUndeductedAnnuityPrice($deductible_amount_o /** * Gets other_amounts * - * @return \Swagger\Client\Model\OtherAmounts[] + * @return \OpenAPI\Client\Model\OtherAmounts[]|null */ public function getOtherAmounts() { @@ -1553,12 +1815,15 @@ public function getOtherAmounts() /** * Sets other_amounts * - * @param \Swagger\Client\Model\OtherAmounts[] $other_amounts + * @param \OpenAPI\Client\Model\OtherAmounts[]|null $other_amounts * - * @return $this + * @return self */ public function setOtherAmounts($other_amounts) { + if (is_null($other_amounts)) { + throw new \InvalidArgumentException('non-nullable other_amounts cannot be null'); + } $this->container['other_amounts'] = $other_amounts; return $this; @@ -1567,7 +1832,7 @@ public function setOtherAmounts($other_amounts) /** * Gets payer_abn * - * @return string + * @return string|null */ public function getPayerAbn() { @@ -1577,12 +1842,15 @@ public function getPayerAbn() /** * Sets payer_abn * - * @param string $payer_abn + * @param string|null $payer_abn * - * @return $this + * @return self */ public function setPayerAbn($payer_abn) { + if (is_null($payer_abn)) { + throw new \InvalidArgumentException('non-nullable payer_abn cannot be null'); + } $this->container['payer_abn'] = $payer_abn; return $this; @@ -1591,7 +1859,7 @@ public function setPayerAbn($payer_abn) /** * Gets payer_name * - * @return string + * @return string|null */ public function getPayerName() { @@ -1601,12 +1869,15 @@ public function getPayerName() /** * Sets payer_name * - * @param string $payer_name + * @param string|null $payer_name * - * @return $this + * @return self */ public function setPayerName($payer_name) { + if (is_null($payer_name)) { + throw new \InvalidArgumentException('non-nullable payer_name cannot be null'); + } $this->container['payer_name'] = $payer_name; return $this; @@ -1615,7 +1886,7 @@ public function setPayerName($payer_name) /** * Gets payer_branch * - * @return string + * @return string|null */ public function getPayerBranch() { @@ -1625,12 +1896,15 @@ public function getPayerBranch() /** * Sets payer_branch * - * @param string $payer_branch + * @param string|null $payer_branch * - * @return $this + * @return self */ public function setPayerBranch($payer_branch) { + if (is_null($payer_branch)) { + throw new \InvalidArgumentException('non-nullable payer_branch cannot be null'); + } $this->container['payer_branch'] = $payer_branch; return $this; @@ -1639,7 +1913,7 @@ public function setPayerBranch($payer_branch) /** * Gets payer_signatory * - * @return string + * @return string|null */ public function getPayerSignatory() { @@ -1649,12 +1923,15 @@ public function getPayerSignatory() /** * Sets payer_signatory * - * @param string $payer_signatory + * @param string|null $payer_signatory * - * @return $this + * @return self */ public function setPayerSignatory($payer_signatory) { + if (is_null($payer_signatory)) { + throw new \InvalidArgumentException('non-nullable payer_signatory cannot be null'); + } $this->container['payer_signatory'] = $payer_signatory; return $this; @@ -1663,7 +1940,7 @@ public function setPayerSignatory($payer_signatory) /** * Gets payment_date * - * @return \DateTime + * @return \DateTime|null */ public function getPaymentDate() { @@ -1673,12 +1950,15 @@ public function getPaymentDate() /** * Sets payment_date * - * @param \DateTime $payment_date + * @param \DateTime|null $payment_date * - * @return $this + * @return self */ public function setPaymentDate($payment_date) { + if (is_null($payment_date)) { + throw new \InvalidArgumentException('non-nullable payment_date cannot be null'); + } $this->container['payment_date'] = $payment_date; return $this; @@ -1687,7 +1967,7 @@ public function setPaymentDate($payment_date) /** * Gets is_transitional_termination_payment * - * @return bool + * @return bool|null */ public function getIsTransitionalTerminationPayment() { @@ -1697,12 +1977,15 @@ public function getIsTransitionalTerminationPayment() /** * Sets is_transitional_termination_payment * - * @param bool $is_transitional_termination_payment + * @param bool|null $is_transitional_termination_payment * - * @return $this + * @return self */ public function setIsTransitionalTerminationPayment($is_transitional_termination_payment) { + if (is_null($is_transitional_termination_payment)) { + throw new \InvalidArgumentException('non-nullable is_transitional_termination_payment cannot be null'); + } $this->container['is_transitional_termination_payment'] = $is_transitional_termination_payment; return $this; @@ -1711,7 +1994,7 @@ public function setIsTransitionalTerminationPayment($is_transitional_termination /** * Gets is_part_of_earlier_payment * - * @return bool + * @return bool|null */ public function getIsPartOfEarlierPayment() { @@ -1721,12 +2004,15 @@ public function getIsPartOfEarlierPayment() /** * Sets is_part_of_earlier_payment * - * @param bool $is_part_of_earlier_payment + * @param bool|null $is_part_of_earlier_payment * - * @return $this + * @return self */ public function setIsPartOfEarlierPayment($is_part_of_earlier_payment) { + if (is_null($is_part_of_earlier_payment)) { + throw new \InvalidArgumentException('non-nullable is_part_of_earlier_payment cannot be null'); + } $this->container['is_part_of_earlier_payment'] = $is_part_of_earlier_payment; return $this; @@ -1735,7 +2021,7 @@ public function setIsPartOfEarlierPayment($is_part_of_earlier_payment) /** * Gets taxable_component * - * @return int + * @return int|null */ public function getTaxableComponent() { @@ -1745,12 +2031,15 @@ public function getTaxableComponent() /** * Sets taxable_component * - * @param int $taxable_component + * @param int|null $taxable_component * - * @return $this + * @return self */ public function setTaxableComponent($taxable_component) { + if (is_null($taxable_component)) { + throw new \InvalidArgumentException('non-nullable taxable_component cannot be null'); + } $this->container['taxable_component'] = $taxable_component; return $this; @@ -1759,7 +2048,7 @@ public function setTaxableComponent($taxable_component) /** * Gets tax_free_component * - * @return int + * @return int|null */ public function getTaxFreeComponent() { @@ -1769,12 +2058,15 @@ public function getTaxFreeComponent() /** * Sets tax_free_component * - * @param int $tax_free_component + * @param int|null $tax_free_component * - * @return $this + * @return self */ public function setTaxFreeComponent($tax_free_component) { + if (is_null($tax_free_component)) { + throw new \InvalidArgumentException('non-nullable tax_free_component cannot be null'); + } $this->container['tax_free_component'] = $tax_free_component; return $this; @@ -1783,7 +2075,7 @@ public function setTaxFreeComponent($tax_free_component) /** * Gets payee_abn * - * @return string + * @return string|null */ public function getPayeeAbn() { @@ -1793,12 +2085,15 @@ public function getPayeeAbn() /** * Sets payee_abn * - * @param string $payee_abn + * @param string|null $payee_abn * - * @return $this + * @return self */ public function setPayeeAbn($payee_abn) { + if (is_null($payee_abn)) { + throw new \InvalidArgumentException('non-nullable payee_abn cannot be null'); + } $this->container['payee_abn'] = $payee_abn; return $this; @@ -1807,7 +2102,7 @@ public function setPayeeAbn($payee_abn) /** * Gets payment_type * - * @return string + * @return string|null */ public function getPaymentType() { @@ -1817,12 +2112,15 @@ public function getPaymentType() /** * Sets payment_type * - * @param string $payment_type + * @param string|null $payment_type * - * @return $this + * @return self */ public function setPaymentType($payment_type) { + if (is_null($payment_type)) { + throw new \InvalidArgumentException('non-nullable payment_type cannot be null'); + } $this->container['payment_type'] = $payment_type; return $this; @@ -1831,7 +2129,7 @@ public function setPaymentType($payment_type) /** * Gets gross_payment_type * - * @return string + * @return string|null */ public function getGrossPaymentType() { @@ -1841,12 +2139,15 @@ public function getGrossPaymentType() /** * Sets gross_payment_type * - * @param string $gross_payment_type + * @param string|null $gross_payment_type * - * @return $this + * @return self */ public function setGrossPaymentType($gross_payment_type) { + if (is_null($gross_payment_type)) { + throw new \InvalidArgumentException('non-nullable gross_payment_type cannot be null'); + } $this->container['gross_payment_type'] = $gross_payment_type; return $this; @@ -1855,7 +2156,7 @@ public function setGrossPaymentType($gross_payment_type) /** * Gets foreign_tax_paid * - * @return int + * @return int|null */ public function getForeignTaxPaid() { @@ -1865,12 +2166,15 @@ public function getForeignTaxPaid() /** * Sets foreign_tax_paid * - * @param int $foreign_tax_paid + * @param int|null $foreign_tax_paid * - * @return $this + * @return self */ public function setForeignTaxPaid($foreign_tax_paid) { + if (is_null($foreign_tax_paid)) { + throw new \InvalidArgumentException('non-nullable foreign_tax_paid cannot be null'); + } $this->container['foreign_tax_paid'] = $foreign_tax_paid; return $this; @@ -1879,7 +2183,7 @@ public function setForeignTaxPaid($foreign_tax_paid) /** * Gets taxable_component_taxed_element * - * @return int + * @return int|null */ public function getTaxableComponentTaxedElement() { @@ -1889,12 +2193,15 @@ public function getTaxableComponentTaxedElement() /** * Sets taxable_component_taxed_element * - * @param int $taxable_component_taxed_element + * @param int|null $taxable_component_taxed_element * - * @return $this + * @return self */ public function setTaxableComponentTaxedElement($taxable_component_taxed_element) { + if (is_null($taxable_component_taxed_element)) { + throw new \InvalidArgumentException('non-nullable taxable_component_taxed_element cannot be null'); + } $this->container['taxable_component_taxed_element'] = $taxable_component_taxed_element; return $this; @@ -1903,7 +2210,7 @@ public function setTaxableComponentTaxedElement($taxable_component_taxed_element /** * Gets taxable_component_untaxed_element * - * @return int + * @return int|null */ public function getTaxableComponentUntaxedElement() { @@ -1913,12 +2220,15 @@ public function getTaxableComponentUntaxedElement() /** * Sets taxable_component_untaxed_element * - * @param int $taxable_component_untaxed_element + * @param int|null $taxable_component_untaxed_element * - * @return $this + * @return self */ public function setTaxableComponentUntaxedElement($taxable_component_untaxed_element) { + if (is_null($taxable_component_untaxed_element)) { + throw new \InvalidArgumentException('non-nullable taxable_component_untaxed_element cannot be null'); + } $this->container['taxable_component_untaxed_element'] = $taxable_component_untaxed_element; return $this; @@ -1927,7 +2237,7 @@ public function setTaxableComponentUntaxedElement($taxable_component_untaxed_ele /** * Gets taxable_component_tax_free_component * - * @return int + * @return int|null */ public function getTaxableComponentTaxFreeComponent() { @@ -1937,12 +2247,15 @@ public function getTaxableComponentTaxFreeComponent() /** * Sets taxable_component_tax_free_component * - * @param int $taxable_component_tax_free_component + * @param int|null $taxable_component_tax_free_component * - * @return $this + * @return self */ public function setTaxableComponentTaxFreeComponent($taxable_component_tax_free_component) { + if (is_null($taxable_component_tax_free_component)) { + throw new \InvalidArgumentException('non-nullable taxable_component_tax_free_component cannot be null'); + } $this->container['taxable_component_tax_free_component'] = $taxable_component_tax_free_component; return $this; @@ -1951,7 +2264,7 @@ public function setTaxableComponentTaxFreeComponent($taxable_component_tax_free_ /** * Gets taxable_component_tax_offset_amount * - * @return int + * @return int|null */ public function getTaxableComponentTaxOffsetAmount() { @@ -1961,12 +2274,15 @@ public function getTaxableComponentTaxOffsetAmount() /** * Sets taxable_component_tax_offset_amount * - * @param int $taxable_component_tax_offset_amount + * @param int|null $taxable_component_tax_offset_amount * - * @return $this + * @return self */ public function setTaxableComponentTaxOffsetAmount($taxable_component_tax_offset_amount) { + if (is_null($taxable_component_tax_offset_amount)) { + throw new \InvalidArgumentException('non-nullable taxable_component_tax_offset_amount cannot be null'); + } $this->container['taxable_component_tax_offset_amount'] = $taxable_component_tax_offset_amount; return $this; @@ -1975,7 +2291,7 @@ public function setTaxableComponentTaxOffsetAmount($taxable_component_tax_offset /** * Gets lump_sum_in_arrears_taxed_element * - * @return int + * @return int|null */ public function getLumpSumInArrearsTaxedElement() { @@ -1985,12 +2301,15 @@ public function getLumpSumInArrearsTaxedElement() /** * Sets lump_sum_in_arrears_taxed_element * - * @param int $lump_sum_in_arrears_taxed_element + * @param int|null $lump_sum_in_arrears_taxed_element * - * @return $this + * @return self */ public function setLumpSumInArrearsTaxedElement($lump_sum_in_arrears_taxed_element) { + if (is_null($lump_sum_in_arrears_taxed_element)) { + throw new \InvalidArgumentException('non-nullable lump_sum_in_arrears_taxed_element cannot be null'); + } $this->container['lump_sum_in_arrears_taxed_element'] = $lump_sum_in_arrears_taxed_element; return $this; @@ -1999,7 +2318,7 @@ public function setLumpSumInArrearsTaxedElement($lump_sum_in_arrears_taxed_eleme /** * Gets lump_sum_in_arrears_untaxed_element * - * @return int + * @return int|null */ public function getLumpSumInArrearsUntaxedElement() { @@ -2009,12 +2328,15 @@ public function getLumpSumInArrearsUntaxedElement() /** * Sets lump_sum_in_arrears_untaxed_element * - * @param int $lump_sum_in_arrears_untaxed_element + * @param int|null $lump_sum_in_arrears_untaxed_element * - * @return $this + * @return self */ public function setLumpSumInArrearsUntaxedElement($lump_sum_in_arrears_untaxed_element) { + if (is_null($lump_sum_in_arrears_untaxed_element)) { + throw new \InvalidArgumentException('non-nullable lump_sum_in_arrears_untaxed_element cannot be null'); + } $this->container['lump_sum_in_arrears_untaxed_element'] = $lump_sum_in_arrears_untaxed_element; return $this; @@ -2023,7 +2345,7 @@ public function setLumpSumInArrearsUntaxedElement($lump_sum_in_arrears_untaxed_e /** * Gets lump_sum_in_arrears_tax_free_component * - * @return int + * @return int|null */ public function getLumpSumInArrearsTaxFreeComponent() { @@ -2033,12 +2355,15 @@ public function getLumpSumInArrearsTaxFreeComponent() /** * Sets lump_sum_in_arrears_tax_free_component * - * @param int $lump_sum_in_arrears_tax_free_component + * @param int|null $lump_sum_in_arrears_tax_free_component * - * @return $this + * @return self */ public function setLumpSumInArrearsTaxFreeComponent($lump_sum_in_arrears_tax_free_component) { + if (is_null($lump_sum_in_arrears_tax_free_component)) { + throw new \InvalidArgumentException('non-nullable lump_sum_in_arrears_tax_free_component cannot be null'); + } $this->container['lump_sum_in_arrears_tax_free_component'] = $lump_sum_in_arrears_tax_free_component; return $this; @@ -2047,7 +2372,7 @@ public function setLumpSumInArrearsTaxFreeComponent($lump_sum_in_arrears_tax_fre /** * Gets is_death_benefit * - * @return bool + * @return bool|null */ public function getIsDeathBenefit() { @@ -2057,12 +2382,15 @@ public function getIsDeathBenefit() /** * Sets is_death_benefit * - * @param bool $is_death_benefit + * @param bool|null $is_death_benefit * - * @return $this + * @return self */ public function setIsDeathBenefit($is_death_benefit) { + if (is_null($is_death_benefit)) { + throw new \InvalidArgumentException('non-nullable is_death_benefit cannot be null'); + } $this->container['is_death_benefit'] = $is_death_benefit; return $this; @@ -2071,7 +2399,7 @@ public function setIsDeathBenefit($is_death_benefit) /** * Gets death_benefit_type * - * @return string + * @return string|null */ public function getDeathBenefitType() { @@ -2081,12 +2409,15 @@ public function getDeathBenefitType() /** * Sets death_benefit_type * - * @param string $death_benefit_type + * @param string|null $death_benefit_type * - * @return $this + * @return self */ public function setDeathBenefitType($death_benefit_type) { + if (is_null($death_benefit_type)) { + throw new \InvalidArgumentException('non-nullable death_benefit_type cannot be null'); + } $this->container['death_benefit_type'] = $death_benefit_type; return $this; @@ -2095,7 +2426,7 @@ public function setDeathBenefitType($death_benefit_type) /** * Gets input_gross_earnings * - * @return double + * @return float|null */ public function getInputGrossEarnings() { @@ -2105,12 +2436,15 @@ public function getInputGrossEarnings() /** * Sets input_gross_earnings * - * @param double $input_gross_earnings + * @param float|null $input_gross_earnings * - * @return $this + * @return self */ public function setInputGrossEarnings($input_gross_earnings) { + if (is_null($input_gross_earnings)) { + throw new \InvalidArgumentException('non-nullable input_gross_earnings cannot be null'); + } $this->container['input_gross_earnings'] = $input_gross_earnings; return $this; @@ -2119,7 +2453,7 @@ public function setInputGrossEarnings($input_gross_earnings) /** * Gets input_pre_tax_deduction_amount * - * @return double + * @return float|null */ public function getInputPreTaxDeductionAmount() { @@ -2129,12 +2463,15 @@ public function getInputPreTaxDeductionAmount() /** * Sets input_pre_tax_deduction_amount * - * @param double $input_pre_tax_deduction_amount + * @param float|null $input_pre_tax_deduction_amount * - * @return $this + * @return self */ public function setInputPreTaxDeductionAmount($input_pre_tax_deduction_amount) { + if (is_null($input_pre_tax_deduction_amount)) { + throw new \InvalidArgumentException('non-nullable input_pre_tax_deduction_amount cannot be null'); + } $this->container['input_pre_tax_deduction_amount'] = $input_pre_tax_deduction_amount; return $this; @@ -2143,7 +2480,7 @@ public function setInputPreTaxDeductionAmount($input_pre_tax_deduction_amount) /** * Gets total_deductions * - * @return double + * @return float|null */ public function getTotalDeductions() { @@ -2153,12 +2490,15 @@ public function getTotalDeductions() /** * Sets total_deductions * - * @param double $total_deductions + * @param float|null $total_deductions * - * @return $this + * @return self */ public function setTotalDeductions($total_deductions) { + if (is_null($total_deductions)) { + throw new \InvalidArgumentException('non-nullable total_deductions cannot be null'); + } $this->container['total_deductions'] = $total_deductions; return $this; @@ -2170,7 +2510,7 @@ public function setTotalDeductions($total_deductions) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -2180,22 +2520,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -2211,11 +2552,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -2223,13 +2577,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaygReportExportModel.php b/src/lib/Model/PaygReportExportModel.php index ead14c8..ab514cc 100644 --- a/src/lib/Model/PaygReportExportModel.php +++ b/src/lib/Model/PaygReportExportModel.php @@ -2,76 +2,78 @@ /** * PaygReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaygReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaygReportExportModel implements ModelInterface, ArrayAccess +class PaygReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaygReportExportModel'; + protected static $openAPIModelName = 'PaygReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location' => 'string', 'month' => 'string', - 'gross_earnings' => 'double', - 'tax_exempt_earnings' => 'double', - 'pre_tax_deductions' => 'double', - 'taxable_earnings' => 'double', - 'payg' => 'double' + 'gross_earnings' => 'float', + 'tax_exempt_earnings' => 'float', + 'pre_tax_deductions' => 'float', + 'taxable_earnings' => 'float', + 'payg' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location' => null, 'month' => null, 'gross_earnings' => 'double', @@ -81,14 +83,36 @@ class PaygReportExportModel implements ModelInterface, ArrayAccess 'payg' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location' => false, + 'month' => false, + 'gross_earnings' => false, + 'tax_exempt_earnings' => false, + 'pre_tax_deductions' => false, + 'taxable_earnings' => false, + 'payg' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['month'] = isset($data['month']) ? $data['month'] : null; - $this->container['gross_earnings'] = isset($data['gross_earnings']) ? $data['gross_earnings'] : null; - $this->container['tax_exempt_earnings'] = isset($data['tax_exempt_earnings']) ? $data['tax_exempt_earnings'] : null; - $this->container['pre_tax_deductions'] = isset($data['pre_tax_deductions']) ? $data['pre_tax_deductions'] : null; - $this->container['taxable_earnings'] = isset($data['taxable_earnings']) ? $data['taxable_earnings'] : null; - $this->container['payg'] = isset($data['payg']) ? $data['payg'] : null; + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('month', $data ?? [], null); + $this->setIfExists('gross_earnings', $data ?? [], null); + $this->setIfExists('tax_exempt_earnings', $data ?? [], null); + $this->setIfExists('pre_tax_deductions', $data ?? [], null); + $this->setIfExists('taxable_earnings', $data ?? [], null); + $this->setIfExists('payg', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -253,12 +344,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -267,7 +361,7 @@ public function setLocation($location) /** * Gets month * - * @return string + * @return string|null */ public function getMonth() { @@ -277,12 +371,15 @@ public function getMonth() /** * Sets month * - * @param string $month + * @param string|null $month * - * @return $this + * @return self */ public function setMonth($month) { + if (is_null($month)) { + throw new \InvalidArgumentException('non-nullable month cannot be null'); + } $this->container['month'] = $month; return $this; @@ -291,7 +388,7 @@ public function setMonth($month) /** * Gets gross_earnings * - * @return double + * @return float|null */ public function getGrossEarnings() { @@ -301,12 +398,15 @@ public function getGrossEarnings() /** * Sets gross_earnings * - * @param double $gross_earnings + * @param float|null $gross_earnings * - * @return $this + * @return self */ public function setGrossEarnings($gross_earnings) { + if (is_null($gross_earnings)) { + throw new \InvalidArgumentException('non-nullable gross_earnings cannot be null'); + } $this->container['gross_earnings'] = $gross_earnings; return $this; @@ -315,7 +415,7 @@ public function setGrossEarnings($gross_earnings) /** * Gets tax_exempt_earnings * - * @return double + * @return float|null */ public function getTaxExemptEarnings() { @@ -325,12 +425,15 @@ public function getTaxExemptEarnings() /** * Sets tax_exempt_earnings * - * @param double $tax_exempt_earnings + * @param float|null $tax_exempt_earnings * - * @return $this + * @return self */ public function setTaxExemptEarnings($tax_exempt_earnings) { + if (is_null($tax_exempt_earnings)) { + throw new \InvalidArgumentException('non-nullable tax_exempt_earnings cannot be null'); + } $this->container['tax_exempt_earnings'] = $tax_exempt_earnings; return $this; @@ -339,7 +442,7 @@ public function setTaxExemptEarnings($tax_exempt_earnings) /** * Gets pre_tax_deductions * - * @return double + * @return float|null */ public function getPreTaxDeductions() { @@ -349,12 +452,15 @@ public function getPreTaxDeductions() /** * Sets pre_tax_deductions * - * @param double $pre_tax_deductions + * @param float|null $pre_tax_deductions * - * @return $this + * @return self */ public function setPreTaxDeductions($pre_tax_deductions) { + if (is_null($pre_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable pre_tax_deductions cannot be null'); + } $this->container['pre_tax_deductions'] = $pre_tax_deductions; return $this; @@ -363,7 +469,7 @@ public function setPreTaxDeductions($pre_tax_deductions) /** * Gets taxable_earnings * - * @return double + * @return float|null */ public function getTaxableEarnings() { @@ -373,12 +479,15 @@ public function getTaxableEarnings() /** * Sets taxable_earnings * - * @param double $taxable_earnings + * @param float|null $taxable_earnings * - * @return $this + * @return self */ public function setTaxableEarnings($taxable_earnings) { + if (is_null($taxable_earnings)) { + throw new \InvalidArgumentException('non-nullable taxable_earnings cannot be null'); + } $this->container['taxable_earnings'] = $taxable_earnings; return $this; @@ -387,7 +496,7 @@ public function setTaxableEarnings($taxable_earnings) /** * Gets payg * - * @return double + * @return float|null */ public function getPayg() { @@ -397,12 +506,15 @@ public function getPayg() /** * Sets payg * - * @param double $payg + * @param float|null $payg * - * @return $this + * @return self */ public function setPayg($payg) { + if (is_null($payg)) { + throw new \InvalidArgumentException('non-nullable payg cannot be null'); + } $this->container['payg'] = $payg; return $this; @@ -414,7 +526,7 @@ public function setPayg($payg) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaygReportRequestModel.php b/src/lib/Model/PaygReportRequestModel.php index fc6566f..45ae62d 100644 --- a/src/lib/Model/PaygReportRequestModel.php +++ b/src/lib/Model/PaygReportRequestModel.php @@ -2,61 +2,61 @@ /** * PaygReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaygReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaygReportRequestModel implements ModelInterface, ArrayAccess +class PaygReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaygReportRequestModel'; + protected static $openAPIModelName = 'PaygReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'state' => 'string', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -68,8 +68,10 @@ class PaygReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'state' => null, 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -77,14 +79,34 @@ class PaygReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'state' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -241,12 +330,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setState($state) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -265,12 +357,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -279,7 +374,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -289,12 +384,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -303,7 +401,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -313,12 +411,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -327,7 +428,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -337,12 +438,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -354,7 +458,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PaymentHistoryReportRequestModel.php b/src/lib/Model/PaymentHistoryReportRequestModel.php index f991113..5576a4b 100644 --- a/src/lib/Model/PaymentHistoryReportRequestModel.php +++ b/src/lib/Model/PaymentHistoryReportRequestModel.php @@ -2,61 +2,61 @@ /** * PaymentHistoryReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PaymentHistoryReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PaymentHistoryReportRequestModel implements ModelInterface, ArrayAccess +class PaymentHistoryReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PaymentHistoryReportRequestModel'; + protected static $openAPIModelName = 'PaymentHistoryReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -68,8 +68,10 @@ class PaymentHistoryReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -77,14 +79,34 @@ class PaymentHistoryReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -241,12 +330,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -255,7 +347,7 @@ public function setEmployeeId($employee_id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -265,12 +357,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -279,7 +374,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -289,12 +384,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -303,7 +401,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -313,12 +411,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -327,7 +428,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -337,12 +438,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -354,7 +458,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayrollTaxReportExportModel.php b/src/lib/Model/PayrollTaxReportExportModel.php index 517677b..aa8c698 100644 --- a/src/lib/Model/PayrollTaxReportExportModel.php +++ b/src/lib/Model/PayrollTaxReportExportModel.php @@ -2,61 +2,61 @@ /** * PayrollTaxReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayrollTaxReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayrollTaxReportExportModel implements ModelInterface, ArrayAccess +class PayrollTaxReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayrollTaxReportExportModel'; + protected static $openAPIModelName = 'PayrollTaxReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'first_name' => 'string', 'surname' => 'string', @@ -64,7 +64,7 @@ class PayrollTaxReportExportModel implements ModelInterface, ArrayAccess 'location' => 'string', 'type' => 'string', 'state' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'employee_payroll_tax_exempt' => 'bool', 'pay_category_payroll_tax_exempt' => 'bool', 'termination_payment' => 'bool', @@ -78,8 +78,10 @@ class PayrollTaxReportExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'first_name' => null, 'surname' => null, @@ -97,14 +99,44 @@ class PayrollTaxReportExportModel implements ModelInterface, ArrayAccess 'lump_sum_d' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'location' => false, + 'type' => false, + 'state' => false, + 'amount' => false, + 'employee_payroll_tax_exempt' => false, + 'pay_category_payroll_tax_exempt' => false, + 'termination_payment' => false, + 'allowance' => false, + 'etp' => false, + 'genuine_redundancy' => false, + 'lump_sum_d' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -225,12 +309,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -247,21 +328,39 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['employee_payroll_tax_exempt'] = isset($data['employee_payroll_tax_exempt']) ? $data['employee_payroll_tax_exempt'] : null; - $this->container['pay_category_payroll_tax_exempt'] = isset($data['pay_category_payroll_tax_exempt']) ? $data['pay_category_payroll_tax_exempt'] : null; - $this->container['termination_payment'] = isset($data['termination_payment']) ? $data['termination_payment'] : null; - $this->container['allowance'] = isset($data['allowance']) ? $data['allowance'] : null; - $this->container['etp'] = isset($data['etp']) ? $data['etp'] : null; - $this->container['genuine_redundancy'] = isset($data['genuine_redundancy']) ? $data['genuine_redundancy'] : null; - $this->container['lump_sum_d'] = isset($data['lump_sum_d']) ? $data['lump_sum_d'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('employee_payroll_tax_exempt', $data ?? [], null); + $this->setIfExists('pay_category_payroll_tax_exempt', $data ?? [], null); + $this->setIfExists('termination_payment', $data ?? [], null); + $this->setIfExists('allowance', $data ?? [], null); + $this->setIfExists('etp', $data ?? [], null); + $this->setIfExists('genuine_redundancy', $data ?? [], null); + $this->setIfExists('lump_sum_d', $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; } /** @@ -291,7 +390,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -301,12 +400,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -315,7 +417,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -325,12 +427,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -339,7 +444,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -349,12 +454,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -363,7 +471,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -373,12 +481,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -387,7 +498,7 @@ public function setExternalId($external_id) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -397,12 +508,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -411,7 +525,7 @@ public function setLocation($location) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -421,12 +535,15 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -435,7 +552,7 @@ public function setType($type) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -445,12 +562,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -459,7 +579,7 @@ public function setState($state) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -469,12 +589,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -483,7 +606,7 @@ public function setAmount($amount) /** * Gets employee_payroll_tax_exempt * - * @return bool + * @return bool|null */ public function getEmployeePayrollTaxExempt() { @@ -493,12 +616,15 @@ public function getEmployeePayrollTaxExempt() /** * Sets employee_payroll_tax_exempt * - * @param bool $employee_payroll_tax_exempt + * @param bool|null $employee_payroll_tax_exempt * - * @return $this + * @return self */ public function setEmployeePayrollTaxExempt($employee_payroll_tax_exempt) { + if (is_null($employee_payroll_tax_exempt)) { + throw new \InvalidArgumentException('non-nullable employee_payroll_tax_exempt cannot be null'); + } $this->container['employee_payroll_tax_exempt'] = $employee_payroll_tax_exempt; return $this; @@ -507,7 +633,7 @@ public function setEmployeePayrollTaxExempt($employee_payroll_tax_exempt) /** * Gets pay_category_payroll_tax_exempt * - * @return bool + * @return bool|null */ public function getPayCategoryPayrollTaxExempt() { @@ -517,12 +643,15 @@ public function getPayCategoryPayrollTaxExempt() /** * Sets pay_category_payroll_tax_exempt * - * @param bool $pay_category_payroll_tax_exempt + * @param bool|null $pay_category_payroll_tax_exempt * - * @return $this + * @return self */ public function setPayCategoryPayrollTaxExempt($pay_category_payroll_tax_exempt) { + if (is_null($pay_category_payroll_tax_exempt)) { + throw new \InvalidArgumentException('non-nullable pay_category_payroll_tax_exempt cannot be null'); + } $this->container['pay_category_payroll_tax_exempt'] = $pay_category_payroll_tax_exempt; return $this; @@ -531,7 +660,7 @@ public function setPayCategoryPayrollTaxExempt($pay_category_payroll_tax_exempt) /** * Gets termination_payment * - * @return bool + * @return bool|null */ public function getTerminationPayment() { @@ -541,12 +670,15 @@ public function getTerminationPayment() /** * Sets termination_payment * - * @param bool $termination_payment + * @param bool|null $termination_payment * - * @return $this + * @return self */ public function setTerminationPayment($termination_payment) { + if (is_null($termination_payment)) { + throw new \InvalidArgumentException('non-nullable termination_payment cannot be null'); + } $this->container['termination_payment'] = $termination_payment; return $this; @@ -555,7 +687,7 @@ public function setTerminationPayment($termination_payment) /** * Gets allowance * - * @return bool + * @return bool|null */ public function getAllowance() { @@ -565,12 +697,15 @@ public function getAllowance() /** * Sets allowance * - * @param bool $allowance + * @param bool|null $allowance * - * @return $this + * @return self */ public function setAllowance($allowance) { + if (is_null($allowance)) { + throw new \InvalidArgumentException('non-nullable allowance cannot be null'); + } $this->container['allowance'] = $allowance; return $this; @@ -579,7 +714,7 @@ public function setAllowance($allowance) /** * Gets etp * - * @return bool + * @return bool|null */ public function getEtp() { @@ -589,12 +724,15 @@ public function getEtp() /** * Sets etp * - * @param bool $etp + * @param bool|null $etp * - * @return $this + * @return self */ public function setEtp($etp) { + if (is_null($etp)) { + throw new \InvalidArgumentException('non-nullable etp cannot be null'); + } $this->container['etp'] = $etp; return $this; @@ -603,7 +741,7 @@ public function setEtp($etp) /** * Gets genuine_redundancy * - * @return bool + * @return bool|null */ public function getGenuineRedundancy() { @@ -613,12 +751,15 @@ public function getGenuineRedundancy() /** * Sets genuine_redundancy * - * @param bool $genuine_redundancy + * @param bool|null $genuine_redundancy * - * @return $this + * @return self */ public function setGenuineRedundancy($genuine_redundancy) { + if (is_null($genuine_redundancy)) { + throw new \InvalidArgumentException('non-nullable genuine_redundancy cannot be null'); + } $this->container['genuine_redundancy'] = $genuine_redundancy; return $this; @@ -627,7 +768,7 @@ public function setGenuineRedundancy($genuine_redundancy) /** * Gets lump_sum_d * - * @return bool + * @return bool|null */ public function getLumpSumD() { @@ -637,12 +778,15 @@ public function getLumpSumD() /** * Sets lump_sum_d * - * @param bool $lump_sum_d + * @param bool|null $lump_sum_d * - * @return $this + * @return self */ public function setLumpSumD($lump_sum_d) { + if (is_null($lump_sum_d)) { + throw new \InvalidArgumentException('non-nullable lump_sum_d cannot be null'); + } $this->container['lump_sum_d'] = $lump_sum_d; return $this; @@ -654,7 +798,7 @@ public function setLumpSumD($lump_sum_d) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -664,22 +808,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,11 +840,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -707,13 +865,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PayrollTaxReportRequestModel.php b/src/lib/Model/PayrollTaxReportRequestModel.php index eaf82e0..c953358 100644 --- a/src/lib/Model/PayrollTaxReportRequestModel.php +++ b/src/lib/Model/PayrollTaxReportRequestModel.php @@ -2,61 +2,61 @@ /** * PayrollTaxReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PayrollTaxReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PayrollTaxReportRequestModel implements ModelInterface, ArrayAccess +class PayrollTaxReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PayrollTaxReportRequestModel'; + protected static $openAPIModelName = 'PayrollTaxReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'group_by' => 'string', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -68,8 +68,10 @@ class PayrollTaxReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'group_by' => null, 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -77,14 +79,34 @@ class PayrollTaxReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'group_by' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,15 +249,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const GROUP_BY_EARNINGS_LOCATION = 'EarningsLocation'; - const GROUP_BY_DEFAULT_LOCATION = 'DefaultLocation'; - const GROUP_BY_EARNINGS_ROLL_UP_LOCATION = 'EarningsRollUpLocation'; - + public const GROUP_BY_EARNINGS_LOCATION = 'EarningsLocation'; + public const GROUP_BY_DEFAULT_LOCATION = 'DefaultLocation'; + public const GROUP_BY_EARNINGS_ROLL_UP_LOCATION = 'EarningsRollUpLocation'; - /** * Gets allowable values of the enum * @@ -197,7 +269,6 @@ public function getGroupByAllowableValues() self::GROUP_BY_EARNINGS_ROLL_UP_LOCATION, ]; } - /** * Associative array for storing property values @@ -214,11 +285,29 @@ public function getGroupByAllowableValues() */ public function __construct(array $data = null) { - $this->container['group_by'] = isset($data['group_by']) ? $data['group_by'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('group_by', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -233,7 +322,8 @@ public function listInvalidProperties() $allowedValues = $this->getGroupByAllowableValues(); if (!is_null($this->container['group_by']) && !in_array($this->container['group_by'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'group_by', must be one of '%s'", + "invalid value '%s' for 'group_by', must be one of '%s'", + $this->container['group_by'], implode("', '", $allowedValues) ); } @@ -256,7 +346,7 @@ public function valid() /** * Gets group_by * - * @return string + * @return string|null */ public function getGroupBy() { @@ -266,17 +356,21 @@ public function getGroupBy() /** * Sets group_by * - * @param string $group_by + * @param string|null $group_by * - * @return $this + * @return self */ public function setGroupBy($group_by) { + if (is_null($group_by)) { + throw new \InvalidArgumentException('non-nullable group_by cannot be null'); + } $allowedValues = $this->getGroupByAllowableValues(); - if (!is_null($group_by) && !in_array($group_by, $allowedValues, true)) { + if (!in_array($group_by, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'group_by', must be one of '%s'", + "Invalid value '%s' for 'group_by', must be one of '%s'", + $group_by, implode("', '", $allowedValues) ) ); @@ -289,7 +383,7 @@ public function setGroupBy($group_by) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -299,12 +393,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -313,7 +410,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -323,12 +420,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -337,7 +437,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -347,12 +447,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -361,7 +464,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -371,12 +474,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -388,7 +494,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -398,22 +504,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -429,11 +536,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -441,13 +561,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PinResetModel.php b/src/lib/Model/PinResetModel.php index fed25b7..cac2517 100644 --- a/src/lib/Model/PinResetModel.php +++ b/src/lib/Model/PinResetModel.php @@ -2,61 +2,61 @@ /** * PinResetModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PinResetModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PinResetModel implements ModelInterface, ArrayAccess +class PinResetModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PinResetModel'; + protected static $openAPIModelName = 'PinResetModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int' ]; @@ -64,19 +64,37 @@ class PinResetModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; + $this->setIfExists('employee_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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -217,12 +302,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -234,7 +322,7 @@ public function setEmployeeId($employee_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ProfileImageMetadata.php b/src/lib/Model/ProfileImageMetadata.php index 61974e1..641c6d7 100644 --- a/src/lib/Model/ProfileImageMetadata.php +++ b/src/lib/Model/ProfileImageMetadata.php @@ -2,61 +2,61 @@ /** * ProfileImageMetadata * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ProfileImageMetadata Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ProfileImageMetadata implements ModelInterface, ArrayAccess +class ProfileImageMetadata implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ProfileImageMetadata'; + protected static $openAPIModelName = 'ProfileImageMetadata'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'content_type' => 'string', 'extension' => 'string', 'width' => 'int', @@ -67,22 +67,43 @@ class ProfileImageMetadata implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'content_type' => null, 'extension' => null, 'width' => 'int32', 'height' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'content_type' => false, + 'extension' => false, + 'width' => false, + 'height' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['content_type'] = isset($data['content_type']) ? $data['content_type'] : null; - $this->container['extension'] = isset($data['extension']) ? $data['extension'] : null; - $this->container['width'] = isset($data['width']) ? $data['width'] : null; - $this->container['height'] = isset($data['height']) ? $data['height'] : null; + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('extension', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('height', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets content_type * - * @return string + * @return string|null */ public function getContentType() { @@ -235,12 +323,15 @@ public function getContentType() /** * Sets content_type * - * @param string $content_type + * @param string|null $content_type * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setContentType($content_type) /** * Gets extension * - * @return string + * @return string|null */ public function getExtension() { @@ -259,12 +350,15 @@ public function getExtension() /** * Sets extension * - * @param string $extension + * @param string|null $extension * - * @return $this + * @return self */ public function setExtension($extension) { + if (is_null($extension)) { + throw new \InvalidArgumentException('non-nullable extension cannot be null'); + } $this->container['extension'] = $extension; return $this; @@ -273,7 +367,7 @@ public function setExtension($extension) /** * Gets width * - * @return int + * @return int|null */ public function getWidth() { @@ -283,12 +377,15 @@ public function getWidth() /** * Sets width * - * @param int $width + * @param int|null $width * - * @return $this + * @return self */ public function setWidth($width) { + if (is_null($width)) { + throw new \InvalidArgumentException('non-nullable width cannot be null'); + } $this->container['width'] = $width; return $this; @@ -297,7 +394,7 @@ public function setWidth($width) /** * Gets height * - * @return int + * @return int|null */ public function getHeight() { @@ -307,12 +404,15 @@ public function getHeight() /** * Sets height * - * @param int $height + * @param int|null $height * - * @return $this + * @return self */ public function setHeight($height) { + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); + } $this->container['height'] = $height; return $this; @@ -324,7 +424,7 @@ public function setHeight($height) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/PublicHolidayModel.php b/src/lib/Model/PublicHolidayModel.php index 87924cf..c552103 100644 --- a/src/lib/Model/PublicHolidayModel.php +++ b/src/lib/Model/PublicHolidayModel.php @@ -2,61 +2,61 @@ /** * PublicHolidayModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * PublicHolidayModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class PublicHolidayModel implements ModelInterface, ArrayAccess +class PublicHolidayModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'PublicHolidayModel'; + protected static $openAPIModelName = 'PublicHolidayModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'date' => '\DateTime', 'states' => 'string[]', @@ -72,8 +72,10 @@ class PublicHolidayModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'date' => 'date-time', 'states' => null, @@ -85,14 +87,38 @@ class PublicHolidayModel implements ModelInterface, ArrayAccess 'mondayised_alternative_to_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => false, + 'states' => false, + 'location_ids' => false, + 'description' => false, + 'note' => false, + 'is_system' => false, + 'not_a_public_holiday' => false, + 'mondayised_alternative_to_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['states'] = isset($data['states']) ? $data['states'] : null; - $this->container['location_ids'] = isset($data['location_ids']) ? $data['location_ids'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['is_system'] = isset($data['is_system']) ? $data['is_system'] : null; - $this->container['not_a_public_holiday'] = isset($data['not_a_public_holiday']) ? $data['not_a_public_holiday'] : null; - $this->container['mondayised_alternative_to_id'] = isset($data['mondayised_alternative_to_id']) ? $data['mondayised_alternative_to_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('states', $data ?? [], null); + $this->setIfExists('location_ids', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('is_system', $data ?? [], null); + $this->setIfExists('not_a_public_holiday', $data ?? [], null); + $this->setIfExists('mondayised_alternative_to_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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +358,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +375,7 @@ public function setId($id) /** * Gets date * - * @return \DateTime + * @return \DateTime|null */ public function getDate() { @@ -289,12 +385,15 @@ public function getDate() /** * Sets date * - * @param \DateTime $date + * @param \DateTime|null $date * - * @return $this + * @return self */ public function setDate($date) { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -303,7 +402,7 @@ public function setDate($date) /** * Gets states * - * @return string[] + * @return string[]|null */ public function getStates() { @@ -313,12 +412,15 @@ public function getStates() /** * Sets states * - * @param string[] $states + * @param string[]|null $states * - * @return $this + * @return self */ public function setStates($states) { + if (is_null($states)) { + throw new \InvalidArgumentException('non-nullable states cannot be null'); + } $this->container['states'] = $states; return $this; @@ -327,7 +429,7 @@ public function setStates($states) /** * Gets location_ids * - * @return int[] + * @return int[]|null */ public function getLocationIds() { @@ -337,12 +439,15 @@ public function getLocationIds() /** * Sets location_ids * - * @param int[] $location_ids + * @param int[]|null $location_ids * - * @return $this + * @return self */ public function setLocationIds($location_ids) { + if (is_null($location_ids)) { + throw new \InvalidArgumentException('non-nullable location_ids cannot be null'); + } $this->container['location_ids'] = $location_ids; return $this; @@ -351,7 +456,7 @@ public function setLocationIds($location_ids) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -361,12 +466,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -375,7 +483,7 @@ public function setDescription($description) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -385,12 +493,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -399,7 +510,7 @@ public function setNote($note) /** * Gets is_system * - * @return bool + * @return bool|null */ public function getIsSystem() { @@ -409,12 +520,15 @@ public function getIsSystem() /** * Sets is_system * - * @param bool $is_system + * @param bool|null $is_system * - * @return $this + * @return self */ public function setIsSystem($is_system) { + if (is_null($is_system)) { + throw new \InvalidArgumentException('non-nullable is_system cannot be null'); + } $this->container['is_system'] = $is_system; return $this; @@ -423,7 +537,7 @@ public function setIsSystem($is_system) /** * Gets not_a_public_holiday * - * @return bool + * @return bool|null */ public function getNotAPublicHoliday() { @@ -433,12 +547,15 @@ public function getNotAPublicHoliday() /** * Sets not_a_public_holiday * - * @param bool $not_a_public_holiday + * @param bool|null $not_a_public_holiday * - * @return $this + * @return self */ public function setNotAPublicHoliday($not_a_public_holiday) { + if (is_null($not_a_public_holiday)) { + throw new \InvalidArgumentException('non-nullable not_a_public_holiday cannot be null'); + } $this->container['not_a_public_holiday'] = $not_a_public_holiday; return $this; @@ -447,7 +564,7 @@ public function setNotAPublicHoliday($not_a_public_holiday) /** * Gets mondayised_alternative_to_id * - * @return int + * @return int|null */ public function getMondayisedAlternativeToId() { @@ -457,12 +574,15 @@ public function getMondayisedAlternativeToId() /** * Sets mondayised_alternative_to_id * - * @param int $mondayised_alternative_to_id + * @param int|null $mondayised_alternative_to_id * - * @return $this + * @return self */ public function setMondayisedAlternativeToId($mondayised_alternative_to_id) { + if (is_null($mondayised_alternative_to_id)) { + throw new \InvalidArgumentException('non-nullable mondayised_alternative_to_id cannot be null'); + } $this->container['mondayised_alternative_to_id'] = $mondayised_alternative_to_id; return $this; @@ -474,7 +594,7 @@ public function setMondayisedAlternativeToId($mondayised_alternative_to_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/QualificationModel.php b/src/lib/Model/QualificationModel.php index 98b8a4d..59e3b36 100644 --- a/src/lib/Model/QualificationModel.php +++ b/src/lib/Model/QualificationModel.php @@ -2,61 +2,61 @@ /** * QualificationModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * QualificationModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class QualificationModel implements ModelInterface, ArrayAccess +class QualificationModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'QualificationModel'; + protected static $openAPIModelName = 'QualificationModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class QualificationModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RangeVariable.php b/src/lib/Model/RangeVariable.php index 1865475..fa4907e 100644 --- a/src/lib/Model/RangeVariable.php +++ b/src/lib/Model/RangeVariable.php @@ -2,63 +2,63 @@ /** * RangeVariable * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RangeVariable Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RangeVariable implements ModelInterface, ArrayAccess +class RangeVariable implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RangeVariable'; + protected static $openAPIModelName = 'RangeVariable'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', - 'type_reference' => '\Swagger\Client\Model\IEdmTypeReference', + 'type_reference' => '\OpenAPI\Client\Model\IEdmTypeReference', 'kind' => 'int' ]; @@ -66,21 +66,41 @@ class RangeVariable implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'type_reference' => null, 'kind' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'type_reference' => false, + 'kind' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['type_reference'] = isset($data['type_reference']) ? $data['type_reference'] : null; - $this->container['kind'] = isset($data['kind']) ? $data['kind'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type_reference', $data ?? [], null); + $this->setIfExists('kind', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -229,12 +316,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setName($name) /** * Gets type_reference * - * @return \Swagger\Client\Model\IEdmTypeReference + * @return \OpenAPI\Client\Model\IEdmTypeReference|null */ public function getTypeReference() { @@ -253,12 +343,15 @@ public function getTypeReference() /** * Sets type_reference * - * @param \Swagger\Client\Model\IEdmTypeReference $type_reference + * @param \OpenAPI\Client\Model\IEdmTypeReference|null $type_reference type_reference * - * @return $this + * @return self */ public function setTypeReference($type_reference) { + if (is_null($type_reference)) { + throw new \InvalidArgumentException('non-nullable type_reference cannot be null'); + } $this->container['type_reference'] = $type_reference; return $this; @@ -267,7 +360,7 @@ public function setTypeReference($type_reference) /** * Gets kind * - * @return int + * @return int|null */ public function getKind() { @@ -277,12 +370,15 @@ public function getKind() /** * Sets kind * - * @param int $kind + * @param int|null $kind * - * @return $this + * @return self */ public function setKind($kind) { + if (is_null($kind)) { + throw new \InvalidArgumentException('non-nullable kind cannot be null'); + } $this->container['kind'] = $kind; return $this; @@ -294,7 +390,7 @@ public function setKind($kind) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RateOverride.php b/src/lib/Model/RateOverride.php index 614a409..a8c8b30 100644 --- a/src/lib/Model/RateOverride.php +++ b/src/lib/Model/RateOverride.php @@ -2,63 +2,63 @@ /** * RateOverride * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RateOverride Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RateOverride implements ModelInterface, ArrayAccess +class RateOverride implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RateOverride'; + protected static $openAPIModelName = 'RateOverride'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_category_id' => 'int', - 'rate' => 'double', + 'rate' => 'float', 'use_rate_as_is' => 'bool' ]; @@ -66,21 +66,41 @@ class RateOverride implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_category_id' => 'int32', 'rate' => 'double', 'use_rate_as_is' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_category_id' => false, + 'rate' => false, + 'use_rate_as_is' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['use_rate_as_is'] = isset($data['use_rate_as_is']) ? $data['use_rate_as_is'] : null; + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('use_rate_as_is', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -229,12 +316,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -243,7 +333,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -253,12 +343,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -267,7 +360,7 @@ public function setRate($rate) /** * Gets use_rate_as_is * - * @return bool + * @return bool|null */ public function getUseRateAsIs() { @@ -277,12 +370,15 @@ public function getUseRateAsIs() /** * Sets use_rate_as_is * - * @param bool $use_rate_as_is Nullable

Note:If set to \"true\", the system assumes the Rate value is inclusive of rate loading and penalty loading. + * @param bool|null $use_rate_as_is Nullable

Note:If set to \"true\", the system assumes the Rate value is inclusive of rate loading and penalty loading. * - * @return $this + * @return self */ public function setUseRateAsIs($use_rate_as_is) { + if (is_null($use_rate_as_is)) { + throw new \InvalidArgumentException('non-nullable use_rate_as_is cannot be null'); + } $this->container['use_rate_as_is'] = $use_rate_as_is; return $this; @@ -294,7 +390,7 @@ public function setUseRateAsIs($use_rate_as_is) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RecoverPasswordModel.php b/src/lib/Model/RecoverPasswordModel.php index 5008d2f..806f964 100644 --- a/src/lib/Model/RecoverPasswordModel.php +++ b/src/lib/Model/RecoverPasswordModel.php @@ -2,61 +2,61 @@ /** * RecoverPasswordModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RecoverPasswordModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RecoverPasswordModel implements ModelInterface, ArrayAccess +class RecoverPasswordModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RecoverPasswordModel'; + protected static $openAPIModelName = 'RecoverPasswordModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'username' => 'string', 'message_type' => 'string' ]; @@ -65,20 +65,39 @@ class RecoverPasswordModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'username' => null, 'message_type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'username' => false, + 'message_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,131 +231,129 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const MESSAGE_TYPE_NEW_PAY_SLIP_AVAILABLE = 'NewPaySlipAvailable'; - const MESSAGE_TYPE_NEW_USER = 'NewUser'; - const MESSAGE_TYPE_RECOVER_PASSWORD = 'RecoverPassword'; - const MESSAGE_TYPE_EMPLOYEE_ACCESS = 'EmployeeAccess'; - const MESSAGE_TYPE_BUSINESS_ACCESS = 'BusinessAccess'; - const MESSAGE_TYPE_CANCEL_ACCOUNT = 'CancelAccount'; - const MESSAGE_TYPE_INVOICE = 'Invoice'; - const MESSAGE_TYPE_INVOICE_PAYMENT_SUCCESS_NOTIFICATION = 'InvoicePaymentSuccessNotification'; - const MESSAGE_TYPE_AUTOMATED_PASSWORD = 'AutomatedPassword'; - const MESSAGE_TYPE_LEAVE_REQUEST_NOTIFICATION = 'LeaveRequestNotification'; - const MESSAGE_TYPE_RESTRICTED_ACCESS = 'RestrictedAccess'; - const MESSAGE_TYPE_RESEND_PAYSLIP = 'ResendPayslip'; - const MESSAGE_TYPE_PAYMENT_SUMMARY_AVAILABLE = 'PaymentSummaryAvailable'; - const MESSAGE_TYPE_SUPER_PAYMENTS_UPDATE_RESULTS = 'SuperPaymentsUpdateResults'; - const MESSAGE_TYPE_INVOICE_PAYMENT_FAILED_NOTIFICATION = 'InvoicePaymentFailedNotification'; - const MESSAGE_TYPE_NEW_SHIFTS_PUBLISHED = 'NewShiftsPublished'; - const MESSAGE_TYPE_SHIFTS_UNPUBLISHED = 'ShiftsUnpublished'; - const MESSAGE_TYPE_SHIFT_DECLINED = 'ShiftDeclined'; - const MESSAGE_TYPE_KIOSK_ACCESS_GRANTED = 'KioskAccessGranted'; - const MESSAGE_TYPE_DAILY_NOTIFICATIONS = 'DailyNotifications'; - const MESSAGE_TYPE_BSB_DATA_IMPORTED = 'BsbDataImported'; - const MESSAGE_TYPE_INVOICEE_CARD_DETAILS_REMOVED = 'InvoiceeCardDetailsRemoved'; - const MESSAGE_TYPE_WHITE_LABEL_MANAGER_ACCESS = 'WhiteLabelManagerAccess'; - const MESSAGE_TYPE_RESELLER_ACCESS = 'ResellerAccess'; - const MESSAGE_TYPE_DIRECT_DEPOSIT_REMINDER = 'DirectDepositReminder'; - const MESSAGE_TYPE_EXPENSE_REQUEST_NOTIFICATION = 'ExpenseRequestNotification'; - const MESSAGE_TYPE_UNAVAILABILITY_NOTIFICATION = 'UnavailabilityNotification'; - const MESSAGE_TYPE_REPORT_PACK_GENERATED = 'ReportPackGenerated'; - const MESSAGE_TYPE_REPORT_PACK_ERROR = 'ReportPackError'; - const MESSAGE_TYPE_SYSTEM_PUBLIC_HOLIDAY_IMPORT = 'SystemPublicHolidayImport'; - const MESSAGE_TYPE_TIMESHEET_REJECTED = 'TimesheetRejected'; - const MESSAGE_TYPE_SHIFT_REPUBLISHED = 'ShiftRepublished'; - const MESSAGE_TYPE_PENDING_SHIFTS_REMINDER = 'PendingShiftsReminder'; - const MESSAGE_TYPE_EMPLOYEE_SHIFT_ACTION_TIMEOUT = 'EmployeeShiftActionTimeout'; - const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING = 'InitiateEmployeeOnboarding'; - const MESSAGE_TYPE_FOLLOW_UP_EMPLOYEE_ONBOARDING = 'FollowUpEmployeeOnboarding'; - const MESSAGE_TYPE_COMPLETE_EMPLOYEE_ONBOARDING = 'CompleteEmployeeOnboarding'; - const MESSAGE_TYPE_NEW_SHIFTS_PRE_ACCEPTED = 'NewShiftsPreAccepted'; - const MESSAGE_TYPE_PAY_RUN_TASK_NOTIFICATION = 'PayRunTaskNotification'; - const MESSAGE_TYPE_SHIFT_SWAP_CANCELLED = 'ShiftSwapCancelled'; - const MESSAGE_TYPE_BULK_SHIFT_SWAPS_CANCELLED = 'BulkShiftSwapsCancelled'; - const MESSAGE_TYPE_SHIFT_SWAP_AWAITING_APPROVAL = 'ShiftSwapAwaitingApproval'; - const MESSAGE_TYPE_SHIFT_SWAP_PROPOSED = 'ShiftSwapProposed'; - const MESSAGE_TYPE_SHIFT_SWAP_ACCEPTED = 'ShiftSwapAccepted'; - const MESSAGE_TYPE_SHIFT_SWAP_DECLINED = 'ShiftSwapDeclined'; - const MESSAGE_TYPE_SHIFT_SWAP_REJECTED = 'ShiftSwapRejected'; - const MESSAGE_TYPE_SHIFT_SWAP_APPROVED = 'ShiftSwapApproved'; - const MESSAGE_TYPE_P60_AVAILABLE = 'P60Available'; - const MESSAGE_TYPE_P60_ERROR = 'P60Error'; - const MESSAGE_TYPE_LEAVING_EMPLOYEE_FORM_NOTIFICATION = 'LeavingEmployeeFormNotification'; - const MESSAGE_TYPE_AUTO_ENROLMENT_NOTIFICATION = 'AutoEnrolmentNotification'; - const MESSAGE_TYPE_LODGEMENT_NOTIFICATION = 'LodgementNotification'; - const MESSAGE_TYPE_TWO_FACTOR_LOGIN = 'TwoFactorLogin'; - const MESSAGE_TYPE_TWO_FACTOR_CHALLENGE = 'TwoFactorChallenge'; - const MESSAGE_TYPE_CONFIRM_EMAIL_ADDRESS = 'ConfirmEmailAddress'; - const MESSAGE_TYPE_CONFIRM_MOBILE_PHONE = 'ConfirmMobilePhone'; - const MESSAGE_TYPE_DOCUMENT_NOTIFICATION_INITIAL = 'DocumentNotificationInitial'; - const MESSAGE_TYPE_DOCUMENT_NOTIFICATION_INITIAL_WITH_ACKNOWLEDGEMENT = 'DocumentNotificationInitialWithAcknowledgement'; - const MESSAGE_TYPE_DOCUMENT_NOTIFICATION_REMINDER = 'DocumentNotificationReminder'; - const MESSAGE_TYPE_DOCUMENT_ACKNOWLEDGED_NOTIFICATION = 'DocumentAcknowledgedNotification'; - const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING_ADMIN = 'InitiateEmployeeOnboardingAdmin'; - const MESSAGE_TYPE_PAY_EVENT_REQUEST_AUTHORITY = 'PayEventRequestAuthority'; - const MESSAGE_TYPE_PAY_EVENT_APPROVED_OR_REJECTED = 'PayEventApprovedOrRejected'; - const MESSAGE_TYPE_SHIFT_BID_ACCEPTED = 'ShiftBidAccepted'; - const MESSAGE_TYPE_EMPLOYEE_DETAILS_UPDATED = 'EmployeeDetailsUpdated'; - const MESSAGE_TYPE_BANK_ACCOUNT_DETAILS_UPDATED = 'BankAccountDetailsUpdated'; - const MESSAGE_TYPE_SUPER_DETAILS_UPDATED = 'SuperDetailsUpdated'; - const MESSAGE_TYPE_MANAGER_SHIFT_ACTION_TIMEOUT = 'ManagerShiftActionTimeout'; - const MESSAGE_TYPE_SUPER_FUND_NOTIFICATION_NEW_MEMBER = 'SuperFundNotificationNewMember'; - const MESSAGE_TYPE_SUPER_PAYMENT_DISHONOUR = 'SuperPaymentDishonour'; - const MESSAGE_TYPE_KIWI_SAVER_DETAILS_UPDATED = 'KiwiSaverDetailsUpdated'; - const MESSAGE_TYPE_AUTO_ENROLMENT_POSTPONEMENT_NOTIFICATION = 'AutoEnrolmentPostponementNotification'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_CREATION = 'AutomatedPayRunErrorCreation'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_PROCESSING = 'AutomatedPayRunErrorProcessing'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_FINALISATION = 'AutomatedPayRunErrorFinalisation'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_POST_FINALISE = 'AutomatedPayRunErrorPostFinalise'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_SUCCESS_AND_FINALISED = 'AutomatedPayRunSuccessAndFinalised'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_SUCCESS_NOT_FINALISED = 'AutomatedPayRunSuccessNotFinalised'; - const MESSAGE_TYPE_AUTOMATED_PAY_RUN_CREATION = 'AutomatedPayRunCreation'; - const MESSAGE_TYPE_PAY_RUN_USAGE_BILLING_FAILURES = 'PayRunUsageBillingFailures'; - const MESSAGE_TYPE_INCOME_STATEMENT_AVAILABLE = 'IncomeStatementAvailable'; - const MESSAGE_TYPE_MALICIOUS_FILE_NOTIFICATION_ADMIN = 'MaliciousFileNotificationAdmin'; - const MESSAGE_TYPE_USER_ACCOUNT_LOCKED = 'UserAccountLocked'; - const MESSAGE_TYPE_MALICIOUS_FILE_NOTIFICATION_EMPLOYEE = 'MaliciousFileNotificationEmployee'; - const MESSAGE_TYPE_SUPER_FUND_REFUND_NOTIFICATION = 'SuperFundRefundNotification'; - const MESSAGE_TYPE_SUPER_BATCH_CANCELLED_NOTIFICATION = 'SuperBatchCancelledNotification'; - const MESSAGE_TYPE_JOB_KEEPER_EMPLOYEE_NOMINATION = 'JobKeeperEmployeeNomination'; - const MESSAGE_TYPE_HMRC_PAYMENT_REMINDER = 'HmrcPaymentReminder'; - const MESSAGE_TYPE_IRAS_FORM_AVAILABLE = 'IrasFormAvailable'; - const MESSAGE_TYPE_HMRC_PAYMENT_REMINDER_SEND_FAILURE = 'HmrcPaymentReminderSendFailure'; - const MESSAGE_TYPE_SYNC_CANCELLED_SUPER_BATCHES_FROM_BEAM = 'SyncCancelledSuperBatchesFromBeam'; - const MESSAGE_TYPE_EA_FORM_INCOME_TAX_AVAILABLE = 'EAFormIncomeTaxAvailable'; - const MESSAGE_TYPE_PCB2_FORM_AVAILABLE = 'PCB2FormAvailable'; - const MESSAGE_TYPE_JOB_MAKER_EMPLOYEE_NOMINATION = 'JobMakerEmployeeNomination'; - const MESSAGE_TYPE_EARNINGS_CERTIFICATE_AVAILABLE = 'EarningsCertificateAvailable'; - const MESSAGE_TYPE_P11D_AVAILABLE = 'P11dAvailable'; - const MESSAGE_TYPE_PAY_RUN_APPROVAL_NOTIFICATION = 'PayRunApprovalNotification'; - const MESSAGE_TYPE_PAY_RUN_APPROVAL_REMINDER = 'PayRunApprovalReminder'; - const MESSAGE_TYPE_PAY_RUN_STATUS_CHANGED = 'PayRunStatusChanged'; - const MESSAGE_TYPE_QUALIFICATION_UPDATED_NOTIFICATION = 'QualificationUpdatedNotification'; - const MESSAGE_TYPE_QUALIFICATION_EXPIRING_NOTIFICATION = 'QualificationExpiringNotification'; - const MESSAGE_TYPE_QUALIFICATION_EXPIRED_NOTIFICATION = 'QualificationExpiredNotification'; - const MESSAGE_TYPE_CREDIT_CARD_EXPIRING_REMINDER = 'CreditCardExpiringReminder'; - const MESSAGE_TYPE_RESEND_PAYMENT_AND_DEDUCTION_STATEMENT = 'ResendPaymentAndDeductionStatement'; - const MESSAGE_TYPE_EMPLOYEE_SELF_SETUP_REMINDER = 'EmployeeSelfSetupReminder'; - const MESSAGE_TYPE_EMPLOYEE_ONBOARDING_P45_UPLOADED = 'EmployeeOnboardingP45Uploaded'; - const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING_WITH_CONTRACT = 'InitiateEmployeeOnboardingWithContract'; - const MESSAGE_TYPE_SIGNATORY_CONTRACT = 'SignatoryContract'; - const MESSAGE_TYPE_WORK_ELIGIBILITY_EXPIRING_NOTIFICATION = 'WorkEligibilityExpiringNotification'; - const MESSAGE_TYPE_WORK_ELIGIBILITY_EXPIRED_NOTIFICATION = 'WorkEligibilityExpiredNotification'; - const MESSAGE_TYPE_CONTRACT_SIGNED_EMPLOYEE_NOTIFICATION = 'ContractSignedEmployeeNotification'; - const MESSAGE_TYPE_CONTRACT_SIGNED_EMPLOYER_NOTIFICATION = 'ContractSignedEmployerNotification'; - const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING_WITH_LOGIN = 'InitiateEmployeeOnboardingWithLogin'; - const MESSAGE_TYPE_AUTHORISING_SIGNATORY_NOTIFICATION = 'AuthorisingSignatoryNotification'; - const MESSAGE_TYPE_INTEGRATION_CUSTOM_FEATURE_REQUEST = 'IntegrationCustomFeatureRequest'; - const MESSAGE_TYPE_EMAIL_ADDRESS_CHANGED = 'EmailAddressChanged'; - const MESSAGE_TYPE_EMAIL_ADDRESS_CONFIRM_CHANGED = 'EmailAddressConfirmChanged'; - const MESSAGE_TYPE_RECOVERY_EMAIL_ADDRESS_CHANGED = 'RecoveryEmailAddressChanged'; - const MESSAGE_TYPE_RECOVERY_EMAIL_ADDRESS_CONFIRM_CHANGED = 'RecoveryEmailAddressConfirmChanged'; - - - + public const MESSAGE_TYPE_NEW_PAY_SLIP_AVAILABLE = 'NewPaySlipAvailable'; + public const MESSAGE_TYPE_NEW_USER = 'NewUser'; + public const MESSAGE_TYPE_RECOVER_PASSWORD = 'RecoverPassword'; + public const MESSAGE_TYPE_EMPLOYEE_ACCESS = 'EmployeeAccess'; + public const MESSAGE_TYPE_BUSINESS_ACCESS = 'BusinessAccess'; + public const MESSAGE_TYPE_CANCEL_ACCOUNT = 'CancelAccount'; + public const MESSAGE_TYPE_INVOICE = 'Invoice'; + public const MESSAGE_TYPE_INVOICE_PAYMENT_SUCCESS_NOTIFICATION = 'InvoicePaymentSuccessNotification'; + public const MESSAGE_TYPE_AUTOMATED_PASSWORD = 'AutomatedPassword'; + public const MESSAGE_TYPE_LEAVE_REQUEST_NOTIFICATION = 'LeaveRequestNotification'; + public const MESSAGE_TYPE_RESTRICTED_ACCESS = 'RestrictedAccess'; + public const MESSAGE_TYPE_RESEND_PAYSLIP = 'ResendPayslip'; + public const MESSAGE_TYPE_PAYMENT_SUMMARY_AVAILABLE = 'PaymentSummaryAvailable'; + public const MESSAGE_TYPE_SUPER_PAYMENTS_UPDATE_RESULTS = 'SuperPaymentsUpdateResults'; + public const MESSAGE_TYPE_INVOICE_PAYMENT_FAILED_NOTIFICATION = 'InvoicePaymentFailedNotification'; + public const MESSAGE_TYPE_NEW_SHIFTS_PUBLISHED = 'NewShiftsPublished'; + public const MESSAGE_TYPE_SHIFTS_UNPUBLISHED = 'ShiftsUnpublished'; + public const MESSAGE_TYPE_SHIFT_DECLINED = 'ShiftDeclined'; + public const MESSAGE_TYPE_KIOSK_ACCESS_GRANTED = 'KioskAccessGranted'; + public const MESSAGE_TYPE_DAILY_NOTIFICATIONS = 'DailyNotifications'; + public const MESSAGE_TYPE_BSB_DATA_IMPORTED = 'BsbDataImported'; + public const MESSAGE_TYPE_INVOICEE_CARD_DETAILS_REMOVED = 'InvoiceeCardDetailsRemoved'; + public const MESSAGE_TYPE_WHITE_LABEL_MANAGER_ACCESS = 'WhiteLabelManagerAccess'; + public const MESSAGE_TYPE_RESELLER_ACCESS = 'ResellerAccess'; + public const MESSAGE_TYPE_DIRECT_DEPOSIT_REMINDER = 'DirectDepositReminder'; + public const MESSAGE_TYPE_EXPENSE_REQUEST_NOTIFICATION = 'ExpenseRequestNotification'; + public const MESSAGE_TYPE_UNAVAILABILITY_NOTIFICATION = 'UnavailabilityNotification'; + public const MESSAGE_TYPE_REPORT_PACK_GENERATED = 'ReportPackGenerated'; + public const MESSAGE_TYPE_REPORT_PACK_ERROR = 'ReportPackError'; + public const MESSAGE_TYPE_SYSTEM_PUBLIC_HOLIDAY_IMPORT = 'SystemPublicHolidayImport'; + public const MESSAGE_TYPE_TIMESHEET_REJECTED = 'TimesheetRejected'; + public const MESSAGE_TYPE_SHIFT_REPUBLISHED = 'ShiftRepublished'; + public const MESSAGE_TYPE_PENDING_SHIFTS_REMINDER = 'PendingShiftsReminder'; + public const MESSAGE_TYPE_EMPLOYEE_SHIFT_ACTION_TIMEOUT = 'EmployeeShiftActionTimeout'; + public const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING = 'InitiateEmployeeOnboarding'; + public const MESSAGE_TYPE_FOLLOW_UP_EMPLOYEE_ONBOARDING = 'FollowUpEmployeeOnboarding'; + public const MESSAGE_TYPE_COMPLETE_EMPLOYEE_ONBOARDING = 'CompleteEmployeeOnboarding'; + public const MESSAGE_TYPE_NEW_SHIFTS_PRE_ACCEPTED = 'NewShiftsPreAccepted'; + public const MESSAGE_TYPE_PAY_RUN_TASK_NOTIFICATION = 'PayRunTaskNotification'; + public const MESSAGE_TYPE_SHIFT_SWAP_CANCELLED = 'ShiftSwapCancelled'; + public const MESSAGE_TYPE_BULK_SHIFT_SWAPS_CANCELLED = 'BulkShiftSwapsCancelled'; + public const MESSAGE_TYPE_SHIFT_SWAP_AWAITING_APPROVAL = 'ShiftSwapAwaitingApproval'; + public const MESSAGE_TYPE_SHIFT_SWAP_PROPOSED = 'ShiftSwapProposed'; + public const MESSAGE_TYPE_SHIFT_SWAP_ACCEPTED = 'ShiftSwapAccepted'; + public const MESSAGE_TYPE_SHIFT_SWAP_DECLINED = 'ShiftSwapDeclined'; + public const MESSAGE_TYPE_SHIFT_SWAP_REJECTED = 'ShiftSwapRejected'; + public const MESSAGE_TYPE_SHIFT_SWAP_APPROVED = 'ShiftSwapApproved'; + public const MESSAGE_TYPE_P60_AVAILABLE = 'P60Available'; + public const MESSAGE_TYPE_P60_ERROR = 'P60Error'; + public const MESSAGE_TYPE_LEAVING_EMPLOYEE_FORM_NOTIFICATION = 'LeavingEmployeeFormNotification'; + public const MESSAGE_TYPE_AUTO_ENROLMENT_NOTIFICATION = 'AutoEnrolmentNotification'; + public const MESSAGE_TYPE_LODGEMENT_NOTIFICATION = 'LodgementNotification'; + public const MESSAGE_TYPE_TWO_FACTOR_LOGIN = 'TwoFactorLogin'; + public const MESSAGE_TYPE_TWO_FACTOR_CHALLENGE = 'TwoFactorChallenge'; + public const MESSAGE_TYPE_CONFIRM_EMAIL_ADDRESS = 'ConfirmEmailAddress'; + public const MESSAGE_TYPE_CONFIRM_MOBILE_PHONE = 'ConfirmMobilePhone'; + public const MESSAGE_TYPE_DOCUMENT_NOTIFICATION_INITIAL = 'DocumentNotificationInitial'; + public const MESSAGE_TYPE_DOCUMENT_NOTIFICATION_INITIAL_WITH_ACKNOWLEDGEMENT = 'DocumentNotificationInitialWithAcknowledgement'; + public const MESSAGE_TYPE_DOCUMENT_NOTIFICATION_REMINDER = 'DocumentNotificationReminder'; + public const MESSAGE_TYPE_DOCUMENT_ACKNOWLEDGED_NOTIFICATION = 'DocumentAcknowledgedNotification'; + public const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING_ADMIN = 'InitiateEmployeeOnboardingAdmin'; + public const MESSAGE_TYPE_PAY_EVENT_REQUEST_AUTHORITY = 'PayEventRequestAuthority'; + public const MESSAGE_TYPE_PAY_EVENT_APPROVED_OR_REJECTED = 'PayEventApprovedOrRejected'; + public const MESSAGE_TYPE_SHIFT_BID_ACCEPTED = 'ShiftBidAccepted'; + public const MESSAGE_TYPE_EMPLOYEE_DETAILS_UPDATED = 'EmployeeDetailsUpdated'; + public const MESSAGE_TYPE_BANK_ACCOUNT_DETAILS_UPDATED = 'BankAccountDetailsUpdated'; + public const MESSAGE_TYPE_SUPER_DETAILS_UPDATED = 'SuperDetailsUpdated'; + public const MESSAGE_TYPE_MANAGER_SHIFT_ACTION_TIMEOUT = 'ManagerShiftActionTimeout'; + public const MESSAGE_TYPE_SUPER_FUND_NOTIFICATION_NEW_MEMBER = 'SuperFundNotificationNewMember'; + public const MESSAGE_TYPE_SUPER_PAYMENT_DISHONOUR = 'SuperPaymentDishonour'; + public const MESSAGE_TYPE_KIWI_SAVER_DETAILS_UPDATED = 'KiwiSaverDetailsUpdated'; + public const MESSAGE_TYPE_AUTO_ENROLMENT_POSTPONEMENT_NOTIFICATION = 'AutoEnrolmentPostponementNotification'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_CREATION = 'AutomatedPayRunErrorCreation'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_PROCESSING = 'AutomatedPayRunErrorProcessing'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_FINALISATION = 'AutomatedPayRunErrorFinalisation'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_ERROR_POST_FINALISE = 'AutomatedPayRunErrorPostFinalise'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_SUCCESS_AND_FINALISED = 'AutomatedPayRunSuccessAndFinalised'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_SUCCESS_NOT_FINALISED = 'AutomatedPayRunSuccessNotFinalised'; + public const MESSAGE_TYPE_AUTOMATED_PAY_RUN_CREATION = 'AutomatedPayRunCreation'; + public const MESSAGE_TYPE_PAY_RUN_USAGE_BILLING_FAILURES = 'PayRunUsageBillingFailures'; + public const MESSAGE_TYPE_INCOME_STATEMENT_AVAILABLE = 'IncomeStatementAvailable'; + public const MESSAGE_TYPE_MALICIOUS_FILE_NOTIFICATION_ADMIN = 'MaliciousFileNotificationAdmin'; + public const MESSAGE_TYPE_USER_ACCOUNT_LOCKED = 'UserAccountLocked'; + public const MESSAGE_TYPE_MALICIOUS_FILE_NOTIFICATION_EMPLOYEE = 'MaliciousFileNotificationEmployee'; + public const MESSAGE_TYPE_SUPER_FUND_REFUND_NOTIFICATION = 'SuperFundRefundNotification'; + public const MESSAGE_TYPE_SUPER_BATCH_CANCELLED_NOTIFICATION = 'SuperBatchCancelledNotification'; + public const MESSAGE_TYPE_JOB_KEEPER_EMPLOYEE_NOMINATION = 'JobKeeperEmployeeNomination'; + public const MESSAGE_TYPE_HMRC_PAYMENT_REMINDER = 'HmrcPaymentReminder'; + public const MESSAGE_TYPE_IRAS_FORM_AVAILABLE = 'IrasFormAvailable'; + public const MESSAGE_TYPE_HMRC_PAYMENT_REMINDER_SEND_FAILURE = 'HmrcPaymentReminderSendFailure'; + public const MESSAGE_TYPE_SYNC_CANCELLED_SUPER_BATCHES_FROM_BEAM = 'SyncCancelledSuperBatchesFromBeam'; + public const MESSAGE_TYPE_EA_FORM_INCOME_TAX_AVAILABLE = 'EAFormIncomeTaxAvailable'; + public const MESSAGE_TYPE_PCB2_FORM_AVAILABLE = 'PCB2FormAvailable'; + public const MESSAGE_TYPE_JOB_MAKER_EMPLOYEE_NOMINATION = 'JobMakerEmployeeNomination'; + public const MESSAGE_TYPE_EARNINGS_CERTIFICATE_AVAILABLE = 'EarningsCertificateAvailable'; + public const MESSAGE_TYPE_P11D_AVAILABLE = 'P11dAvailable'; + public const MESSAGE_TYPE_PAY_RUN_APPROVAL_NOTIFICATION = 'PayRunApprovalNotification'; + public const MESSAGE_TYPE_PAY_RUN_APPROVAL_REMINDER = 'PayRunApprovalReminder'; + public const MESSAGE_TYPE_PAY_RUN_STATUS_CHANGED = 'PayRunStatusChanged'; + public const MESSAGE_TYPE_QUALIFICATION_UPDATED_NOTIFICATION = 'QualificationUpdatedNotification'; + public const MESSAGE_TYPE_QUALIFICATION_EXPIRING_NOTIFICATION = 'QualificationExpiringNotification'; + public const MESSAGE_TYPE_QUALIFICATION_EXPIRED_NOTIFICATION = 'QualificationExpiredNotification'; + public const MESSAGE_TYPE_CREDIT_CARD_EXPIRING_REMINDER = 'CreditCardExpiringReminder'; + public const MESSAGE_TYPE_RESEND_PAYMENT_AND_DEDUCTION_STATEMENT = 'ResendPaymentAndDeductionStatement'; + public const MESSAGE_TYPE_EMPLOYEE_SELF_SETUP_REMINDER = 'EmployeeSelfSetupReminder'; + public const MESSAGE_TYPE_EMPLOYEE_ONBOARDING_P45_UPLOADED = 'EmployeeOnboardingP45Uploaded'; + public const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING_WITH_CONTRACT = 'InitiateEmployeeOnboardingWithContract'; + public const MESSAGE_TYPE_SIGNATORY_CONTRACT = 'SignatoryContract'; + public const MESSAGE_TYPE_WORK_ELIGIBILITY_EXPIRING_NOTIFICATION = 'WorkEligibilityExpiringNotification'; + public const MESSAGE_TYPE_WORK_ELIGIBILITY_EXPIRED_NOTIFICATION = 'WorkEligibilityExpiredNotification'; + public const MESSAGE_TYPE_CONTRACT_SIGNED_EMPLOYEE_NOTIFICATION = 'ContractSignedEmployeeNotification'; + public const MESSAGE_TYPE_CONTRACT_SIGNED_EMPLOYER_NOTIFICATION = 'ContractSignedEmployerNotification'; + public const MESSAGE_TYPE_INITIATE_EMPLOYEE_ONBOARDING_WITH_LOGIN = 'InitiateEmployeeOnboardingWithLogin'; + public const MESSAGE_TYPE_AUTHORISING_SIGNATORY_NOTIFICATION = 'AuthorisingSignatoryNotification'; + public const MESSAGE_TYPE_INTEGRATION_CUSTOM_FEATURE_REQUEST = 'IntegrationCustomFeatureRequest'; + public const MESSAGE_TYPE_EMAIL_ADDRESS_CHANGED = 'EmailAddressChanged'; + public const MESSAGE_TYPE_EMAIL_ADDRESS_CONFIRM_CHANGED = 'EmailAddressConfirmChanged'; + public const MESSAGE_TYPE_RECOVERY_EMAIL_ADDRESS_CHANGED = 'RecoveryEmailAddressChanged'; + public const MESSAGE_TYPE_RECOVERY_EMAIL_ADDRESS_CONFIRM_CHANGED = 'RecoveryEmailAddressConfirmChanged'; + /** * Gets allowable values of the enum * @@ -414,7 +483,6 @@ public function getMessageTypeAllowableValues() self::MESSAGE_TYPE_RECOVERY_EMAIL_ADDRESS_CONFIRM_CHANGED, ]; } - /** * Associative array for storing property values @@ -431,8 +499,26 @@ public function getMessageTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['message_type'] = isset($data['message_type']) ? $data['message_type'] : null; + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('message_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; } /** @@ -450,7 +536,8 @@ public function listInvalidProperties() $allowedValues = $this->getMessageTypeAllowableValues(); if (!is_null($this->container['message_type']) && !in_array($this->container['message_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'message_type', must be one of '%s'", + "invalid value '%s' for 'message_type', must be one of '%s'", + $this->container['message_type'], implode("', '", $allowedValues) ); } @@ -485,10 +572,13 @@ public function getUsername() * * @param string $username Required * - * @return $this + * @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; @@ -497,7 +587,7 @@ public function setUsername($username) /** * Gets message_type * - * @return string + * @return string|null */ public function getMessageType() { @@ -507,17 +597,21 @@ public function getMessageType() /** * Sets message_type * - * @param string $message_type + * @param string|null $message_type * - * @return $this + * @return self */ public function setMessageType($message_type) { + if (is_null($message_type)) { + throw new \InvalidArgumentException('non-nullable message_type cannot be null'); + } $allowedValues = $this->getMessageTypeAllowableValues(); - if (!is_null($message_type) && !in_array($message_type, $allowedValues, true)) { + if (!in_array($message_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'message_type', must be one of '%s'", + "Invalid value '%s' for 'message_type', must be one of '%s'", + $message_type, implode("', '", $allowedValues) ) ); @@ -533,7 +627,7 @@ public function setMessageType($message_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -543,22 +637,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -574,11 +669,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -586,13 +694,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReducedReportingDimensionValueApiModel.php b/src/lib/Model/ReducedReportingDimensionValueApiModel.php index df2fb02..be71fe5 100644 --- a/src/lib/Model/ReducedReportingDimensionValueApiModel.php +++ b/src/lib/Model/ReducedReportingDimensionValueApiModel.php @@ -2,61 +2,61 @@ /** * ReducedReportingDimensionValueApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReducedReportingDimensionValueApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReducedReportingDimensionValueApiModel implements ModelInterface, ArrayAccess +class ReducedReportingDimensionValueApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReducedReportingDimensionValueApiModel'; + protected static $openAPIModelName = 'ReducedReportingDimensionValueApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'reporting_dimension_id' => 'int' @@ -66,21 +66,41 @@ class ReducedReportingDimensionValueApiModel implements ModelInterface, ArrayAcc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'reporting_dimension_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'reporting_dimension_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['reporting_dimension_id'] = isset($data['reporting_dimension_id']) ? $data['reporting_dimension_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('reporting_dimension_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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -253,12 +343,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -267,7 +360,7 @@ public function setName($name) /** * Gets reporting_dimension_id * - * @return int + * @return int|null */ public function getReportingDimensionId() { @@ -277,12 +370,15 @@ public function getReportingDimensionId() /** * Sets reporting_dimension_id * - * @param int $reporting_dimension_id + * @param int|null $reporting_dimension_id * - * @return $this + * @return self */ public function setReportingDimensionId($reporting_dimension_id) { + if (is_null($reporting_dimension_id)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_id cannot be null'); + } $this->container['reporting_dimension_id'] = $reporting_dimension_id; return $this; @@ -294,7 +390,7 @@ public function setReportingDimensionId($reporting_dimension_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportAccessModel.php b/src/lib/Model/ReportAccessModel.php index d68ba36..da958f5 100644 --- a/src/lib/Model/ReportAccessModel.php +++ b/src/lib/Model/ReportAccessModel.php @@ -2,61 +2,61 @@ /** * ReportAccessModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportAccessModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportAccessModel implements ModelInterface, ArrayAccess +class ReportAccessModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportAccessModel'; + protected static $openAPIModelName = 'ReportAccessModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'access_type' => 'string', 'specific_reports' => 'string', 'no_reporting_restriction' => 'bool' @@ -66,21 +66,41 @@ class ReportAccessModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'access_type' => null, 'specific_reports' => null, 'no_reporting_restriction' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'access_type' => false, + 'specific_reports' => false, + 'no_reporting_restriction' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -165,109 +237,107 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCESS_TYPE_NONE = 'None'; - const ACCESS_TYPE_ALL_REPORTS = 'AllReports'; - const ACCESS_TYPE_SPECIFIC_REPORTS = 'SpecificReports'; - const ACCESS_TYPE_REPORT_PACK = 'ReportPack'; - const SPECIFIC_REPORTS_DETAILED_ACTIVITY_REPORT = 'DetailedActivityReport'; - const SPECIFIC_REPORTS_PAY_RUN_COMPARISON_REPORT = 'PayRunComparisonReport'; - const SPECIFIC_REPORTS_SUPER_CONTRIBUTIONS_REPORT = 'SuperContributionsReport'; - const SPECIFIC_REPORTS_ORDINARY_TIME_EARNINGS_REPORT = 'OrdinaryTimeEarningsReport'; - const SPECIFIC_REPORTS_DEDUCTIONS_REPORT = 'DeductionsReport'; - const SPECIFIC_REPORTS_PAYROLL_TAX_REPORT = 'PayrollTaxReport'; - const SPECIFIC_REPORTS_PAYG_REPORT = 'PaygReport'; - const SPECIFIC_REPORTS_PAY_CATEGORIES_REPORT = 'PayCategoriesReport'; - const SPECIFIC_REPORTS_PAY_RUN_AUDIT_REPORT = 'PayRunAuditReport'; - const SPECIFIC_REPORTS_COSTING_REPORT = 'CostingReport'; - const SPECIFIC_REPORTS_TIMESHEET_REPORT = 'TimesheetReport'; - const SPECIFIC_REPORTS_EXPENSES_REPORT = 'ExpensesReport'; - const SPECIFIC_REPORTS_PAYMENT_HISTORY_REPORT = 'PaymentHistoryReport'; - const SPECIFIC_REPORTS_LEAVE_BALANCES_REPORT = 'LeaveBalancesReport'; - const SPECIFIC_REPORTS_LEAVE_LIABILITY_REPORT = 'LeaveLiabilityReport'; - const SPECIFIC_REPORTS_LEAVE_HISTORY_REPORT = 'LeaveHistoryReport'; - const SPECIFIC_REPORTS_BIRTHDAY_REPORT = 'BirthdayReport'; - const SPECIFIC_REPORTS_EMPLOYEE_DETAILS_REPORT = 'EmployeeDetailsReport'; - const SPECIFIC_REPORTS_UNPAID_EMPLOYEES_REPORT = 'UnpaidEmployeesReport'; - const SPECIFIC_REPORTS_QUALIFICATIONS_REPORT = 'QualificationsReport'; - const SPECIFIC_REPORTS_EMPLOYEE_SATISFACTION_REPORT = 'EmployeeSatisfactionReport'; - const SPECIFIC_REPORTS_ATTENDANCE_REPORT = 'AttendanceReport'; - const SPECIFIC_REPORTS_EMERGENCY_CONTACTS_REPORT = 'EmergencyContactsReport'; - const SPECIFIC_REPORTS_EMPLOYER_LIABILITIES_REPORT = 'EmployerLiabilitiesReport'; - const SPECIFIC_REPORTS_PAY_RUN_VARIANCE_REPORT = 'PayRunVarianceReport'; - const SPECIFIC_REPORTS_EMPLOYEE_DETAILS_AUDIT_REPORT = 'EmployeeDetailsAuditReport'; - const SPECIFIC_REPORTS_GROSS_TO_NET_REPORT = 'GrossToNetReport'; - const SPECIFIC_REPORTS_LIVE_VIEW = 'LiveView'; - const SPECIFIC_REPORTS_TASKS_REPORT = 'TasksReport'; - const SPECIFIC_REPORTS_SHIFT_SWAPPING_REPORT = 'ShiftSwappingReport'; - const SPECIFIC_REPORTS_PENSION_CONTRIBUTIONS_REPORT = 'PensionContributionsReport'; - const SPECIFIC_REPORTS_EMPLOYER_PAYMENT_SUMMARY_REPORT = 'EmployerPaymentSummaryReport'; - const SPECIFIC_REPORTS_PAY_RUN_INCLUSIONS_REPORT = 'PayRunInclusionsReport'; - const SPECIFIC_REPORTS_P32_REPORT = 'P32Report'; - const SPECIFIC_REPORTS_PAY_SLIP_REPORT = 'PaySlipReport'; - const SPECIFIC_REPORTS_PAYMENT_FILE_REPORT = 'PaymentFileReport'; - const SPECIFIC_REPORTS_JOURNAL_REPORT = 'JournalReport'; - const SPECIFIC_REPORTS_IRD_EMPLOYEE_DETAILS_REPORT = 'IrdEmployeeDetailsReport'; - const SPECIFIC_REPORTS_PAY_DAY_FILING_REPORT = 'PayDayFilingReport'; - const SPECIFIC_REPORTS_KIWI_SAVER_REPORT = 'KiwiSaverReport'; - const SPECIFIC_REPORTS_PAYE_REPORT = 'PayeReport'; - const SPECIFIC_REPORTS_KIWI_SAVER_EMPLOYMENT_DETAILS_REPORT = 'KiwiSaverEmploymentDetailsReport'; - const SPECIFIC_REPORTS_EMPLOYER_DEDUCTIONS = 'EmployerDeductions'; - const SPECIFIC_REPORTS_ROSTER_TIMESHEET_COMPARISON_REPORT = 'RosterTimesheetComparisonReport'; - const SPECIFIC_REPORTS_CPF_LODGEMENT_REPORT = 'CpfLodgementReport'; - const SPECIFIC_REPORTS_WITHHOLDING_REPORT = 'WithholdingReport'; - const SPECIFIC_REPORTS_ESCT_RATE_REPORT = 'EsctRateReport'; - const SPECIFIC_REPORTS_JOB_KEEPER_ELIGIBILITY_REPORT = 'JobKeeperEligibilityReport'; - const SPECIFIC_REPORTS_EARNINGS_CERTIFICATE = 'EarningsCertificate'; - const SPECIFIC_REPORTS_IR8_A_REPORT = 'Ir8AReport'; - const SPECIFIC_REPORTS_EXCESS_CPF_CONTRIBUTIONS_REPORT = 'ExcessCpfContributionsReport'; - const SPECIFIC_REPORTS_BENEFITS_IN_KIND_REPORT = 'BenefitsInKindReport'; - const SPECIFIC_REPORTS_SHARE_OPTIONS_REPORT = 'ShareOptionsReport'; - const SPECIFIC_REPORTS_CP39_REPORT = 'Cp39Report'; - const SPECIFIC_REPORTS_EA_FORM_REPORT = 'EAFormReport'; - const SPECIFIC_REPORTS_PCB2_FORM_REPORT = 'PCB2FormReport'; - const SPECIFIC_REPORTS_IRAS_REPORT = 'IrasReport'; - const SPECIFIC_REPORTS_IRAS_LODGEMENT_REPORT = 'IrasLodgementReport'; - const SPECIFIC_REPORTS_PAY_RUN_EXPORT_REPORT = 'PayRunExportReport'; - const SPECIFIC_REPORTS_JOB_MAKER_ELIGIBILITY_REPORT = 'JobMakerEligibilityReport'; - const SPECIFIC_REPORTS_EPF_KWSP6_BORANG_A = 'EpfKwsp6BorangA'; - const SPECIFIC_REPORTS_EPF_KWSP3_REGISTRATION = 'EpfKwsp3Registration'; - const SPECIFIC_REPORTS_MY_BENEFITS_IN_KIND_REPORT = 'MyBenefitsInKindReport'; - const SPECIFIC_REPORTS_EMPLOYEE_BENEFITS_REPORT = 'EmployeeBenefitsReport'; - const SPECIFIC_REPORTS_BENEFITS_NI_REPORT = 'BenefitsNiReport'; - const SPECIFIC_REPORTS_SOCSO_FORM2 = 'SocsoForm2'; - const SPECIFIC_REPORTS_SOCSO_FORM_SIP2A = 'SocsoFormSip2a'; - const SPECIFIC_REPORTS_SOCSO_FORM8A = 'SocsoForm8a'; - const SPECIFIC_REPORTS_PCB_WITHHOLDING_REPORT = 'PcbWithholdingReport'; - const SPECIFIC_REPORTS_SOCSO_FORM3 = 'SocsoForm3'; - const SPECIFIC_REPORTS_IRB_FORM_CP22 = 'IrbFormCp22'; - const SPECIFIC_REPORTS_IRB_FORM_CP22A = 'IrbFormCp22a'; - const SPECIFIC_REPORTS_COMPANY_CARS_REPORT = 'CompanyCarsReport'; - const SPECIFIC_REPORTS_P11_D = 'P11D'; - const SPECIFIC_REPORTS_P11_DB = 'P11Db'; - const SPECIFIC_REPORTS_EMPLOYEE_CARS_REPORT = 'EmployeeCarsReport'; - const SPECIFIC_REPORTS_P46_CAR = 'P46Car'; - const SPECIFIC_REPORTS_IRB_FORM_CP8D = 'IrbFormCp8d'; - const SPECIFIC_REPORTS_DOCUMENT_ACKNOWLEDGEMENTS_REPORT = 'DocumentAcknowledgementsReport'; - const SPECIFIC_REPORTS_PAYMENT_AND_DEDUCTION_STATEMENT_REPORT = 'PaymentAndDeductionStatementReport'; - const SPECIFIC_REPORTS_UK_GENDER_PAY_GAP_DATA_REPORT = 'UkGenderPayGapDataReport'; - const SPECIFIC_REPORTS_CIS300 = 'Cis300'; - const SPECIFIC_REPORTS_ZAKAT = 'Zakat'; - const SPECIFIC_REPORTS_EIS_CONTRIBUTIONS_REPORT = 'EisContributionsReport'; - const SPECIFIC_REPORTS_EMPLOYEE_LEAVE_RATES_REPORT = 'EmployeeLeaveRatesReport'; - const SPECIFIC_REPORTS_P11 = 'P11'; - const SPECIFIC_REPORTS_P60 = 'P60'; - const SPECIFIC_REPORTS_AVERAGE_HOURS_REPORT = 'AverageHoursReport'; - const SPECIFIC_REPORTS_UK_COURT_ORDER_REPORT = 'UkCourtOrderReport'; - const SPECIFIC_REPORTS_UK_OCCUPATIONAL_PAY_REPORT = 'UkOccupationalPayReport'; - const SPECIFIC_REPORTS_EIS_SOCSO_COMBINED_CONTRIBUTIONS_REPORT = 'EisSocsoCombinedContributionsReport'; - const SPECIFIC_REPORTS_P45_REPORT = 'P45Report'; - const SPECIFIC_REPORTS_CPF_OW_AND_AW_RECONCILIATION_REPORT = 'CpfOwAndAwReconciliationReport'; - - - + public const ACCESS_TYPE_NONE = 'None'; + public const ACCESS_TYPE_ALL_REPORTS = 'AllReports'; + public const ACCESS_TYPE_SPECIFIC_REPORTS = 'SpecificReports'; + public const ACCESS_TYPE_REPORT_PACK = 'ReportPack'; + public const SPECIFIC_REPORTS_DETAILED_ACTIVITY_REPORT = 'DetailedActivityReport'; + public const SPECIFIC_REPORTS_PAY_RUN_COMPARISON_REPORT = 'PayRunComparisonReport'; + public const SPECIFIC_REPORTS_SUPER_CONTRIBUTIONS_REPORT = 'SuperContributionsReport'; + public const SPECIFIC_REPORTS_ORDINARY_TIME_EARNINGS_REPORT = 'OrdinaryTimeEarningsReport'; + public const SPECIFIC_REPORTS_DEDUCTIONS_REPORT = 'DeductionsReport'; + public const SPECIFIC_REPORTS_PAYROLL_TAX_REPORT = 'PayrollTaxReport'; + public const SPECIFIC_REPORTS_PAYG_REPORT = 'PaygReport'; + public const SPECIFIC_REPORTS_PAY_CATEGORIES_REPORT = 'PayCategoriesReport'; + public const SPECIFIC_REPORTS_PAY_RUN_AUDIT_REPORT = 'PayRunAuditReport'; + public const SPECIFIC_REPORTS_COSTING_REPORT = 'CostingReport'; + public const SPECIFIC_REPORTS_TIMESHEET_REPORT = 'TimesheetReport'; + public const SPECIFIC_REPORTS_EXPENSES_REPORT = 'ExpensesReport'; + public const SPECIFIC_REPORTS_PAYMENT_HISTORY_REPORT = 'PaymentHistoryReport'; + public const SPECIFIC_REPORTS_LEAVE_BALANCES_REPORT = 'LeaveBalancesReport'; + public const SPECIFIC_REPORTS_LEAVE_LIABILITY_REPORT = 'LeaveLiabilityReport'; + public const SPECIFIC_REPORTS_LEAVE_HISTORY_REPORT = 'LeaveHistoryReport'; + public const SPECIFIC_REPORTS_BIRTHDAY_REPORT = 'BirthdayReport'; + public const SPECIFIC_REPORTS_EMPLOYEE_DETAILS_REPORT = 'EmployeeDetailsReport'; + public const SPECIFIC_REPORTS_UNPAID_EMPLOYEES_REPORT = 'UnpaidEmployeesReport'; + public const SPECIFIC_REPORTS_QUALIFICATIONS_REPORT = 'QualificationsReport'; + public const SPECIFIC_REPORTS_EMPLOYEE_SATISFACTION_REPORT = 'EmployeeSatisfactionReport'; + public const SPECIFIC_REPORTS_ATTENDANCE_REPORT = 'AttendanceReport'; + public const SPECIFIC_REPORTS_EMERGENCY_CONTACTS_REPORT = 'EmergencyContactsReport'; + public const SPECIFIC_REPORTS_EMPLOYER_LIABILITIES_REPORT = 'EmployerLiabilitiesReport'; + public const SPECIFIC_REPORTS_PAY_RUN_VARIANCE_REPORT = 'PayRunVarianceReport'; + public const SPECIFIC_REPORTS_EMPLOYEE_DETAILS_AUDIT_REPORT = 'EmployeeDetailsAuditReport'; + public const SPECIFIC_REPORTS_GROSS_TO_NET_REPORT = 'GrossToNetReport'; + public const SPECIFIC_REPORTS_LIVE_VIEW = 'LiveView'; + public const SPECIFIC_REPORTS_TASKS_REPORT = 'TasksReport'; + public const SPECIFIC_REPORTS_SHIFT_SWAPPING_REPORT = 'ShiftSwappingReport'; + public const SPECIFIC_REPORTS_PENSION_CONTRIBUTIONS_REPORT = 'PensionContributionsReport'; + public const SPECIFIC_REPORTS_EMPLOYER_PAYMENT_SUMMARY_REPORT = 'EmployerPaymentSummaryReport'; + public const SPECIFIC_REPORTS_PAY_RUN_INCLUSIONS_REPORT = 'PayRunInclusionsReport'; + public const SPECIFIC_REPORTS_P32_REPORT = 'P32Report'; + public const SPECIFIC_REPORTS_PAY_SLIP_REPORT = 'PaySlipReport'; + public const SPECIFIC_REPORTS_PAYMENT_FILE_REPORT = 'PaymentFileReport'; + public const SPECIFIC_REPORTS_JOURNAL_REPORT = 'JournalReport'; + public const SPECIFIC_REPORTS_IRD_EMPLOYEE_DETAILS_REPORT = 'IrdEmployeeDetailsReport'; + public const SPECIFIC_REPORTS_PAY_DAY_FILING_REPORT = 'PayDayFilingReport'; + public const SPECIFIC_REPORTS_KIWI_SAVER_REPORT = 'KiwiSaverReport'; + public const SPECIFIC_REPORTS_PAYE_REPORT = 'PayeReport'; + public const SPECIFIC_REPORTS_KIWI_SAVER_EMPLOYMENT_DETAILS_REPORT = 'KiwiSaverEmploymentDetailsReport'; + public const SPECIFIC_REPORTS_EMPLOYER_DEDUCTIONS = 'EmployerDeductions'; + public const SPECIFIC_REPORTS_ROSTER_TIMESHEET_COMPARISON_REPORT = 'RosterTimesheetComparisonReport'; + public const SPECIFIC_REPORTS_CPF_LODGEMENT_REPORT = 'CpfLodgementReport'; + public const SPECIFIC_REPORTS_WITHHOLDING_REPORT = 'WithholdingReport'; + public const SPECIFIC_REPORTS_ESCT_RATE_REPORT = 'EsctRateReport'; + public const SPECIFIC_REPORTS_JOB_KEEPER_ELIGIBILITY_REPORT = 'JobKeeperEligibilityReport'; + public const SPECIFIC_REPORTS_EARNINGS_CERTIFICATE = 'EarningsCertificate'; + public const SPECIFIC_REPORTS_IR8_A_REPORT = 'Ir8AReport'; + public const SPECIFIC_REPORTS_EXCESS_CPF_CONTRIBUTIONS_REPORT = 'ExcessCpfContributionsReport'; + public const SPECIFIC_REPORTS_BENEFITS_IN_KIND_REPORT = 'BenefitsInKindReport'; + public const SPECIFIC_REPORTS_SHARE_OPTIONS_REPORT = 'ShareOptionsReport'; + public const SPECIFIC_REPORTS_CP39_REPORT = 'Cp39Report'; + public const SPECIFIC_REPORTS_EA_FORM_REPORT = 'EAFormReport'; + public const SPECIFIC_REPORTS_PCB2_FORM_REPORT = 'PCB2FormReport'; + public const SPECIFIC_REPORTS_IRAS_REPORT = 'IrasReport'; + public const SPECIFIC_REPORTS_IRAS_LODGEMENT_REPORT = 'IrasLodgementReport'; + public const SPECIFIC_REPORTS_PAY_RUN_EXPORT_REPORT = 'PayRunExportReport'; + public const SPECIFIC_REPORTS_JOB_MAKER_ELIGIBILITY_REPORT = 'JobMakerEligibilityReport'; + public const SPECIFIC_REPORTS_EPF_KWSP6_BORANG_A = 'EpfKwsp6BorangA'; + public const SPECIFIC_REPORTS_EPF_KWSP3_REGISTRATION = 'EpfKwsp3Registration'; + public const SPECIFIC_REPORTS_MY_BENEFITS_IN_KIND_REPORT = 'MyBenefitsInKindReport'; + public const SPECIFIC_REPORTS_EMPLOYEE_BENEFITS_REPORT = 'EmployeeBenefitsReport'; + public const SPECIFIC_REPORTS_BENEFITS_NI_REPORT = 'BenefitsNiReport'; + public const SPECIFIC_REPORTS_SOCSO_FORM2 = 'SocsoForm2'; + public const SPECIFIC_REPORTS_SOCSO_FORM_SIP2A = 'SocsoFormSip2a'; + public const SPECIFIC_REPORTS_SOCSO_FORM8A = 'SocsoForm8a'; + public const SPECIFIC_REPORTS_PCB_WITHHOLDING_REPORT = 'PcbWithholdingReport'; + public const SPECIFIC_REPORTS_SOCSO_FORM3 = 'SocsoForm3'; + public const SPECIFIC_REPORTS_IRB_FORM_CP22 = 'IrbFormCp22'; + public const SPECIFIC_REPORTS_IRB_FORM_CP22A = 'IrbFormCp22a'; + public const SPECIFIC_REPORTS_COMPANY_CARS_REPORT = 'CompanyCarsReport'; + public const SPECIFIC_REPORTS_P11_D = 'P11D'; + public const SPECIFIC_REPORTS_P11_DB = 'P11Db'; + public const SPECIFIC_REPORTS_EMPLOYEE_CARS_REPORT = 'EmployeeCarsReport'; + public const SPECIFIC_REPORTS_P46_CAR = 'P46Car'; + public const SPECIFIC_REPORTS_IRB_FORM_CP8D = 'IrbFormCp8d'; + public const SPECIFIC_REPORTS_DOCUMENT_ACKNOWLEDGEMENTS_REPORT = 'DocumentAcknowledgementsReport'; + public const SPECIFIC_REPORTS_PAYMENT_AND_DEDUCTION_STATEMENT_REPORT = 'PaymentAndDeductionStatementReport'; + public const SPECIFIC_REPORTS_UK_GENDER_PAY_GAP_DATA_REPORT = 'UkGenderPayGapDataReport'; + public const SPECIFIC_REPORTS_CIS300 = 'Cis300'; + public const SPECIFIC_REPORTS_ZAKAT = 'Zakat'; + public const SPECIFIC_REPORTS_EIS_CONTRIBUTIONS_REPORT = 'EisContributionsReport'; + public const SPECIFIC_REPORTS_EMPLOYEE_LEAVE_RATES_REPORT = 'EmployeeLeaveRatesReport'; + public const SPECIFIC_REPORTS_P11 = 'P11'; + public const SPECIFIC_REPORTS_P60 = 'P60'; + public const SPECIFIC_REPORTS_AVERAGE_HOURS_REPORT = 'AverageHoursReport'; + public const SPECIFIC_REPORTS_UK_COURT_ORDER_REPORT = 'UkCourtOrderReport'; + public const SPECIFIC_REPORTS_UK_OCCUPATIONAL_PAY_REPORT = 'UkOccupationalPayReport'; + public const SPECIFIC_REPORTS_EIS_SOCSO_COMBINED_CONTRIBUTIONS_REPORT = 'EisSocsoCombinedContributionsReport'; + public const SPECIFIC_REPORTS_P45_REPORT = 'P45Report'; + public const SPECIFIC_REPORTS_CPF_OW_AND_AW_RECONCILIATION_REPORT = 'CpfOwAndAwReconciliationReport'; + /** * Gets allowable values of the enum * @@ -282,7 +352,7 @@ public function getAccessTypeAllowableValues() self::ACCESS_TYPE_REPORT_PACK, ]; } - + /** * Gets allowable values of the enum * @@ -386,7 +456,6 @@ public function getSpecificReportsAllowableValues() self::SPECIFIC_REPORTS_CPF_OW_AND_AW_RECONCILIATION_REPORT, ]; } - /** * Associative array for storing property values @@ -403,9 +472,27 @@ public function getSpecificReportsAllowableValues() */ public function __construct(array $data = null) { - $this->container['access_type'] = isset($data['access_type']) ? $data['access_type'] : null; - $this->container['specific_reports'] = isset($data['specific_reports']) ? $data['specific_reports'] : null; - $this->container['no_reporting_restriction'] = isset($data['no_reporting_restriction']) ? $data['no_reporting_restriction'] : null; + $this->setIfExists('access_type', $data ?? [], null); + $this->setIfExists('specific_reports', $data ?? [], null); + $this->setIfExists('no_reporting_restriction', $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; } /** @@ -420,7 +507,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccessTypeAllowableValues(); if (!is_null($this->container['access_type']) && !in_array($this->container['access_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'access_type', must be one of '%s'", + "invalid value '%s' for 'access_type', must be one of '%s'", + $this->container['access_type'], implode("', '", $allowedValues) ); } @@ -428,7 +516,8 @@ public function listInvalidProperties() $allowedValues = $this->getSpecificReportsAllowableValues(); if (!is_null($this->container['specific_reports']) && !in_array($this->container['specific_reports'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'specific_reports', must be one of '%s'", + "invalid value '%s' for 'specific_reports', must be one of '%s'", + $this->container['specific_reports'], implode("', '", $allowedValues) ); } @@ -451,7 +540,7 @@ public function valid() /** * Gets access_type * - * @return string + * @return string|null */ public function getAccessType() { @@ -461,17 +550,21 @@ public function getAccessType() /** * Sets access_type * - * @param string $access_type + * @param string|null $access_type * - * @return $this + * @return self */ public function setAccessType($access_type) { + if (is_null($access_type)) { + throw new \InvalidArgumentException('non-nullable access_type cannot be null'); + } $allowedValues = $this->getAccessTypeAllowableValues(); - if (!is_null($access_type) && !in_array($access_type, $allowedValues, true)) { + if (!in_array($access_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'access_type', must be one of '%s'", + "Invalid value '%s' for 'access_type', must be one of '%s'", + $access_type, implode("', '", $allowedValues) ) ); @@ -484,7 +577,7 @@ public function setAccessType($access_type) /** * Gets specific_reports * - * @return string + * @return string|null */ public function getSpecificReports() { @@ -494,17 +587,21 @@ public function getSpecificReports() /** * Sets specific_reports * - * @param string $specific_reports Comma separated list of ReportEnum. + * @param string|null $specific_reports Comma separated list of ReportEnum. * - * @return $this + * @return self */ public function setSpecificReports($specific_reports) { + if (is_null($specific_reports)) { + throw new \InvalidArgumentException('non-nullable specific_reports cannot be null'); + } $allowedValues = $this->getSpecificReportsAllowableValues(); - if (!is_null($specific_reports) && !in_array($specific_reports, $allowedValues, true)) { + if (!in_array($specific_reports, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'specific_reports', must be one of '%s'", + "Invalid value '%s' for 'specific_reports', must be one of '%s'", + $specific_reports, implode("', '", $allowedValues) ) ); @@ -517,7 +614,7 @@ public function setSpecificReports($specific_reports) /** * Gets no_reporting_restriction * - * @return bool + * @return bool|null */ public function getNoReportingRestriction() { @@ -527,12 +624,15 @@ public function getNoReportingRestriction() /** * Sets no_reporting_restriction * - * @param bool $no_reporting_restriction + * @param bool|null $no_reporting_restriction * - * @return $this + * @return self */ public function setNoReportingRestriction($no_reporting_restriction) { + if (is_null($no_reporting_restriction)) { + throw new \InvalidArgumentException('non-nullable no_reporting_restriction cannot be null'); + } $this->container['no_reporting_restriction'] = $no_reporting_restriction; return $this; @@ -544,7 +644,7 @@ public function setNoReportingRestriction($no_reporting_restriction) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -554,22 +654,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -585,11 +686,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -597,13 +711,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportLeaveLiabilityRequestModel.php b/src/lib/Model/ReportLeaveLiabilityRequestModel.php index 0f0bae4..b4b5219 100644 --- a/src/lib/Model/ReportLeaveLiabilityRequestModel.php +++ b/src/lib/Model/ReportLeaveLiabilityRequestModel.php @@ -2,61 +2,61 @@ /** * ReportLeaveLiabilityRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportLeaveLiabilityRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportLeaveLiabilityRequestModel implements ModelInterface, ArrayAccess +class ReportLeaveLiabilityRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportLeaveLiabilityRequestModel'; + protected static $openAPIModelName = 'ReportLeaveLiabilityRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'leave_type_id' => 'int', 'include_approved_leave' => 'bool', @@ -68,8 +68,10 @@ class ReportLeaveLiabilityRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'leave_type_id' => 'int32', 'include_approved_leave' => null, @@ -77,14 +79,34 @@ class ReportLeaveLiabilityRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'leave_type_id' => false, + 'include_approved_leave' => false, + 'as_at_date' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['leave_type_id'] = isset($data['leave_type_id']) ? $data['leave_type_id'] : null; - $this->container['include_approved_leave'] = isset($data['include_approved_leave']) ? $data['include_approved_leave'] : null; - $this->container['as_at_date'] = isset($data['as_at_date']) ? $data['as_at_date'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('leave_type_id', $data ?? [], null); + $this->setIfExists('include_approved_leave', $data ?? [], null); + $this->setIfExists('as_at_date', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -241,12 +330,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -255,7 +347,7 @@ public function setLocationId($location_id) /** * Gets leave_type_id * - * @return int + * @return int|null */ public function getLeaveTypeId() { @@ -265,12 +357,15 @@ public function getLeaveTypeId() /** * Sets leave_type_id * - * @param int $leave_type_id + * @param int|null $leave_type_id * - * @return $this + * @return self */ public function setLeaveTypeId($leave_type_id) { + if (is_null($leave_type_id)) { + throw new \InvalidArgumentException('non-nullable leave_type_id cannot be null'); + } $this->container['leave_type_id'] = $leave_type_id; return $this; @@ -279,7 +374,7 @@ public function setLeaveTypeId($leave_type_id) /** * Gets include_approved_leave * - * @return bool + * @return bool|null */ public function getIncludeApprovedLeave() { @@ -289,12 +384,15 @@ public function getIncludeApprovedLeave() /** * Sets include_approved_leave * - * @param bool $include_approved_leave + * @param bool|null $include_approved_leave * - * @return $this + * @return self */ public function setIncludeApprovedLeave($include_approved_leave) { + if (is_null($include_approved_leave)) { + throw new \InvalidArgumentException('non-nullable include_approved_leave cannot be null'); + } $this->container['include_approved_leave'] = $include_approved_leave; return $this; @@ -303,7 +401,7 @@ public function setIncludeApprovedLeave($include_approved_leave) /** * Gets as_at_date * - * @return \DateTime + * @return \DateTime|null */ public function getAsAtDate() { @@ -313,12 +411,15 @@ public function getAsAtDate() /** * Sets as_at_date * - * @param \DateTime $as_at_date + * @param \DateTime|null $as_at_date * - * @return $this + * @return self */ public function setAsAtDate($as_at_date) { + if (is_null($as_at_date)) { + throw new \InvalidArgumentException('non-nullable as_at_date cannot be null'); + } $this->container['as_at_date'] = $as_at_date; return $this; @@ -327,7 +428,7 @@ public function setAsAtDate($as_at_date) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -337,12 +438,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -354,7 +458,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportPackModel.php b/src/lib/Model/ReportPackModel.php index 81d4a9f..079dfd3 100644 --- a/src/lib/Model/ReportPackModel.php +++ b/src/lib/Model/ReportPackModel.php @@ -2,61 +2,61 @@ /** * ReportPackModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportPackModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportPackModel implements ModelInterface, ArrayAccess +class ReportPackModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportPackModel'; + protected static $openAPIModelName = 'ReportPackModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class ReportPackModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportRequestWithPayScheduleModel.php b/src/lib/Model/ReportRequestWithPayScheduleModel.php index f9a8f91..2d4d8e1 100644 --- a/src/lib/Model/ReportRequestWithPayScheduleModel.php +++ b/src/lib/Model/ReportRequestWithPayScheduleModel.php @@ -2,61 +2,61 @@ /** * ReportRequestWithPayScheduleModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportRequestWithPayScheduleModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportRequestWithPayScheduleModel implements ModelInterface, ArrayAccess +class ReportRequestWithPayScheduleModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportRequestWithPayScheduleModel'; + protected static $openAPIModelName = 'ReportRequestWithPayScheduleModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_schedule_id' => 'int', 'include_post_tax_deductions' => 'bool', 'from_date' => '\DateTime', @@ -69,8 +69,10 @@ class ReportRequestWithPayScheduleModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_schedule_id' => 'int32', 'include_post_tax_deductions' => null, 'from_date' => 'date-time', @@ -79,14 +81,35 @@ class ReportRequestWithPayScheduleModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -247,12 +337,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -261,7 +354,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -271,12 +364,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -285,7 +381,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -295,12 +391,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -309,7 +408,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -319,12 +418,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -333,7 +435,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -343,12 +445,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -357,7 +462,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -367,12 +472,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -384,7 +492,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportingDimensionApiModel.php b/src/lib/Model/ReportingDimensionApiModel.php index b3b052e..7951d44 100644 --- a/src/lib/Model/ReportingDimensionApiModel.php +++ b/src/lib/Model/ReportingDimensionApiModel.php @@ -2,61 +2,61 @@ /** * ReportingDimensionApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportingDimensionApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportingDimensionApiModel implements ModelInterface, ArrayAccess +class ReportingDimensionApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportingDimensionApiModel'; + protected static $openAPIModelName = 'ReportingDimensionApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'source' => 'string', @@ -67,22 +67,43 @@ class ReportingDimensionApiModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'source' => null, 'external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'source' => false, + 'external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,88 +243,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -338,7 +409,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -355,10 +425,28 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('external_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; } /** @@ -373,7 +461,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -396,7 +485,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -406,12 +495,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -420,7 +512,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -430,12 +522,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -444,7 +539,7 @@ public function setName($name) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -454,17 +549,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -477,7 +576,7 @@ public function setSource($source) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -487,12 +586,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -504,7 +606,7 @@ public function setExternalId($external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +616,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +648,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +673,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportingDimensionValueApiModel.php b/src/lib/Model/ReportingDimensionValueApiModel.php index 47bc774..e5c8cab 100644 --- a/src/lib/Model/ReportingDimensionValueApiModel.php +++ b/src/lib/Model/ReportingDimensionValueApiModel.php @@ -2,61 +2,61 @@ /** * ReportingDimensionValueApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportingDimensionValueApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportingDimensionValueApiModel implements ModelInterface, ArrayAccess +class ReportingDimensionValueApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportingDimensionValueApiModel'; + protected static $openAPIModelName = 'ReportingDimensionValueApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'reporting_dimension_id' => 'int', @@ -65,15 +65,17 @@ class ReportingDimensionValueApiModel implements ModelInterface, ArrayAccess 'all_employees' => 'bool', 'specific_employees' => 'string', 'filter_combination_strategy' => 'string', - 'filters' => '\Swagger\Client\Model\ReportingDimensionValueFilterApiModel[]' + 'filters' => '\OpenAPI\Client\Model\ReportingDimensionValueFilterApiModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'reporting_dimension_id' => 'int32', @@ -85,14 +87,38 @@ class ReportingDimensionValueApiModel implements ModelInterface, ArrayAccess 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'reporting_dimension_id' => false, + 'source' => false, + 'external_id' => false, + 'all_employees' => false, + 'specific_employees' => false, + 'filter_combination_strategy' => false, + 'filters' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -195,88 +273,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -363,7 +439,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -380,15 +455,33 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['reporting_dimension_id'] = isset($data['reporting_dimension_id']) ? $data['reporting_dimension_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['all_employees'] = isset($data['all_employees']) ? $data['all_employees'] : null; - $this->container['specific_employees'] = isset($data['specific_employees']) ? $data['specific_employees'] : null; - $this->container['filter_combination_strategy'] = isset($data['filter_combination_strategy']) ? $data['filter_combination_strategy'] : null; - $this->container['filters'] = isset($data['filters']) ? $data['filters'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('reporting_dimension_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('all_employees', $data ?? [], null); + $this->setIfExists('specific_employees', $data ?? [], null); + $this->setIfExists('filter_combination_strategy', $data ?? [], null); + $this->setIfExists('filters', $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; } /** @@ -403,7 +496,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -426,7 +520,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -436,12 +530,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -450,7 +547,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -460,12 +557,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -474,7 +574,7 @@ public function setName($name) /** * Gets reporting_dimension_id * - * @return int + * @return int|null */ public function getReportingDimensionId() { @@ -484,12 +584,15 @@ public function getReportingDimensionId() /** * Sets reporting_dimension_id * - * @param int $reporting_dimension_id + * @param int|null $reporting_dimension_id * - * @return $this + * @return self */ public function setReportingDimensionId($reporting_dimension_id) { + if (is_null($reporting_dimension_id)) { + throw new \InvalidArgumentException('non-nullable reporting_dimension_id cannot be null'); + } $this->container['reporting_dimension_id'] = $reporting_dimension_id; return $this; @@ -498,7 +601,7 @@ public function setReportingDimensionId($reporting_dimension_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -508,17 +611,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -531,7 +638,7 @@ public function setSource($source) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -541,12 +648,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -555,7 +665,7 @@ public function setExternalId($external_id) /** * Gets all_employees * - * @return bool + * @return bool|null */ public function getAllEmployees() { @@ -565,12 +675,15 @@ public function getAllEmployees() /** * Sets all_employees * - * @param bool $all_employees + * @param bool|null $all_employees * - * @return $this + * @return self */ public function setAllEmployees($all_employees) { + if (is_null($all_employees)) { + throw new \InvalidArgumentException('non-nullable all_employees cannot be null'); + } $this->container['all_employees'] = $all_employees; return $this; @@ -579,7 +692,7 @@ public function setAllEmployees($all_employees) /** * Gets specific_employees * - * @return string + * @return string|null */ public function getSpecificEmployees() { @@ -589,12 +702,15 @@ public function getSpecificEmployees() /** * Sets specific_employees * - * @param string $specific_employees + * @param string|null $specific_employees * - * @return $this + * @return self */ public function setSpecificEmployees($specific_employees) { + if (is_null($specific_employees)) { + throw new \InvalidArgumentException('non-nullable specific_employees cannot be null'); + } $this->container['specific_employees'] = $specific_employees; return $this; @@ -603,7 +719,7 @@ public function setSpecificEmployees($specific_employees) /** * Gets filter_combination_strategy * - * @return string + * @return string|null */ public function getFilterCombinationStrategy() { @@ -613,12 +729,15 @@ public function getFilterCombinationStrategy() /** * Sets filter_combination_strategy * - * @param string $filter_combination_strategy + * @param string|null $filter_combination_strategy * - * @return $this + * @return self */ public function setFilterCombinationStrategy($filter_combination_strategy) { + if (is_null($filter_combination_strategy)) { + throw new \InvalidArgumentException('non-nullable filter_combination_strategy cannot be null'); + } $this->container['filter_combination_strategy'] = $filter_combination_strategy; return $this; @@ -627,7 +746,7 @@ public function setFilterCombinationStrategy($filter_combination_strategy) /** * Gets filters * - * @return \Swagger\Client\Model\ReportingDimensionValueFilterApiModel[] + * @return \OpenAPI\Client\Model\ReportingDimensionValueFilterApiModel[]|null */ public function getFilters() { @@ -637,12 +756,15 @@ public function getFilters() /** * Sets filters * - * @param \Swagger\Client\Model\ReportingDimensionValueFilterApiModel[] $filters + * @param \OpenAPI\Client\Model\ReportingDimensionValueFilterApiModel[]|null $filters * - * @return $this + * @return self */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; @@ -654,7 +776,7 @@ public function setFilters($filters) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -664,22 +786,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,11 +818,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -707,13 +843,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ReportingDimensionValueFilterApiModel.php b/src/lib/Model/ReportingDimensionValueFilterApiModel.php index 73032e5..fd7c58f 100644 --- a/src/lib/Model/ReportingDimensionValueFilterApiModel.php +++ b/src/lib/Model/ReportingDimensionValueFilterApiModel.php @@ -2,61 +2,61 @@ /** * ReportingDimensionValueFilterApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ReportingDimensionValueFilterApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ReportingDimensionValueFilterApiModel implements ModelInterface, ArrayAccess +class ReportingDimensionValueFilterApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ReportingDimensionValueFilterApiModel'; + protected static $openAPIModelName = 'ReportingDimensionValueFilterApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'filter_type' => 'string', 'value' => 'string' ]; @@ -65,20 +65,39 @@ class ReportingDimensionValueFilterApiModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'filter_type' => null, 'value' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filter_type' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filter_type'] = isset($data['filter_type']) ? $data['filter_type'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; + $this->setIfExists('filter_type', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets filter_type * - * @return string + * @return string|null */ public function getFilterType() { @@ -223,12 +309,15 @@ public function getFilterType() /** * Sets filter_type * - * @param string $filter_type + * @param string|null $filter_type * - * @return $this + * @return self */ public function setFilterType($filter_type) { + if (is_null($filter_type)) { + throw new \InvalidArgumentException('non-nullable filter_type cannot be null'); + } $this->container['filter_type'] = $filter_type; return $this; @@ -237,7 +326,7 @@ public function setFilterType($filter_type) /** * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -247,12 +336,15 @@ public function getValue() /** * Sets value * - * @param string $value + * @param string|null $value * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setValue($value) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ResellerModel.php b/src/lib/Model/ResellerModel.php index 7b880bf..ea99d2f 100644 --- a/src/lib/Model/ResellerModel.php +++ b/src/lib/Model/ResellerModel.php @@ -2,61 +2,61 @@ /** * ResellerModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ResellerModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ResellerModel implements ModelInterface, ArrayAccess +class ResellerModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ResellerModel'; + protected static $openAPIModelName = 'ResellerModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class ResellerModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RosterShiftBreakApiModel.php b/src/lib/Model/RosterShiftBreakApiModel.php index d948511..f38b8d6 100644 --- a/src/lib/Model/RosterShiftBreakApiModel.php +++ b/src/lib/Model/RosterShiftBreakApiModel.php @@ -2,61 +2,61 @@ /** * RosterShiftBreakApiModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RosterShiftBreakApiModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RosterShiftBreakApiModel implements ModelInterface, ArrayAccess +class RosterShiftBreakApiModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RosterShiftBreakApiModel'; + protected static $openAPIModelName = 'RosterShiftBreakApiModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'start_time' => '\DateTime', 'end_time' => '\DateTime', @@ -67,22 +67,43 @@ class RosterShiftBreakApiModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'start_time' => 'date-time', 'end_time' => 'date-time', 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'start_time' => false, + 'end_time' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -259,12 +350,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -273,7 +367,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -283,12 +377,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -297,7 +394,7 @@ public function setEndTime($end_time) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -307,12 +404,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -324,7 +424,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RosterShiftEditModel.php b/src/lib/Model/RosterShiftEditModel.php index 736d88f..75206b6 100644 --- a/src/lib/Model/RosterShiftEditModel.php +++ b/src/lib/Model/RosterShiftEditModel.php @@ -2,71 +2,71 @@ /** * RosterShiftEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RosterShiftEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RosterShiftEditModel implements ModelInterface, ArrayAccess +class RosterShiftEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RosterShiftEditModel'; + protected static $openAPIModelName = 'RosterShiftEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', - 'qualifications' => '\Swagger\Client\Model\QualificationModel[]', - 'breaks' => '\Swagger\Client\Model\RosterShiftBreakApiModel[]', + 'qualifications' => '\OpenAPI\Client\Model\QualificationModel[]', + 'breaks' => '\OpenAPI\Client\Model\RosterShiftBreakApiModel[]', 'employee_id' => 'int', 'employee_name' => 'string', 'location_id' => 'int', 'location_name' => 'string', 'work_type_id' => 'int', 'work_type_name' => 'string', - 'role' => '\Swagger\Client\Model\RosterShiftRole', + 'role' => '\OpenAPI\Client\Model\RosterShiftRole', 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'notes' => 'string' @@ -76,8 +76,10 @@ class RosterShiftEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'qualifications' => null, 'breaks' => null, @@ -93,14 +95,42 @@ class RosterShiftEditModel implements ModelInterface, ArrayAccess 'notes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'qualifications' => false, + 'breaks' => false, + 'employee_id' => false, + 'employee_name' => false, + 'location_id' => false, + 'location_name' => false, + 'work_type_id' => false, + 'work_type_name' => false, + 'role' => false, + 'start_time' => false, + 'end_time' => false, + 'notes' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -215,12 +297,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -237,19 +316,37 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['qualifications'] = isset($data['qualifications']) ? $data['qualifications'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type_name'] = isset($data['work_type_name']) ? $data['work_type_name'] : null; - $this->container['role'] = isset($data['role']) ? $data['role'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('qualifications', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type_name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('notes', $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; } /** @@ -279,7 +376,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -289,12 +386,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -303,7 +403,7 @@ public function setId($id) /** * Gets qualifications * - * @return \Swagger\Client\Model\QualificationModel[] + * @return \OpenAPI\Client\Model\QualificationModel[]|null */ public function getQualifications() { @@ -313,12 +413,15 @@ public function getQualifications() /** * Sets qualifications * - * @param \Swagger\Client\Model\QualificationModel[] $qualifications + * @param \OpenAPI\Client\Model\QualificationModel[]|null $qualifications * - * @return $this + * @return self */ public function setQualifications($qualifications) { + if (is_null($qualifications)) { + throw new \InvalidArgumentException('non-nullable qualifications cannot be null'); + } $this->container['qualifications'] = $qualifications; return $this; @@ -327,7 +430,7 @@ public function setQualifications($qualifications) /** * Gets breaks * - * @return \Swagger\Client\Model\RosterShiftBreakApiModel[] + * @return \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null */ public function getBreaks() { @@ -337,12 +440,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\RosterShiftBreakApiModel[] $breaks + * @param \OpenAPI\Client\Model\RosterShiftBreakApiModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -351,7 +457,7 @@ public function setBreaks($breaks) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -361,12 +467,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -375,7 +484,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -385,12 +494,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -399,7 +511,7 @@ public function setEmployeeName($employee_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -409,12 +521,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -423,7 +538,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -433,12 +548,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -447,7 +565,7 @@ public function setLocationName($location_name) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -457,12 +575,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -471,7 +592,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type_name * - * @return string + * @return string|null */ public function getWorkTypeName() { @@ -481,12 +602,15 @@ public function getWorkTypeName() /** * Sets work_type_name * - * @param string $work_type_name + * @param string|null $work_type_name * - * @return $this + * @return self */ public function setWorkTypeName($work_type_name) { + if (is_null($work_type_name)) { + throw new \InvalidArgumentException('non-nullable work_type_name cannot be null'); + } $this->container['work_type_name'] = $work_type_name; return $this; @@ -495,7 +619,7 @@ public function setWorkTypeName($work_type_name) /** * Gets role * - * @return \Swagger\Client\Model\RosterShiftRole + * @return \OpenAPI\Client\Model\RosterShiftRole|null */ public function getRole() { @@ -505,12 +629,15 @@ public function getRole() /** * Sets role * - * @param \Swagger\Client\Model\RosterShiftRole $role + * @param \OpenAPI\Client\Model\RosterShiftRole|null $role role * - * @return $this + * @return self */ public function setRole($role) { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -519,7 +646,7 @@ public function setRole($role) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -529,12 +656,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -543,7 +673,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -553,12 +683,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -567,7 +700,7 @@ public function setEndTime($end_time) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -577,12 +710,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -594,7 +730,7 @@ public function setNotes($notes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -604,22 +740,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -635,11 +772,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -647,13 +797,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RosterShiftFilterModel.php b/src/lib/Model/RosterShiftFilterModel.php index e2ccfb0..861400b 100644 --- a/src/lib/Model/RosterShiftFilterModel.php +++ b/src/lib/Model/RosterShiftFilterModel.php @@ -2,61 +2,61 @@ /** * RosterShiftFilterModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RosterShiftFilterModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RosterShiftFilterModel implements ModelInterface, ArrayAccess +class RosterShiftFilterModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RosterShiftFilterModel'; + protected static $openAPIModelName = 'RosterShiftFilterModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime', 'shift_status' => 'string', @@ -79,8 +79,10 @@ class RosterShiftFilterModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time', 'shift_status' => null, @@ -99,14 +101,45 @@ class RosterShiftFilterModel implements ModelInterface, ArrayAccess 'include_warnings' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => false, + 'shift_status' => false, + 'shift_statuses' => false, + 'selected_locations' => false, + 'selected_employees' => false, + 'selected_roles' => false, + 'employee_id' => false, + 'location_id' => false, + 'employee_group_id' => false, + 'unassigned_shifts_only' => false, + 'select_all_roles' => false, + 'exclude_shifts_overlapping_from_date' => false, + 'page_size' => false, + 'current_page' => false, + 'include_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -114,9 +147,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -230,20 +315,18 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const SHIFT_STATUS_ALL = 'All'; - const SHIFT_STATUS_PUBLISHED = 'Published'; - const SHIFT_STATUS_UNPUBLISHED = 'Unpublished'; - const SHIFT_STATUS_ACCEPTED = 'Accepted'; - const SHIFT_STATUSES_ALL = 'All'; - const SHIFT_STATUSES_PUBLISHED = 'Published'; - const SHIFT_STATUSES_UNPUBLISHED = 'Unpublished'; - const SHIFT_STATUSES_ACCEPTED = 'Accepted'; - + public const SHIFT_STATUS_ALL = 'All'; + public const SHIFT_STATUS_PUBLISHED = 'Published'; + public const SHIFT_STATUS_UNPUBLISHED = 'Unpublished'; + public const SHIFT_STATUS_ACCEPTED = 'Accepted'; + public const SHIFT_STATUSES_ALL = 'All'; + public const SHIFT_STATUSES_PUBLISHED = 'Published'; + public const SHIFT_STATUSES_UNPUBLISHED = 'Unpublished'; + public const SHIFT_STATUSES_ACCEPTED = 'Accepted'; - /** * Gets allowable values of the enum * @@ -258,7 +341,7 @@ public function getShiftStatusAllowableValues() self::SHIFT_STATUS_ACCEPTED, ]; } - + /** * Gets allowable values of the enum * @@ -273,7 +356,6 @@ public function getShiftStatusesAllowableValues() self::SHIFT_STATUSES_ACCEPTED, ]; } - /** * Associative array for storing property values @@ -290,22 +372,40 @@ public function getShiftStatusesAllowableValues() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['shift_status'] = isset($data['shift_status']) ? $data['shift_status'] : null; - $this->container['shift_statuses'] = isset($data['shift_statuses']) ? $data['shift_statuses'] : null; - $this->container['selected_locations'] = isset($data['selected_locations']) ? $data['selected_locations'] : null; - $this->container['selected_employees'] = isset($data['selected_employees']) ? $data['selected_employees'] : null; - $this->container['selected_roles'] = isset($data['selected_roles']) ? $data['selected_roles'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employee_group_id'] = isset($data['employee_group_id']) ? $data['employee_group_id'] : null; - $this->container['unassigned_shifts_only'] = isset($data['unassigned_shifts_only']) ? $data['unassigned_shifts_only'] : null; - $this->container['select_all_roles'] = isset($data['select_all_roles']) ? $data['select_all_roles'] : null; - $this->container['exclude_shifts_overlapping_from_date'] = isset($data['exclude_shifts_overlapping_from_date']) ? $data['exclude_shifts_overlapping_from_date'] : null; - $this->container['page_size'] = isset($data['page_size']) ? $data['page_size'] : null; - $this->container['current_page'] = isset($data['current_page']) ? $data['current_page'] : null; - $this->container['include_warnings'] = isset($data['include_warnings']) ? $data['include_warnings'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('shift_status', $data ?? [], null); + $this->setIfExists('shift_statuses', $data ?? [], null); + $this->setIfExists('selected_locations', $data ?? [], null); + $this->setIfExists('selected_employees', $data ?? [], null); + $this->setIfExists('selected_roles', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employee_group_id', $data ?? [], null); + $this->setIfExists('unassigned_shifts_only', $data ?? [], null); + $this->setIfExists('select_all_roles', $data ?? [], null); + $this->setIfExists('exclude_shifts_overlapping_from_date', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('current_page', $data ?? [], null); + $this->setIfExists('include_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; } /** @@ -320,7 +420,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftStatusAllowableValues(); if (!is_null($this->container['shift_status']) && !in_array($this->container['shift_status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_status', must be one of '%s'", + "invalid value '%s' for 'shift_status', must be one of '%s'", + $this->container['shift_status'], implode("', '", $allowedValues) ); } @@ -343,7 +444,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -353,12 +454,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -367,7 +471,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -377,12 +481,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -391,7 +498,7 @@ public function setToDate($to_date) /** * Gets shift_status * - * @return string + * @return string|null */ public function getShiftStatus() { @@ -401,17 +508,21 @@ public function getShiftStatus() /** * Sets shift_status * - * @param string $shift_status + * @param string|null $shift_status * - * @return $this + * @return self */ public function setShiftStatus($shift_status) { + if (is_null($shift_status)) { + throw new \InvalidArgumentException('non-nullable shift_status cannot be null'); + } $allowedValues = $this->getShiftStatusAllowableValues(); - if (!is_null($shift_status) && !in_array($shift_status, $allowedValues, true)) { + if (!in_array($shift_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_status', must be one of '%s'", + "Invalid value '%s' for 'shift_status', must be one of '%s'", + $shift_status, implode("', '", $allowedValues) ) ); @@ -424,7 +535,7 @@ public function setShiftStatus($shift_status) /** * Gets shift_statuses * - * @return string[] + * @return string[]|null */ public function getShiftStatuses() { @@ -434,14 +545,17 @@ public function getShiftStatuses() /** * Sets shift_statuses * - * @param string[] $shift_statuses + * @param string[]|null $shift_statuses * - * @return $this + * @return self */ public function setShiftStatuses($shift_statuses) { + if (is_null($shift_statuses)) { + throw new \InvalidArgumentException('non-nullable shift_statuses cannot be null'); + } $allowedValues = $this->getShiftStatusesAllowableValues(); - if (!is_null($shift_statuses) && array_diff($shift_statuses, $allowedValues)) { + if (array_diff($shift_statuses, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'shift_statuses', must be one of '%s'", @@ -457,7 +571,7 @@ public function setShiftStatuses($shift_statuses) /** * Gets selected_locations * - * @return string[] + * @return string[]|null */ public function getSelectedLocations() { @@ -467,12 +581,15 @@ public function getSelectedLocations() /** * Sets selected_locations * - * @param string[] $selected_locations + * @param string[]|null $selected_locations * - * @return $this + * @return self */ public function setSelectedLocations($selected_locations) { + if (is_null($selected_locations)) { + throw new \InvalidArgumentException('non-nullable selected_locations cannot be null'); + } $this->container['selected_locations'] = $selected_locations; return $this; @@ -481,7 +598,7 @@ public function setSelectedLocations($selected_locations) /** * Gets selected_employees * - * @return string[] + * @return string[]|null */ public function getSelectedEmployees() { @@ -491,12 +608,15 @@ public function getSelectedEmployees() /** * Sets selected_employees * - * @param string[] $selected_employees + * @param string[]|null $selected_employees * - * @return $this + * @return self */ public function setSelectedEmployees($selected_employees) { + if (is_null($selected_employees)) { + throw new \InvalidArgumentException('non-nullable selected_employees cannot be null'); + } $this->container['selected_employees'] = $selected_employees; return $this; @@ -505,7 +625,7 @@ public function setSelectedEmployees($selected_employees) /** * Gets selected_roles * - * @return string[] + * @return string[]|null */ public function getSelectedRoles() { @@ -515,12 +635,15 @@ public function getSelectedRoles() /** * Sets selected_roles * - * @param string[] $selected_roles + * @param string[]|null $selected_roles * - * @return $this + * @return self */ public function setSelectedRoles($selected_roles) { + if (is_null($selected_roles)) { + throw new \InvalidArgumentException('non-nullable selected_roles cannot be null'); + } $this->container['selected_roles'] = $selected_roles; return $this; @@ -529,7 +652,7 @@ public function setSelectedRoles($selected_roles) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -539,12 +662,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -553,7 +679,7 @@ public function setEmployeeId($employee_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -563,12 +689,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -577,7 +706,7 @@ public function setLocationId($location_id) /** * Gets employee_group_id * - * @return int + * @return int|null */ public function getEmployeeGroupId() { @@ -587,12 +716,15 @@ public function getEmployeeGroupId() /** * Sets employee_group_id * - * @param int $employee_group_id + * @param int|null $employee_group_id * - * @return $this + * @return self */ public function setEmployeeGroupId($employee_group_id) { + if (is_null($employee_group_id)) { + throw new \InvalidArgumentException('non-nullable employee_group_id cannot be null'); + } $this->container['employee_group_id'] = $employee_group_id; return $this; @@ -601,7 +733,7 @@ public function setEmployeeGroupId($employee_group_id) /** * Gets unassigned_shifts_only * - * @return bool + * @return bool|null */ public function getUnassignedShiftsOnly() { @@ -611,12 +743,15 @@ public function getUnassignedShiftsOnly() /** * Sets unassigned_shifts_only * - * @param bool $unassigned_shifts_only + * @param bool|null $unassigned_shifts_only * - * @return $this + * @return self */ public function setUnassignedShiftsOnly($unassigned_shifts_only) { + if (is_null($unassigned_shifts_only)) { + throw new \InvalidArgumentException('non-nullable unassigned_shifts_only cannot be null'); + } $this->container['unassigned_shifts_only'] = $unassigned_shifts_only; return $this; @@ -625,7 +760,7 @@ public function setUnassignedShiftsOnly($unassigned_shifts_only) /** * Gets select_all_roles * - * @return bool + * @return bool|null */ public function getSelectAllRoles() { @@ -635,12 +770,15 @@ public function getSelectAllRoles() /** * Sets select_all_roles * - * @param bool $select_all_roles + * @param bool|null $select_all_roles * - * @return $this + * @return self */ public function setSelectAllRoles($select_all_roles) { + if (is_null($select_all_roles)) { + throw new \InvalidArgumentException('non-nullable select_all_roles cannot be null'); + } $this->container['select_all_roles'] = $select_all_roles; return $this; @@ -649,7 +787,7 @@ public function setSelectAllRoles($select_all_roles) /** * Gets exclude_shifts_overlapping_from_date * - * @return bool + * @return bool|null */ public function getExcludeShiftsOverlappingFromDate() { @@ -659,12 +797,15 @@ public function getExcludeShiftsOverlappingFromDate() /** * Sets exclude_shifts_overlapping_from_date * - * @param bool $exclude_shifts_overlapping_from_date + * @param bool|null $exclude_shifts_overlapping_from_date * - * @return $this + * @return self */ public function setExcludeShiftsOverlappingFromDate($exclude_shifts_overlapping_from_date) { + if (is_null($exclude_shifts_overlapping_from_date)) { + throw new \InvalidArgumentException('non-nullable exclude_shifts_overlapping_from_date cannot be null'); + } $this->container['exclude_shifts_overlapping_from_date'] = $exclude_shifts_overlapping_from_date; return $this; @@ -673,7 +814,7 @@ public function setExcludeShiftsOverlappingFromDate($exclude_shifts_overlapping_ /** * Gets page_size * - * @return int + * @return int|null */ public function getPageSize() { @@ -683,12 +824,15 @@ public function getPageSize() /** * Sets page_size * - * @param int $page_size + * @param int|null $page_size * - * @return $this + * @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; @@ -697,7 +841,7 @@ public function setPageSize($page_size) /** * Gets current_page * - * @return int + * @return int|null */ public function getCurrentPage() { @@ -707,12 +851,15 @@ public function getCurrentPage() /** * Sets current_page * - * @param int $current_page + * @param int|null $current_page * - * @return $this + * @return self */ public function setCurrentPage($current_page) { + if (is_null($current_page)) { + throw new \InvalidArgumentException('non-nullable current_page cannot be null'); + } $this->container['current_page'] = $current_page; return $this; @@ -721,7 +868,7 @@ public function setCurrentPage($current_page) /** * Gets include_warnings * - * @return bool + * @return bool|null */ public function getIncludeWarnings() { @@ -731,12 +878,15 @@ public function getIncludeWarnings() /** * Sets include_warnings * - * @param bool $include_warnings + * @param bool|null $include_warnings * - * @return $this + * @return self */ public function setIncludeWarnings($include_warnings) { + if (is_null($include_warnings)) { + throw new \InvalidArgumentException('non-nullable include_warnings cannot be null'); + } $this->container['include_warnings'] = $include_warnings; return $this; @@ -748,7 +898,7 @@ public function setIncludeWarnings($include_warnings) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -758,22 +908,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -789,11 +940,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -801,13 +965,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RosterShiftRole.php b/src/lib/Model/RosterShiftRole.php index fcbe51a..45ff35e 100644 --- a/src/lib/Model/RosterShiftRole.php +++ b/src/lib/Model/RosterShiftRole.php @@ -2,61 +2,61 @@ /** * RosterShiftRole * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RosterShiftRole Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RosterShiftRole implements ModelInterface, ArrayAccess +class RosterShiftRole implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RosterShiftRole'; + protected static $openAPIModelName = 'RosterShiftRole'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'class_name' => 'string', @@ -67,22 +67,43 @@ class RosterShiftRole implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'class_name' => null, 'hex_colour_code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'class_name' => false, + 'hex_colour_code' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['class_name'] = isset($data['class_name']) ? $data['class_name'] : null; - $this->container['hex_colour_code'] = isset($data['hex_colour_code']) ? $data['hex_colour_code'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('class_name', $data ?? [], null); + $this->setIfExists('hex_colour_code', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -259,12 +350,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -273,7 +367,7 @@ public function setName($name) /** * Gets class_name * - * @return string + * @return string|null */ public function getClassName() { @@ -283,12 +377,15 @@ public function getClassName() /** * Sets class_name * - * @param string $class_name + * @param string|null $class_name * - * @return $this + * @return self */ public function setClassName($class_name) { + if (is_null($class_name)) { + throw new \InvalidArgumentException('non-nullable class_name cannot be null'); + } $this->container['class_name'] = $class_name; return $this; @@ -297,7 +394,7 @@ public function setClassName($class_name) /** * Gets hex_colour_code * - * @return string + * @return string|null */ public function getHexColourCode() { @@ -307,12 +404,15 @@ public function getHexColourCode() /** * Sets hex_colour_code * - * @param string $hex_colour_code + * @param string|null $hex_colour_code * - * @return $this + * @return self */ public function setHexColourCode($hex_colour_code) { + if (is_null($hex_colour_code)) { + throw new \InvalidArgumentException('non-nullable hex_colour_code cannot be null'); + } $this->container['hex_colour_code'] = $hex_colour_code; return $this; @@ -324,7 +424,7 @@ public function setHexColourCode($hex_colour_code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RosterShiftSwapModel.php b/src/lib/Model/RosterShiftSwapModel.php index e1b413b..e6ac168 100644 --- a/src/lib/Model/RosterShiftSwapModel.php +++ b/src/lib/Model/RosterShiftSwapModel.php @@ -2,61 +2,61 @@ /** * RosterShiftSwapModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RosterShiftSwapModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RosterShiftSwapModel implements ModelInterface, ArrayAccess +class RosterShiftSwapModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RosterShiftSwapModel'; + protected static $openAPIModelName = 'RosterShiftSwapModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'from_employee' => 'string', 'to_employee' => 'string', @@ -73,8 +73,10 @@ class RosterShiftSwapModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'from_employee' => null, 'to_employee' => null, @@ -87,14 +89,39 @@ class RosterShiftSwapModel implements ModelInterface, ArrayAccess 'status_description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from_employee' => false, + 'to_employee' => false, + 'from_employee_id' => false, + 'to_employee_id' => false, + 'date_created' => false, + 'note' => false, + 'rejected_reason' => false, + 'status' => false, + 'status_description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_employee'] = isset($data['from_employee']) ? $data['from_employee'] : null; - $this->container['to_employee'] = isset($data['to_employee']) ? $data['to_employee'] : null; - $this->container['from_employee_id'] = isset($data['from_employee_id']) ? $data['from_employee_id'] : null; - $this->container['to_employee_id'] = isset($data['to_employee_id']) ? $data['to_employee_id'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['rejected_reason'] = isset($data['rejected_reason']) ? $data['rejected_reason'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['status_description'] = isset($data['status_description']) ? $data['status_description'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_employee', $data ?? [], null); + $this->setIfExists('to_employee', $data ?? [], null); + $this->setIfExists('from_employee_id', $data ?? [], null); + $this->setIfExists('to_employee_id', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('rejected_reason', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('status_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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets from_employee * - * @return string + * @return string|null */ public function getFromEmployee() { @@ -295,12 +392,15 @@ public function getFromEmployee() /** * Sets from_employee * - * @param string $from_employee + * @param string|null $from_employee * - * @return $this + * @return self */ public function setFromEmployee($from_employee) { + if (is_null($from_employee)) { + throw new \InvalidArgumentException('non-nullable from_employee cannot be null'); + } $this->container['from_employee'] = $from_employee; return $this; @@ -309,7 +409,7 @@ public function setFromEmployee($from_employee) /** * Gets to_employee * - * @return string + * @return string|null */ public function getToEmployee() { @@ -319,12 +419,15 @@ public function getToEmployee() /** * Sets to_employee * - * @param string $to_employee + * @param string|null $to_employee * - * @return $this + * @return self */ public function setToEmployee($to_employee) { + if (is_null($to_employee)) { + throw new \InvalidArgumentException('non-nullable to_employee cannot be null'); + } $this->container['to_employee'] = $to_employee; return $this; @@ -333,7 +436,7 @@ public function setToEmployee($to_employee) /** * Gets from_employee_id * - * @return int + * @return int|null */ public function getFromEmployeeId() { @@ -343,12 +446,15 @@ public function getFromEmployeeId() /** * Sets from_employee_id * - * @param int $from_employee_id + * @param int|null $from_employee_id * - * @return $this + * @return self */ public function setFromEmployeeId($from_employee_id) { + if (is_null($from_employee_id)) { + throw new \InvalidArgumentException('non-nullable from_employee_id cannot be null'); + } $this->container['from_employee_id'] = $from_employee_id; return $this; @@ -357,7 +463,7 @@ public function setFromEmployeeId($from_employee_id) /** * Gets to_employee_id * - * @return int + * @return int|null */ public function getToEmployeeId() { @@ -367,12 +473,15 @@ public function getToEmployeeId() /** * Sets to_employee_id * - * @param int $to_employee_id + * @param int|null $to_employee_id * - * @return $this + * @return self */ public function setToEmployeeId($to_employee_id) { + if (is_null($to_employee_id)) { + throw new \InvalidArgumentException('non-nullable to_employee_id cannot be null'); + } $this->container['to_employee_id'] = $to_employee_id; return $this; @@ -381,7 +490,7 @@ public function setToEmployeeId($to_employee_id) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -391,12 +500,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -405,7 +517,7 @@ public function setDateCreated($date_created) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -415,12 +527,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -429,7 +544,7 @@ public function setNote($note) /** * Gets rejected_reason * - * @return string + * @return string|null */ public function getRejectedReason() { @@ -439,12 +554,15 @@ public function getRejectedReason() /** * Sets rejected_reason * - * @param string $rejected_reason + * @param string|null $rejected_reason * - * @return $this + * @return self */ public function setRejectedReason($rejected_reason) { + if (is_null($rejected_reason)) { + throw new \InvalidArgumentException('non-nullable rejected_reason cannot be null'); + } $this->container['rejected_reason'] = $rejected_reason; return $this; @@ -453,7 +571,7 @@ public function setRejectedReason($rejected_reason) /** * Gets status * - * @return int + * @return int|null */ public function getStatus() { @@ -463,12 +581,15 @@ public function getStatus() /** * Sets status * - * @param int $status + * @param int|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -477,7 +598,7 @@ public function setStatus($status) /** * Gets status_description * - * @return string + * @return string|null */ public function getStatusDescription() { @@ -487,12 +608,15 @@ public function getStatusDescription() /** * Sets status_description * - * @param string $status_description + * @param string|null $status_description * - * @return $this + * @return self */ public function setStatusDescription($status_description) { + if (is_null($status_description)) { + throw new \InvalidArgumentException('non-nullable status_description cannot be null'); + } $this->container['status_description'] = $status_description; return $this; @@ -504,7 +628,7 @@ public function setStatusDescription($status_description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/RuleEvaluationResult.php b/src/lib/Model/RuleEvaluationResult.php index 2ce0f68..1c0fc75 100644 --- a/src/lib/Model/RuleEvaluationResult.php +++ b/src/lib/Model/RuleEvaluationResult.php @@ -2,61 +2,61 @@ /** * RuleEvaluationResult * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * RuleEvaluationResult Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class RuleEvaluationResult implements ModelInterface, ArrayAccess +class RuleEvaluationResult implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'RuleEvaluationResult'; + protected static $openAPIModelName = 'RuleEvaluationResult'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'rule_name' => 'string', 'match_result' => 'string' ]; @@ -65,20 +65,39 @@ class RuleEvaluationResult implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'rule_name' => null, 'match_result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rule_name' => false, + 'match_result' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,17 +231,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const MATCH_RESULT_NO_MATCH = 'NoMatch'; - const MATCH_RESULT_MATCH = 'Match'; - const MATCH_RESULT_DISABLED_FOR_RULE_SET = 'DisabledForRuleSet'; - const MATCH_RESULT_DISABLED_FOR_EMPLOYEE = 'DisabledForEmployee'; - const MATCH_RESULT_EXCLUDED_CUSTOM_RULE = 'ExcludedCustomRule'; - + public const MATCH_RESULT_NO_MATCH = 'NoMatch'; + public const MATCH_RESULT_MATCH = 'Match'; + public const MATCH_RESULT_DISABLED_FOR_RULE_SET = 'DisabledForRuleSet'; + public const MATCH_RESULT_DISABLED_FOR_EMPLOYEE = 'DisabledForEmployee'; + public const MATCH_RESULT_EXCLUDED_CUSTOM_RULE = 'ExcludedCustomRule'; - /** * Gets allowable values of the enum * @@ -186,7 +255,6 @@ public function getMatchResultAllowableValues() self::MATCH_RESULT_EXCLUDED_CUSTOM_RULE, ]; } - /** * Associative array for storing property values @@ -203,8 +271,26 @@ public function getMatchResultAllowableValues() */ public function __construct(array $data = null) { - $this->container['rule_name'] = isset($data['rule_name']) ? $data['rule_name'] : null; - $this->container['match_result'] = isset($data['match_result']) ? $data['match_result'] : null; + $this->setIfExists('rule_name', $data ?? [], null); + $this->setIfExists('match_result', $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; } /** @@ -219,7 +305,8 @@ public function listInvalidProperties() $allowedValues = $this->getMatchResultAllowableValues(); if (!is_null($this->container['match_result']) && !in_array($this->container['match_result'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'match_result', must be one of '%s'", + "invalid value '%s' for 'match_result', must be one of '%s'", + $this->container['match_result'], implode("', '", $allowedValues) ); } @@ -242,7 +329,7 @@ public function valid() /** * Gets rule_name * - * @return string + * @return string|null */ public function getRuleName() { @@ -252,12 +339,15 @@ public function getRuleName() /** * Sets rule_name * - * @param string $rule_name + * @param string|null $rule_name * - * @return $this + * @return self */ public function setRuleName($rule_name) { + if (is_null($rule_name)) { + throw new \InvalidArgumentException('non-nullable rule_name cannot be null'); + } $this->container['rule_name'] = $rule_name; return $this; @@ -266,7 +356,7 @@ public function setRuleName($rule_name) /** * Gets match_result * - * @return string + * @return string|null */ public function getMatchResult() { @@ -276,17 +366,21 @@ public function getMatchResult() /** * Sets match_result * - * @param string $match_result + * @param string|null $match_result * - * @return $this + * @return self */ public function setMatchResult($match_result) { + if (is_null($match_result)) { + throw new \InvalidArgumentException('non-nullable match_result cannot be null'); + } $allowedValues = $this->getMatchResultAllowableValues(); - if (!is_null($match_result) && !in_array($match_result, $allowedValues, true)) { + if (!in_array($match_result, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'match_result', must be one of '%s'", + "Invalid value '%s' for 'match_result', must be one of '%s'", + $match_result, implode("', '", $allowedValues) ) ); @@ -302,7 +396,7 @@ public function setMatchResult($match_result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -312,22 +406,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -343,11 +438,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -355,13 +463,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SaveLeaveAccrualModel.php b/src/lib/Model/SaveLeaveAccrualModel.php index 2d80263..86c6b0a 100644 --- a/src/lib/Model/SaveLeaveAccrualModel.php +++ b/src/lib/Model/SaveLeaveAccrualModel.php @@ -2,64 +2,64 @@ /** * SaveLeaveAccrualModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SaveLeaveAccrualModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SaveLeaveAccrualModel implements ModelInterface, ArrayAccess +class SaveLeaveAccrualModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SaveLeaveAccrualModel'; + protected static $openAPIModelName = 'SaveLeaveAccrualModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'accrual_type' => 'string', 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'leave_category_id' => 'int', 'apply_leave_loading' => 'bool', 'adjust_earnings' => 'bool', @@ -70,8 +70,10 @@ class SaveLeaveAccrualModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'accrual_type' => null, 'notes' => null, 'amount' => 'double', @@ -81,14 +83,36 @@ class SaveLeaveAccrualModel implements ModelInterface, ArrayAccess 'external_reference_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'accrual_type' => false, + 'notes' => false, + 'amount' => false, + 'leave_category_id' => false, + 'apply_leave_loading' => false, + 'adjust_earnings' => false, + 'external_reference_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,15 +261,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const ACCRUAL_TYPE_LEAVE_ACCRUED = 'LeaveAccrued'; - const ACCRUAL_TYPE_LEAVE_TAKEN = 'LeaveTaken'; - const ACCRUAL_TYPE_LEAVE_ADJUSTMENT = 'LeaveAdjustment'; - + public const ACCRUAL_TYPE_LEAVE_ACCRUED = 'LeaveAccrued'; + public const ACCRUAL_TYPE_LEAVE_TAKEN = 'LeaveTaken'; + public const ACCRUAL_TYPE_LEAVE_ADJUSTMENT = 'LeaveAdjustment'; - /** * Gets allowable values of the enum * @@ -207,7 +281,6 @@ public function getAccrualTypeAllowableValues() self::ACCRUAL_TYPE_LEAVE_ADJUSTMENT, ]; } - /** * Associative array for storing property values @@ -224,13 +297,31 @@ public function getAccrualTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['accrual_type'] = isset($data['accrual_type']) ? $data['accrual_type'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['apply_leave_loading'] = isset($data['apply_leave_loading']) ? $data['apply_leave_loading'] : null; - $this->container['adjust_earnings'] = isset($data['adjust_earnings']) ? $data['adjust_earnings'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; + $this->setIfExists('accrual_type', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('apply_leave_loading', $data ?? [], null); + $this->setIfExists('adjust_earnings', $data ?? [], null); + $this->setIfExists('external_reference_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; } /** @@ -245,7 +336,8 @@ public function listInvalidProperties() $allowedValues = $this->getAccrualTypeAllowableValues(); if (!is_null($this->container['accrual_type']) && !in_array($this->container['accrual_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'accrual_type', must be one of '%s'", + "invalid value '%s' for 'accrual_type', must be one of '%s'", + $this->container['accrual_type'], implode("', '", $allowedValues) ); } @@ -268,7 +360,7 @@ public function valid() /** * Gets accrual_type * - * @return string + * @return string|null */ public function getAccrualType() { @@ -278,17 +370,21 @@ public function getAccrualType() /** * Sets accrual_type * - * @param string $accrual_type + * @param string|null $accrual_type * - * @return $this + * @return self */ public function setAccrualType($accrual_type) { + if (is_null($accrual_type)) { + throw new \InvalidArgumentException('non-nullable accrual_type cannot be null'); + } $allowedValues = $this->getAccrualTypeAllowableValues(); - if (!is_null($accrual_type) && !in_array($accrual_type, $allowedValues, true)) { + if (!in_array($accrual_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'accrual_type', must be one of '%s'", + "Invalid value '%s' for 'accrual_type', must be one of '%s'", + $accrual_type, implode("', '", $allowedValues) ) ); @@ -301,7 +397,7 @@ public function setAccrualType($accrual_type) /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -311,12 +407,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -325,7 +424,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -335,12 +434,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -349,7 +451,7 @@ public function setAmount($amount) /** * Gets leave_category_id * - * @return int + * @return int|null */ public function getLeaveCategoryId() { @@ -359,12 +461,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param int $leave_category_id + * @param int|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -373,7 +478,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets apply_leave_loading * - * @return bool + * @return bool|null */ public function getApplyLeaveLoading() { @@ -383,12 +488,15 @@ public function getApplyLeaveLoading() /** * Sets apply_leave_loading * - * @param bool $apply_leave_loading + * @param bool|null $apply_leave_loading * - * @return $this + * @return self */ public function setApplyLeaveLoading($apply_leave_loading) { + if (is_null($apply_leave_loading)) { + throw new \InvalidArgumentException('non-nullable apply_leave_loading cannot be null'); + } $this->container['apply_leave_loading'] = $apply_leave_loading; return $this; @@ -397,7 +505,7 @@ public function setApplyLeaveLoading($apply_leave_loading) /** * Gets adjust_earnings * - * @return bool + * @return bool|null */ public function getAdjustEarnings() { @@ -407,12 +515,15 @@ public function getAdjustEarnings() /** * Sets adjust_earnings * - * @param bool $adjust_earnings + * @param bool|null $adjust_earnings * - * @return $this + * @return self */ public function setAdjustEarnings($adjust_earnings) { + if (is_null($adjust_earnings)) { + throw new \InvalidArgumentException('non-nullable adjust_earnings cannot be null'); + } $this->container['adjust_earnings'] = $adjust_earnings; return $this; @@ -421,7 +532,7 @@ public function setAdjustEarnings($adjust_earnings) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -431,12 +542,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -448,7 +562,7 @@ public function setExternalReferenceId($external_reference_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -458,22 +572,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -489,11 +604,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -501,13 +629,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SaveSuperFundModel.php b/src/lib/Model/SaveSuperFundModel.php index 9f814cd..c74ddee 100644 --- a/src/lib/Model/SaveSuperFundModel.php +++ b/src/lib/Model/SaveSuperFundModel.php @@ -2,64 +2,64 @@ /** * SaveSuperFundModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SaveSuperFundModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SaveSuperFundModel implements ModelInterface, ArrayAccess +class SaveSuperFundModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SaveSuperFundModel'; + protected static $openAPIModelName = 'SaveSuperFundModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'member_number' => 'string', - 'allocated_percentage' => 'double', - 'fixed_amount' => 'double', + 'allocated_percentage' => 'float', + 'fixed_amount' => 'float', 'product_code' => 'string', 'fund_name' => 'string', 'allocate_balance' => 'bool', @@ -70,8 +70,10 @@ class SaveSuperFundModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'member_number' => null, 'allocated_percentage' => 'double', 'fixed_amount' => 'double', @@ -81,14 +83,36 @@ class SaveSuperFundModel implements ModelInterface, ArrayAccess 'is_employer_nominated_fund' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'member_number' => false, + 'allocated_percentage' => false, + 'fixed_amount' => false, + 'product_code' => false, + 'fund_name' => false, + 'allocate_balance' => false, + 'is_employer_nominated_fund' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['member_number'] = isset($data['member_number']) ? $data['member_number'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['fixed_amount'] = isset($data['fixed_amount']) ? $data['fixed_amount'] : null; - $this->container['product_code'] = isset($data['product_code']) ? $data['product_code'] : null; - $this->container['fund_name'] = isset($data['fund_name']) ? $data['fund_name'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; - $this->container['is_employer_nominated_fund'] = isset($data['is_employer_nominated_fund']) ? $data['is_employer_nominated_fund'] : null; + $this->setIfExists('member_number', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('fixed_amount', $data ?? [], null); + $this->setIfExists('product_code', $data ?? [], null); + $this->setIfExists('fund_name', $data ?? [], null); + $this->setIfExists('allocate_balance', $data ?? [], null); + $this->setIfExists('is_employer_nominated_fund', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets member_number * - * @return string + * @return string|null */ public function getMemberNumber() { @@ -253,12 +344,15 @@ public function getMemberNumber() /** * Sets member_number * - * @param string $member_number + * @param string|null $member_number * - * @return $this + * @return self */ public function setMemberNumber($member_number) { + if (is_null($member_number)) { + throw new \InvalidArgumentException('non-nullable member_number cannot be null'); + } $this->container['member_number'] = $member_number; return $this; @@ -267,7 +361,7 @@ public function setMemberNumber($member_number) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -277,12 +371,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -291,7 +388,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets fixed_amount * - * @return double + * @return float|null */ public function getFixedAmount() { @@ -301,12 +398,15 @@ public function getFixedAmount() /** * Sets fixed_amount * - * @param double $fixed_amount + * @param float|null $fixed_amount * - * @return $this + * @return self */ public function setFixedAmount($fixed_amount) { + if (is_null($fixed_amount)) { + throw new \InvalidArgumentException('non-nullable fixed_amount cannot be null'); + } $this->container['fixed_amount'] = $fixed_amount; return $this; @@ -315,7 +415,7 @@ public function setFixedAmount($fixed_amount) /** * Gets product_code * - * @return string + * @return string|null */ public function getProductCode() { @@ -325,12 +425,15 @@ public function getProductCode() /** * Sets product_code * - * @param string $product_code Nullable

Must be \"SMSF\" for a self managed super fund + * @param string|null $product_code Nullable

Must be \"SMSF\" for a self managed super fund * - * @return $this + * @return self */ public function setProductCode($product_code) { + if (is_null($product_code)) { + throw new \InvalidArgumentException('non-nullable product_code cannot be null'); + } $this->container['product_code'] = $product_code; return $this; @@ -339,7 +442,7 @@ public function setProductCode($product_code) /** * Gets fund_name * - * @return string + * @return string|null */ public function getFundName() { @@ -349,12 +452,15 @@ public function getFundName() /** * Sets fund_name * - * @param string $fund_name + * @param string|null $fund_name * - * @return $this + * @return self */ public function setFundName($fund_name) { + if (is_null($fund_name)) { + throw new \InvalidArgumentException('non-nullable fund_name cannot be null'); + } $this->container['fund_name'] = $fund_name; return $this; @@ -363,7 +469,7 @@ public function setFundName($fund_name) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -373,12 +479,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -387,7 +496,7 @@ public function setAllocateBalance($allocate_balance) /** * Gets is_employer_nominated_fund * - * @return bool + * @return bool|null */ public function getIsEmployerNominatedFund() { @@ -397,12 +506,15 @@ public function getIsEmployerNominatedFund() /** * Sets is_employer_nominated_fund * - * @param bool $is_employer_nominated_fund + * @param bool|null $is_employer_nominated_fund * - * @return $this + * @return self */ public function setIsEmployerNominatedFund($is_employer_nominated_fund) { + if (is_null($is_employer_nominated_fund)) { + throw new \InvalidArgumentException('non-nullable is_employer_nominated_fund cannot be null'); + } $this->container['is_employer_nominated_fund'] = $is_employer_nominated_fund; return $this; @@ -414,7 +526,7 @@ public function setIsEmployerNominatedFund($is_employer_nominated_fund) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SaveSuperFundResponseModel.php b/src/lib/Model/SaveSuperFundResponseModel.php index f4c4f35..be297db 100644 --- a/src/lib/Model/SaveSuperFundResponseModel.php +++ b/src/lib/Model/SaveSuperFundResponseModel.php @@ -2,83 +2,102 @@ /** * SaveSuperFundResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SaveSuperFundResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SaveSuperFundResponseModel implements ModelInterface, ArrayAccess +class SaveSuperFundResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SaveSuperFundResponseModel'; + protected static $openAPIModelName = 'SaveSuperFundResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'validation_warning' => 'string', - 'result' => '\Swagger\Client\Model\SuperFundModel' + 'result' => '\OpenAPI\Client\Model\SuperFundModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'validation_warning' => null, 'result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'validation_warning' => false, + 'result' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['validation_warning'] = isset($data['validation_warning']) ? $data['validation_warning'] : null; - $this->container['result'] = isset($data['result']) ? $data['result'] : null; + $this->setIfExists('validation_warning', $data ?? [], null); + $this->setIfExists('result', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets validation_warning * - * @return string + * @return string|null */ public function getValidationWarning() { @@ -223,12 +309,15 @@ public function getValidationWarning() /** * Sets validation_warning * - * @param string $validation_warning + * @param string|null $validation_warning * - * @return $this + * @return self */ public function setValidationWarning($validation_warning) { + if (is_null($validation_warning)) { + throw new \InvalidArgumentException('non-nullable validation_warning cannot be null'); + } $this->container['validation_warning'] = $validation_warning; return $this; @@ -237,7 +326,7 @@ public function setValidationWarning($validation_warning) /** * Gets result * - * @return \Swagger\Client\Model\SuperFundModel + * @return \OpenAPI\Client\Model\SuperFundModel|null */ public function getResult() { @@ -247,12 +336,15 @@ public function getResult() /** * Sets result * - * @param \Swagger\Client\Model\SuperFundModel $result + * @param \OpenAPI\Client\Model\SuperFundModel|null $result result * - * @return $this + * @return self */ public function setResult($result) { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } $this->container['result'] = $result; return $this; @@ -264,7 +356,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SelectExpandClause.php b/src/lib/Model/SelectExpandClause.php index bc1fcab..b2b50b9 100644 --- a/src/lib/Model/SelectExpandClause.php +++ b/src/lib/Model/SelectExpandClause.php @@ -2,62 +2,62 @@ /** * SelectExpandClause * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SelectExpandClause Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SelectExpandClause implements ModelInterface, ArrayAccess +class SelectExpandClause implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SelectExpandClause'; + protected static $openAPIModelName = 'SelectExpandClause'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'selected_items' => '\Swagger\Client\Model\SelectItem[]', + protected static $openAPITypes = [ + 'selected_items' => 'object[]', 'all_selected' => 'bool' ]; @@ -65,20 +65,39 @@ class SelectExpandClause implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'selected_items' => null, 'all_selected' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'selected_items' => false, + 'all_selected' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['selected_items'] = isset($data['selected_items']) ? $data['selected_items'] : null; - $this->container['all_selected'] = isset($data['all_selected']) ? $data['all_selected'] : null; + $this->setIfExists('selected_items', $data ?? [], null); + $this->setIfExists('all_selected', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets selected_items * - * @return \Swagger\Client\Model\SelectItem[] + * @return object[]|null */ public function getSelectedItems() { @@ -223,12 +309,15 @@ public function getSelectedItems() /** * Sets selected_items * - * @param \Swagger\Client\Model\SelectItem[] $selected_items + * @param object[]|null $selected_items * - * @return $this + * @return self */ public function setSelectedItems($selected_items) { + if (is_null($selected_items)) { + throw new \InvalidArgumentException('non-nullable selected_items cannot be null'); + } $this->container['selected_items'] = $selected_items; return $this; @@ -237,7 +326,7 @@ public function setSelectedItems($selected_items) /** * Gets all_selected * - * @return bool + * @return bool|null */ public function getAllSelected() { @@ -247,12 +336,15 @@ public function getAllSelected() /** * Sets all_selected * - * @param bool $all_selected + * @param bool|null $all_selected * - * @return $this + * @return self */ public function setAllSelected($all_selected) { + if (is_null($all_selected)) { + throw new \InvalidArgumentException('non-nullable all_selected cannot be null'); + } $this->container['all_selected'] = $all_selected; return $this; @@ -264,7 +356,7 @@ public function setAllSelected($all_selected) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SelectExpandQueryOption.php b/src/lib/Model/SelectExpandQueryOption.php index fd62ab4..775fa95 100644 --- a/src/lib/Model/SelectExpandQueryOption.php +++ b/src/lib/Model/SelectExpandQueryOption.php @@ -2,74 +2,76 @@ /** * SelectExpandQueryOption * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SelectExpandQueryOption Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SelectExpandQueryOption implements ModelInterface, ArrayAccess +class SelectExpandQueryOption implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SelectExpandQueryOption'; + protected static $openAPIModelName = 'SelectExpandQueryOption'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'context' => '\Swagger\Client\Model\ODataQueryContext', + protected static $openAPITypes = [ + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'raw_select' => 'string', 'raw_expand' => 'string', - 'validator' => '\Swagger\Client\Model\SelectExpandQueryValidator', - 'select_expand_clause' => '\Swagger\Client\Model\SelectExpandClause' + 'validator' => 'object', + 'select_expand_clause' => '\OpenAPI\Client\Model\SelectExpandClause' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'context' => null, 'raw_select' => null, 'raw_expand' => null, @@ -77,14 +79,34 @@ class SelectExpandQueryOption implements ModelInterface, ArrayAccess 'select_expand_clause' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'context' => false, + 'raw_select' => false, + 'raw_expand' => false, + 'validator' => false, + 'select_expand_clause' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['raw_select'] = isset($data['raw_select']) ? $data['raw_select'] : null; - $this->container['raw_expand'] = isset($data['raw_expand']) ? $data['raw_expand'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; - $this->container['select_expand_clause'] = isset($data['select_expand_clause']) ? $data['select_expand_clause'] : null; + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('raw_select', $data ?? [], null); + $this->setIfExists('raw_expand', $data ?? [], null); + $this->setIfExists('validator', $data ?? [], null); + $this->setIfExists('select_expand_clause', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -241,12 +330,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -255,7 +347,7 @@ public function setContext($context) /** * Gets raw_select * - * @return string + * @return string|null */ public function getRawSelect() { @@ -265,12 +357,15 @@ public function getRawSelect() /** * Sets raw_select * - * @param string $raw_select + * @param string|null $raw_select * - * @return $this + * @return self */ public function setRawSelect($raw_select) { + if (is_null($raw_select)) { + throw new \InvalidArgumentException('non-nullable raw_select cannot be null'); + } $this->container['raw_select'] = $raw_select; return $this; @@ -279,7 +374,7 @@ public function setRawSelect($raw_select) /** * Gets raw_expand * - * @return string + * @return string|null */ public function getRawExpand() { @@ -289,12 +384,15 @@ public function getRawExpand() /** * Sets raw_expand * - * @param string $raw_expand + * @param string|null $raw_expand * - * @return $this + * @return self */ public function setRawExpand($raw_expand) { + if (is_null($raw_expand)) { + throw new \InvalidArgumentException('non-nullable raw_expand cannot be null'); + } $this->container['raw_expand'] = $raw_expand; return $this; @@ -303,7 +401,7 @@ public function setRawExpand($raw_expand) /** * Gets validator * - * @return \Swagger\Client\Model\SelectExpandQueryValidator + * @return object|null */ public function getValidator() { @@ -313,12 +411,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\SelectExpandQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -327,7 +428,7 @@ public function setValidator($validator) /** * Gets select_expand_clause * - * @return \Swagger\Client\Model\SelectExpandClause + * @return \OpenAPI\Client\Model\SelectExpandClause|null */ public function getSelectExpandClause() { @@ -337,12 +438,15 @@ public function getSelectExpandClause() /** * Sets select_expand_clause * - * @param \Swagger\Client\Model\SelectExpandClause $select_expand_clause + * @param \OpenAPI\Client\Model\SelectExpandClause|null $select_expand_clause select_expand_clause * - * @return $this + * @return self */ public function setSelectExpandClause($select_expand_clause) { + if (is_null($select_expand_clause)) { + throw new \InvalidArgumentException('non-nullable select_expand_clause cannot be null'); + } $this->container['select_expand_clause'] = $select_expand_clause; return $this; @@ -354,7 +458,7 @@ public function setSelectExpandClause($select_expand_clause) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SelectExpandQueryValidator.php b/src/lib/Model/SelectExpandQueryValidator.php deleted file mode 100644 index 1aa9fcc..0000000 --- a/src/lib/Model/SelectExpandQueryValidator.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/SelectItem.php b/src/lib/Model/SelectItem.php deleted file mode 100644 index e6bbba7..0000000 --- a/src/lib/Model/SelectItem.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/SelectListGroup.php b/src/lib/Model/SelectListGroup.php index d72b82d..9d11dd1 100644 --- a/src/lib/Model/SelectListGroup.php +++ b/src/lib/Model/SelectListGroup.php @@ -2,61 +2,61 @@ /** * SelectListGroup * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SelectListGroup Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SelectListGroup implements ModelInterface, ArrayAccess +class SelectListGroup implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SelectListGroup'; + protected static $openAPIModelName = 'SelectListGroup'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string' ]; @@ -64,19 +64,37 @@ class SelectListGroup implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : 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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -217,12 +302,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -234,7 +322,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SelectListItem.php b/src/lib/Model/SelectListItem.php index 22d74b1..3903d68 100644 --- a/src/lib/Model/SelectListItem.php +++ b/src/lib/Model/SelectListItem.php @@ -2,64 +2,64 @@ /** * SelectListItem * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SelectListItem Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SelectListItem implements ModelInterface, ArrayAccess +class SelectListItem implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SelectListItem'; + protected static $openAPIModelName = 'SelectListItem'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'text' => 'string', 'value' => 'string', - 'group' => '\Swagger\Client\Model\SelectListGroup', + 'group' => '\OpenAPI\Client\Model\SelectListGroup', 'disabled' => 'bool', 'selected' => 'bool' ]; @@ -68,8 +68,10 @@ class SelectListItem implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'text' => null, 'value' => null, 'group' => null, @@ -77,14 +79,34 @@ class SelectListItem implements ModelInterface, ArrayAccess 'selected' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'text' => false, + 'value' => false, + 'group' => false, + 'disabled' => false, + 'selected' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['text'] = isset($data['text']) ? $data['text'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['group'] = isset($data['group']) ? $data['group'] : null; - $this->container['disabled'] = isset($data['disabled']) ? $data['disabled'] : null; - $this->container['selected'] = isset($data['selected']) ? $data['selected'] : null; + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('disabled', $data ?? [], null); + $this->setIfExists('selected', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets text * - * @return string + * @return string|null */ public function getText() { @@ -241,12 +330,15 @@ public function getText() /** * Sets text * - * @param string $text + * @param string|null $text * - * @return $this + * @return self */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -255,7 +347,7 @@ public function setText($text) /** * Gets value * - * @return string + * @return string|null */ public function getValue() { @@ -265,12 +357,15 @@ public function getValue() /** * Sets value * - * @param string $value + * @param string|null $value * - * @return $this + * @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; @@ -279,7 +374,7 @@ public function setValue($value) /** * Gets group * - * @return \Swagger\Client\Model\SelectListGroup + * @return \OpenAPI\Client\Model\SelectListGroup|null */ public function getGroup() { @@ -289,12 +384,15 @@ public function getGroup() /** * Sets group * - * @param \Swagger\Client\Model\SelectListGroup $group + * @param \OpenAPI\Client\Model\SelectListGroup|null $group group * - * @return $this + * @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; @@ -303,7 +401,7 @@ public function setGroup($group) /** * Gets disabled * - * @return bool + * @return bool|null */ public function getDisabled() { @@ -313,12 +411,15 @@ public function getDisabled() /** * Sets disabled * - * @param bool $disabled + * @param bool|null $disabled * - * @return $this + * @return self */ public function setDisabled($disabled) { + if (is_null($disabled)) { + throw new \InvalidArgumentException('non-nullable disabled cannot be null'); + } $this->container['disabled'] = $disabled; return $this; @@ -327,7 +428,7 @@ public function setDisabled($disabled) /** * Gets selected * - * @return bool + * @return bool|null */ public function getSelected() { @@ -337,12 +438,15 @@ public function getSelected() /** * Sets selected * - * @param bool $selected + * @param bool|null $selected * - * @return $this + * @return self */ public function setSelected($selected) { + if (is_null($selected)) { + throw new \InvalidArgumentException('non-nullable selected cannot be null'); + } $this->container['selected'] = $selected; return $this; @@ -354,7 +458,7 @@ public function setSelected($selected) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SelfManagedSuperFundModel.php b/src/lib/Model/SelfManagedSuperFundModel.php index 10989d1..f370467 100644 --- a/src/lib/Model/SelfManagedSuperFundModel.php +++ b/src/lib/Model/SelfManagedSuperFundModel.php @@ -2,61 +2,61 @@ /** * SelfManagedSuperFundModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SelfManagedSuperFundModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SelfManagedSuperFundModel implements ModelInterface, ArrayAccess +class SelfManagedSuperFundModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SelfManagedSuperFundModel'; + protected static $openAPIModelName = 'SelfManagedSuperFundModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'abn' => 'string', 'fund_name' => 'string', @@ -73,8 +73,10 @@ class SelfManagedSuperFundModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'abn' => null, 'fund_name' => null, @@ -87,14 +89,39 @@ class SelfManagedSuperFundModel implements ModelInterface, ArrayAccess 'external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'abn' => false, + 'fund_name' => false, + 'account_name' => false, + 'account_number' => false, + 'bsb' => false, + 'electronic_service_address' => false, + 'email' => false, + 'employee_id' => false, + 'external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['fund_name'] = isset($data['fund_name']) ? $data['fund_name'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['electronic_service_address'] = isset($data['electronic_service_address']) ? $data['electronic_service_address'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('fund_name', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('electronic_service_address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('external_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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -295,12 +392,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -309,7 +409,7 @@ public function setAbn($abn) /** * Gets fund_name * - * @return string + * @return string|null */ public function getFundName() { @@ -319,12 +419,15 @@ public function getFundName() /** * Sets fund_name * - * @param string $fund_name + * @param string|null $fund_name * - * @return $this + * @return self */ public function setFundName($fund_name) { + if (is_null($fund_name)) { + throw new \InvalidArgumentException('non-nullable fund_name cannot be null'); + } $this->container['fund_name'] = $fund_name; return $this; @@ -333,7 +436,7 @@ public function setFundName($fund_name) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -343,12 +446,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -357,7 +463,7 @@ public function setAccountName($account_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -367,12 +473,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -381,7 +490,7 @@ public function setAccountNumber($account_number) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -391,12 +500,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -405,7 +517,7 @@ public function setBsb($bsb) /** * Gets electronic_service_address * - * @return string + * @return string|null */ public function getElectronicServiceAddress() { @@ -415,12 +527,15 @@ public function getElectronicServiceAddress() /** * Sets electronic_service_address * - * @param string $electronic_service_address + * @param string|null $electronic_service_address * - * @return $this + * @return self */ public function setElectronicServiceAddress($electronic_service_address) { + if (is_null($electronic_service_address)) { + throw new \InvalidArgumentException('non-nullable electronic_service_address cannot be null'); + } $this->container['electronic_service_address'] = $electronic_service_address; return $this; @@ -429,7 +544,7 @@ public function setElectronicServiceAddress($electronic_service_address) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -439,12 +554,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -453,7 +571,7 @@ public function setEmail($email) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -463,12 +581,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -477,7 +598,7 @@ public function setEmployeeId($employee_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -487,12 +608,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -504,7 +628,7 @@ public function setExternalId($external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SetBillingPlanRequestModel.php b/src/lib/Model/SetBillingPlanRequestModel.php index 213acdb..f4d3276 100644 --- a/src/lib/Model/SetBillingPlanRequestModel.php +++ b/src/lib/Model/SetBillingPlanRequestModel.php @@ -2,61 +2,61 @@ /** * SetBillingPlanRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SetBillingPlanRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SetBillingPlanRequestModel implements ModelInterface, ArrayAccess +class SetBillingPlanRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SetBillingPlanRequestModel'; + protected static $openAPIModelName = 'SetBillingPlanRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'billing_plan_id' => 'int' ]; @@ -64,19 +64,37 @@ class SetBillingPlanRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'billing_plan_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'billing_plan_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['billing_plan_id'] = isset($data['billing_plan_id']) ? $data['billing_plan_id'] : null; + $this->setIfExists('billing_plan_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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets billing_plan_id * - * @return int + * @return int|null */ public function getBillingPlanId() { @@ -217,12 +302,15 @@ public function getBillingPlanId() /** * Sets billing_plan_id * - * @param int $billing_plan_id + * @param int|null $billing_plan_id * - * @return $this + * @return self */ public function setBillingPlanId($billing_plan_id) { + if (is_null($billing_plan_id)) { + throw new \InvalidArgumentException('non-nullable billing_plan_id cannot be null'); + } $this->container['billing_plan_id'] = $billing_plan_id; return $this; @@ -234,7 +322,7 @@ public function setBillingPlanId($billing_plan_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SetPayRunUIUnlockStateRequest.php b/src/lib/Model/SetPayRunUIUnlockStateRequest.php index 3a5c6fa..83cec5f 100644 --- a/src/lib/Model/SetPayRunUIUnlockStateRequest.php +++ b/src/lib/Model/SetPayRunUIUnlockStateRequest.php @@ -2,61 +2,61 @@ /** * SetPayRunUIUnlockStateRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SetPayRunUIUnlockStateRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SetPayRunUIUnlockStateRequest implements ModelInterface, ArrayAccess +class SetPayRunUIUnlockStateRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SetPayRunUIUnlockStateRequest'; + protected static $openAPIModelName = 'SetPayRunUIUnlockStateRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'enable_ui_unlock' => 'bool' ]; @@ -64,19 +64,37 @@ class SetPayRunUIUnlockStateRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'enable_ui_unlock' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'enable_ui_unlock' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['enable_ui_unlock'] = isset($data['enable_ui_unlock']) ? $data['enable_ui_unlock'] : null; + $this->setIfExists('enable_ui_unlock', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets enable_ui_unlock * - * @return bool + * @return bool|null */ public function getEnableUiUnlock() { @@ -217,12 +302,15 @@ public function getEnableUiUnlock() /** * Sets enable_ui_unlock * - * @param bool $enable_ui_unlock + * @param bool|null $enable_ui_unlock * - * @return $this + * @return self */ public function setEnableUiUnlock($enable_ui_unlock) { + if (is_null($enable_ui_unlock)) { + throw new \InvalidArgumentException('non-nullable enable_ui_unlock cannot be null'); + } $this->container['enable_ui_unlock'] = $enable_ui_unlock; return $this; @@ -234,7 +322,7 @@ public function setEnableUiUnlock($enable_ui_unlock) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftAllowanceModel.php b/src/lib/Model/ShiftAllowanceModel.php index 8b96ad1..9370341 100644 --- a/src/lib/Model/ShiftAllowanceModel.php +++ b/src/lib/Model/ShiftAllowanceModel.php @@ -2,77 +2,79 @@ /** * ShiftAllowanceModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftAllowanceModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftAllowanceModel implements ModelInterface, ArrayAccess +class ShiftAllowanceModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftAllowanceModel'; + protected static $openAPIModelName = 'ShiftAllowanceModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_category' => 'string', 'pay_category_id' => 'int', - 'units' => 'double', - 'cost' => 'double', - 'rate_multiplier' => 'double', + 'units' => 'float', + 'cost' => 'float', + 'rate_multiplier' => 'float', 'option' => 'string', 'type' => 'string', - 'classification' => '\Swagger\Client\Model\NominalClassification' + 'classification' => '\OpenAPI\Client\Model\NominalClassification' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_category' => null, 'pay_category_id' => 'int32', 'units' => 'double', @@ -83,14 +85,37 @@ class ShiftAllowanceModel implements ModelInterface, ArrayAccess 'classification' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_category' => false, + 'pay_category_id' => false, + 'units' => false, + 'cost' => false, + 'rate_multiplier' => false, + 'option' => false, + 'type' => false, + 'classification' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -190,18 +267,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const OPTION_FIXED = 'Fixed'; - const OPTION_PER_HOUR_WORKED = 'PerHourWorked'; - const OPTION_PERCENTAGE_OF_SHIFT_COST = 'PercentageOfShiftCost'; - const OPTION_PER_SHIFT_UNIT = 'PerShiftUnit'; - const TYPE_STANDARD = 'Standard'; - const TYPE_ALL_PURPOSE = 'AllPurpose'; - + public const OPTION_FIXED = 'Fixed'; + public const OPTION_PER_HOUR_WORKED = 'PerHourWorked'; + public const OPTION_PERCENTAGE_OF_SHIFT_COST = 'PercentageOfShiftCost'; + public const OPTION_PER_SHIFT_UNIT = 'PerShiftUnit'; + public const TYPE_STANDARD = 'Standard'; + public const TYPE_ALL_PURPOSE = 'AllPurpose'; - /** * Gets allowable values of the enum * @@ -216,7 +291,7 @@ public function getOptionAllowableValues() self::OPTION_PER_SHIFT_UNIT, ]; } - + /** * Gets allowable values of the enum * @@ -229,7 +304,6 @@ public function getTypeAllowableValues() self::TYPE_ALL_PURPOSE, ]; } - /** * Associative array for storing property values @@ -246,14 +320,32 @@ public function getTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['pay_category'] = isset($data['pay_category']) ? $data['pay_category'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['rate_multiplier'] = isset($data['rate_multiplier']) ? $data['rate_multiplier'] : null; - $this->container['option'] = isset($data['option']) ? $data['option'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; + $this->setIfExists('pay_category', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('rate_multiplier', $data ?? [], null); + $this->setIfExists('option', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('classification', $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; } /** @@ -268,7 +360,8 @@ public function listInvalidProperties() $allowedValues = $this->getOptionAllowableValues(); if (!is_null($this->container['option']) && !in_array($this->container['option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'option', must be one of '%s'", + "invalid value '%s' for 'option', must be one of '%s'", + $this->container['option'], implode("', '", $allowedValues) ); } @@ -276,7 +369,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -299,7 +393,7 @@ public function valid() /** * Gets pay_category * - * @return string + * @return string|null */ public function getPayCategory() { @@ -309,12 +403,15 @@ public function getPayCategory() /** * Sets pay_category * - * @param string $pay_category + * @param string|null $pay_category * - * @return $this + * @return self */ public function setPayCategory($pay_category) { + if (is_null($pay_category)) { + throw new \InvalidArgumentException('non-nullable pay_category cannot be null'); + } $this->container['pay_category'] = $pay_category; return $this; @@ -323,7 +420,7 @@ public function setPayCategory($pay_category) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -333,12 +430,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -347,7 +447,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -357,12 +457,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -371,7 +474,7 @@ public function setUnits($units) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -381,12 +484,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -395,7 +501,7 @@ public function setCost($cost) /** * Gets rate_multiplier * - * @return double + * @return float|null */ public function getRateMultiplier() { @@ -405,12 +511,15 @@ public function getRateMultiplier() /** * Sets rate_multiplier * - * @param double $rate_multiplier + * @param float|null $rate_multiplier * - * @return $this + * @return self */ public function setRateMultiplier($rate_multiplier) { + if (is_null($rate_multiplier)) { + throw new \InvalidArgumentException('non-nullable rate_multiplier cannot be null'); + } $this->container['rate_multiplier'] = $rate_multiplier; return $this; @@ -419,7 +528,7 @@ public function setRateMultiplier($rate_multiplier) /** * Gets option * - * @return string + * @return string|null */ public function getOption() { @@ -429,17 +538,21 @@ public function getOption() /** * Sets option * - * @param string $option + * @param string|null $option * - * @return $this + * @return self */ public function setOption($option) { + if (is_null($option)) { + throw new \InvalidArgumentException('non-nullable option cannot be null'); + } $allowedValues = $this->getOptionAllowableValues(); - if (!is_null($option) && !in_array($option, $allowedValues, true)) { + if (!in_array($option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'option', must be one of '%s'", + "Invalid value '%s' for 'option', must be one of '%s'", + $option, implode("', '", $allowedValues) ) ); @@ -452,7 +565,7 @@ public function setOption($option) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -462,17 +575,21 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { + if (!in_array($type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -485,7 +602,7 @@ public function setType($type) /** * Gets classification * - * @return \Swagger\Client\Model\NominalClassification + * @return \OpenAPI\Client\Model\NominalClassification|null */ public function getClassification() { @@ -495,12 +612,15 @@ public function getClassification() /** * Sets classification * - * @param \Swagger\Client\Model\NominalClassification $classification + * @param \OpenAPI\Client\Model\NominalClassification|null $classification classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -512,7 +632,7 @@ public function setClassification($classification) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -522,22 +642,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -553,11 +674,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -565,13 +699,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftBreakModel.php b/src/lib/Model/ShiftBreakModel.php index ff2703b..428d983 100644 --- a/src/lib/Model/ShiftBreakModel.php +++ b/src/lib/Model/ShiftBreakModel.php @@ -2,67 +2,67 @@ /** * ShiftBreakModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftBreakModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftBreakModel implements ModelInterface, ArrayAccess +class ShiftBreakModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftBreakModel'; + protected static $openAPIModelName = 'ShiftBreakModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'start' => '\Swagger\Client\Model\StartBreakModel', - 'end' => '\Swagger\Client\Model\EndBreakModel', + protected static $openAPITypes = [ + 'start' => '\OpenAPI\Client\Model\StartBreakModel', + 'end' => '\OpenAPI\Client\Model\EndBreakModel', 'is_paid_break' => 'bool', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -76,8 +76,10 @@ class ShiftBreakModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'start' => null, 'end' => null, 'is_paid_break' => null, @@ -93,14 +95,42 @@ class ShiftBreakModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start' => false, + 'end' => false, + 'is_paid_break' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -215,14 +297,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -235,7 +315,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -252,19 +331,37 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('is_paid_break', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -283,7 +380,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -306,7 +404,7 @@ public function valid() /** * Gets start * - * @return \Swagger\Client\Model\StartBreakModel + * @return \OpenAPI\Client\Model\StartBreakModel|null */ public function getStart() { @@ -316,12 +414,15 @@ public function getStart() /** * Sets start * - * @param \Swagger\Client\Model\StartBreakModel $start + * @param \OpenAPI\Client\Model\StartBreakModel|null $start start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -330,7 +431,7 @@ public function setStart($start) /** * Gets end * - * @return \Swagger\Client\Model\EndBreakModel + * @return \OpenAPI\Client\Model\EndBreakModel|null */ public function getEnd() { @@ -340,12 +441,15 @@ public function getEnd() /** * Sets end * - * @param \Swagger\Client\Model\EndBreakModel $end + * @param \OpenAPI\Client\Model\EndBreakModel|null $end end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -354,7 +458,7 @@ public function setEnd($end) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -364,12 +468,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -378,7 +485,7 @@ public function setIsPaidBreak($is_paid_break) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -388,12 +495,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -402,7 +512,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -412,12 +522,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -426,7 +539,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -436,12 +549,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -450,7 +566,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -460,12 +576,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -474,7 +593,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -484,12 +603,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -498,7 +620,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -508,15 +630,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling ShiftBreakModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling ShiftBreakModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -527,7 +652,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -537,12 +662,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -551,7 +679,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -561,12 +689,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -575,7 +706,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -585,12 +716,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -599,7 +733,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -609,17 +743,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -635,7 +773,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -645,22 +783,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -676,11 +815,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -688,13 +840,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCondition.php b/src/lib/Model/ShiftCondition.php index 22a9d3f..9b67dfa 100644 --- a/src/lib/Model/ShiftCondition.php +++ b/src/lib/Model/ShiftCondition.php @@ -2,61 +2,61 @@ /** * ShiftCondition * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCondition Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCondition implements ModelInterface, ArrayAccess +class ShiftCondition implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCondition'; + protected static $openAPIModelName = 'ShiftCondition'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class ShiftCondition implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftConditionModel.php b/src/lib/Model/ShiftConditionModel.php index 66cd77b..01fab25 100644 --- a/src/lib/Model/ShiftConditionModel.php +++ b/src/lib/Model/ShiftConditionModel.php @@ -2,61 +2,61 @@ /** * ShiftConditionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftConditionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftConditionModel implements ModelInterface, ArrayAccess +class ShiftConditionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftConditionModel'; + protected static $openAPIModelName = 'ShiftConditionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class ShiftConditionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftConditionSelectModel.php b/src/lib/Model/ShiftConditionSelectModel.php index 8475e4b..2a8479b 100644 --- a/src/lib/Model/ShiftConditionSelectModel.php +++ b/src/lib/Model/ShiftConditionSelectModel.php @@ -2,61 +2,61 @@ /** * ShiftConditionSelectModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftConditionSelectModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftConditionSelectModel implements ModelInterface, ArrayAccess +class ShiftConditionSelectModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftConditionSelectModel'; + protected static $openAPIModelName = 'ShiftConditionSelectModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'short_code' => 'string', 'business_award_package_id' => 'int', 'id' => 'int', @@ -67,22 +67,43 @@ class ShiftConditionSelectModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'short_code' => null, 'business_award_package_id' => 'int32', 'id' => 'int32', 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'short_code' => false, + 'business_award_package_id' => false, + 'id' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['short_code'] = isset($data['short_code']) ? $data['short_code'] : null; - $this->container['business_award_package_id'] = isset($data['business_award_package_id']) ? $data['business_award_package_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('short_code', $data ?? [], null); + $this->setIfExists('business_award_package_id', $data ?? [], null); + $this->setIfExists('id', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets short_code * - * @return string + * @return string|null */ public function getShortCode() { @@ -235,12 +323,15 @@ public function getShortCode() /** * Sets short_code * - * @param string $short_code + * @param string|null $short_code * - * @return $this + * @return self */ public function setShortCode($short_code) { + if (is_null($short_code)) { + throw new \InvalidArgumentException('non-nullable short_code cannot be null'); + } $this->container['short_code'] = $short_code; return $this; @@ -249,7 +340,7 @@ public function setShortCode($short_code) /** * Gets business_award_package_id * - * @return int + * @return int|null */ public function getBusinessAwardPackageId() { @@ -259,12 +350,15 @@ public function getBusinessAwardPackageId() /** * Sets business_award_package_id * - * @param int $business_award_package_id + * @param int|null $business_award_package_id * - * @return $this + * @return self */ public function setBusinessAwardPackageId($business_award_package_id) { + if (is_null($business_award_package_id)) { + throw new \InvalidArgumentException('non-nullable business_award_package_id cannot be null'); + } $this->container['business_award_package_id'] = $business_award_package_id; return $this; @@ -273,7 +367,7 @@ public function setBusinessAwardPackageId($business_award_package_id) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -283,12 +377,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setId($id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -307,12 +404,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -324,7 +424,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingBreakdownModel.php b/src/lib/Model/ShiftCostingBreakdownModel.php index 57e0385..69130db 100644 --- a/src/lib/Model/ShiftCostingBreakdownModel.php +++ b/src/lib/Model/ShiftCostingBreakdownModel.php @@ -2,68 +2,68 @@ /** * ShiftCostingBreakdownModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingBreakdownModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingBreakdownModel implements ModelInterface, ArrayAccess +class ShiftCostingBreakdownModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingBreakdownModel'; + protected static $openAPIModelName = 'ShiftCostingBreakdownModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'pay_category_id' => 'int', 'pay_category_name' => 'string', - 'units' => 'double', - 'rate' => 'double', - 'cost' => 'double', + 'units' => 'float', + 'rate' => 'float', + 'cost' => 'float', 'type' => 'string', 'liability_category_id' => 'int', 'liability_category_name' => 'string', @@ -75,8 +75,10 @@ class ShiftCostingBreakdownModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'start_time' => 'date-time', 'end_time' => 'date-time', 'pay_category_id' => 'int32', @@ -91,14 +93,41 @@ class ShiftCostingBreakdownModel implements ModelInterface, ArrayAccess 'location_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_time' => false, + 'end_time' => false, + 'pay_category_id' => false, + 'pay_category_name' => false, + 'units' => false, + 'rate' => false, + 'cost' => false, + 'type' => false, + 'liability_category_id' => false, + 'liability_category_name' => false, + 'location_id' => false, + 'location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['pay_category_name'] = isset($data['pay_category_name']) ? $data['pay_category_name'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['liability_category_id'] = isset($data['liability_category_id']) ? $data['liability_category_id'] : null; - $this->container['liability_category_name'] = isset($data['liability_category_name']) ? $data['liability_category_name'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('pay_category_name', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('liability_category_id', $data ?? [], null); + $this->setIfExists('liability_category_name', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -283,12 +379,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -297,7 +396,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -307,12 +406,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -321,7 +423,7 @@ public function setEndTime($end_time) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -331,12 +433,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -345,7 +450,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets pay_category_name * - * @return string + * @return string|null */ public function getPayCategoryName() { @@ -355,12 +460,15 @@ public function getPayCategoryName() /** * Sets pay_category_name * - * @param string $pay_category_name + * @param string|null $pay_category_name * - * @return $this + * @return self */ public function setPayCategoryName($pay_category_name) { + if (is_null($pay_category_name)) { + throw new \InvalidArgumentException('non-nullable pay_category_name cannot be null'); + } $this->container['pay_category_name'] = $pay_category_name; return $this; @@ -369,7 +477,7 @@ public function setPayCategoryName($pay_category_name) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -379,12 +487,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -393,7 +504,7 @@ public function setUnits($units) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -403,12 +514,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -417,7 +531,7 @@ public function setRate($rate) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -427,12 +541,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -441,7 +558,7 @@ public function setCost($cost) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -451,12 +568,15 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -465,7 +585,7 @@ public function setType($type) /** * Gets liability_category_id * - * @return int + * @return int|null */ public function getLiabilityCategoryId() { @@ -475,12 +595,15 @@ public function getLiabilityCategoryId() /** * Sets liability_category_id * - * @param int $liability_category_id + * @param int|null $liability_category_id * - * @return $this + * @return self */ public function setLiabilityCategoryId($liability_category_id) { + if (is_null($liability_category_id)) { + throw new \InvalidArgumentException('non-nullable liability_category_id cannot be null'); + } $this->container['liability_category_id'] = $liability_category_id; return $this; @@ -489,7 +612,7 @@ public function setLiabilityCategoryId($liability_category_id) /** * Gets liability_category_name * - * @return string + * @return string|null */ public function getLiabilityCategoryName() { @@ -499,12 +622,15 @@ public function getLiabilityCategoryName() /** * Sets liability_category_name * - * @param string $liability_category_name + * @param string|null $liability_category_name * - * @return $this + * @return self */ public function setLiabilityCategoryName($liability_category_name) { + if (is_null($liability_category_name)) { + throw new \InvalidArgumentException('non-nullable liability_category_name cannot be null'); + } $this->container['liability_category_name'] = $liability_category_name; return $this; @@ -513,7 +639,7 @@ public function setLiabilityCategoryName($liability_category_name) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -523,12 +649,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -537,7 +666,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -547,12 +676,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -564,7 +696,7 @@ public function setLocationName($location_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingData.php b/src/lib/Model/ShiftCostingData.php index b3f7b56..175ad85 100644 --- a/src/lib/Model/ShiftCostingData.php +++ b/src/lib/Model/ShiftCostingData.php @@ -2,64 +2,64 @@ /** * ShiftCostingData * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingData Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingData implements ModelInterface, ArrayAccess +class ShiftCostingData implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingData'; + protected static $openAPIModelName = 'ShiftCostingData'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'shift_parts' => '\Swagger\Client\Model\ShiftPartModel[]', - 'allowances' => '\Swagger\Client\Model\ShiftAllowanceModel[]', - 'liabilities' => '\Swagger\Client\Model\ShiftLiabilityModel[]', + protected static $openAPITypes = [ + 'shift_parts' => '\OpenAPI\Client\Model\ShiftPartModel[]', + 'allowances' => '\OpenAPI\Client\Model\ShiftAllowanceModel[]', + 'liabilities' => '\OpenAPI\Client\Model\ShiftLiabilityModel[]', 'is_consolidated' => 'bool' ]; @@ -67,22 +67,43 @@ class ShiftCostingData implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shift_parts' => null, 'allowances' => null, 'liabilities' => null, 'is_consolidated' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shift_parts' => false, + 'allowances' => false, + 'liabilities' => false, + 'is_consolidated' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['shift_parts'] = isset($data['shift_parts']) ? $data['shift_parts'] : null; - $this->container['allowances'] = isset($data['allowances']) ? $data['allowances'] : null; - $this->container['liabilities'] = isset($data['liabilities']) ? $data['liabilities'] : null; - $this->container['is_consolidated'] = isset($data['is_consolidated']) ? $data['is_consolidated'] : null; + $this->setIfExists('shift_parts', $data ?? [], null); + $this->setIfExists('allowances', $data ?? [], null); + $this->setIfExists('liabilities', $data ?? [], null); + $this->setIfExists('is_consolidated', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets shift_parts * - * @return \Swagger\Client\Model\ShiftPartModel[] + * @return \OpenAPI\Client\Model\ShiftPartModel[]|null */ public function getShiftParts() { @@ -235,12 +323,15 @@ public function getShiftParts() /** * Sets shift_parts * - * @param \Swagger\Client\Model\ShiftPartModel[] $shift_parts + * @param \OpenAPI\Client\Model\ShiftPartModel[]|null $shift_parts * - * @return $this + * @return self */ public function setShiftParts($shift_parts) { + if (is_null($shift_parts)) { + throw new \InvalidArgumentException('non-nullable shift_parts cannot be null'); + } $this->container['shift_parts'] = $shift_parts; return $this; @@ -249,7 +340,7 @@ public function setShiftParts($shift_parts) /** * Gets allowances * - * @return \Swagger\Client\Model\ShiftAllowanceModel[] + * @return \OpenAPI\Client\Model\ShiftAllowanceModel[]|null */ public function getAllowances() { @@ -259,12 +350,15 @@ public function getAllowances() /** * Sets allowances * - * @param \Swagger\Client\Model\ShiftAllowanceModel[] $allowances + * @param \OpenAPI\Client\Model\ShiftAllowanceModel[]|null $allowances * - * @return $this + * @return self */ public function setAllowances($allowances) { + if (is_null($allowances)) { + throw new \InvalidArgumentException('non-nullable allowances cannot be null'); + } $this->container['allowances'] = $allowances; return $this; @@ -273,7 +367,7 @@ public function setAllowances($allowances) /** * Gets liabilities * - * @return \Swagger\Client\Model\ShiftLiabilityModel[] + * @return \OpenAPI\Client\Model\ShiftLiabilityModel[]|null */ public function getLiabilities() { @@ -283,12 +377,15 @@ public function getLiabilities() /** * Sets liabilities * - * @param \Swagger\Client\Model\ShiftLiabilityModel[] $liabilities + * @param \OpenAPI\Client\Model\ShiftLiabilityModel[]|null $liabilities * - * @return $this + * @return self */ public function setLiabilities($liabilities) { + if (is_null($liabilities)) { + throw new \InvalidArgumentException('non-nullable liabilities cannot be null'); + } $this->container['liabilities'] = $liabilities; return $this; @@ -297,7 +394,7 @@ public function setLiabilities($liabilities) /** * Gets is_consolidated * - * @return bool + * @return bool|null */ public function getIsConsolidated() { @@ -307,12 +404,15 @@ public function getIsConsolidated() /** * Sets is_consolidated * - * @param bool $is_consolidated + * @param bool|null $is_consolidated * - * @return $this + * @return self */ public function setIsConsolidated($is_consolidated) { + if (is_null($is_consolidated)) { + throw new \InvalidArgumentException('non-nullable is_consolidated cannot be null'); + } $this->container['is_consolidated'] = $is_consolidated; return $this; @@ -324,7 +424,7 @@ public function setIsConsolidated($is_consolidated) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingsEmployeeModel.php b/src/lib/Model/ShiftCostingsEmployeeModel.php index 9cc400f..fdf5a76 100644 --- a/src/lib/Model/ShiftCostingsEmployeeModel.php +++ b/src/lib/Model/ShiftCostingsEmployeeModel.php @@ -2,66 +2,66 @@ /** * ShiftCostingsEmployeeModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingsEmployeeModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingsEmployeeModel implements ModelInterface, ArrayAccess +class ShiftCostingsEmployeeModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingsEmployeeModel'; + protected static $openAPIModelName = 'ShiftCostingsEmployeeModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'name' => 'string', 'date_of_birth' => '\DateTime', 'anniversary_date' => '\DateTime', - 'standard_hours_per_week' => 'double', - 'standard_hours_per_day' => 'double', + 'standard_hours_per_week' => 'float', + 'standard_hours_per_day' => 'float', 'tags' => 'string[]' ]; @@ -69,8 +69,10 @@ class ShiftCostingsEmployeeModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'name' => null, 'date_of_birth' => 'date-time', 'anniversary_date' => 'date-time', @@ -79,14 +81,35 @@ class ShiftCostingsEmployeeModel implements ModelInterface, ArrayAccess 'tags' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'date_of_birth' => false, + 'anniversary_date' => false, + 'standard_hours_per_week' => false, + 'standard_hours_per_day' => false, + 'tags' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null; - $this->container['anniversary_date'] = isset($data['anniversary_date']) ? $data['anniversary_date'] : null; - $this->container['standard_hours_per_week'] = isset($data['standard_hours_per_week']) ? $data['standard_hours_per_week'] : null; - $this->container['standard_hours_per_day'] = isset($data['standard_hours_per_day']) ? $data['standard_hours_per_day'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('date_of_birth', $data ?? [], null); + $this->setIfExists('anniversary_date', $data ?? [], null); + $this->setIfExists('standard_hours_per_week', $data ?? [], null); + $this->setIfExists('standard_hours_per_day', $data ?? [], null); + $this->setIfExists('tags', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +337,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setName($name) /** * Gets date_of_birth * - * @return \DateTime + * @return \DateTime|null */ public function getDateOfBirth() { @@ -271,12 +364,15 @@ public function getDateOfBirth() /** * Sets date_of_birth * - * @param \DateTime $date_of_birth + * @param \DateTime|null $date_of_birth * - * @return $this + * @return self */ public function setDateOfBirth($date_of_birth) { + if (is_null($date_of_birth)) { + throw new \InvalidArgumentException('non-nullable date_of_birth cannot be null'); + } $this->container['date_of_birth'] = $date_of_birth; return $this; @@ -285,7 +381,7 @@ public function setDateOfBirth($date_of_birth) /** * Gets anniversary_date * - * @return \DateTime + * @return \DateTime|null */ public function getAnniversaryDate() { @@ -295,12 +391,15 @@ public function getAnniversaryDate() /** * Sets anniversary_date * - * @param \DateTime $anniversary_date + * @param \DateTime|null $anniversary_date * - * @return $this + * @return self */ public function setAnniversaryDate($anniversary_date) { + if (is_null($anniversary_date)) { + throw new \InvalidArgumentException('non-nullable anniversary_date cannot be null'); + } $this->container['anniversary_date'] = $anniversary_date; return $this; @@ -309,7 +408,7 @@ public function setAnniversaryDate($anniversary_date) /** * Gets standard_hours_per_week * - * @return double + * @return float|null */ public function getStandardHoursPerWeek() { @@ -319,12 +418,15 @@ public function getStandardHoursPerWeek() /** * Sets standard_hours_per_week * - * @param double $standard_hours_per_week + * @param float|null $standard_hours_per_week * - * @return $this + * @return self */ public function setStandardHoursPerWeek($standard_hours_per_week) { + if (is_null($standard_hours_per_week)) { + throw new \InvalidArgumentException('non-nullable standard_hours_per_week cannot be null'); + } $this->container['standard_hours_per_week'] = $standard_hours_per_week; return $this; @@ -333,7 +435,7 @@ public function setStandardHoursPerWeek($standard_hours_per_week) /** * Gets standard_hours_per_day * - * @return double + * @return float|null */ public function getStandardHoursPerDay() { @@ -343,12 +445,15 @@ public function getStandardHoursPerDay() /** * Sets standard_hours_per_day * - * @param double $standard_hours_per_day + * @param float|null $standard_hours_per_day * - * @return $this + * @return self */ public function setStandardHoursPerDay($standard_hours_per_day) { + if (is_null($standard_hours_per_day)) { + throw new \InvalidArgumentException('non-nullable standard_hours_per_day cannot be null'); + } $this->container['standard_hours_per_day'] = $standard_hours_per_day; return $this; @@ -357,7 +462,7 @@ public function setStandardHoursPerDay($standard_hours_per_day) /** * Gets tags * - * @return string[] + * @return string[]|null */ public function getTags() { @@ -367,12 +472,15 @@ public function getTags() /** * Sets tags * - * @param string[] $tags + * @param string[]|null $tags * - * @return $this + * @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; @@ -384,7 +492,7 @@ public function setTags($tags) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingsRequestModel.php b/src/lib/Model/ShiftCostingsRequestModel.php index ede666d..3634060 100644 --- a/src/lib/Model/ShiftCostingsRequestModel.php +++ b/src/lib/Model/ShiftCostingsRequestModel.php @@ -2,76 +2,78 @@ /** * ShiftCostingsRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingsRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingsRequestModel implements ModelInterface, ArrayAccess +class ShiftCostingsRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingsRequestModel'; + protected static $openAPIModelName = 'ShiftCostingsRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'transaction_external_id' => 'string', 'location_id_type' => 'string', 'work_type_id_type' => 'string', 'include_evaluation_results' => 'bool', - 'employee' => '\Swagger\Client\Model\ShiftCostingsEmployeeModel', - 'shifts' => '\Swagger\Client\Model\ShiftCostingsRequestShiftModel[]', - 'override_rates' => '\Swagger\Client\Model\RateOverride[]' + 'employee' => '\OpenAPI\Client\Model\ShiftCostingsEmployeeModel', + 'shifts' => '\OpenAPI\Client\Model\ShiftCostingsRequestShiftModel[]', + 'override_rates' => '\OpenAPI\Client\Model\RateOverride[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'transaction_external_id' => null, 'location_id_type' => null, 'work_type_id_type' => null, @@ -81,14 +83,36 @@ class ShiftCostingsRequestModel implements ModelInterface, ArrayAccess 'override_rates' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'transaction_external_id' => false, + 'location_id_type' => false, + 'work_type_id_type' => false, + 'include_evaluation_results' => false, + 'employee' => false, + 'shifts' => false, + 'override_rates' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -185,16 +261,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const LOCATION_ID_TYPE_STANDARD = 'Standard'; - const LOCATION_ID_TYPE_EXTERNAL = 'External'; - const WORK_TYPE_ID_TYPE_STANDARD = 'Standard'; - const WORK_TYPE_ID_TYPE_EXTERNAL = 'External'; - + public const LOCATION_ID_TYPE_STANDARD = 'Standard'; + public const LOCATION_ID_TYPE_EXTERNAL = 'External'; + public const WORK_TYPE_ID_TYPE_STANDARD = 'Standard'; + public const WORK_TYPE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -207,7 +281,7 @@ public function getLocationIdTypeAllowableValues() self::LOCATION_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -220,7 +294,6 @@ public function getWorkTypeIdTypeAllowableValues() self::WORK_TYPE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -237,13 +310,31 @@ public function getWorkTypeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['transaction_external_id'] = isset($data['transaction_external_id']) ? $data['transaction_external_id'] : null; - $this->container['location_id_type'] = isset($data['location_id_type']) ? $data['location_id_type'] : null; - $this->container['work_type_id_type'] = isset($data['work_type_id_type']) ? $data['work_type_id_type'] : null; - $this->container['include_evaluation_results'] = isset($data['include_evaluation_results']) ? $data['include_evaluation_results'] : null; - $this->container['employee'] = isset($data['employee']) ? $data['employee'] : null; - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; - $this->container['override_rates'] = isset($data['override_rates']) ? $data['override_rates'] : null; + $this->setIfExists('transaction_external_id', $data ?? [], null); + $this->setIfExists('location_id_type', $data ?? [], null); + $this->setIfExists('work_type_id_type', $data ?? [], null); + $this->setIfExists('include_evaluation_results', $data ?? [], null); + $this->setIfExists('employee', $data ?? [], null); + $this->setIfExists('shifts', $data ?? [], null); + $this->setIfExists('override_rates', $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; } /** @@ -258,7 +349,8 @@ public function listInvalidProperties() $allowedValues = $this->getLocationIdTypeAllowableValues(); if (!is_null($this->container['location_id_type']) && !in_array($this->container['location_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'location_id_type', must be one of '%s'", + "invalid value '%s' for 'location_id_type', must be one of '%s'", + $this->container['location_id_type'], implode("', '", $allowedValues) ); } @@ -266,7 +358,8 @@ public function listInvalidProperties() $allowedValues = $this->getWorkTypeIdTypeAllowableValues(); if (!is_null($this->container['work_type_id_type']) && !in_array($this->container['work_type_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'work_type_id_type', must be one of '%s'", + "invalid value '%s' for 'work_type_id_type', must be one of '%s'", + $this->container['work_type_id_type'], implode("', '", $allowedValues) ); } @@ -289,7 +382,7 @@ public function valid() /** * Gets transaction_external_id * - * @return string + * @return string|null */ public function getTransactionExternalId() { @@ -299,12 +392,15 @@ public function getTransactionExternalId() /** * Sets transaction_external_id * - * @param string $transaction_external_id + * @param string|null $transaction_external_id * - * @return $this + * @return self */ public function setTransactionExternalId($transaction_external_id) { + if (is_null($transaction_external_id)) { + throw new \InvalidArgumentException('non-nullable transaction_external_id cannot be null'); + } $this->container['transaction_external_id'] = $transaction_external_id; return $this; @@ -313,7 +409,7 @@ public function setTransactionExternalId($transaction_external_id) /** * Gets location_id_type * - * @return string + * @return string|null */ public function getLocationIdType() { @@ -323,17 +419,21 @@ public function getLocationIdType() /** * Sets location_id_type * - * @param string $location_id_type + * @param string|null $location_id_type * - * @return $this + * @return self */ public function setLocationIdType($location_id_type) { + if (is_null($location_id_type)) { + throw new \InvalidArgumentException('non-nullable location_id_type cannot be null'); + } $allowedValues = $this->getLocationIdTypeAllowableValues(); - if (!is_null($location_id_type) && !in_array($location_id_type, $allowedValues, true)) { + if (!in_array($location_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'location_id_type', must be one of '%s'", + "Invalid value '%s' for 'location_id_type', must be one of '%s'", + $location_id_type, implode("', '", $allowedValues) ) ); @@ -346,7 +446,7 @@ public function setLocationIdType($location_id_type) /** * Gets work_type_id_type * - * @return string + * @return string|null */ public function getWorkTypeIdType() { @@ -356,17 +456,21 @@ public function getWorkTypeIdType() /** * Sets work_type_id_type * - * @param string $work_type_id_type + * @param string|null $work_type_id_type * - * @return $this + * @return self */ public function setWorkTypeIdType($work_type_id_type) { + if (is_null($work_type_id_type)) { + throw new \InvalidArgumentException('non-nullable work_type_id_type cannot be null'); + } $allowedValues = $this->getWorkTypeIdTypeAllowableValues(); - if (!is_null($work_type_id_type) && !in_array($work_type_id_type, $allowedValues, true)) { + if (!in_array($work_type_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'work_type_id_type', must be one of '%s'", + "Invalid value '%s' for 'work_type_id_type', must be one of '%s'", + $work_type_id_type, implode("', '", $allowedValues) ) ); @@ -379,7 +483,7 @@ public function setWorkTypeIdType($work_type_id_type) /** * Gets include_evaluation_results * - * @return bool + * @return bool|null */ public function getIncludeEvaluationResults() { @@ -389,12 +493,15 @@ public function getIncludeEvaluationResults() /** * Sets include_evaluation_results * - * @param bool $include_evaluation_results + * @param bool|null $include_evaluation_results * - * @return $this + * @return self */ public function setIncludeEvaluationResults($include_evaluation_results) { + if (is_null($include_evaluation_results)) { + throw new \InvalidArgumentException('non-nullable include_evaluation_results cannot be null'); + } $this->container['include_evaluation_results'] = $include_evaluation_results; return $this; @@ -403,7 +510,7 @@ public function setIncludeEvaluationResults($include_evaluation_results) /** * Gets employee * - * @return \Swagger\Client\Model\ShiftCostingsEmployeeModel + * @return \OpenAPI\Client\Model\ShiftCostingsEmployeeModel|null */ public function getEmployee() { @@ -413,12 +520,15 @@ public function getEmployee() /** * Sets employee * - * @param \Swagger\Client\Model\ShiftCostingsEmployeeModel $employee + * @param \OpenAPI\Client\Model\ShiftCostingsEmployeeModel|null $employee employee * - * @return $this + * @return self */ public function setEmployee($employee) { + if (is_null($employee)) { + throw new \InvalidArgumentException('non-nullable employee cannot be null'); + } $this->container['employee'] = $employee; return $this; @@ -427,7 +537,7 @@ public function setEmployee($employee) /** * Gets shifts * - * @return \Swagger\Client\Model\ShiftCostingsRequestShiftModel[] + * @return \OpenAPI\Client\Model\ShiftCostingsRequestShiftModel[]|null */ public function getShifts() { @@ -437,12 +547,15 @@ public function getShifts() /** * Sets shifts * - * @param \Swagger\Client\Model\ShiftCostingsRequestShiftModel[] $shifts + * @param \OpenAPI\Client\Model\ShiftCostingsRequestShiftModel[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -451,7 +564,7 @@ public function setShifts($shifts) /** * Gets override_rates * - * @return \Swagger\Client\Model\RateOverride[] + * @return \OpenAPI\Client\Model\RateOverride[]|null */ public function getOverrideRates() { @@ -461,12 +574,15 @@ public function getOverrideRates() /** * Sets override_rates * - * @param \Swagger\Client\Model\RateOverride[] $override_rates + * @param \OpenAPI\Client\Model\RateOverride[]|null $override_rates * - * @return $this + * @return self */ public function setOverrideRates($override_rates) { + if (is_null($override_rates)) { + throw new \InvalidArgumentException('non-nullable override_rates cannot be null'); + } $this->container['override_rates'] = $override_rates; return $this; @@ -478,7 +594,7 @@ public function setOverrideRates($override_rates) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -488,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -519,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -531,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingsRequestShiftModel.php b/src/lib/Model/ShiftCostingsRequestShiftModel.php index fca47b1..103ba54 100644 --- a/src/lib/Model/ShiftCostingsRequestShiftModel.php +++ b/src/lib/Model/ShiftCostingsRequestShiftModel.php @@ -2,64 +2,64 @@ /** * ShiftCostingsRequestShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingsRequestShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingsRequestShiftModel implements ModelInterface, ArrayAccess +class ShiftCostingsRequestShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingsRequestShiftModel'; + protected static $openAPIModelName = 'ShiftCostingsRequestShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'shift_id' => 'string', 'state' => 'string', - 'override_rates' => '\Swagger\Client\Model\RateOverride[]', + 'override_rates' => '\OpenAPI\Client\Model\RateOverride[]', 'classification_id' => 'string', 'classification' => 'string', 'location_is_deleted' => 'bool', @@ -67,13 +67,13 @@ class ShiftCostingsRequestShiftModel implements ModelInterface, ArrayAccess 'employee_id' => 'int', 'start_time' => '\DateTime', 'end_time' => '\DateTime', - 'units' => 'double', + 'units' => 'float', 'work_type_id' => 'string', 'location_id' => 'string', 'comments' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakModelv3[]', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakModelv3[]', 'status' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'leave_category_id' => 'string', 'pay_category_id' => 'string', 'external_id' => 'string', @@ -82,9 +82,9 @@ class ShiftCostingsRequestShiftModel implements ModelInterface, ArrayAccess 'shift_condition_ids' => 'string[]', 'work_type' => 'string', 'fully_qualified_location_name' => 'string', - 'shift_conditions' => '\Swagger\Client\Model\TimesheetShiftConditionModelv3[]', + 'shift_conditions' => '\OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]', 'hidden_comments' => 'string', - 'attachment' => '\Swagger\Client\Model\Attachment', + 'attachment' => '\OpenAPI\Client\Model\Attachment', 'submitted_by_user' => 'string' ]; @@ -92,8 +92,10 @@ class ShiftCostingsRequestShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'shift_id' => null, 'state' => null, 'override_rates' => null, @@ -125,14 +127,58 @@ class ShiftCostingsRequestShiftModel implements ModelInterface, ArrayAccess 'submitted_by_user' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'shift_id' => false, + 'state' => false, + 'override_rates' => false, + 'classification_id' => false, + 'classification' => false, + 'location_is_deleted' => false, + 'id' => false, + 'employee_id' => false, + 'start_time' => false, + 'end_time' => false, + 'units' => false, + 'work_type_id' => false, + 'location_id' => false, + 'comments' => false, + 'breaks' => false, + 'status' => false, + 'rate' => false, + 'leave_category_id' => false, + 'pay_category_id' => false, + 'external_id' => false, + 'source' => false, + 'attachment_id' => false, + 'shift_condition_ids' => false, + 'work_type' => false, + 'fully_qualified_location_name' => false, + 'shift_conditions' => false, + 'hidden_comments' => false, + 'attachment' => false, + 'submitted_by_user' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -140,9 +186,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -295,88 +393,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -463,7 +559,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -480,35 +575,53 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['shift_id'] = isset($data['shift_id']) ? $data['shift_id'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['override_rates'] = isset($data['override_rates']) ? $data['override_rates'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['location_is_deleted'] = isset($data['location_is_deleted']) ? $data['location_is_deleted'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['fully_qualified_location_name'] = isset($data['fully_qualified_location_name']) ? $data['fully_qualified_location_name'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; - $this->container['submitted_by_user'] = isset($data['submitted_by_user']) ? $data['submitted_by_user'] : null; + $this->setIfExists('shift_id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('override_rates', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('location_is_deleted', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('fully_qualified_location_name', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('attachment', $data ?? [], null); + $this->setIfExists('submitted_by_user', $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; } /** @@ -523,7 +636,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -546,7 +660,7 @@ public function valid() /** * Gets shift_id * - * @return string + * @return string|null */ public function getShiftId() { @@ -556,12 +670,15 @@ public function getShiftId() /** * Sets shift_id * - * @param string $shift_id + * @param string|null $shift_id * - * @return $this + * @return self */ public function setShiftId($shift_id) { + if (is_null($shift_id)) { + throw new \InvalidArgumentException('non-nullable shift_id cannot be null'); + } $this->container['shift_id'] = $shift_id; return $this; @@ -570,7 +687,7 @@ public function setShiftId($shift_id) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -580,12 +697,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -594,7 +714,7 @@ public function setState($state) /** * Gets override_rates * - * @return \Swagger\Client\Model\RateOverride[] + * @return \OpenAPI\Client\Model\RateOverride[]|null */ public function getOverrideRates() { @@ -604,12 +724,15 @@ public function getOverrideRates() /** * Sets override_rates * - * @param \Swagger\Client\Model\RateOverride[] $override_rates + * @param \OpenAPI\Client\Model\RateOverride[]|null $override_rates * - * @return $this + * @return self */ public function setOverrideRates($override_rates) { + if (is_null($override_rates)) { + throw new \InvalidArgumentException('non-nullable override_rates cannot be null'); + } $this->container['override_rates'] = $override_rates; return $this; @@ -618,7 +741,7 @@ public function setOverrideRates($override_rates) /** * Gets classification_id * - * @return string + * @return string|null */ public function getClassificationId() { @@ -628,12 +751,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param string $classification_id + * @param string|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -642,7 +768,7 @@ public function setClassificationId($classification_id) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -652,12 +778,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -666,7 +795,7 @@ public function setClassification($classification) /** * Gets location_is_deleted * - * @return bool + * @return bool|null */ public function getLocationIsDeleted() { @@ -676,12 +805,15 @@ public function getLocationIsDeleted() /** * Sets location_is_deleted * - * @param bool $location_is_deleted + * @param bool|null $location_is_deleted * - * @return $this + * @return self */ public function setLocationIsDeleted($location_is_deleted) { + if (is_null($location_is_deleted)) { + throw new \InvalidArgumentException('non-nullable location_is_deleted cannot be null'); + } $this->container['location_is_deleted'] = $location_is_deleted; return $this; @@ -690,7 +822,7 @@ public function setLocationIsDeleted($location_is_deleted) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -700,12 +832,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -714,7 +849,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -724,12 +859,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -738,7 +876,7 @@ public function setEmployeeId($employee_id) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -748,12 +886,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -762,7 +903,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -772,12 +913,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -786,7 +930,7 @@ public function setEndTime($end_time) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -796,12 +940,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -810,7 +957,7 @@ public function setUnits($units) /** * Gets work_type_id * - * @return string + * @return string|null */ public function getWorkTypeId() { @@ -820,12 +967,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param string $work_type_id + * @param string|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -834,7 +984,7 @@ public function setWorkTypeId($work_type_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -844,12 +994,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -858,7 +1011,7 @@ public function setLocationId($location_id) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -868,12 +1021,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -882,7 +1038,7 @@ public function setComments($comments) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakModelv3[] + * @return \OpenAPI\Client\Model\TimesheetBreakModelv3[]|null */ public function getBreaks() { @@ -892,12 +1048,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakModelv3[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakModelv3[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -906,7 +1065,7 @@ public function setBreaks($breaks) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -916,12 +1075,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -930,7 +1092,7 @@ public function setStatus($status) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -940,12 +1102,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -954,7 +1119,7 @@ public function setRate($rate) /** * Gets leave_category_id * - * @return string + * @return string|null */ public function getLeaveCategoryId() { @@ -964,12 +1129,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param string $leave_category_id + * @param string|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -978,7 +1146,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets pay_category_id * - * @return string + * @return string|null */ public function getPayCategoryId() { @@ -988,12 +1156,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param string $pay_category_id + * @param string|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -1002,7 +1173,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -1012,12 +1183,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -1026,7 +1200,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -1036,17 +1210,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -1059,7 +1237,7 @@ public function setSource($source) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -1069,12 +1247,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -1083,7 +1264,7 @@ public function setAttachmentId($attachment_id) /** * Gets shift_condition_ids * - * @return string[] + * @return string[]|null */ public function getShiftConditionIds() { @@ -1093,12 +1274,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param string[] $shift_condition_ids + * @param string[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -1107,7 +1291,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets work_type * - * @return string + * @return string|null */ public function getWorkType() { @@ -1117,12 +1301,15 @@ public function getWorkType() /** * Sets work_type * - * @param string $work_type + * @param string|null $work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -1131,7 +1318,7 @@ public function setWorkType($work_type) /** * Gets fully_qualified_location_name * - * @return string + * @return string|null */ public function getFullyQualifiedLocationName() { @@ -1141,12 +1328,15 @@ public function getFullyQualifiedLocationName() /** * Sets fully_qualified_location_name * - * @param string $fully_qualified_location_name + * @param string|null $fully_qualified_location_name * - * @return $this + * @return self */ public function setFullyQualifiedLocationName($fully_qualified_location_name) { + if (is_null($fully_qualified_location_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_location_name cannot be null'); + } $this->container['fully_qualified_location_name'] = $fully_qualified_location_name; return $this; @@ -1155,7 +1345,7 @@ public function setFullyQualifiedLocationName($fully_qualified_location_name) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\TimesheetShiftConditionModelv3[] + * @return \OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]|null */ public function getShiftConditions() { @@ -1165,12 +1355,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\TimesheetShiftConditionModelv3[] $shift_conditions + * @param \OpenAPI\Client\Model\TimesheetShiftConditionModelv3[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -1179,7 +1372,7 @@ public function setShiftConditions($shift_conditions) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -1189,12 +1382,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -1203,7 +1399,7 @@ public function setHiddenComments($hidden_comments) /** * Gets attachment * - * @return \Swagger\Client\Model\Attachment + * @return \OpenAPI\Client\Model\Attachment|null */ public function getAttachment() { @@ -1213,12 +1409,15 @@ public function getAttachment() /** * Sets attachment * - * @param \Swagger\Client\Model\Attachment $attachment + * @param \OpenAPI\Client\Model\Attachment|null $attachment attachment * - * @return $this + * @return self */ public function setAttachment($attachment) { + if (is_null($attachment)) { + throw new \InvalidArgumentException('non-nullable attachment cannot be null'); + } $this->container['attachment'] = $attachment; return $this; @@ -1227,7 +1426,7 @@ public function setAttachment($attachment) /** * Gets submitted_by_user * - * @return string + * @return string|null */ public function getSubmittedByUser() { @@ -1237,12 +1436,15 @@ public function getSubmittedByUser() /** * Sets submitted_by_user * - * @param string $submitted_by_user + * @param string|null $submitted_by_user * - * @return $this + * @return self */ public function setSubmittedByUser($submitted_by_user) { + if (is_null($submitted_by_user)) { + throw new \InvalidArgumentException('non-nullable submitted_by_user cannot be null'); + } $this->container['submitted_by_user'] = $submitted_by_user; return $this; @@ -1254,7 +1456,7 @@ public function setSubmittedByUser($submitted_by_user) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1264,22 +1466,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1295,11 +1498,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1307,13 +1523,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingsResponseModel.php b/src/lib/Model/ShiftCostingsResponseModel.php index 85aa481..9fd57b4 100644 --- a/src/lib/Model/ShiftCostingsResponseModel.php +++ b/src/lib/Model/ShiftCostingsResponseModel.php @@ -2,76 +2,78 @@ /** * ShiftCostingsResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingsResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingsResponseModel implements ModelInterface, ArrayAccess +class ShiftCostingsResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingsResponseModel'; + protected static $openAPIModelName = 'ShiftCostingsResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'transaction_id' => 'string', 'transaction_external_id' => 'string', 'employment_agreement_id' => 'int', 'employment_agreement_name' => 'string', 'pay_condition_rule_set_id' => 'int', 'pay_condition_rule_set_name' => 'string', - 'shifts' => '\Swagger\Client\Model\ShiftCostingsResponseShiftModel[]' + 'shifts' => '\OpenAPI\Client\Model\ShiftCostingsResponseShiftModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'transaction_id' => 'uuid', 'transaction_external_id' => null, 'employment_agreement_id' => 'int32', @@ -81,14 +83,36 @@ class ShiftCostingsResponseModel implements ModelInterface, ArrayAccess 'shifts' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'transaction_id' => false, + 'transaction_external_id' => false, + 'employment_agreement_id' => false, + 'employment_agreement_name' => false, + 'pay_condition_rule_set_id' => false, + 'pay_condition_rule_set_name' => false, + 'shifts' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['transaction_id'] = isset($data['transaction_id']) ? $data['transaction_id'] : null; - $this->container['transaction_external_id'] = isset($data['transaction_external_id']) ? $data['transaction_external_id'] : null; - $this->container['employment_agreement_id'] = isset($data['employment_agreement_id']) ? $data['employment_agreement_id'] : null; - $this->container['employment_agreement_name'] = isset($data['employment_agreement_name']) ? $data['employment_agreement_name'] : null; - $this->container['pay_condition_rule_set_id'] = isset($data['pay_condition_rule_set_id']) ? $data['pay_condition_rule_set_id'] : null; - $this->container['pay_condition_rule_set_name'] = isset($data['pay_condition_rule_set_name']) ? $data['pay_condition_rule_set_name'] : null; - $this->container['shifts'] = isset($data['shifts']) ? $data['shifts'] : null; + $this->setIfExists('transaction_id', $data ?? [], null); + $this->setIfExists('transaction_external_id', $data ?? [], null); + $this->setIfExists('employment_agreement_id', $data ?? [], null); + $this->setIfExists('employment_agreement_name', $data ?? [], null); + $this->setIfExists('pay_condition_rule_set_id', $data ?? [], null); + $this->setIfExists('pay_condition_rule_set_name', $data ?? [], null); + $this->setIfExists('shifts', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets transaction_id * - * @return string + * @return string|null */ public function getTransactionId() { @@ -253,12 +344,15 @@ public function getTransactionId() /** * Sets transaction_id * - * @param string $transaction_id + * @param string|null $transaction_id * - * @return $this + * @return self */ public function setTransactionId($transaction_id) { + if (is_null($transaction_id)) { + throw new \InvalidArgumentException('non-nullable transaction_id cannot be null'); + } $this->container['transaction_id'] = $transaction_id; return $this; @@ -267,7 +361,7 @@ public function setTransactionId($transaction_id) /** * Gets transaction_external_id * - * @return string + * @return string|null */ public function getTransactionExternalId() { @@ -277,12 +371,15 @@ public function getTransactionExternalId() /** * Sets transaction_external_id * - * @param string $transaction_external_id + * @param string|null $transaction_external_id * - * @return $this + * @return self */ public function setTransactionExternalId($transaction_external_id) { + if (is_null($transaction_external_id)) { + throw new \InvalidArgumentException('non-nullable transaction_external_id cannot be null'); + } $this->container['transaction_external_id'] = $transaction_external_id; return $this; @@ -291,7 +388,7 @@ public function setTransactionExternalId($transaction_external_id) /** * Gets employment_agreement_id * - * @return int + * @return int|null */ public function getEmploymentAgreementId() { @@ -301,12 +398,15 @@ public function getEmploymentAgreementId() /** * Sets employment_agreement_id * - * @param int $employment_agreement_id + * @param int|null $employment_agreement_id * - * @return $this + * @return self */ public function setEmploymentAgreementId($employment_agreement_id) { + if (is_null($employment_agreement_id)) { + throw new \InvalidArgumentException('non-nullable employment_agreement_id cannot be null'); + } $this->container['employment_agreement_id'] = $employment_agreement_id; return $this; @@ -315,7 +415,7 @@ public function setEmploymentAgreementId($employment_agreement_id) /** * Gets employment_agreement_name * - * @return string + * @return string|null */ public function getEmploymentAgreementName() { @@ -325,12 +425,15 @@ public function getEmploymentAgreementName() /** * Sets employment_agreement_name * - * @param string $employment_agreement_name + * @param string|null $employment_agreement_name * - * @return $this + * @return self */ public function setEmploymentAgreementName($employment_agreement_name) { + if (is_null($employment_agreement_name)) { + throw new \InvalidArgumentException('non-nullable employment_agreement_name cannot be null'); + } $this->container['employment_agreement_name'] = $employment_agreement_name; return $this; @@ -339,7 +442,7 @@ public function setEmploymentAgreementName($employment_agreement_name) /** * Gets pay_condition_rule_set_id * - * @return int + * @return int|null */ public function getPayConditionRuleSetId() { @@ -349,12 +452,15 @@ public function getPayConditionRuleSetId() /** * Sets pay_condition_rule_set_id * - * @param int $pay_condition_rule_set_id + * @param int|null $pay_condition_rule_set_id * - * @return $this + * @return self */ public function setPayConditionRuleSetId($pay_condition_rule_set_id) { + if (is_null($pay_condition_rule_set_id)) { + throw new \InvalidArgumentException('non-nullable pay_condition_rule_set_id cannot be null'); + } $this->container['pay_condition_rule_set_id'] = $pay_condition_rule_set_id; return $this; @@ -363,7 +469,7 @@ public function setPayConditionRuleSetId($pay_condition_rule_set_id) /** * Gets pay_condition_rule_set_name * - * @return string + * @return string|null */ public function getPayConditionRuleSetName() { @@ -373,12 +479,15 @@ public function getPayConditionRuleSetName() /** * Sets pay_condition_rule_set_name * - * @param string $pay_condition_rule_set_name + * @param string|null $pay_condition_rule_set_name * - * @return $this + * @return self */ public function setPayConditionRuleSetName($pay_condition_rule_set_name) { + if (is_null($pay_condition_rule_set_name)) { + throw new \InvalidArgumentException('non-nullable pay_condition_rule_set_name cannot be null'); + } $this->container['pay_condition_rule_set_name'] = $pay_condition_rule_set_name; return $this; @@ -387,7 +496,7 @@ public function setPayConditionRuleSetName($pay_condition_rule_set_name) /** * Gets shifts * - * @return \Swagger\Client\Model\ShiftCostingsResponseShiftModel[] + * @return \OpenAPI\Client\Model\ShiftCostingsResponseShiftModel[]|null */ public function getShifts() { @@ -397,12 +506,15 @@ public function getShifts() /** * Sets shifts * - * @param \Swagger\Client\Model\ShiftCostingsResponseShiftModel[] $shifts + * @param \OpenAPI\Client\Model\ShiftCostingsResponseShiftModel[]|null $shifts * - * @return $this + * @return self */ public function setShifts($shifts) { + if (is_null($shifts)) { + throw new \InvalidArgumentException('non-nullable shifts cannot be null'); + } $this->container['shifts'] = $shifts; return $this; @@ -414,7 +526,7 @@ public function setShifts($shifts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftCostingsResponseShiftModel.php b/src/lib/Model/ShiftCostingsResponseShiftModel.php index 75a7b5d..14eebf5 100644 --- a/src/lib/Model/ShiftCostingsResponseShiftModel.php +++ b/src/lib/Model/ShiftCostingsResponseShiftModel.php @@ -2,76 +2,78 @@ /** * ShiftCostingsResponseShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftCostingsResponseShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftCostingsResponseShiftModel implements ModelInterface, ArrayAccess +class ShiftCostingsResponseShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftCostingsResponseShiftModel'; + protected static $openAPIModelName = 'ShiftCostingsResponseShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'external_id' => 'string', 'start_time' => '\DateTime', 'end_time' => '\DateTime', - 'cost' => 'double', - 'evaluation_results' => '\Swagger\Client\Model\RuleEvaluationResult[]', + 'cost' => 'float', + 'evaluation_results' => '\OpenAPI\Client\Model\RuleEvaluationResult[]', 'consolidated_shifts' => 'string[]', - 'cost_breakdown' => '\Swagger\Client\Model\ShiftCostingBreakdownModel[]' + 'cost_breakdown' => '\OpenAPI\Client\Model\ShiftCostingBreakdownModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'external_id' => null, 'start_time' => 'date-time', 'end_time' => 'date-time', @@ -81,14 +83,36 @@ class ShiftCostingsResponseShiftModel implements ModelInterface, ArrayAccess 'cost_breakdown' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_id' => false, + 'start_time' => false, + 'end_time' => false, + 'cost' => false, + 'evaluation_results' => false, + 'consolidated_shifts' => false, + 'cost_breakdown' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['evaluation_results'] = isset($data['evaluation_results']) ? $data['evaluation_results'] : null; - $this->container['consolidated_shifts'] = isset($data['consolidated_shifts']) ? $data['consolidated_shifts'] : null; - $this->container['cost_breakdown'] = isset($data['cost_breakdown']) ? $data['cost_breakdown'] : null; + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('evaluation_results', $data ?? [], null); + $this->setIfExists('consolidated_shifts', $data ?? [], null); + $this->setIfExists('cost_breakdown', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -253,12 +344,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -267,7 +361,7 @@ public function setExternalId($external_id) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -277,12 +371,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -291,7 +388,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -301,12 +398,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -315,7 +415,7 @@ public function setEndTime($end_time) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -325,12 +425,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -339,7 +442,7 @@ public function setCost($cost) /** * Gets evaluation_results * - * @return \Swagger\Client\Model\RuleEvaluationResult[] + * @return \OpenAPI\Client\Model\RuleEvaluationResult[]|null */ public function getEvaluationResults() { @@ -349,12 +452,15 @@ public function getEvaluationResults() /** * Sets evaluation_results * - * @param \Swagger\Client\Model\RuleEvaluationResult[] $evaluation_results + * @param \OpenAPI\Client\Model\RuleEvaluationResult[]|null $evaluation_results * - * @return $this + * @return self */ public function setEvaluationResults($evaluation_results) { + if (is_null($evaluation_results)) { + throw new \InvalidArgumentException('non-nullable evaluation_results cannot be null'); + } $this->container['evaluation_results'] = $evaluation_results; return $this; @@ -363,7 +469,7 @@ public function setEvaluationResults($evaluation_results) /** * Gets consolidated_shifts * - * @return string[] + * @return string[]|null */ public function getConsolidatedShifts() { @@ -373,12 +479,15 @@ public function getConsolidatedShifts() /** * Sets consolidated_shifts * - * @param string[] $consolidated_shifts + * @param string[]|null $consolidated_shifts * - * @return $this + * @return self */ public function setConsolidatedShifts($consolidated_shifts) { + if (is_null($consolidated_shifts)) { + throw new \InvalidArgumentException('non-nullable consolidated_shifts cannot be null'); + } $this->container['consolidated_shifts'] = $consolidated_shifts; return $this; @@ -387,7 +496,7 @@ public function setConsolidatedShifts($consolidated_shifts) /** * Gets cost_breakdown * - * @return \Swagger\Client\Model\ShiftCostingBreakdownModel[] + * @return \OpenAPI\Client\Model\ShiftCostingBreakdownModel[]|null */ public function getCostBreakdown() { @@ -397,12 +506,15 @@ public function getCostBreakdown() /** * Sets cost_breakdown * - * @param \Swagger\Client\Model\ShiftCostingBreakdownModel[] $cost_breakdown + * @param \OpenAPI\Client\Model\ShiftCostingBreakdownModel[]|null $cost_breakdown * - * @return $this + * @return self */ public function setCostBreakdown($cost_breakdown) { + if (is_null($cost_breakdown)) { + throw new \InvalidArgumentException('non-nullable cost_breakdown cannot be null'); + } $this->container['cost_breakdown'] = $cost_breakdown; return $this; @@ -414,7 +526,7 @@ public function setCostBreakdown($cost_breakdown) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftLiabilityModel.php b/src/lib/Model/ShiftLiabilityModel.php index cb4fd41..fd765a9 100644 --- a/src/lib/Model/ShiftLiabilityModel.php +++ b/src/lib/Model/ShiftLiabilityModel.php @@ -2,75 +2,77 @@ /** * ShiftLiabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftLiabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftLiabilityModel implements ModelInterface, ArrayAccess +class ShiftLiabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftLiabilityModel'; + protected static $openAPIModelName = 'ShiftLiabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'liability_category_name' => 'string', 'liability_category_id' => 'int', 'include_in_shift_cost' => 'bool', - 'amount' => 'double', + 'amount' => 'float', 'option' => 'string', - 'cost' => 'double' + 'cost' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'liability_category_name' => null, 'liability_category_id' => 'int32', 'include_in_shift_cost' => null, @@ -79,14 +81,35 @@ class ShiftLiabilityModel implements ModelInterface, ArrayAccess 'cost' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'liability_category_name' => false, + 'liability_category_id' => false, + 'include_in_shift_cost' => false, + 'amount' => false, + 'option' => false, + 'cost' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,16 +255,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const OPTION_FIXED = 'Fixed'; - const OPTION_PER_HOUR_WORKED = 'PerHourWorked'; - const OPTION_PERCENTAGE_OF_SHIFT_COST = 'PercentageOfShiftCost'; - const OPTION_PER_SHIFT_UNIT = 'PerShiftUnit'; - + public const OPTION_FIXED = 'Fixed'; + public const OPTION_PER_HOUR_WORKED = 'PerHourWorked'; + public const OPTION_PERCENTAGE_OF_SHIFT_COST = 'PercentageOfShiftCost'; + public const OPTION_PER_SHIFT_UNIT = 'PerShiftUnit'; - /** * Gets allowable values of the enum * @@ -204,7 +277,6 @@ public function getOptionAllowableValues() self::OPTION_PER_SHIFT_UNIT, ]; } - /** * Associative array for storing property values @@ -221,12 +293,30 @@ public function getOptionAllowableValues() */ public function __construct(array $data = null) { - $this->container['liability_category_name'] = isset($data['liability_category_name']) ? $data['liability_category_name'] : null; - $this->container['liability_category_id'] = isset($data['liability_category_id']) ? $data['liability_category_id'] : null; - $this->container['include_in_shift_cost'] = isset($data['include_in_shift_cost']) ? $data['include_in_shift_cost'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['option'] = isset($data['option']) ? $data['option'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; + $this->setIfExists('liability_category_name', $data ?? [], null); + $this->setIfExists('liability_category_id', $data ?? [], null); + $this->setIfExists('include_in_shift_cost', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('option', $data ?? [], null); + $this->setIfExists('cost', $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; } /** @@ -241,7 +331,8 @@ public function listInvalidProperties() $allowedValues = $this->getOptionAllowableValues(); if (!is_null($this->container['option']) && !in_array($this->container['option'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'option', must be one of '%s'", + "invalid value '%s' for 'option', must be one of '%s'", + $this->container['option'], implode("', '", $allowedValues) ); } @@ -264,7 +355,7 @@ public function valid() /** * Gets liability_category_name * - * @return string + * @return string|null */ public function getLiabilityCategoryName() { @@ -274,12 +365,15 @@ public function getLiabilityCategoryName() /** * Sets liability_category_name * - * @param string $liability_category_name + * @param string|null $liability_category_name * - * @return $this + * @return self */ public function setLiabilityCategoryName($liability_category_name) { + if (is_null($liability_category_name)) { + throw new \InvalidArgumentException('non-nullable liability_category_name cannot be null'); + } $this->container['liability_category_name'] = $liability_category_name; return $this; @@ -288,7 +382,7 @@ public function setLiabilityCategoryName($liability_category_name) /** * Gets liability_category_id * - * @return int + * @return int|null */ public function getLiabilityCategoryId() { @@ -298,12 +392,15 @@ public function getLiabilityCategoryId() /** * Sets liability_category_id * - * @param int $liability_category_id + * @param int|null $liability_category_id * - * @return $this + * @return self */ public function setLiabilityCategoryId($liability_category_id) { + if (is_null($liability_category_id)) { + throw new \InvalidArgumentException('non-nullable liability_category_id cannot be null'); + } $this->container['liability_category_id'] = $liability_category_id; return $this; @@ -312,7 +409,7 @@ public function setLiabilityCategoryId($liability_category_id) /** * Gets include_in_shift_cost * - * @return bool + * @return bool|null */ public function getIncludeInShiftCost() { @@ -322,12 +419,15 @@ public function getIncludeInShiftCost() /** * Sets include_in_shift_cost * - * @param bool $include_in_shift_cost + * @param bool|null $include_in_shift_cost * - * @return $this + * @return self */ public function setIncludeInShiftCost($include_in_shift_cost) { + if (is_null($include_in_shift_cost)) { + throw new \InvalidArgumentException('non-nullable include_in_shift_cost cannot be null'); + } $this->container['include_in_shift_cost'] = $include_in_shift_cost; return $this; @@ -336,7 +436,7 @@ public function setIncludeInShiftCost($include_in_shift_cost) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -346,12 +446,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -360,7 +463,7 @@ public function setAmount($amount) /** * Gets option * - * @return string + * @return string|null */ public function getOption() { @@ -370,17 +473,21 @@ public function getOption() /** * Sets option * - * @param string $option + * @param string|null $option * - * @return $this + * @return self */ public function setOption($option) { + if (is_null($option)) { + throw new \InvalidArgumentException('non-nullable option cannot be null'); + } $allowedValues = $this->getOptionAllowableValues(); - if (!is_null($option) && !in_array($option, $allowedValues, true)) { + if (!in_array($option, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'option', must be one of '%s'", + "Invalid value '%s' for 'option', must be one of '%s'", + $option, implode("', '", $allowedValues) ) ); @@ -393,7 +500,7 @@ public function setOption($option) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -403,12 +510,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -420,7 +530,7 @@ public function setCost($cost) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -430,22 +540,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -461,11 +572,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -473,13 +597,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftNoteViewModel.php b/src/lib/Model/ShiftNoteViewModel.php index bc0b4df..6443bb7 100644 --- a/src/lib/Model/ShiftNoteViewModel.php +++ b/src/lib/Model/ShiftNoteViewModel.php @@ -2,63 +2,63 @@ /** * ShiftNoteViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftNoteViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftNoteViewModel implements ModelInterface, ArrayAccess +class ShiftNoteViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftNoteViewModel'; + protected static $openAPIModelName = 'ShiftNoteViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', - 'employee' => '\Swagger\Client\Model\EmployeeViewModel', + 'employee' => '\OpenAPI\Client\Model\EmployeeViewModel', 'date' => '\DateTime', 'type' => 'string', 'note' => 'string', @@ -72,8 +72,10 @@ class ShiftNoteViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee' => null, 'date' => 'date-time', @@ -85,14 +87,38 @@ class ShiftNoteViewModel implements ModelInterface, ArrayAccess 'created_by_admin' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee' => false, + 'date' => false, + 'type' => false, + 'note' => false, + 'note_id' => false, + 'visibility' => false, + 'read' => false, + 'created_by_admin' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,17 +273,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const TYPE_SHIFT = 'Shift'; - const TYPE_CLOCK_ON = 'ClockOn'; - const TYPE_CLOCK_OFF = 'ClockOff'; - const VISIBILITY_HIDDEN = 'Hidden'; - const VISIBILITY_VISIBLE = 'Visible'; - + public const TYPE_SHIFT = 'Shift'; + public const TYPE_CLOCK_ON = 'ClockOn'; + public const TYPE_CLOCK_OFF = 'ClockOff'; + public const VISIBILITY_HIDDEN = 'Hidden'; + public const VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -219,7 +295,7 @@ public function getTypeAllowableValues() self::TYPE_CLOCK_OFF, ]; } - + /** * Gets allowable values of the enum * @@ -232,7 +308,6 @@ public function getVisibilityAllowableValues() self::VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -249,15 +324,33 @@ public function getVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee'] = isset($data['employee']) ? $data['employee'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['note_id'] = isset($data['note_id']) ? $data['note_id'] : null; - $this->container['visibility'] = isset($data['visibility']) ? $data['visibility'] : null; - $this->container['read'] = isset($data['read']) ? $data['read'] : null; - $this->container['created_by_admin'] = isset($data['created_by_admin']) ? $data['created_by_admin'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('note_id', $data ?? [], null); + $this->setIfExists('visibility', $data ?? [], null); + $this->setIfExists('read', $data ?? [], null); + $this->setIfExists('created_by_admin', $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; } /** @@ -272,7 +365,8 @@ public function listInvalidProperties() $allowedValues = $this->getTypeAllowableValues(); if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'type', must be one of '%s'", + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -280,7 +374,8 @@ public function listInvalidProperties() $allowedValues = $this->getVisibilityAllowableValues(); if (!is_null($this->container['visibility']) && !in_array($this->container['visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'visibility', must be one of '%s'", + "invalid value '%s' for 'visibility', must be one of '%s'", + $this->container['visibility'], implode("', '", $allowedValues) ); } @@ -303,7 +398,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -313,12 +408,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -327,7 +425,7 @@ public function setId($id) /** * Gets employee * - * @return \Swagger\Client\Model\EmployeeViewModel + * @return \OpenAPI\Client\Model\EmployeeViewModel|null */ public function getEmployee() { @@ -337,12 +435,15 @@ public function getEmployee() /** * Sets employee * - * @param \Swagger\Client\Model\EmployeeViewModel $employee + * @param \OpenAPI\Client\Model\EmployeeViewModel|null $employee employee * - * @return $this + * @return self */ public function setEmployee($employee) { + if (is_null($employee)) { + throw new \InvalidArgumentException('non-nullable employee cannot be null'); + } $this->container['employee'] = $employee; return $this; @@ -351,7 +452,7 @@ public function setEmployee($employee) /** * Gets date * - * @return \DateTime + * @return \DateTime|null */ public function getDate() { @@ -361,12 +462,15 @@ public function getDate() /** * Sets date * - * @param \DateTime $date + * @param \DateTime|null $date * - * @return $this + * @return self */ public function setDate($date) { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } $this->container['date'] = $date; return $this; @@ -375,7 +479,7 @@ public function setDate($date) /** * Gets type * - * @return string + * @return string|null */ public function getType() { @@ -385,17 +489,21 @@ public function getType() /** * Sets type * - * @param string $type + * @param string|null $type * - * @return $this + * @return self */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { + if (!in_array($type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'type', must be one of '%s'", + "Invalid value '%s' for 'type', must be one of '%s'", + $type, implode("', '", $allowedValues) ) ); @@ -408,7 +516,7 @@ public function setType($type) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -418,12 +526,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -432,7 +543,7 @@ public function setNote($note) /** * Gets note_id * - * @return int + * @return int|null */ public function getNoteId() { @@ -442,12 +553,15 @@ public function getNoteId() /** * Sets note_id * - * @param int $note_id + * @param int|null $note_id * - * @return $this + * @return self */ public function setNoteId($note_id) { + if (is_null($note_id)) { + throw new \InvalidArgumentException('non-nullable note_id cannot be null'); + } $this->container['note_id'] = $note_id; return $this; @@ -456,7 +570,7 @@ public function setNoteId($note_id) /** * Gets visibility * - * @return string + * @return string|null */ public function getVisibility() { @@ -466,17 +580,21 @@ public function getVisibility() /** * Sets visibility * - * @param string $visibility + * @param string|null $visibility * - * @return $this + * @return self */ public function setVisibility($visibility) { + if (is_null($visibility)) { + throw new \InvalidArgumentException('non-nullable visibility cannot be null'); + } $allowedValues = $this->getVisibilityAllowableValues(); - if (!is_null($visibility) && !in_array($visibility, $allowedValues, true)) { + if (!in_array($visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'visibility', must be one of '%s'", + "Invalid value '%s' for 'visibility', must be one of '%s'", + $visibility, implode("', '", $allowedValues) ) ); @@ -489,7 +607,7 @@ public function setVisibility($visibility) /** * Gets read * - * @return bool + * @return bool|null */ public function getRead() { @@ -499,12 +617,15 @@ public function getRead() /** * Sets read * - * @param bool $read + * @param bool|null $read * - * @return $this + * @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; @@ -513,7 +634,7 @@ public function setRead($read) /** * Gets created_by_admin * - * @return bool + * @return bool|null */ public function getCreatedByAdmin() { @@ -523,12 +644,15 @@ public function getCreatedByAdmin() /** * Sets created_by_admin * - * @param bool $created_by_admin + * @param bool|null $created_by_admin * - * @return $this + * @return self */ public function setCreatedByAdmin($created_by_admin) { + if (is_null($created_by_admin)) { + throw new \InvalidArgumentException('non-nullable created_by_admin cannot be null'); + } $this->container['created_by_admin'] = $created_by_admin; return $this; @@ -540,7 +664,7 @@ public function setCreatedByAdmin($created_by_admin) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -550,22 +674,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -581,11 +706,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -593,13 +731,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftPartModel.php b/src/lib/Model/ShiftPartModel.php index 463ee69..c975cbc 100644 --- a/src/lib/Model/ShiftPartModel.php +++ b/src/lib/Model/ShiftPartModel.php @@ -2,61 +2,61 @@ /** * ShiftPartModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftPartModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftPartModel implements ModelInterface, ArrayAccess +class ShiftPartModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftPartModel'; + protected static $openAPIModelName = 'ShiftPartModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_break' => 'bool', 'is_paid_break' => 'bool', 'start_time' => '\DateTime', @@ -65,15 +65,15 @@ class ShiftPartModel implements ModelInterface, ArrayAccess 'actual_duration' => 'string', 'pay_category' => 'string', 'pay_category_id' => 'int', - 'cost' => 'double', - 'rate_multiplier' => 'double', - 'base_rate' => 'double', - 'calculated_rate' => 'double', + 'cost' => 'float', + 'rate_multiplier' => 'float', + 'base_rate' => 'float', + 'calculated_rate' => 'float', 'display_duration' => 'string', - 'work_type' => '\Swagger\Client\Model\NominalWorkType', - 'classification' => '\Swagger\Client\Model\NominalClassification', - 'leave_category' => '\Swagger\Client\Model\NominalLeaveCategory', - 'location' => '\Swagger\Client\Model\NominalLocation', + 'work_type' => '\OpenAPI\Client\Model\NominalWorkType', + 'classification' => '\OpenAPI\Client\Model\NominalClassification', + 'leave_category' => '\OpenAPI\Client\Model\NominalLeaveCategory', + 'location' => '\OpenAPI\Client\Model\NominalLocation', 'is_allowance_or_unit_based' => 'bool' ]; @@ -81,8 +81,10 @@ class ShiftPartModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_break' => null, 'is_paid_break' => null, 'start_time' => 'date-time', @@ -103,14 +105,47 @@ class ShiftPartModel implements ModelInterface, ArrayAccess 'is_allowance_or_unit_based' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_break' => false, + 'is_paid_break' => false, + 'start_time' => false, + 'end_time' => false, + 'effective_duration' => false, + 'actual_duration' => false, + 'pay_category' => false, + 'pay_category_id' => false, + 'cost' => false, + 'rate_multiplier' => false, + 'base_rate' => false, + 'calculated_rate' => false, + 'display_duration' => false, + 'work_type' => false, + 'classification' => false, + 'leave_category' => false, + 'location' => false, + 'is_allowance_or_unit_based' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -118,9 +153,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -240,12 +327,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -262,24 +346,42 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['is_break'] = isset($data['is_break']) ? $data['is_break'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['effective_duration'] = isset($data['effective_duration']) ? $data['effective_duration'] : null; - $this->container['actual_duration'] = isset($data['actual_duration']) ? $data['actual_duration'] : null; - $this->container['pay_category'] = isset($data['pay_category']) ? $data['pay_category'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['cost'] = isset($data['cost']) ? $data['cost'] : null; - $this->container['rate_multiplier'] = isset($data['rate_multiplier']) ? $data['rate_multiplier'] : null; - $this->container['base_rate'] = isset($data['base_rate']) ? $data['base_rate'] : null; - $this->container['calculated_rate'] = isset($data['calculated_rate']) ? $data['calculated_rate'] : null; - $this->container['display_duration'] = isset($data['display_duration']) ? $data['display_duration'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['leave_category'] = isset($data['leave_category']) ? $data['leave_category'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['is_allowance_or_unit_based'] = isset($data['is_allowance_or_unit_based']) ? $data['is_allowance_or_unit_based'] : null; + $this->setIfExists('is_break', $data ?? [], null); + $this->setIfExists('is_paid_break', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('effective_duration', $data ?? [], null); + $this->setIfExists('actual_duration', $data ?? [], null); + $this->setIfExists('pay_category', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('cost', $data ?? [], null); + $this->setIfExists('rate_multiplier', $data ?? [], null); + $this->setIfExists('base_rate', $data ?? [], null); + $this->setIfExists('calculated_rate', $data ?? [], null); + $this->setIfExists('display_duration', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('leave_category', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('is_allowance_or_unit_based', $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; } /** @@ -309,7 +411,7 @@ public function valid() /** * Gets is_break * - * @return bool + * @return bool|null */ public function getIsBreak() { @@ -319,12 +421,15 @@ public function getIsBreak() /** * Sets is_break * - * @param bool $is_break + * @param bool|null $is_break * - * @return $this + * @return self */ public function setIsBreak($is_break) { + if (is_null($is_break)) { + throw new \InvalidArgumentException('non-nullable is_break cannot be null'); + } $this->container['is_break'] = $is_break; return $this; @@ -333,7 +438,7 @@ public function setIsBreak($is_break) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -343,12 +448,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -357,7 +465,7 @@ public function setIsPaidBreak($is_paid_break) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -367,12 +475,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -381,7 +492,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -391,12 +502,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -405,7 +519,7 @@ public function setEndTime($end_time) /** * Gets effective_duration * - * @return string + * @return string|null */ public function getEffectiveDuration() { @@ -415,12 +529,15 @@ public function getEffectiveDuration() /** * Sets effective_duration * - * @param string $effective_duration + * @param string|null $effective_duration * - * @return $this + * @return self */ public function setEffectiveDuration($effective_duration) { + if (is_null($effective_duration)) { + throw new \InvalidArgumentException('non-nullable effective_duration cannot be null'); + } $this->container['effective_duration'] = $effective_duration; return $this; @@ -429,7 +546,7 @@ public function setEffectiveDuration($effective_duration) /** * Gets actual_duration * - * @return string + * @return string|null */ public function getActualDuration() { @@ -439,12 +556,15 @@ public function getActualDuration() /** * Sets actual_duration * - * @param string $actual_duration + * @param string|null $actual_duration * - * @return $this + * @return self */ public function setActualDuration($actual_duration) { + if (is_null($actual_duration)) { + throw new \InvalidArgumentException('non-nullable actual_duration cannot be null'); + } $this->container['actual_duration'] = $actual_duration; return $this; @@ -453,7 +573,7 @@ public function setActualDuration($actual_duration) /** * Gets pay_category * - * @return string + * @return string|null */ public function getPayCategory() { @@ -463,12 +583,15 @@ public function getPayCategory() /** * Sets pay_category * - * @param string $pay_category + * @param string|null $pay_category * - * @return $this + * @return self */ public function setPayCategory($pay_category) { + if (is_null($pay_category)) { + throw new \InvalidArgumentException('non-nullable pay_category cannot be null'); + } $this->container['pay_category'] = $pay_category; return $this; @@ -477,7 +600,7 @@ public function setPayCategory($pay_category) /** * Gets pay_category_id * - * @return int + * @return int|null */ public function getPayCategoryId() { @@ -487,12 +610,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param int $pay_category_id + * @param int|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -501,7 +627,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets cost * - * @return double + * @return float|null */ public function getCost() { @@ -511,12 +637,15 @@ public function getCost() /** * Sets cost * - * @param double $cost + * @param float|null $cost * - * @return $this + * @return self */ public function setCost($cost) { + if (is_null($cost)) { + throw new \InvalidArgumentException('non-nullable cost cannot be null'); + } $this->container['cost'] = $cost; return $this; @@ -525,7 +654,7 @@ public function setCost($cost) /** * Gets rate_multiplier * - * @return double + * @return float|null */ public function getRateMultiplier() { @@ -535,12 +664,15 @@ public function getRateMultiplier() /** * Sets rate_multiplier * - * @param double $rate_multiplier + * @param float|null $rate_multiplier * - * @return $this + * @return self */ public function setRateMultiplier($rate_multiplier) { + if (is_null($rate_multiplier)) { + throw new \InvalidArgumentException('non-nullable rate_multiplier cannot be null'); + } $this->container['rate_multiplier'] = $rate_multiplier; return $this; @@ -549,7 +681,7 @@ public function setRateMultiplier($rate_multiplier) /** * Gets base_rate * - * @return double + * @return float|null */ public function getBaseRate() { @@ -559,12 +691,15 @@ public function getBaseRate() /** * Sets base_rate * - * @param double $base_rate + * @param float|null $base_rate * - * @return $this + * @return self */ public function setBaseRate($base_rate) { + if (is_null($base_rate)) { + throw new \InvalidArgumentException('non-nullable base_rate cannot be null'); + } $this->container['base_rate'] = $base_rate; return $this; @@ -573,7 +708,7 @@ public function setBaseRate($base_rate) /** * Gets calculated_rate * - * @return double + * @return float|null */ public function getCalculatedRate() { @@ -583,12 +718,15 @@ public function getCalculatedRate() /** * Sets calculated_rate * - * @param double $calculated_rate + * @param float|null $calculated_rate * - * @return $this + * @return self */ public function setCalculatedRate($calculated_rate) { + if (is_null($calculated_rate)) { + throw new \InvalidArgumentException('non-nullable calculated_rate cannot be null'); + } $this->container['calculated_rate'] = $calculated_rate; return $this; @@ -597,7 +735,7 @@ public function setCalculatedRate($calculated_rate) /** * Gets display_duration * - * @return string + * @return string|null */ public function getDisplayDuration() { @@ -607,12 +745,15 @@ public function getDisplayDuration() /** * Sets display_duration * - * @param string $display_duration + * @param string|null $display_duration * - * @return $this + * @return self */ public function setDisplayDuration($display_duration) { + if (is_null($display_duration)) { + throw new \InvalidArgumentException('non-nullable display_duration cannot be null'); + } $this->container['display_duration'] = $display_duration; return $this; @@ -621,7 +762,7 @@ public function setDisplayDuration($display_duration) /** * Gets work_type * - * @return \Swagger\Client\Model\NominalWorkType + * @return \OpenAPI\Client\Model\NominalWorkType|null */ public function getWorkType() { @@ -631,12 +772,15 @@ public function getWorkType() /** * Sets work_type * - * @param \Swagger\Client\Model\NominalWorkType $work_type + * @param \OpenAPI\Client\Model\NominalWorkType|null $work_type work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -645,7 +789,7 @@ public function setWorkType($work_type) /** * Gets classification * - * @return \Swagger\Client\Model\NominalClassification + * @return \OpenAPI\Client\Model\NominalClassification|null */ public function getClassification() { @@ -655,12 +799,15 @@ public function getClassification() /** * Sets classification * - * @param \Swagger\Client\Model\NominalClassification $classification + * @param \OpenAPI\Client\Model\NominalClassification|null $classification classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -669,7 +816,7 @@ public function setClassification($classification) /** * Gets leave_category * - * @return \Swagger\Client\Model\NominalLeaveCategory + * @return \OpenAPI\Client\Model\NominalLeaveCategory|null */ public function getLeaveCategory() { @@ -679,12 +826,15 @@ public function getLeaveCategory() /** * Sets leave_category * - * @param \Swagger\Client\Model\NominalLeaveCategory $leave_category + * @param \OpenAPI\Client\Model\NominalLeaveCategory|null $leave_category leave_category * - * @return $this + * @return self */ public function setLeaveCategory($leave_category) { + if (is_null($leave_category)) { + throw new \InvalidArgumentException('non-nullable leave_category cannot be null'); + } $this->container['leave_category'] = $leave_category; return $this; @@ -693,7 +843,7 @@ public function setLeaveCategory($leave_category) /** * Gets location * - * @return \Swagger\Client\Model\NominalLocation + * @return \OpenAPI\Client\Model\NominalLocation|null */ public function getLocation() { @@ -703,12 +853,15 @@ public function getLocation() /** * Sets location * - * @param \Swagger\Client\Model\NominalLocation $location + * @param \OpenAPI\Client\Model\NominalLocation|null $location location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -717,7 +870,7 @@ public function setLocation($location) /** * Gets is_allowance_or_unit_based * - * @return bool + * @return bool|null */ public function getIsAllowanceOrUnitBased() { @@ -727,12 +880,15 @@ public function getIsAllowanceOrUnitBased() /** * Sets is_allowance_or_unit_based * - * @param bool $is_allowance_or_unit_based + * @param bool|null $is_allowance_or_unit_based * - * @return $this + * @return self */ public function setIsAllowanceOrUnitBased($is_allowance_or_unit_based) { + if (is_null($is_allowance_or_unit_based)) { + throw new \InvalidArgumentException('non-nullable is_allowance_or_unit_based cannot be null'); + } $this->container['is_allowance_or_unit_based'] = $is_allowance_or_unit_based; return $this; @@ -744,7 +900,7 @@ public function setIsAllowanceOrUnitBased($is_allowance_or_unit_based) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -754,22 +910,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -785,11 +942,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -797,13 +967,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftPeriodModel.php b/src/lib/Model/ShiftPeriodModel.php index e232542..a9a2892 100644 --- a/src/lib/Model/ShiftPeriodModel.php +++ b/src/lib/Model/ShiftPeriodModel.php @@ -2,61 +2,61 @@ /** * ShiftPeriodModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftPeriodModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftPeriodModel implements ModelInterface, ArrayAccess +class ShiftPeriodModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftPeriodModel'; + protected static $openAPIModelName = 'ShiftPeriodModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime' ]; @@ -65,20 +65,39 @@ class ShiftPeriodModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -223,12 +309,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -237,7 +326,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -247,12 +336,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -264,7 +356,7 @@ public function setToDate($to_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftSwappingReportExportModel.php b/src/lib/Model/ShiftSwappingReportExportModel.php index 4512a43..d595d23 100644 --- a/src/lib/Model/ShiftSwappingReportExportModel.php +++ b/src/lib/Model/ShiftSwappingReportExportModel.php @@ -2,61 +2,61 @@ /** * ShiftSwappingReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftSwappingReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftSwappingReportExportModel implements ModelInterface, ArrayAccess +class ShiftSwappingReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftSwappingReportExportModel'; + protected static $openAPIModelName = 'ShiftSwappingReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_employee_id' => 'int', 'from_employee_name' => 'string', 'to_employee_id' => 'int', @@ -70,16 +70,18 @@ class ShiftSwappingReportExportModel implements ModelInterface, ArrayAccess 'work_type_id' => 'string', 'work_type' => 'string', 'status' => 'string', - 'old_cost' => 'double', - 'new_cost' => 'double' + 'old_cost' => 'float', + 'new_cost' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_employee_id' => 'int32', 'from_employee_name' => null, 'to_employee_id' => 'int32', @@ -97,14 +99,44 @@ class ShiftSwappingReportExportModel implements ModelInterface, ArrayAccess 'new_cost' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_employee_id' => false, + 'from_employee_name' => false, + 'to_employee_id' => false, + 'to_employee_name' => false, + 'start' => false, + 'start_time' => false, + 'end' => false, + 'end_time' => false, + 'location_id' => false, + 'location' => false, + 'work_type_id' => false, + 'work_type' => false, + 'status' => false, + 'old_cost' => false, + 'new_cost' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -225,12 +309,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -247,21 +328,39 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_employee_id'] = isset($data['from_employee_id']) ? $data['from_employee_id'] : null; - $this->container['from_employee_name'] = isset($data['from_employee_name']) ? $data['from_employee_name'] : null; - $this->container['to_employee_id'] = isset($data['to_employee_id']) ? $data['to_employee_id'] : null; - $this->container['to_employee_name'] = isset($data['to_employee_name']) ? $data['to_employee_name'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location'] = isset($data['location']) ? $data['location'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['old_cost'] = isset($data['old_cost']) ? $data['old_cost'] : null; - $this->container['new_cost'] = isset($data['new_cost']) ? $data['new_cost'] : null; + $this->setIfExists('from_employee_id', $data ?? [], null); + $this->setIfExists('from_employee_name', $data ?? [], null); + $this->setIfExists('to_employee_id', $data ?? [], null); + $this->setIfExists('to_employee_name', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('old_cost', $data ?? [], null); + $this->setIfExists('new_cost', $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; } /** @@ -291,7 +390,7 @@ public function valid() /** * Gets from_employee_id * - * @return int + * @return int|null */ public function getFromEmployeeId() { @@ -301,12 +400,15 @@ public function getFromEmployeeId() /** * Sets from_employee_id * - * @param int $from_employee_id + * @param int|null $from_employee_id * - * @return $this + * @return self */ public function setFromEmployeeId($from_employee_id) { + if (is_null($from_employee_id)) { + throw new \InvalidArgumentException('non-nullable from_employee_id cannot be null'); + } $this->container['from_employee_id'] = $from_employee_id; return $this; @@ -315,7 +417,7 @@ public function setFromEmployeeId($from_employee_id) /** * Gets from_employee_name * - * @return string + * @return string|null */ public function getFromEmployeeName() { @@ -325,12 +427,15 @@ public function getFromEmployeeName() /** * Sets from_employee_name * - * @param string $from_employee_name + * @param string|null $from_employee_name * - * @return $this + * @return self */ public function setFromEmployeeName($from_employee_name) { + if (is_null($from_employee_name)) { + throw new \InvalidArgumentException('non-nullable from_employee_name cannot be null'); + } $this->container['from_employee_name'] = $from_employee_name; return $this; @@ -339,7 +444,7 @@ public function setFromEmployeeName($from_employee_name) /** * Gets to_employee_id * - * @return int + * @return int|null */ public function getToEmployeeId() { @@ -349,12 +454,15 @@ public function getToEmployeeId() /** * Sets to_employee_id * - * @param int $to_employee_id + * @param int|null $to_employee_id * - * @return $this + * @return self */ public function setToEmployeeId($to_employee_id) { + if (is_null($to_employee_id)) { + throw new \InvalidArgumentException('non-nullable to_employee_id cannot be null'); + } $this->container['to_employee_id'] = $to_employee_id; return $this; @@ -363,7 +471,7 @@ public function setToEmployeeId($to_employee_id) /** * Gets to_employee_name * - * @return string + * @return string|null */ public function getToEmployeeName() { @@ -373,12 +481,15 @@ public function getToEmployeeName() /** * Sets to_employee_name * - * @param string $to_employee_name + * @param string|null $to_employee_name * - * @return $this + * @return self */ public function setToEmployeeName($to_employee_name) { + if (is_null($to_employee_name)) { + throw new \InvalidArgumentException('non-nullable to_employee_name cannot be null'); + } $this->container['to_employee_name'] = $to_employee_name; return $this; @@ -387,7 +498,7 @@ public function setToEmployeeName($to_employee_name) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -397,12 +508,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -411,7 +525,7 @@ public function setStart($start) /** * Gets start_time * - * @return string + * @return string|null */ public function getStartTime() { @@ -421,12 +535,15 @@ public function getStartTime() /** * Sets start_time * - * @param string $start_time + * @param string|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -435,7 +552,7 @@ public function setStartTime($start_time) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -445,12 +562,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -459,7 +579,7 @@ public function setEnd($end) /** * Gets end_time * - * @return string + * @return string|null */ public function getEndTime() { @@ -469,12 +589,15 @@ public function getEndTime() /** * Sets end_time * - * @param string $end_time + * @param string|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -483,7 +606,7 @@ public function setEndTime($end_time) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -493,12 +616,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -507,7 +633,7 @@ public function setLocationId($location_id) /** * Gets location * - * @return string + * @return string|null */ public function getLocation() { @@ -517,12 +643,15 @@ public function getLocation() /** * Sets location * - * @param string $location + * @param string|null $location * - * @return $this + * @return self */ public function setLocation($location) { + if (is_null($location)) { + throw new \InvalidArgumentException('non-nullable location cannot be null'); + } $this->container['location'] = $location; return $this; @@ -531,7 +660,7 @@ public function setLocation($location) /** * Gets work_type_id * - * @return string + * @return string|null */ public function getWorkTypeId() { @@ -541,12 +670,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param string $work_type_id + * @param string|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -555,7 +687,7 @@ public function setWorkTypeId($work_type_id) /** * Gets work_type * - * @return string + * @return string|null */ public function getWorkType() { @@ -565,12 +697,15 @@ public function getWorkType() /** * Sets work_type * - * @param string $work_type + * @param string|null $work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -579,7 +714,7 @@ public function setWorkType($work_type) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -589,12 +724,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -603,7 +741,7 @@ public function setStatus($status) /** * Gets old_cost * - * @return double + * @return float|null */ public function getOldCost() { @@ -613,12 +751,15 @@ public function getOldCost() /** * Sets old_cost * - * @param double $old_cost + * @param float|null $old_cost * - * @return $this + * @return self */ public function setOldCost($old_cost) { + if (is_null($old_cost)) { + throw new \InvalidArgumentException('non-nullable old_cost cannot be null'); + } $this->container['old_cost'] = $old_cost; return $this; @@ -627,7 +768,7 @@ public function setOldCost($old_cost) /** * Gets new_cost * - * @return double + * @return float|null */ public function getNewCost() { @@ -637,12 +778,15 @@ public function getNewCost() /** * Sets new_cost * - * @param double $new_cost + * @param float|null $new_cost * - * @return $this + * @return self */ public function setNewCost($new_cost) { + if (is_null($new_cost)) { + throw new \InvalidArgumentException('non-nullable new_cost cannot be null'); + } $this->container['new_cost'] = $new_cost; return $this; @@ -654,7 +798,7 @@ public function setNewCost($new_cost) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -664,22 +808,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,11 +840,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -707,13 +865,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/ShiftSwappingReportRequestModel.php b/src/lib/Model/ShiftSwappingReportRequestModel.php index ca5f368..a8747bc 100644 --- a/src/lib/Model/ShiftSwappingReportRequestModel.php +++ b/src/lib/Model/ShiftSwappingReportRequestModel.php @@ -2,61 +2,61 @@ /** * ShiftSwappingReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * ShiftSwappingReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class ShiftSwappingReportRequestModel implements ModelInterface, ArrayAccess +class ShiftSwappingReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'ShiftSwappingReportRequestModel'; + protected static $openAPIModelName = 'ShiftSwappingReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_employee_id' => 'int', 'to_employee_id' => 'int', 'include_costs' => 'bool', @@ -71,8 +71,10 @@ class ShiftSwappingReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_employee_id' => 'int32', 'to_employee_id' => 'int32', 'include_costs' => null, @@ -83,14 +85,37 @@ class ShiftSwappingReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_employee_id' => false, + 'to_employee_id' => false, + 'include_costs' => false, + 'statuses' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -190,19 +267,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUSES_CREATED = 'Created'; - const STATUSES_CANCELLED = 'Cancelled'; - const STATUSES_ACCEPTED = 'Accepted'; - const STATUSES_DECLINED = 'Declined'; - const STATUSES_AWAITING_MANAGER_APPROVAL = 'AwaitingManagerApproval'; - const STATUSES_APPROVED_BY_MANAGER = 'ApprovedByManager'; - const STATUSES_REJECTED_BY_MANAGER = 'RejectedByManager'; - + public const STATUSES_CREATED = 'Created'; + public const STATUSES_CANCELLED = 'Cancelled'; + public const STATUSES_ACCEPTED = 'Accepted'; + public const STATUSES_DECLINED = 'Declined'; + public const STATUSES_AWAITING_MANAGER_APPROVAL = 'AwaitingManagerApproval'; + public const STATUSES_APPROVED_BY_MANAGER = 'ApprovedByManager'; + public const STATUSES_REJECTED_BY_MANAGER = 'RejectedByManager'; - /** * Gets allowable values of the enum * @@ -220,7 +295,6 @@ public function getStatusesAllowableValues() self::STATUSES_REJECTED_BY_MANAGER, ]; } - /** * Associative array for storing property values @@ -237,14 +311,32 @@ public function getStatusesAllowableValues() */ public function __construct(array $data = null) { - $this->container['from_employee_id'] = isset($data['from_employee_id']) ? $data['from_employee_id'] : null; - $this->container['to_employee_id'] = isset($data['to_employee_id']) ? $data['to_employee_id'] : null; - $this->container['include_costs'] = isset($data['include_costs']) ? $data['include_costs'] : null; - $this->container['statuses'] = isset($data['statuses']) ? $data['statuses'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('from_employee_id', $data ?? [], null); + $this->setIfExists('to_employee_id', $data ?? [], null); + $this->setIfExists('include_costs', $data ?? [], null); + $this->setIfExists('statuses', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -274,7 +366,7 @@ public function valid() /** * Gets from_employee_id * - * @return int + * @return int|null */ public function getFromEmployeeId() { @@ -284,12 +376,15 @@ public function getFromEmployeeId() /** * Sets from_employee_id * - * @param int $from_employee_id + * @param int|null $from_employee_id * - * @return $this + * @return self */ public function setFromEmployeeId($from_employee_id) { + if (is_null($from_employee_id)) { + throw new \InvalidArgumentException('non-nullable from_employee_id cannot be null'); + } $this->container['from_employee_id'] = $from_employee_id; return $this; @@ -298,7 +393,7 @@ public function setFromEmployeeId($from_employee_id) /** * Gets to_employee_id * - * @return int + * @return int|null */ public function getToEmployeeId() { @@ -308,12 +403,15 @@ public function getToEmployeeId() /** * Sets to_employee_id * - * @param int $to_employee_id + * @param int|null $to_employee_id * - * @return $this + * @return self */ public function setToEmployeeId($to_employee_id) { + if (is_null($to_employee_id)) { + throw new \InvalidArgumentException('non-nullable to_employee_id cannot be null'); + } $this->container['to_employee_id'] = $to_employee_id; return $this; @@ -322,7 +420,7 @@ public function setToEmployeeId($to_employee_id) /** * Gets include_costs * - * @return bool + * @return bool|null */ public function getIncludeCosts() { @@ -332,12 +430,15 @@ public function getIncludeCosts() /** * Sets include_costs * - * @param bool $include_costs + * @param bool|null $include_costs * - * @return $this + * @return self */ public function setIncludeCosts($include_costs) { + if (is_null($include_costs)) { + throw new \InvalidArgumentException('non-nullable include_costs cannot be null'); + } $this->container['include_costs'] = $include_costs; return $this; @@ -346,7 +447,7 @@ public function setIncludeCosts($include_costs) /** * Gets statuses * - * @return string[] + * @return string[]|null */ public function getStatuses() { @@ -356,14 +457,17 @@ public function getStatuses() /** * Sets statuses * - * @param string[] $statuses + * @param string[]|null $statuses * - * @return $this + * @return self */ public function setStatuses($statuses) { + if (is_null($statuses)) { + throw new \InvalidArgumentException('non-nullable statuses cannot be null'); + } $allowedValues = $this->getStatusesAllowableValues(); - if (!is_null($statuses) && array_diff($statuses, $allowedValues)) { + if (array_diff($statuses, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'statuses', must be one of '%s'", @@ -379,7 +483,7 @@ public function setStatuses($statuses) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -389,12 +493,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -403,7 +510,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -413,12 +520,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -427,7 +537,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -437,12 +547,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -451,7 +564,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -461,12 +574,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -478,7 +594,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -488,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -519,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -531,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SignupModel.php b/src/lib/Model/SignupModel.php index 8086d0d..9e76394 100644 --- a/src/lib/Model/SignupModel.php +++ b/src/lib/Model/SignupModel.php @@ -2,61 +2,61 @@ /** * SignupModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SignupModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SignupModel implements ModelInterface, ArrayAccess +class SignupModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SignupModel'; + protected static $openAPIModelName = 'SignupModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'business_id' => 'int', 'business_name' => 'string', 'date_created' => '\DateTime', @@ -74,8 +74,10 @@ class SignupModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'business_id' => 'int32', 'business_name' => null, 'date_created' => 'date-time', @@ -89,14 +91,40 @@ class SignupModel implements ModelInterface, ArrayAccess 'date_last_pay_run_finalised' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'business_id' => false, + 'business_name' => false, + 'date_created' => false, + 'billing_plan' => false, + 'realm_id' => false, + 'external_id' => false, + 'email_addresses' => false, + 'user_ids' => false, + 'number_of_complete_employees' => false, + 'number_of_incomplete_employees' => false, + 'date_last_pay_run_finalised' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['business_id'] = isset($data['business_id']) ? $data['business_id'] : null; - $this->container['business_name'] = isset($data['business_name']) ? $data['business_name'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['billing_plan'] = isset($data['billing_plan']) ? $data['billing_plan'] : null; - $this->container['realm_id'] = isset($data['realm_id']) ? $data['realm_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['email_addresses'] = isset($data['email_addresses']) ? $data['email_addresses'] : null; - $this->container['user_ids'] = isset($data['user_ids']) ? $data['user_ids'] : null; - $this->container['number_of_complete_employees'] = isset($data['number_of_complete_employees']) ? $data['number_of_complete_employees'] : null; - $this->container['number_of_incomplete_employees'] = isset($data['number_of_incomplete_employees']) ? $data['number_of_incomplete_employees'] : null; - $this->container['date_last_pay_run_finalised'] = isset($data['date_last_pay_run_finalised']) ? $data['date_last_pay_run_finalised'] : null; + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('business_name', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('billing_plan', $data ?? [], null); + $this->setIfExists('realm_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('user_ids', $data ?? [], null); + $this->setIfExists('number_of_complete_employees', $data ?? [], null); + $this->setIfExists('number_of_incomplete_employees', $data ?? [], null); + $this->setIfExists('date_last_pay_run_finalised', $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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets business_id * - * @return int + * @return int|null */ public function getBusinessId() { @@ -277,12 +372,15 @@ public function getBusinessId() /** * Sets business_id * - * @param int $business_id + * @param int|null $business_id * - * @return $this + * @return self */ public function setBusinessId($business_id) { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } $this->container['business_id'] = $business_id; return $this; @@ -291,7 +389,7 @@ public function setBusinessId($business_id) /** * Gets business_name * - * @return string + * @return string|null */ public function getBusinessName() { @@ -301,12 +399,15 @@ public function getBusinessName() /** * Sets business_name * - * @param string $business_name + * @param string|null $business_name * - * @return $this + * @return self */ public function setBusinessName($business_name) { + if (is_null($business_name)) { + throw new \InvalidArgumentException('non-nullable business_name cannot be null'); + } $this->container['business_name'] = $business_name; return $this; @@ -315,7 +416,7 @@ public function setBusinessName($business_name) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -325,12 +426,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -339,7 +443,7 @@ public function setDateCreated($date_created) /** * Gets billing_plan * - * @return string + * @return string|null */ public function getBillingPlan() { @@ -349,12 +453,15 @@ public function getBillingPlan() /** * Sets billing_plan * - * @param string $billing_plan + * @param string|null $billing_plan * - * @return $this + * @return self */ public function setBillingPlan($billing_plan) { + if (is_null($billing_plan)) { + throw new \InvalidArgumentException('non-nullable billing_plan cannot be null'); + } $this->container['billing_plan'] = $billing_plan; return $this; @@ -363,7 +470,7 @@ public function setBillingPlan($billing_plan) /** * Gets realm_id * - * @return string + * @return string|null */ public function getRealmId() { @@ -373,12 +480,15 @@ public function getRealmId() /** * Sets realm_id * - * @param string $realm_id + * @param string|null $realm_id * - * @return $this + * @return self */ public function setRealmId($realm_id) { + if (is_null($realm_id)) { + throw new \InvalidArgumentException('non-nullable realm_id cannot be null'); + } $this->container['realm_id'] = $realm_id; return $this; @@ -387,7 +497,7 @@ public function setRealmId($realm_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -397,12 +507,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -411,7 +524,7 @@ public function setExternalId($external_id) /** * Gets email_addresses * - * @return string + * @return string|null */ public function getEmailAddresses() { @@ -421,12 +534,15 @@ public function getEmailAddresses() /** * Sets email_addresses * - * @param string $email_addresses + * @param string|null $email_addresses * - * @return $this + * @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; @@ -435,7 +551,7 @@ public function setEmailAddresses($email_addresses) /** * Gets user_ids * - * @return string + * @return string|null */ public function getUserIds() { @@ -445,12 +561,15 @@ public function getUserIds() /** * Sets user_ids * - * @param string $user_ids + * @param string|null $user_ids * - * @return $this + * @return self */ public function setUserIds($user_ids) { + if (is_null($user_ids)) { + throw new \InvalidArgumentException('non-nullable user_ids cannot be null'); + } $this->container['user_ids'] = $user_ids; return $this; @@ -459,7 +578,7 @@ public function setUserIds($user_ids) /** * Gets number_of_complete_employees * - * @return int + * @return int|null */ public function getNumberOfCompleteEmployees() { @@ -469,12 +588,15 @@ public function getNumberOfCompleteEmployees() /** * Sets number_of_complete_employees * - * @param int $number_of_complete_employees + * @param int|null $number_of_complete_employees * - * @return $this + * @return self */ public function setNumberOfCompleteEmployees($number_of_complete_employees) { + if (is_null($number_of_complete_employees)) { + throw new \InvalidArgumentException('non-nullable number_of_complete_employees cannot be null'); + } $this->container['number_of_complete_employees'] = $number_of_complete_employees; return $this; @@ -483,7 +605,7 @@ public function setNumberOfCompleteEmployees($number_of_complete_employees) /** * Gets number_of_incomplete_employees * - * @return int + * @return int|null */ public function getNumberOfIncompleteEmployees() { @@ -493,12 +615,15 @@ public function getNumberOfIncompleteEmployees() /** * Sets number_of_incomplete_employees * - * @param int $number_of_incomplete_employees + * @param int|null $number_of_incomplete_employees * - * @return $this + * @return self */ public function setNumberOfIncompleteEmployees($number_of_incomplete_employees) { + if (is_null($number_of_incomplete_employees)) { + throw new \InvalidArgumentException('non-nullable number_of_incomplete_employees cannot be null'); + } $this->container['number_of_incomplete_employees'] = $number_of_incomplete_employees; return $this; @@ -507,7 +632,7 @@ public function setNumberOfIncompleteEmployees($number_of_incomplete_employees) /** * Gets date_last_pay_run_finalised * - * @return \DateTime + * @return \DateTime|null */ public function getDateLastPayRunFinalised() { @@ -517,12 +642,15 @@ public function getDateLastPayRunFinalised() /** * Sets date_last_pay_run_finalised * - * @param \DateTime $date_last_pay_run_finalised + * @param \DateTime|null $date_last_pay_run_finalised * - * @return $this + * @return self */ public function setDateLastPayRunFinalised($date_last_pay_run_finalised) { + if (is_null($date_last_pay_run_finalised)) { + throw new \InvalidArgumentException('non-nullable date_last_pay_run_finalised cannot be null'); + } $this->container['date_last_pay_run_finalised'] = $date_last_pay_run_finalised; return $this; @@ -534,7 +662,7 @@ public function setDateLastPayRunFinalised($date_last_pay_run_finalised) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SingleSignOnRequestAdditionalDataModel.php b/src/lib/Model/SingleSignOnRequestAdditionalDataModel.php index ae1b2e8..e31c8d4 100644 --- a/src/lib/Model/SingleSignOnRequestAdditionalDataModel.php +++ b/src/lib/Model/SingleSignOnRequestAdditionalDataModel.php @@ -2,61 +2,61 @@ /** * SingleSignOnRequestAdditionalDataModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SingleSignOnRequestAdditionalDataModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SingleSignOnRequestAdditionalDataModel implements ModelInterface, ArrayAccess +class SingleSignOnRequestAdditionalDataModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SingleSignOnRequestAdditionalDataModel'; + protected static $openAPIModelName = 'SingleSignOnRequestAdditionalDataModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'organisation_id' => 'string', 'member_id' => 'string' ]; @@ -65,20 +65,39 @@ class SingleSignOnRequestAdditionalDataModel implements ModelInterface, ArrayAcc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'organisation_id' => null, 'member_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'organisation_id' => false, + 'member_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['organisation_id'] = isset($data['organisation_id']) ? $data['organisation_id'] : null; - $this->container['member_id'] = isset($data['member_id']) ? $data['member_id'] : null; + $this->setIfExists('organisation_id', $data ?? [], null); + $this->setIfExists('member_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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets organisation_id * - * @return string + * @return string|null */ public function getOrganisationId() { @@ -223,12 +309,15 @@ public function getOrganisationId() /** * Sets organisation_id * - * @param string $organisation_id + * @param string|null $organisation_id * - * @return $this + * @return self */ public function setOrganisationId($organisation_id) { + if (is_null($organisation_id)) { + throw new \InvalidArgumentException('non-nullable organisation_id cannot be null'); + } $this->container['organisation_id'] = $organisation_id; return $this; @@ -237,7 +326,7 @@ public function setOrganisationId($organisation_id) /** * Gets member_id * - * @return string + * @return string|null */ public function getMemberId() { @@ -247,12 +336,15 @@ public function getMemberId() /** * Sets member_id * - * @param string $member_id + * @param string|null $member_id * - * @return $this + * @return self */ public function setMemberId($member_id) { + if (is_null($member_id)) { + throw new \InvalidArgumentException('non-nullable member_id cannot be null'); + } $this->container['member_id'] = $member_id; return $this; @@ -264,7 +356,7 @@ public function setMemberId($member_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SingleSignOnRequestModel.php b/src/lib/Model/SingleSignOnRequestModel.php index af3509d..e0b6980 100644 --- a/src/lib/Model/SingleSignOnRequestModel.php +++ b/src/lib/Model/SingleSignOnRequestModel.php @@ -2,61 +2,61 @@ /** * SingleSignOnRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SingleSignOnRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SingleSignOnRequestModel implements ModelInterface, ArrayAccess +class SingleSignOnRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SingleSignOnRequestModel'; + protected static $openAPIModelName = 'SingleSignOnRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'business_id' => 'int', 'user_name' => 'string', 'url' => 'string', @@ -68,8 +68,10 @@ class SingleSignOnRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'business_id' => 'int32', 'user_name' => null, 'url' => null, @@ -77,14 +79,34 @@ class SingleSignOnRequestModel implements ModelInterface, ArrayAccess 'host_name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'business_id' => false, + 'user_name' => false, + 'url' => false, + 'navigation' => false, + 'host_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -175,17 +249,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NAVIGATION_FULL = 'Full'; - const NAVIGATION_PRIMARY = 'Primary'; - const NAVIGATION_SECONDARY = 'Secondary'; - const NAVIGATION_NONE = 'None'; - const NAVIGATION_HIDE_INTERNAL_PAGE_NAV = 'HideInternalPageNav'; - + public const NAVIGATION_FULL = 'Full'; + public const NAVIGATION_PRIMARY = 'Primary'; + public const NAVIGATION_SECONDARY = 'Secondary'; + public const NAVIGATION_NONE = 'None'; + public const NAVIGATION_HIDE_INTERNAL_PAGE_NAV = 'HideInternalPageNav'; - /** * Gets allowable values of the enum * @@ -201,7 +273,6 @@ public function getNavigationAllowableValues() self::NAVIGATION_HIDE_INTERNAL_PAGE_NAV, ]; } - /** * Associative array for storing property values @@ -218,11 +289,29 @@ public function getNavigationAllowableValues() */ public function __construct(array $data = null) { - $this->container['business_id'] = isset($data['business_id']) ? $data['business_id'] : null; - $this->container['user_name'] = isset($data['user_name']) ? $data['user_name'] : null; - $this->container['url'] = isset($data['url']) ? $data['url'] : null; - $this->container['navigation'] = isset($data['navigation']) ? $data['navigation'] : null; - $this->container['host_name'] = isset($data['host_name']) ? $data['host_name'] : null; + $this->setIfExists('business_id', $data ?? [], null); + $this->setIfExists('user_name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('navigation', $data ?? [], null); + $this->setIfExists('host_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; } /** @@ -237,7 +326,8 @@ public function listInvalidProperties() $allowedValues = $this->getNavigationAllowableValues(); if (!is_null($this->container['navigation']) && !in_array($this->container['navigation'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'navigation', must be one of '%s'", + "invalid value '%s' for 'navigation', must be one of '%s'", + $this->container['navigation'], implode("', '", $allowedValues) ); } @@ -260,7 +350,7 @@ public function valid() /** * Gets business_id * - * @return int + * @return int|null */ public function getBusinessId() { @@ -270,12 +360,15 @@ public function getBusinessId() /** * Sets business_id * - * @param int $business_id + * @param int|null $business_id * - * @return $this + * @return self */ public function setBusinessId($business_id) { + if (is_null($business_id)) { + throw new \InvalidArgumentException('non-nullable business_id cannot be null'); + } $this->container['business_id'] = $business_id; return $this; @@ -284,7 +377,7 @@ public function setBusinessId($business_id) /** * Gets user_name * - * @return string + * @return string|null */ public function getUserName() { @@ -294,12 +387,15 @@ public function getUserName() /** * Sets user_name * - * @param string $user_name + * @param string|null $user_name * - * @return $this + * @return self */ public function setUserName($user_name) { + if (is_null($user_name)) { + throw new \InvalidArgumentException('non-nullable user_name cannot be null'); + } $this->container['user_name'] = $user_name; return $this; @@ -308,7 +404,7 @@ public function setUserName($user_name) /** * Gets url * - * @return string + * @return string|null */ public function getUrl() { @@ -318,12 +414,15 @@ public function getUrl() /** * Sets url * - * @param string $url + * @param string|null $url * - * @return $this + * @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; @@ -332,7 +431,7 @@ public function setUrl($url) /** * Gets navigation * - * @return string + * @return string|null */ public function getNavigation() { @@ -342,17 +441,21 @@ public function getNavigation() /** * Sets navigation * - * @param string $navigation + * @param string|null $navigation * - * @return $this + * @return self */ public function setNavigation($navigation) { + if (is_null($navigation)) { + throw new \InvalidArgumentException('non-nullable navigation cannot be null'); + } $allowedValues = $this->getNavigationAllowableValues(); - if (!is_null($navigation) && !in_array($navigation, $allowedValues, true)) { + if (!in_array($navigation, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'navigation', must be one of '%s'", + "Invalid value '%s' for 'navigation', must be one of '%s'", + $navigation, implode("', '", $allowedValues) ) ); @@ -365,7 +468,7 @@ public function setNavigation($navigation) /** * Gets host_name * - * @return string + * @return string|null */ public function getHostName() { @@ -375,12 +478,15 @@ public function getHostName() /** * Sets host_name * - * @param string $host_name + * @param string|null $host_name * - * @return $this + * @return self */ public function setHostName($host_name) { + if (is_null($host_name)) { + throw new \InvalidArgumentException('non-nullable host_name cannot be null'); + } $this->container['host_name'] = $host_name; return $this; @@ -392,7 +498,7 @@ public function setHostName($host_name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -402,22 +508,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -433,11 +540,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -445,13 +565,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SingleSignOnResponseModel.php b/src/lib/Model/SingleSignOnResponseModel.php index 2bfa9c1..1fb5bb0 100644 --- a/src/lib/Model/SingleSignOnResponseModel.php +++ b/src/lib/Model/SingleSignOnResponseModel.php @@ -2,61 +2,61 @@ /** * SingleSignOnResponseModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SingleSignOnResponseModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SingleSignOnResponseModel implements ModelInterface, ArrayAccess +class SingleSignOnResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SingleSignOnResponseModel'; + protected static $openAPIModelName = 'SingleSignOnResponseModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'url' => 'string' ]; @@ -64,19 +64,37 @@ class SingleSignOnResponseModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'url' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + '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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['url'] = isset($data['url']) ? $data['url'] : null; + $this->setIfExists('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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets url * - * @return string + * @return string|null */ public function getUrl() { @@ -217,12 +302,15 @@ public function getUrl() /** * Sets url * - * @param string $url + * @param string|null $url * - * @return $this + * @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; @@ -234,7 +322,7 @@ public function setUrl($url) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SingleValueNode.php b/src/lib/Model/SingleValueNode.php index 0bff0b6..7ee0b76 100644 --- a/src/lib/Model/SingleValueNode.php +++ b/src/lib/Model/SingleValueNode.php @@ -2,62 +2,62 @@ /** * SingleValueNode * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SingleValueNode Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SingleValueNode implements ModelInterface, ArrayAccess +class SingleValueNode implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SingleValueNode'; + protected static $openAPIModelName = 'SingleValueNode'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'type_reference' => '\Swagger\Client\Model\IEdmTypeReference', + protected static $openAPITypes = [ + 'type_reference' => '\OpenAPI\Client\Model\IEdmTypeReference', 'kind' => 'string' ]; @@ -65,20 +65,39 @@ class SingleValueNode implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'type_reference' => null, 'kind' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type_reference' => false, + 'kind' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -160,33 +231,31 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const KIND_NONE = 'None'; - const KIND_CONSTANT = 'Constant'; - const KIND_CONVERT = 'Convert'; - const KIND_NONENTITY_RANGE_VARIABLE_REFERENCE = 'NonentityRangeVariableReference'; - const KIND_BINARY_OPERATOR = 'BinaryOperator'; - const KIND_UNARY_OPERATOR = 'UnaryOperator'; - const KIND_SINGLE_VALUE_PROPERTY_ACCESS = 'SingleValuePropertyAccess'; - const KIND_COLLECTION_PROPERTY_ACCESS = 'CollectionPropertyAccess'; - const KIND_SINGLE_VALUE_FUNCTION_CALL = 'SingleValueFunctionCall'; - const KIND_ANY = 'Any'; - const KIND_COLLECTION_NAVIGATION_NODE = 'CollectionNavigationNode'; - const KIND_SINGLE_NAVIGATION_NODE = 'SingleNavigationNode'; - const KIND_SINGLE_VALUE_OPEN_PROPERTY_ACCESS = 'SingleValueOpenPropertyAccess'; - const KIND_SINGLE_ENTITY_CAST = 'SingleEntityCast'; - const KIND_ALL = 'All'; - const KIND_ENTITY_COLLECTION_CAST = 'EntityCollectionCast'; - const KIND_ENTITY_RANGE_VARIABLE_REFERENCE = 'EntityRangeVariableReference'; - const KIND_SINGLE_ENTITY_FUNCTION_CALL = 'SingleEntityFunctionCall'; - const KIND_COLLECTION_FUNCTION_CALL = 'CollectionFunctionCall'; - const KIND_ENTITY_COLLECTION_FUNCTION_CALL = 'EntityCollectionFunctionCall'; - const KIND_NAMED_FUNCTION_PARAMETER = 'NamedFunctionParameter'; - - - + public const KIND_NONE = 'None'; + public const KIND_CONSTANT = 'Constant'; + public const KIND_CONVERT = 'Convert'; + public const KIND_NONENTITY_RANGE_VARIABLE_REFERENCE = 'NonentityRangeVariableReference'; + public const KIND_BINARY_OPERATOR = 'BinaryOperator'; + public const KIND_UNARY_OPERATOR = 'UnaryOperator'; + public const KIND_SINGLE_VALUE_PROPERTY_ACCESS = 'SingleValuePropertyAccess'; + public const KIND_COLLECTION_PROPERTY_ACCESS = 'CollectionPropertyAccess'; + public const KIND_SINGLE_VALUE_FUNCTION_CALL = 'SingleValueFunctionCall'; + public const KIND_ANY = 'Any'; + public const KIND_COLLECTION_NAVIGATION_NODE = 'CollectionNavigationNode'; + public const KIND_SINGLE_NAVIGATION_NODE = 'SingleNavigationNode'; + public const KIND_SINGLE_VALUE_OPEN_PROPERTY_ACCESS = 'SingleValueOpenPropertyAccess'; + public const KIND_SINGLE_ENTITY_CAST = 'SingleEntityCast'; + public const KIND_ALL = 'All'; + public const KIND_ENTITY_COLLECTION_CAST = 'EntityCollectionCast'; + public const KIND_ENTITY_RANGE_VARIABLE_REFERENCE = 'EntityRangeVariableReference'; + public const KIND_SINGLE_ENTITY_FUNCTION_CALL = 'SingleEntityFunctionCall'; + public const KIND_COLLECTION_FUNCTION_CALL = 'CollectionFunctionCall'; + public const KIND_ENTITY_COLLECTION_FUNCTION_CALL = 'EntityCollectionFunctionCall'; + public const KIND_NAMED_FUNCTION_PARAMETER = 'NamedFunctionParameter'; + /** * Gets allowable values of the enum * @@ -218,7 +287,6 @@ public function getKindAllowableValues() self::KIND_NAMED_FUNCTION_PARAMETER, ]; } - /** * Associative array for storing property values @@ -235,8 +303,26 @@ public function getKindAllowableValues() */ public function __construct(array $data = null) { - $this->container['type_reference'] = isset($data['type_reference']) ? $data['type_reference'] : null; - $this->container['kind'] = isset($data['kind']) ? $data['kind'] : null; + $this->setIfExists('type_reference', $data ?? [], null); + $this->setIfExists('kind', $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; } /** @@ -251,7 +337,8 @@ public function listInvalidProperties() $allowedValues = $this->getKindAllowableValues(); if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'kind', must be one of '%s'", + "invalid value '%s' for 'kind', must be one of '%s'", + $this->container['kind'], implode("', '", $allowedValues) ); } @@ -274,7 +361,7 @@ public function valid() /** * Gets type_reference * - * @return \Swagger\Client\Model\IEdmTypeReference + * @return \OpenAPI\Client\Model\IEdmTypeReference|null */ public function getTypeReference() { @@ -284,12 +371,15 @@ public function getTypeReference() /** * Sets type_reference * - * @param \Swagger\Client\Model\IEdmTypeReference $type_reference + * @param \OpenAPI\Client\Model\IEdmTypeReference|null $type_reference type_reference * - * @return $this + * @return self */ public function setTypeReference($type_reference) { + if (is_null($type_reference)) { + throw new \InvalidArgumentException('non-nullable type_reference cannot be null'); + } $this->container['type_reference'] = $type_reference; return $this; @@ -298,7 +388,7 @@ public function setTypeReference($type_reference) /** * Gets kind * - * @return string + * @return string|null */ public function getKind() { @@ -308,17 +398,21 @@ public function getKind() /** * Sets kind * - * @param string $kind + * @param string|null $kind * - * @return $this + * @return self */ public function setKind($kind) { + if (is_null($kind)) { + throw new \InvalidArgumentException('non-nullable kind cannot be null'); + } $allowedValues = $this->getKindAllowableValues(); - if (!is_null($kind) && !in_array($kind, $allowedValues, true)) { + if (!in_array($kind, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'kind', must be one of '%s'", + "Invalid value '%s' for 'kind', must be one of '%s'", + $kind, implode("', '", $allowedValues) ) ); @@ -334,7 +428,7 @@ public function setKind($kind) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -344,22 +438,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -375,11 +470,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -387,13 +495,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SkipQueryOption.php b/src/lib/Model/SkipQueryOption.php index fb8d4b2..8f55f55 100644 --- a/src/lib/Model/SkipQueryOption.php +++ b/src/lib/Model/SkipQueryOption.php @@ -2,87 +2,108 @@ /** * SkipQueryOption * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SkipQueryOption Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SkipQueryOption implements ModelInterface, ArrayAccess +class SkipQueryOption implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SkipQueryOption'; + protected static $openAPIModelName = 'SkipQueryOption'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'context' => '\Swagger\Client\Model\ODataQueryContext', + protected static $openAPITypes = [ + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'raw_value' => 'string', 'value' => 'int', - 'validator' => '\Swagger\Client\Model\SkipQueryValidator' + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'context' => null, 'raw_value' => null, 'value' => 'int32', 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'context' => false, + 'raw_value' => false, + 'value' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['raw_value'] = isset($data['raw_value']) ? $data['raw_value'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('raw_value', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -235,12 +323,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -249,7 +340,7 @@ public function setContext($context) /** * Gets raw_value * - * @return string + * @return string|null */ public function getRawValue() { @@ -259,12 +350,15 @@ public function getRawValue() /** * Sets raw_value * - * @param string $raw_value + * @param string|null $raw_value * - * @return $this + * @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; @@ -273,7 +367,7 @@ public function setRawValue($raw_value) /** * Gets value * - * @return int + * @return int|null */ public function getValue() { @@ -283,12 +377,15 @@ public function getValue() /** * Sets value * - * @param int $value + * @param int|null $value * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setValue($value) /** * Gets validator * - * @return \Swagger\Client\Model\SkipQueryValidator + * @return object|null */ public function getValidator() { @@ -307,12 +404,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\SkipQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -324,7 +424,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SkipQueryValidator.php b/src/lib/Model/SkipQueryValidator.php deleted file mode 100644 index 1ae3fb9..0000000 --- a/src/lib/Model/SkipQueryValidator.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/StandardHoursDayModel.php b/src/lib/Model/StandardHoursDayModel.php index f3c63ee..6d60ad0 100644 --- a/src/lib/Model/StandardHoursDayModel.php +++ b/src/lib/Model/StandardHoursDayModel.php @@ -2,61 +2,61 @@ /** * StandardHoursDayModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * StandardHoursDayModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class StandardHoursDayModel implements ModelInterface, ArrayAccess +class StandardHoursDayModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'StandardHoursDayModel'; + protected static $openAPIModelName = 'StandardHoursDayModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'week' => 'int', 'day_of_week' => 'int', @@ -67,15 +67,17 @@ class StandardHoursDayModel implements ModelInterface, ArrayAccess 'break_end_time' => 'string', 'location_id' => 'int', 'work_type_id' => 'int', - 'hours' => 'double' + 'hours' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'week' => 'int32', 'day_of_week' => 'int32', @@ -89,14 +91,40 @@ class StandardHoursDayModel implements ModelInterface, ArrayAccess 'hours' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'week' => false, + 'day_of_week' => false, + 'day_name' => false, + 'start_time' => false, + 'end_time' => false, + 'break_start_time' => false, + 'break_end_time' => false, + 'location_id' => false, + 'work_type_id' => false, + 'hours' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,12 +285,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -227,17 +304,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['week'] = isset($data['week']) ? $data['week'] : null; - $this->container['day_of_week'] = isset($data['day_of_week']) ? $data['day_of_week'] : null; - $this->container['day_name'] = isset($data['day_name']) ? $data['day_name'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['break_start_time'] = isset($data['break_start_time']) ? $data['break_start_time'] : null; - $this->container['break_end_time'] = isset($data['break_end_time']) ? $data['break_end_time'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('week', $data ?? [], null); + $this->setIfExists('day_of_week', $data ?? [], null); + $this->setIfExists('day_name', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('break_start_time', $data ?? [], null); + $this->setIfExists('break_end_time', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('hours', $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; } /** @@ -267,7 +362,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -277,12 +372,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -291,7 +389,7 @@ public function setId($id) /** * Gets week * - * @return int + * @return int|null */ public function getWeek() { @@ -301,12 +399,15 @@ public function getWeek() /** * Sets week * - * @param int $week + * @param int|null $week * - * @return $this + * @return self */ public function setWeek($week) { + if (is_null($week)) { + throw new \InvalidArgumentException('non-nullable week cannot be null'); + } $this->container['week'] = $week; return $this; @@ -315,7 +416,7 @@ public function setWeek($week) /** * Gets day_of_week * - * @return int + * @return int|null */ public function getDayOfWeek() { @@ -325,12 +426,15 @@ public function getDayOfWeek() /** * Sets day_of_week * - * @param int $day_of_week + * @param int|null $day_of_week * - * @return $this + * @return self */ public function setDayOfWeek($day_of_week) { + if (is_null($day_of_week)) { + throw new \InvalidArgumentException('non-nullable day_of_week cannot be null'); + } $this->container['day_of_week'] = $day_of_week; return $this; @@ -339,7 +443,7 @@ public function setDayOfWeek($day_of_week) /** * Gets day_name * - * @return string + * @return string|null */ public function getDayName() { @@ -349,12 +453,15 @@ public function getDayName() /** * Sets day_name * - * @param string $day_name + * @param string|null $day_name * - * @return $this + * @return self */ public function setDayName($day_name) { + if (is_null($day_name)) { + throw new \InvalidArgumentException('non-nullable day_name cannot be null'); + } $this->container['day_name'] = $day_name; return $this; @@ -363,7 +470,7 @@ public function setDayName($day_name) /** * Gets start_time * - * @return string + * @return string|null */ public function getStartTime() { @@ -373,12 +480,15 @@ public function getStartTime() /** * Sets start_time * - * @param string $start_time + * @param string|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -387,7 +497,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return string + * @return string|null */ public function getEndTime() { @@ -397,12 +507,15 @@ public function getEndTime() /** * Sets end_time * - * @param string $end_time + * @param string|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -411,7 +524,7 @@ public function setEndTime($end_time) /** * Gets break_start_time * - * @return string + * @return string|null */ public function getBreakStartTime() { @@ -421,12 +534,15 @@ public function getBreakStartTime() /** * Sets break_start_time * - * @param string $break_start_time + * @param string|null $break_start_time * - * @return $this + * @return self */ public function setBreakStartTime($break_start_time) { + if (is_null($break_start_time)) { + throw new \InvalidArgumentException('non-nullable break_start_time cannot be null'); + } $this->container['break_start_time'] = $break_start_time; return $this; @@ -435,7 +551,7 @@ public function setBreakStartTime($break_start_time) /** * Gets break_end_time * - * @return string + * @return string|null */ public function getBreakEndTime() { @@ -445,12 +561,15 @@ public function getBreakEndTime() /** * Sets break_end_time * - * @param string $break_end_time + * @param string|null $break_end_time * - * @return $this + * @return self */ public function setBreakEndTime($break_end_time) { + if (is_null($break_end_time)) { + throw new \InvalidArgumentException('non-nullable break_end_time cannot be null'); + } $this->container['break_end_time'] = $break_end_time; return $this; @@ -459,7 +578,7 @@ public function setBreakEndTime($break_end_time) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -469,12 +588,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -483,7 +605,7 @@ public function setLocationId($location_id) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -493,12 +615,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -507,7 +632,7 @@ public function setWorkTypeId($work_type_id) /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -517,12 +642,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -534,7 +662,7 @@ public function setHours($hours) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +672,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +704,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +729,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/StandardHoursModel.php b/src/lib/Model/StandardHoursModel.php index 1e7882c..9ff46f8 100644 --- a/src/lib/Model/StandardHoursModel.php +++ b/src/lib/Model/StandardHoursModel.php @@ -2,74 +2,76 @@ /** * StandardHoursModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * StandardHoursModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class StandardHoursModel implements ModelInterface, ArrayAccess +class StandardHoursModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'StandardHoursModel'; + protected static $openAPIModelName = 'StandardHoursModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', - 'standard_hours_per_week' => 'double', - 'standard_hours_per_day' => 'double', + 'standard_hours_per_week' => 'float', + 'standard_hours_per_day' => 'float', 'use_advanced_work_week' => 'bool', - 'standard_work_days' => '\Swagger\Client\Model\StandardHoursDayModel[]' + 'standard_work_days' => '\OpenAPI\Client\Model\StandardHoursDayModel[]' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'standard_hours_per_week' => 'double', 'standard_hours_per_day' => 'double', @@ -77,14 +79,34 @@ class StandardHoursModel implements ModelInterface, ArrayAccess 'standard_work_days' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'standard_hours_per_week' => false, + 'standard_hours_per_day' => false, + 'use_advanced_work_week' => false, + 'standard_work_days' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['standard_hours_per_week'] = isset($data['standard_hours_per_week']) ? $data['standard_hours_per_week'] : null; - $this->container['standard_hours_per_day'] = isset($data['standard_hours_per_day']) ? $data['standard_hours_per_day'] : null; - $this->container['use_advanced_work_week'] = isset($data['use_advanced_work_week']) ? $data['use_advanced_work_week'] : null; - $this->container['standard_work_days'] = isset($data['standard_work_days']) ? $data['standard_work_days'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('standard_hours_per_week', $data ?? [], null); + $this->setIfExists('standard_hours_per_day', $data ?? [], null); + $this->setIfExists('use_advanced_work_week', $data ?? [], null); + $this->setIfExists('standard_work_days', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -241,12 +330,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -255,7 +347,7 @@ public function setEmployeeId($employee_id) /** * Gets standard_hours_per_week * - * @return double + * @return float|null */ public function getStandardHoursPerWeek() { @@ -265,12 +357,15 @@ public function getStandardHoursPerWeek() /** * Sets standard_hours_per_week * - * @param double $standard_hours_per_week + * @param float|null $standard_hours_per_week * - * @return $this + * @return self */ public function setStandardHoursPerWeek($standard_hours_per_week) { + if (is_null($standard_hours_per_week)) { + throw new \InvalidArgumentException('non-nullable standard_hours_per_week cannot be null'); + } $this->container['standard_hours_per_week'] = $standard_hours_per_week; return $this; @@ -279,7 +374,7 @@ public function setStandardHoursPerWeek($standard_hours_per_week) /** * Gets standard_hours_per_day * - * @return double + * @return float|null */ public function getStandardHoursPerDay() { @@ -289,12 +384,15 @@ public function getStandardHoursPerDay() /** * Sets standard_hours_per_day * - * @param double $standard_hours_per_day + * @param float|null $standard_hours_per_day * - * @return $this + * @return self */ public function setStandardHoursPerDay($standard_hours_per_day) { + if (is_null($standard_hours_per_day)) { + throw new \InvalidArgumentException('non-nullable standard_hours_per_day cannot be null'); + } $this->container['standard_hours_per_day'] = $standard_hours_per_day; return $this; @@ -303,7 +401,7 @@ public function setStandardHoursPerDay($standard_hours_per_day) /** * Gets use_advanced_work_week * - * @return bool + * @return bool|null */ public function getUseAdvancedWorkWeek() { @@ -313,12 +411,15 @@ public function getUseAdvancedWorkWeek() /** * Sets use_advanced_work_week * - * @param bool $use_advanced_work_week + * @param bool|null $use_advanced_work_week * - * @return $this + * @return self */ public function setUseAdvancedWorkWeek($use_advanced_work_week) { + if (is_null($use_advanced_work_week)) { + throw new \InvalidArgumentException('non-nullable use_advanced_work_week cannot be null'); + } $this->container['use_advanced_work_week'] = $use_advanced_work_week; return $this; @@ -327,7 +428,7 @@ public function setUseAdvancedWorkWeek($use_advanced_work_week) /** * Gets standard_work_days * - * @return \Swagger\Client\Model\StandardHoursDayModel[] + * @return \OpenAPI\Client\Model\StandardHoursDayModel[]|null */ public function getStandardWorkDays() { @@ -337,12 +438,15 @@ public function getStandardWorkDays() /** * Sets standard_work_days * - * @param \Swagger\Client\Model\StandardHoursDayModel[] $standard_work_days + * @param \OpenAPI\Client\Model\StandardHoursDayModel[]|null $standard_work_days * - * @return $this + * @return self */ public function setStandardWorkDays($standard_work_days) { + if (is_null($standard_work_days)) { + throw new \InvalidArgumentException('non-nullable standard_work_days cannot be null'); + } $this->container['standard_work_days'] = $standard_work_days; return $this; @@ -354,7 +458,7 @@ public function setStandardWorkDays($standard_work_days) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/StartBreakModel.php b/src/lib/Model/StartBreakModel.php index 0afb98e..2b82cd9 100644 --- a/src/lib/Model/StartBreakModel.php +++ b/src/lib/Model/StartBreakModel.php @@ -2,65 +2,65 @@ /** * StartBreakModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * StartBreakModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class StartBreakModel implements ModelInterface, ArrayAccess +class StartBreakModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'StartBreakModel'; + protected static $openAPIModelName = 'StartBreakModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_paid_break' => 'bool', 'employee_id' => 'int', - 'latitude' => 'double', - 'longitude' => 'double', + 'latitude' => 'float', + 'longitude' => 'float', 'kiosk_id' => 'int', 'ip_address' => 'string', 'image' => 'string', @@ -74,8 +74,10 @@ class StartBreakModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_paid_break' => null, 'employee_id' => 'int32', 'latitude' => 'double', @@ -89,14 +91,40 @@ class StartBreakModel implements ModelInterface, ArrayAccess 'note_visibility' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_paid_break' => false, + 'employee_id' => false, + 'latitude' => false, + 'longitude' => false, + 'kiosk_id' => false, + 'ip_address' => false, + 'image' => false, + 'is_admin_initiated' => false, + 'recorded_time_utc' => false, + 'utc_offset' => false, + 'note_visibility' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,14 +285,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const NOTE_VISIBILITY_HIDDEN = 'Hidden'; - const NOTE_VISIBILITY_VISIBLE = 'Visible'; - + public const NOTE_VISIBILITY_HIDDEN = 'Hidden'; + public const NOTE_VISIBILITY_VISIBLE = 'Visible'; - /** * Gets allowable values of the enum * @@ -225,7 +303,6 @@ public function getNoteVisibilityAllowableValues() self::NOTE_VISIBILITY_VISIBLE, ]; } - /** * Associative array for storing property values @@ -242,17 +319,35 @@ public function getNoteVisibilityAllowableValues() */ public function __construct(array $data = null) { - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['latitude'] = isset($data['latitude']) ? $data['latitude'] : null; - $this->container['longitude'] = isset($data['longitude']) ? $data['longitude'] : null; - $this->container['kiosk_id'] = isset($data['kiosk_id']) ? $data['kiosk_id'] : null; - $this->container['ip_address'] = isset($data['ip_address']) ? $data['ip_address'] : null; - $this->container['image'] = isset($data['image']) ? $data['image'] : null; - $this->container['is_admin_initiated'] = isset($data['is_admin_initiated']) ? $data['is_admin_initiated'] : null; - $this->container['recorded_time_utc'] = isset($data['recorded_time_utc']) ? $data['recorded_time_utc'] : null; - $this->container['utc_offset'] = isset($data['utc_offset']) ? $data['utc_offset'] : null; - $this->container['note_visibility'] = isset($data['note_visibility']) ? $data['note_visibility'] : null; + $this->setIfExists('is_paid_break', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('kiosk_id', $data ?? [], null); + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('is_admin_initiated', $data ?? [], null); + $this->setIfExists('recorded_time_utc', $data ?? [], null); + $this->setIfExists('utc_offset', $data ?? [], null); + $this->setIfExists('note_visibility', $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; } /** @@ -271,7 +366,8 @@ public function listInvalidProperties() $allowedValues = $this->getNoteVisibilityAllowableValues(); if (!is_null($this->container['note_visibility']) && !in_array($this->container['note_visibility'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'note_visibility', must be one of '%s'", + "invalid value '%s' for 'note_visibility', must be one of '%s'", + $this->container['note_visibility'], implode("', '", $allowedValues) ); } @@ -294,7 +390,7 @@ public function valid() /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -304,12 +400,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -318,7 +417,7 @@ public function setIsPaidBreak($is_paid_break) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -328,12 +427,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -342,7 +444,7 @@ public function setEmployeeId($employee_id) /** * Gets latitude * - * @return double + * @return float|null */ public function getLatitude() { @@ -352,12 +454,15 @@ public function getLatitude() /** * Sets latitude * - * @param double $latitude + * @param float|null $latitude * - * @return $this + * @return self */ public function setLatitude($latitude) { + if (is_null($latitude)) { + throw new \InvalidArgumentException('non-nullable latitude cannot be null'); + } $this->container['latitude'] = $latitude; return $this; @@ -366,7 +471,7 @@ public function setLatitude($latitude) /** * Gets longitude * - * @return double + * @return float|null */ public function getLongitude() { @@ -376,12 +481,15 @@ public function getLongitude() /** * Sets longitude * - * @param double $longitude + * @param float|null $longitude * - * @return $this + * @return self */ public function setLongitude($longitude) { + if (is_null($longitude)) { + throw new \InvalidArgumentException('non-nullable longitude cannot be null'); + } $this->container['longitude'] = $longitude; return $this; @@ -390,7 +498,7 @@ public function setLongitude($longitude) /** * Gets kiosk_id * - * @return int + * @return int|null */ public function getKioskId() { @@ -400,12 +508,15 @@ public function getKioskId() /** * Sets kiosk_id * - * @param int $kiosk_id + * @param int|null $kiosk_id * - * @return $this + * @return self */ public function setKioskId($kiosk_id) { + if (is_null($kiosk_id)) { + throw new \InvalidArgumentException('non-nullable kiosk_id cannot be null'); + } $this->container['kiosk_id'] = $kiosk_id; return $this; @@ -414,7 +525,7 @@ public function setKioskId($kiosk_id) /** * Gets ip_address * - * @return string + * @return string|null */ public function getIpAddress() { @@ -424,12 +535,15 @@ public function getIpAddress() /** * Sets ip_address * - * @param string $ip_address + * @param string|null $ip_address * - * @return $this + * @return self */ public function setIpAddress($ip_address) { + if (is_null($ip_address)) { + throw new \InvalidArgumentException('non-nullable ip_address cannot be null'); + } $this->container['ip_address'] = $ip_address; return $this; @@ -438,7 +552,7 @@ public function setIpAddress($ip_address) /** * Gets image * - * @return string + * @return string|null */ public function getImage() { @@ -448,15 +562,18 @@ public function getImage() /** * Sets image * - * @param string $image + * @param string|null $image * - * @return $this + * @return self */ public function setImage($image) { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } - if (!is_null($image) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { - throw new \InvalidArgumentException("invalid value for $image when calling StartBreakModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $image))) { + throw new \InvalidArgumentException("invalid value for \$image when calling StartBreakModel., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } $this->container['image'] = $image; @@ -467,7 +584,7 @@ public function setImage($image) /** * Gets is_admin_initiated * - * @return bool + * @return bool|null */ public function getIsAdminInitiated() { @@ -477,12 +594,15 @@ public function getIsAdminInitiated() /** * Sets is_admin_initiated * - * @param bool $is_admin_initiated + * @param bool|null $is_admin_initiated * - * @return $this + * @return self */ public function setIsAdminInitiated($is_admin_initiated) { + if (is_null($is_admin_initiated)) { + throw new \InvalidArgumentException('non-nullable is_admin_initiated cannot be null'); + } $this->container['is_admin_initiated'] = $is_admin_initiated; return $this; @@ -491,7 +611,7 @@ public function setIsAdminInitiated($is_admin_initiated) /** * Gets recorded_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getRecordedTimeUtc() { @@ -501,12 +621,15 @@ public function getRecordedTimeUtc() /** * Sets recorded_time_utc * - * @param \DateTime $recorded_time_utc + * @param \DateTime|null $recorded_time_utc * - * @return $this + * @return self */ public function setRecordedTimeUtc($recorded_time_utc) { + if (is_null($recorded_time_utc)) { + throw new \InvalidArgumentException('non-nullable recorded_time_utc cannot be null'); + } $this->container['recorded_time_utc'] = $recorded_time_utc; return $this; @@ -515,7 +638,7 @@ public function setRecordedTimeUtc($recorded_time_utc) /** * Gets utc_offset * - * @return string + * @return string|null */ public function getUtcOffset() { @@ -525,12 +648,15 @@ public function getUtcOffset() /** * Sets utc_offset * - * @param string $utc_offset + * @param string|null $utc_offset * - * @return $this + * @return self */ public function setUtcOffset($utc_offset) { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } $this->container['utc_offset'] = $utc_offset; return $this; @@ -539,7 +665,7 @@ public function setUtcOffset($utc_offset) /** * Gets note_visibility * - * @return string + * @return string|null */ public function getNoteVisibility() { @@ -549,17 +675,21 @@ public function getNoteVisibility() /** * Sets note_visibility * - * @param string $note_visibility + * @param string|null $note_visibility * - * @return $this + * @return self */ public function setNoteVisibility($note_visibility) { + if (is_null($note_visibility)) { + throw new \InvalidArgumentException('non-nullable note_visibility cannot be null'); + } $allowedValues = $this->getNoteVisibilityAllowableValues(); - if (!is_null($note_visibility) && !in_array($note_visibility, $allowedValues, true)) { + if (!in_array($note_visibility, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'note_visibility', must be one of '%s'", + "Invalid value '%s' for 'note_visibility', must be one of '%s'", + $note_visibility, implode("', '", $allowedValues) ) ); @@ -575,7 +705,7 @@ public function setNoteVisibility($note_visibility) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -585,22 +715,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -616,11 +747,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -628,13 +772,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/StubRosterShiftViewModel.php b/src/lib/Model/StubRosterShiftViewModel.php index 34a1442..e0f89b0 100644 --- a/src/lib/Model/StubRosterShiftViewModel.php +++ b/src/lib/Model/StubRosterShiftViewModel.php @@ -2,61 +2,61 @@ /** * StubRosterShiftViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * StubRosterShiftViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class StubRosterShiftViewModel implements ModelInterface, ArrayAccess +class StubRosterShiftViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'StubRosterShiftViewModel'; + protected static $openAPIModelName = 'StubRosterShiftViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'note' => 'string' ]; @@ -64,19 +64,37 @@ class StubRosterShiftViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'note' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'note' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['note'] = isset($data['note']) ? $data['note'] : null; + $this->setIfExists('note', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -217,12 +302,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -234,7 +322,7 @@ public function setNote($note) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SubmitLeaveAccrualsModel.php b/src/lib/Model/SubmitLeaveAccrualsModel.php index 2ef8317..0f07c39 100644 --- a/src/lib/Model/SubmitLeaveAccrualsModel.php +++ b/src/lib/Model/SubmitLeaveAccrualsModel.php @@ -2,87 +2,108 @@ /** * SubmitLeaveAccrualsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SubmitLeaveAccrualsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SubmitLeaveAccrualsModel implements ModelInterface, ArrayAccess +class SubmitLeaveAccrualsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SubmitLeaveAccrualsModel'; + protected static $openAPIModelName = 'SubmitLeaveAccrualsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'replace_existing' => 'bool', 'employee_id_type' => 'string', 'suppress_calculations' => 'bool', - 'leave' => 'map[string,\Swagger\Client\Model\SaveLeaveAccrualModel[]]' + 'leave' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'replace_existing' => null, 'employee_id_type' => null, 'suppress_calculations' => null, 'leave' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'replace_existing' => false, + 'employee_id_type' => false, + 'suppress_calculations' => false, + 'leave' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,14 +243,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -190,7 +261,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -207,10 +277,28 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; - $this->container['leave'] = isset($data['leave']) ? $data['leave'] : null; + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('suppress_calculations', $data ?? [], null); + $this->setIfExists('leave', $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; } /** @@ -225,7 +313,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -248,7 +337,7 @@ public function valid() /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -258,12 +347,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -272,7 +364,7 @@ public function setReplaceExisting($replace_existing) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -282,17 +374,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -305,7 +401,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -315,12 +411,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -329,7 +428,7 @@ public function setSuppressCalculations($suppress_calculations) /** * Gets leave * - * @return map[string,\Swagger\Client\Model\SaveLeaveAccrualModel[]] + * @return array|null */ public function getLeave() { @@ -339,12 +438,15 @@ public function getLeave() /** * Sets leave * - * @param map[string,\Swagger\Client\Model\SaveLeaveAccrualModel[]] $leave + * @param array|null $leave * - * @return $this + * @return self */ public function setLeave($leave) { + if (is_null($leave)) { + throw new \InvalidArgumentException('non-nullable leave cannot be null'); + } $this->container['leave'] = $leave; return $this; @@ -356,7 +458,7 @@ public function setLeave($leave) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -366,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -397,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -409,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SubmitPayRunDeductionRequest.php b/src/lib/Model/SubmitPayRunDeductionRequest.php index e55a267..f56c1d0 100644 --- a/src/lib/Model/SubmitPayRunDeductionRequest.php +++ b/src/lib/Model/SubmitPayRunDeductionRequest.php @@ -2,63 +2,63 @@ /** * SubmitPayRunDeductionRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SubmitPayRunDeductionRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SubmitPayRunDeductionRequest implements ModelInterface, ArrayAccess +class SubmitPayRunDeductionRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SubmitPayRunDeductionRequest'; + protected static $openAPIModelName = 'SubmitPayRunDeductionRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'deduction_category_id_type' => 'string', - 'deductions' => 'map[string,\Swagger\Client\Model\DeductionModel[]]', + 'deductions' => 'array', 'pay_run_id' => 'int', 'employee_id_type' => 'string', 'replace_existing' => 'bool', @@ -69,8 +69,10 @@ class SubmitPayRunDeductionRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'deduction_category_id_type' => null, 'deductions' => null, 'pay_run_id' => 'int32', @@ -79,14 +81,35 @@ class SubmitPayRunDeductionRequest implements ModelInterface, ArrayAccess 'suppress_calculations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'deduction_category_id_type' => false, + 'deductions' => false, + 'pay_run_id' => false, + 'employee_id_type' => false, + 'replace_existing' => false, + 'suppress_calculations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,16 +255,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const DEDUCTION_CATEGORY_ID_TYPE_STANDARD = 'Standard'; - const DEDUCTION_CATEGORY_ID_TYPE_EXTERNAL = 'External'; - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const DEDUCTION_CATEGORY_ID_TYPE_STANDARD = 'Standard'; + public const DEDUCTION_CATEGORY_ID_TYPE_EXTERNAL = 'External'; + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -202,7 +275,7 @@ public function getDeductionCategoryIdTypeAllowableValues() self::DEDUCTION_CATEGORY_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -215,7 +288,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -232,12 +304,30 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['deduction_category_id_type'] = isset($data['deduction_category_id_type']) ? $data['deduction_category_id_type'] : null; - $this->container['deductions'] = isset($data['deductions']) ? $data['deductions'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; + $this->setIfExists('deduction_category_id_type', $data ?? [], null); + $this->setIfExists('deductions', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('suppress_calculations', $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; } /** @@ -252,7 +342,8 @@ public function listInvalidProperties() $allowedValues = $this->getDeductionCategoryIdTypeAllowableValues(); if (!is_null($this->container['deduction_category_id_type']) && !in_array($this->container['deduction_category_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'deduction_category_id_type', must be one of '%s'", + "invalid value '%s' for 'deduction_category_id_type', must be one of '%s'", + $this->container['deduction_category_id_type'], implode("', '", $allowedValues) ); } @@ -260,7 +351,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -283,7 +375,7 @@ public function valid() /** * Gets deduction_category_id_type * - * @return string + * @return string|null */ public function getDeductionCategoryIdType() { @@ -293,17 +385,21 @@ public function getDeductionCategoryIdType() /** * Sets deduction_category_id_type * - * @param string $deduction_category_id_type + * @param string|null $deduction_category_id_type * - * @return $this + * @return self */ public function setDeductionCategoryIdType($deduction_category_id_type) { + if (is_null($deduction_category_id_type)) { + throw new \InvalidArgumentException('non-nullable deduction_category_id_type cannot be null'); + } $allowedValues = $this->getDeductionCategoryIdTypeAllowableValues(); - if (!is_null($deduction_category_id_type) && !in_array($deduction_category_id_type, $allowedValues, true)) { + if (!in_array($deduction_category_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'deduction_category_id_type', must be one of '%s'", + "Invalid value '%s' for 'deduction_category_id_type', must be one of '%s'", + $deduction_category_id_type, implode("', '", $allowedValues) ) ); @@ -316,7 +412,7 @@ public function setDeductionCategoryIdType($deduction_category_id_type) /** * Gets deductions * - * @return map[string,\Swagger\Client\Model\DeductionModel[]] + * @return array|null */ public function getDeductions() { @@ -326,12 +422,15 @@ public function getDeductions() /** * Sets deductions * - * @param map[string,\Swagger\Client\Model\DeductionModel[]] $deductions + * @param array|null $deductions * - * @return $this + * @return self */ public function setDeductions($deductions) { + if (is_null($deductions)) { + throw new \InvalidArgumentException('non-nullable deductions cannot be null'); + } $this->container['deductions'] = $deductions; return $this; @@ -340,7 +439,7 @@ public function setDeductions($deductions) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -350,12 +449,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -364,7 +466,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -374,17 +476,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -397,7 +503,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -407,12 +513,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -421,7 +530,7 @@ public function setReplaceExisting($replace_existing) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -431,12 +540,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -448,7 +560,7 @@ public function setSuppressCalculations($suppress_calculations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -458,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -489,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -501,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SubmitPayRunEmployeeExpenseRequest.php b/src/lib/Model/SubmitPayRunEmployeeExpenseRequest.php index 615cc2a..31760b5 100644 --- a/src/lib/Model/SubmitPayRunEmployeeExpenseRequest.php +++ b/src/lib/Model/SubmitPayRunEmployeeExpenseRequest.php @@ -2,64 +2,64 @@ /** * SubmitPayRunEmployeeExpenseRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SubmitPayRunEmployeeExpenseRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SubmitPayRunEmployeeExpenseRequest implements ModelInterface, ArrayAccess +class SubmitPayRunEmployeeExpenseRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SubmitPayRunEmployeeExpenseRequest'; + protected static $openAPIModelName = 'SubmitPayRunEmployeeExpenseRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id_type' => 'string', 'employee_expense_category_id_type' => 'string', - 'expenses' => 'map[string,\Swagger\Client\Model\EmployeeExpenseModel[]]', + 'expenses' => 'array', 'pay_run_id' => 'int', 'employee_id_type' => 'string', 'replace_existing' => 'bool', @@ -70,8 +70,10 @@ class SubmitPayRunEmployeeExpenseRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id_type' => null, 'employee_expense_category_id_type' => null, 'expenses' => null, @@ -81,14 +83,36 @@ class SubmitPayRunEmployeeExpenseRequest implements ModelInterface, ArrayAccess 'suppress_calculations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id_type' => false, + 'employee_expense_category_id_type' => false, + 'expenses' => false, + 'pay_run_id' => false, + 'employee_id_type' => false, + 'replace_existing' => false, + 'suppress_calculations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -185,18 +261,16 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const LOCATION_ID_TYPE_STANDARD = 'Standard'; - const LOCATION_ID_TYPE_EXTERNAL = 'External'; - const EMPLOYEE_EXPENSE_CATEGORY_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_EXPENSE_CATEGORY_ID_TYPE_EXTERNAL = 'External'; - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const LOCATION_ID_TYPE_STANDARD = 'Standard'; + public const LOCATION_ID_TYPE_EXTERNAL = 'External'; + public const EMPLOYEE_EXPENSE_CATEGORY_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_EXPENSE_CATEGORY_ID_TYPE_EXTERNAL = 'External'; + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -209,7 +283,7 @@ public function getLocationIdTypeAllowableValues() self::LOCATION_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -222,7 +296,7 @@ public function getEmployeeExpenseCategoryIdTypeAllowableValues() self::EMPLOYEE_EXPENSE_CATEGORY_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -235,7 +309,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -252,13 +325,31 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['location_id_type'] = isset($data['location_id_type']) ? $data['location_id_type'] : null; - $this->container['employee_expense_category_id_type'] = isset($data['employee_expense_category_id_type']) ? $data['employee_expense_category_id_type'] : null; - $this->container['expenses'] = isset($data['expenses']) ? $data['expenses'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; + $this->setIfExists('location_id_type', $data ?? [], null); + $this->setIfExists('employee_expense_category_id_type', $data ?? [], null); + $this->setIfExists('expenses', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('suppress_calculations', $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; } /** @@ -273,7 +364,8 @@ public function listInvalidProperties() $allowedValues = $this->getLocationIdTypeAllowableValues(); if (!is_null($this->container['location_id_type']) && !in_array($this->container['location_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'location_id_type', must be one of '%s'", + "invalid value '%s' for 'location_id_type', must be one of '%s'", + $this->container['location_id_type'], implode("', '", $allowedValues) ); } @@ -281,7 +373,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeExpenseCategoryIdTypeAllowableValues(); if (!is_null($this->container['employee_expense_category_id_type']) && !in_array($this->container['employee_expense_category_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_expense_category_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_expense_category_id_type', must be one of '%s'", + $this->container['employee_expense_category_id_type'], implode("', '", $allowedValues) ); } @@ -289,7 +382,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -312,7 +406,7 @@ public function valid() /** * Gets location_id_type * - * @return string + * @return string|null */ public function getLocationIdType() { @@ -322,17 +416,21 @@ public function getLocationIdType() /** * Sets location_id_type * - * @param string $location_id_type + * @param string|null $location_id_type * - * @return $this + * @return self */ public function setLocationIdType($location_id_type) { + if (is_null($location_id_type)) { + throw new \InvalidArgumentException('non-nullable location_id_type cannot be null'); + } $allowedValues = $this->getLocationIdTypeAllowableValues(); - if (!is_null($location_id_type) && !in_array($location_id_type, $allowedValues, true)) { + if (!in_array($location_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'location_id_type', must be one of '%s'", + "Invalid value '%s' for 'location_id_type', must be one of '%s'", + $location_id_type, implode("', '", $allowedValues) ) ); @@ -345,7 +443,7 @@ public function setLocationIdType($location_id_type) /** * Gets employee_expense_category_id_type * - * @return string + * @return string|null */ public function getEmployeeExpenseCategoryIdType() { @@ -355,17 +453,21 @@ public function getEmployeeExpenseCategoryIdType() /** * Sets employee_expense_category_id_type * - * @param string $employee_expense_category_id_type + * @param string|null $employee_expense_category_id_type * - * @return $this + * @return self */ public function setEmployeeExpenseCategoryIdType($employee_expense_category_id_type) { + if (is_null($employee_expense_category_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_expense_category_id_type cannot be null'); + } $allowedValues = $this->getEmployeeExpenseCategoryIdTypeAllowableValues(); - if (!is_null($employee_expense_category_id_type) && !in_array($employee_expense_category_id_type, $allowedValues, true)) { + if (!in_array($employee_expense_category_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_expense_category_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_expense_category_id_type', must be one of '%s'", + $employee_expense_category_id_type, implode("', '", $allowedValues) ) ); @@ -378,7 +480,7 @@ public function setEmployeeExpenseCategoryIdType($employee_expense_category_id_t /** * Gets expenses * - * @return map[string,\Swagger\Client\Model\EmployeeExpenseModel[]] + * @return array|null */ public function getExpenses() { @@ -388,12 +490,15 @@ public function getExpenses() /** * Sets expenses * - * @param map[string,\Swagger\Client\Model\EmployeeExpenseModel[]] $expenses + * @param array|null $expenses * - * @return $this + * @return self */ public function setExpenses($expenses) { + if (is_null($expenses)) { + throw new \InvalidArgumentException('non-nullable expenses cannot be null'); + } $this->container['expenses'] = $expenses; return $this; @@ -402,7 +507,7 @@ public function setExpenses($expenses) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -412,12 +517,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -426,7 +534,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -436,17 +544,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -459,7 +571,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -469,12 +581,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -483,7 +598,7 @@ public function setReplaceExisting($replace_existing) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -493,12 +608,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -510,7 +628,7 @@ public function setSuppressCalculations($suppress_calculations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -520,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -551,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -563,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SubmitPayRunEmployerLiabilityRequest.php b/src/lib/Model/SubmitPayRunEmployerLiabilityRequest.php index 2d17d6c..60415ed 100644 --- a/src/lib/Model/SubmitPayRunEmployerLiabilityRequest.php +++ b/src/lib/Model/SubmitPayRunEmployerLiabilityRequest.php @@ -2,63 +2,63 @@ /** * SubmitPayRunEmployerLiabilityRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SubmitPayRunEmployerLiabilityRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SubmitPayRunEmployerLiabilityRequest implements ModelInterface, ArrayAccess +class SubmitPayRunEmployerLiabilityRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SubmitPayRunEmployerLiabilityRequest'; + protected static $openAPIModelName = 'SubmitPayRunEmployerLiabilityRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employer_liability_category_id_type' => 'string', - 'employer_liabilities' => 'map[string,\Swagger\Client\Model\EmployerLiabilityModel[]]', + 'employer_liabilities' => 'array', 'pay_run_id' => 'int', 'employee_id_type' => 'string', 'replace_existing' => 'bool', @@ -69,8 +69,10 @@ class SubmitPayRunEmployerLiabilityRequest implements ModelInterface, ArrayAcces * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employer_liability_category_id_type' => null, 'employer_liabilities' => null, 'pay_run_id' => 'int32', @@ -79,14 +81,35 @@ class SubmitPayRunEmployerLiabilityRequest implements ModelInterface, ArrayAcces 'suppress_calculations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employer_liability_category_id_type' => false, + 'employer_liabilities' => false, + 'pay_run_id' => false, + 'employee_id_type' => false, + 'replace_existing' => false, + 'suppress_calculations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,16 +255,14 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYER_LIABILITY_CATEGORY_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYER_LIABILITY_CATEGORY_ID_TYPE_EXTERNAL = 'External'; - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const EMPLOYER_LIABILITY_CATEGORY_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYER_LIABILITY_CATEGORY_ID_TYPE_EXTERNAL = 'External'; + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -202,7 +275,7 @@ public function getEmployerLiabilityCategoryIdTypeAllowableValues() self::EMPLOYER_LIABILITY_CATEGORY_ID_TYPE_EXTERNAL, ]; } - + /** * Gets allowable values of the enum * @@ -215,7 +288,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -232,12 +304,30 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['employer_liability_category_id_type'] = isset($data['employer_liability_category_id_type']) ? $data['employer_liability_category_id_type'] : null; - $this->container['employer_liabilities'] = isset($data['employer_liabilities']) ? $data['employer_liabilities'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; + $this->setIfExists('employer_liability_category_id_type', $data ?? [], null); + $this->setIfExists('employer_liabilities', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('suppress_calculations', $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; } /** @@ -252,7 +342,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployerLiabilityCategoryIdTypeAllowableValues(); if (!is_null($this->container['employer_liability_category_id_type']) && !in_array($this->container['employer_liability_category_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employer_liability_category_id_type', must be one of '%s'", + "invalid value '%s' for 'employer_liability_category_id_type', must be one of '%s'", + $this->container['employer_liability_category_id_type'], implode("', '", $allowedValues) ); } @@ -260,7 +351,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -283,7 +375,7 @@ public function valid() /** * Gets employer_liability_category_id_type * - * @return string + * @return string|null */ public function getEmployerLiabilityCategoryIdType() { @@ -293,17 +385,21 @@ public function getEmployerLiabilityCategoryIdType() /** * Sets employer_liability_category_id_type * - * @param string $employer_liability_category_id_type + * @param string|null $employer_liability_category_id_type * - * @return $this + * @return self */ public function setEmployerLiabilityCategoryIdType($employer_liability_category_id_type) { + if (is_null($employer_liability_category_id_type)) { + throw new \InvalidArgumentException('non-nullable employer_liability_category_id_type cannot be null'); + } $allowedValues = $this->getEmployerLiabilityCategoryIdTypeAllowableValues(); - if (!is_null($employer_liability_category_id_type) && !in_array($employer_liability_category_id_type, $allowedValues, true)) { + if (!in_array($employer_liability_category_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employer_liability_category_id_type', must be one of '%s'", + "Invalid value '%s' for 'employer_liability_category_id_type', must be one of '%s'", + $employer_liability_category_id_type, implode("', '", $allowedValues) ) ); @@ -316,7 +412,7 @@ public function setEmployerLiabilityCategoryIdType($employer_liability_category_ /** * Gets employer_liabilities * - * @return map[string,\Swagger\Client\Model\EmployerLiabilityModel[]] + * @return array|null */ public function getEmployerLiabilities() { @@ -326,12 +422,15 @@ public function getEmployerLiabilities() /** * Sets employer_liabilities * - * @param map[string,\Swagger\Client\Model\EmployerLiabilityModel[]] $employer_liabilities + * @param array|null $employer_liabilities * - * @return $this + * @return self */ public function setEmployerLiabilities($employer_liabilities) { + if (is_null($employer_liabilities)) { + throw new \InvalidArgumentException('non-nullable employer_liabilities cannot be null'); + } $this->container['employer_liabilities'] = $employer_liabilities; return $this; @@ -340,7 +439,7 @@ public function setEmployerLiabilities($employer_liabilities) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -350,12 +449,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -364,7 +466,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -374,17 +476,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -397,7 +503,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -407,12 +513,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -421,7 +530,7 @@ public function setReplaceExisting($replace_existing) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -431,12 +540,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -448,7 +560,7 @@ public function setSuppressCalculations($suppress_calculations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -458,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -489,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -501,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SubmitPayRunPaygAdjustmentRequest.php b/src/lib/Model/SubmitPayRunPaygAdjustmentRequest.php index 8b0288a..8c3618a 100644 --- a/src/lib/Model/SubmitPayRunPaygAdjustmentRequest.php +++ b/src/lib/Model/SubmitPayRunPaygAdjustmentRequest.php @@ -2,62 +2,62 @@ /** * SubmitPayRunPaygAdjustmentRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SubmitPayRunPaygAdjustmentRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SubmitPayRunPaygAdjustmentRequest implements ModelInterface, ArrayAccess +class SubmitPayRunPaygAdjustmentRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SubmitPayRunPaygAdjustmentRequest'; + protected static $openAPIModelName = 'SubmitPayRunPaygAdjustmentRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'payg_adjustments' => 'map[string,\Swagger\Client\Model\PaygAdjustmentModel[]]', + protected static $openAPITypes = [ + 'payg_adjustments' => 'array', 'pay_run_id' => 'int', 'employee_id_type' => 'string', 'replace_existing' => 'bool', @@ -68,8 +68,10 @@ class SubmitPayRunPaygAdjustmentRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'payg_adjustments' => null, 'pay_run_id' => 'int32', 'employee_id_type' => null, @@ -77,14 +79,34 @@ class SubmitPayRunPaygAdjustmentRequest implements ModelInterface, ArrayAccess 'suppress_calculations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payg_adjustments' => false, + 'pay_run_id' => false, + 'employee_id_type' => false, + 'replace_existing' => false, + 'suppress_calculations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,14 +249,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -195,7 +267,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -212,11 +283,29 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['payg_adjustments'] = isset($data['payg_adjustments']) ? $data['payg_adjustments'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; + $this->setIfExists('payg_adjustments', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('suppress_calculations', $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; } /** @@ -231,7 +320,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -254,7 +344,7 @@ public function valid() /** * Gets payg_adjustments * - * @return map[string,\Swagger\Client\Model\PaygAdjustmentModel[]] + * @return array|null */ public function getPaygAdjustments() { @@ -264,12 +354,15 @@ public function getPaygAdjustments() /** * Sets payg_adjustments * - * @param map[string,\Swagger\Client\Model\PaygAdjustmentModel[]] $payg_adjustments + * @param array|null $payg_adjustments * - * @return $this + * @return self */ public function setPaygAdjustments($payg_adjustments) { + if (is_null($payg_adjustments)) { + throw new \InvalidArgumentException('non-nullable payg_adjustments cannot be null'); + } $this->container['payg_adjustments'] = $payg_adjustments; return $this; @@ -278,7 +371,7 @@ public function setPaygAdjustments($payg_adjustments) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -288,12 +381,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -302,7 +398,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -312,17 +408,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -335,7 +435,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -345,12 +445,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -359,7 +462,7 @@ public function setReplaceExisting($replace_existing) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -369,12 +472,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -386,7 +492,7 @@ public function setSuppressCalculations($suppress_calculations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -396,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -439,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SubmitPayRunSuperAdjustmentRequest.php b/src/lib/Model/SubmitPayRunSuperAdjustmentRequest.php index 72c21c0..fd571b3 100644 --- a/src/lib/Model/SubmitPayRunSuperAdjustmentRequest.php +++ b/src/lib/Model/SubmitPayRunSuperAdjustmentRequest.php @@ -2,62 +2,62 @@ /** * SubmitPayRunSuperAdjustmentRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SubmitPayRunSuperAdjustmentRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SubmitPayRunSuperAdjustmentRequest implements ModelInterface, ArrayAccess +class SubmitPayRunSuperAdjustmentRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SubmitPayRunSuperAdjustmentRequest'; + protected static $openAPIModelName = 'SubmitPayRunSuperAdjustmentRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'super_adjustments' => 'map[string,\Swagger\Client\Model\SuperAdjustmentModel[]]', + protected static $openAPITypes = [ + 'super_adjustments' => 'array', 'pay_run_id' => 'int', 'employee_id_type' => 'string', 'replace_existing' => 'bool', @@ -68,8 +68,10 @@ class SubmitPayRunSuperAdjustmentRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'super_adjustments' => null, 'pay_run_id' => 'int32', 'employee_id_type' => null, @@ -77,14 +79,34 @@ class SubmitPayRunSuperAdjustmentRequest implements ModelInterface, ArrayAccess 'suppress_calculations' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'super_adjustments' => false, + 'pay_run_id' => false, + 'employee_id_type' => false, + 'replace_existing' => false, + 'suppress_calculations' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -175,14 +249,12 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; - const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - + public const EMPLOYEE_ID_TYPE_STANDARD = 'Standard'; + public const EMPLOYEE_ID_TYPE_EXTERNAL = 'External'; - /** * Gets allowable values of the enum * @@ -195,7 +267,6 @@ public function getEmployeeIdTypeAllowableValues() self::EMPLOYEE_ID_TYPE_EXTERNAL, ]; } - /** * Associative array for storing property values @@ -212,11 +283,29 @@ public function getEmployeeIdTypeAllowableValues() */ public function __construct(array $data = null) { - $this->container['super_adjustments'] = isset($data['super_adjustments']) ? $data['super_adjustments'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['employee_id_type'] = isset($data['employee_id_type']) ? $data['employee_id_type'] : null; - $this->container['replace_existing'] = isset($data['replace_existing']) ? $data['replace_existing'] : null; - $this->container['suppress_calculations'] = isset($data['suppress_calculations']) ? $data['suppress_calculations'] : null; + $this->setIfExists('super_adjustments', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('employee_id_type', $data ?? [], null); + $this->setIfExists('replace_existing', $data ?? [], null); + $this->setIfExists('suppress_calculations', $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; } /** @@ -231,7 +320,8 @@ public function listInvalidProperties() $allowedValues = $this->getEmployeeIdTypeAllowableValues(); if (!is_null($this->container['employee_id_type']) && !in_array($this->container['employee_id_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'employee_id_type', must be one of '%s'", + "invalid value '%s' for 'employee_id_type', must be one of '%s'", + $this->container['employee_id_type'], implode("', '", $allowedValues) ); } @@ -254,7 +344,7 @@ public function valid() /** * Gets super_adjustments * - * @return map[string,\Swagger\Client\Model\SuperAdjustmentModel[]] + * @return array|null */ public function getSuperAdjustments() { @@ -264,12 +354,15 @@ public function getSuperAdjustments() /** * Sets super_adjustments * - * @param map[string,\Swagger\Client\Model\SuperAdjustmentModel[]] $super_adjustments + * @param array|null $super_adjustments * - * @return $this + * @return self */ public function setSuperAdjustments($super_adjustments) { + if (is_null($super_adjustments)) { + throw new \InvalidArgumentException('non-nullable super_adjustments cannot be null'); + } $this->container['super_adjustments'] = $super_adjustments; return $this; @@ -278,7 +371,7 @@ public function setSuperAdjustments($super_adjustments) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -288,12 +381,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -302,7 +398,7 @@ public function setPayRunId($pay_run_id) /** * Gets employee_id_type * - * @return string + * @return string|null */ public function getEmployeeIdType() { @@ -312,17 +408,21 @@ public function getEmployeeIdType() /** * Sets employee_id_type * - * @param string $employee_id_type + * @param string|null $employee_id_type * - * @return $this + * @return self */ public function setEmployeeIdType($employee_id_type) { + if (is_null($employee_id_type)) { + throw new \InvalidArgumentException('non-nullable employee_id_type cannot be null'); + } $allowedValues = $this->getEmployeeIdTypeAllowableValues(); - if (!is_null($employee_id_type) && !in_array($employee_id_type, $allowedValues, true)) { + if (!in_array($employee_id_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'employee_id_type', must be one of '%s'", + "Invalid value '%s' for 'employee_id_type', must be one of '%s'", + $employee_id_type, implode("', '", $allowedValues) ) ); @@ -335,7 +435,7 @@ public function setEmployeeIdType($employee_id_type) /** * Gets replace_existing * - * @return bool + * @return bool|null */ public function getReplaceExisting() { @@ -345,12 +445,15 @@ public function getReplaceExisting() /** * Sets replace_existing * - * @param bool $replace_existing + * @param bool|null $replace_existing * - * @return $this + * @return self */ public function setReplaceExisting($replace_existing) { + if (is_null($replace_existing)) { + throw new \InvalidArgumentException('non-nullable replace_existing cannot be null'); + } $this->container['replace_existing'] = $replace_existing; return $this; @@ -359,7 +462,7 @@ public function setReplaceExisting($replace_existing) /** * Gets suppress_calculations * - * @return bool + * @return bool|null */ public function getSuppressCalculations() { @@ -369,12 +472,15 @@ public function getSuppressCalculations() /** * Sets suppress_calculations * - * @param bool $suppress_calculations + * @param bool|null $suppress_calculations * - * @return $this + * @return self */ public function setSuppressCalculations($suppress_calculations) { + if (is_null($suppress_calculations)) { + throw new \InvalidArgumentException('non-nullable suppress_calculations cannot be null'); + } $this->container['suppress_calculations'] = $suppress_calculations; return $this; @@ -386,7 +492,7 @@ public function setSuppressCalculations($suppress_calculations) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -396,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -439,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuburbModel.php b/src/lib/Model/SuburbModel.php index b545e54..6637417 100644 --- a/src/lib/Model/SuburbModel.php +++ b/src/lib/Model/SuburbModel.php @@ -2,61 +2,61 @@ /** * SuburbModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuburbModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuburbModel implements ModelInterface, ArrayAccess +class SuburbModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuburbModel'; + protected static $openAPIModelName = 'SuburbModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'state' => 'string', @@ -69,8 +69,10 @@ class SuburbModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null, 'state' => null, @@ -79,14 +81,35 @@ class SuburbModel implements ModelInterface, ArrayAccess 'country_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'state' => false, + 'postcode' => false, + 'country' => false, + 'country_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['state'] = isset($data['state']) ? $data['state'] : null; - $this->container['postcode'] = isset($data['postcode']) ? $data['postcode'] : null; - $this->container['country'] = isset($data['country']) ? $data['country'] : null; - $this->container['country_id'] = isset($data['country_id']) ? $data['country_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('postcode', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('country_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -247,12 +337,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -271,12 +364,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -285,7 +381,7 @@ public function setName($name) /** * Gets state * - * @return string + * @return string|null */ public function getState() { @@ -295,12 +391,15 @@ public function getState() /** * Sets state * - * @param string $state + * @param string|null $state * - * @return $this + * @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; @@ -309,7 +408,7 @@ public function setState($state) /** * Gets postcode * - * @return string + * @return string|null */ public function getPostcode() { @@ -319,12 +418,15 @@ public function getPostcode() /** * Sets postcode * - * @param string $postcode + * @param string|null $postcode * - * @return $this + * @return self */ public function setPostcode($postcode) { + if (is_null($postcode)) { + throw new \InvalidArgumentException('non-nullable postcode cannot be null'); + } $this->container['postcode'] = $postcode; return $this; @@ -333,7 +435,7 @@ public function setPostcode($postcode) /** * Gets country * - * @return string + * @return string|null */ public function getCountry() { @@ -343,12 +445,15 @@ public function getCountry() /** * Sets country * - * @param string $country + * @param string|null $country * - * @return $this + * @return self */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -357,7 +462,7 @@ public function setCountry($country) /** * Gets country_id * - * @return string + * @return string|null */ public function getCountryId() { @@ -367,12 +472,15 @@ public function getCountryId() /** * Sets country_id * - * @param string $country_id + * @param string|null $country_id * - * @return $this + * @return self */ public function setCountryId($country_id) { + if (is_null($country_id)) { + throw new \InvalidArgumentException('non-nullable country_id cannot be null'); + } $this->container['country_id'] = $country_id; return $this; @@ -384,7 +492,7 @@ public function setCountryId($country_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuburbResult.php b/src/lib/Model/SuburbResult.php index ffcece0..fdba77e 100644 --- a/src/lib/Model/SuburbResult.php +++ b/src/lib/Model/SuburbResult.php @@ -2,81 +2,99 @@ /** * SuburbResult * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuburbResult Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuburbResult implements ModelInterface, ArrayAccess +class SuburbResult implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuburbResult'; + protected static $openAPIModelName = 'SuburbResult'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'result' => '\Swagger\Client\Model\SuburbModel' + protected static $openAPITypes = [ + 'result' => '\OpenAPI\Client\Model\SuburbModel' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'result' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -84,9 +102,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -155,12 +225,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -177,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['result'] = isset($data['result']) ? $data['result'] : null; + $this->setIfExists('result', $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; } /** @@ -207,7 +292,7 @@ public function valid() /** * Gets result * - * @return \Swagger\Client\Model\SuburbModel + * @return \OpenAPI\Client\Model\SuburbModel|null */ public function getResult() { @@ -217,12 +302,15 @@ public function getResult() /** * Sets result * - * @param \Swagger\Client\Model\SuburbModel $result + * @param \OpenAPI\Client\Model\SuburbModel|null $result result * - * @return $this + * @return self */ public function setResult($result) { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } $this->container['result'] = $result; return $this; @@ -234,7 +322,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -244,22 +332,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -275,11 +364,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -287,13 +389,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuperAccrualExportModel.php b/src/lib/Model/SuperAccrualExportModel.php index d84c243..9da2af5 100644 --- a/src/lib/Model/SuperAccrualExportModel.php +++ b/src/lib/Model/SuperAccrualExportModel.php @@ -2,61 +2,61 @@ /** * SuperAccrualExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuperAccrualExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuperAccrualExportModel implements ModelInterface, ArrayAccess +class SuperAccrualExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuperAccrualExportModel'; + protected static $openAPIModelName = 'SuperAccrualExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_id' => 'int', 'location_name' => 'string', 'employee_id' => 'int', @@ -65,7 +65,7 @@ class SuperAccrualExportModel implements ModelInterface, ArrayAccess 'external_id' => 'string', 'accrual_date' => '\DateTime', 'accrual_type' => 'string', - 'accrual_amount' => 'double', + 'accrual_amount' => 'float', 'batch_id' => 'int', 'status' => 'string' ]; @@ -74,8 +74,10 @@ class SuperAccrualExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_id' => 'int32', 'location_name' => null, 'employee_id' => 'int32', @@ -89,14 +91,40 @@ class SuperAccrualExportModel implements ModelInterface, ArrayAccess 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'accrual_date' => false, + 'accrual_type' => false, + 'accrual_amount' => false, + 'batch_id' => false, + 'status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,30 +285,28 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const STATUS__NEW = 'New'; - const STATUS_SUBMITTED_FOR_PROCESSING = 'SubmittedForProcessing'; - const STATUS_SUBMISSION_FAILED = 'SubmissionFailed'; - const STATUS_SUBMISSION_PROCESSED = 'SubmissionProcessed'; - const STATUS_SUBMISSION_QUEUED_FOR_PAYMENT = 'SubmissionQueuedForPayment'; - const STATUS_SUBMISSION_PAID = 'SubmissionPaid'; - const STATUS_AWAITING_PAYMENT = 'AwaitingPayment'; - const STATUS_AWAITING_CLEARANCE = 'AwaitingClearance'; - const STATUS_RECONCILED = 'Reconciled'; - const STATUS_SENT_TO_FUND = 'SentToFund'; - const STATUS_SENT_TO_FUND_WITH_RESPONSE = 'SentToFundWithResponse'; - const STATUS_SENT_TO_FUND_WITH_REFUND = 'SentToFundWithRefund'; - const STATUS_CANCELLED = 'Cancelled'; - const STATUS_SUBMITTED = 'Submitted'; - const STATUS_REFUNDED = 'Refunded'; - const STATUS_CANCELLING = 'Cancelling'; - const STATUS_PAID = 'Paid'; - const STATUS_PAYMENT_FAILED = 'PaymentFailed'; - - - + return self::$openAPIModelName; + } + + public const STATUS__NEW = 'New'; + public const STATUS_SUBMITTED_FOR_PROCESSING = 'SubmittedForProcessing'; + public const STATUS_SUBMISSION_FAILED = 'SubmissionFailed'; + public const STATUS_SUBMISSION_PROCESSED = 'SubmissionProcessed'; + public const STATUS_SUBMISSION_QUEUED_FOR_PAYMENT = 'SubmissionQueuedForPayment'; + public const STATUS_SUBMISSION_PAID = 'SubmissionPaid'; + public const STATUS_AWAITING_PAYMENT = 'AwaitingPayment'; + public const STATUS_AWAITING_CLEARANCE = 'AwaitingClearance'; + public const STATUS_RECONCILED = 'Reconciled'; + public const STATUS_SENT_TO_FUND = 'SentToFund'; + public const STATUS_SENT_TO_FUND_WITH_RESPONSE = 'SentToFundWithResponse'; + public const STATUS_SENT_TO_FUND_WITH_REFUND = 'SentToFundWithRefund'; + public const STATUS_CANCELLED = 'Cancelled'; + public const STATUS_SUBMITTED = 'Submitted'; + public const STATUS_REFUNDED = 'Refunded'; + public const STATUS_CANCELLING = 'Cancelling'; + public const STATUS_PAID = 'Paid'; + public const STATUS_PAYMENT_FAILED = 'PaymentFailed'; + /** * Gets allowable values of the enum * @@ -257,7 +335,6 @@ public function getStatusAllowableValues() self::STATUS_PAYMENT_FAILED, ]; } - /** * Associative array for storing property values @@ -274,17 +351,35 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['accrual_date'] = isset($data['accrual_date']) ? $data['accrual_date'] : null; - $this->container['accrual_type'] = isset($data['accrual_type']) ? $data['accrual_type'] : null; - $this->container['accrual_amount'] = isset($data['accrual_amount']) ? $data['accrual_amount'] : null; - $this->container['batch_id'] = isset($data['batch_id']) ? $data['batch_id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('accrual_date', $data ?? [], null); + $this->setIfExists('accrual_type', $data ?? [], null); + $this->setIfExists('accrual_amount', $data ?? [], null); + $this->setIfExists('batch_id', $data ?? [], null); + $this->setIfExists('status', $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; } /** @@ -299,7 +394,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -322,7 +418,7 @@ public function valid() /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -332,12 +428,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -346,7 +445,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -356,12 +455,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -370,7 +472,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -380,12 +482,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -394,7 +499,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -404,12 +509,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -418,7 +526,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -428,12 +536,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -442,7 +553,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -452,12 +563,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -466,7 +580,7 @@ public function setExternalId($external_id) /** * Gets accrual_date * - * @return \DateTime + * @return \DateTime|null */ public function getAccrualDate() { @@ -476,12 +590,15 @@ public function getAccrualDate() /** * Sets accrual_date * - * @param \DateTime $accrual_date + * @param \DateTime|null $accrual_date * - * @return $this + * @return self */ public function setAccrualDate($accrual_date) { + if (is_null($accrual_date)) { + throw new \InvalidArgumentException('non-nullable accrual_date cannot be null'); + } $this->container['accrual_date'] = $accrual_date; return $this; @@ -490,7 +607,7 @@ public function setAccrualDate($accrual_date) /** * Gets accrual_type * - * @return string + * @return string|null */ public function getAccrualType() { @@ -500,12 +617,15 @@ public function getAccrualType() /** * Sets accrual_type * - * @param string $accrual_type + * @param string|null $accrual_type * - * @return $this + * @return self */ public function setAccrualType($accrual_type) { + if (is_null($accrual_type)) { + throw new \InvalidArgumentException('non-nullable accrual_type cannot be null'); + } $this->container['accrual_type'] = $accrual_type; return $this; @@ -514,7 +634,7 @@ public function setAccrualType($accrual_type) /** * Gets accrual_amount * - * @return double + * @return float|null */ public function getAccrualAmount() { @@ -524,12 +644,15 @@ public function getAccrualAmount() /** * Sets accrual_amount * - * @param double $accrual_amount + * @param float|null $accrual_amount * - * @return $this + * @return self */ public function setAccrualAmount($accrual_amount) { + if (is_null($accrual_amount)) { + throw new \InvalidArgumentException('non-nullable accrual_amount cannot be null'); + } $this->container['accrual_amount'] = $accrual_amount; return $this; @@ -538,7 +661,7 @@ public function setAccrualAmount($accrual_amount) /** * Gets batch_id * - * @return int + * @return int|null */ public function getBatchId() { @@ -548,12 +671,15 @@ public function getBatchId() /** * Sets batch_id * - * @param int $batch_id + * @param int|null $batch_id * - * @return $this + * @return self */ public function setBatchId($batch_id) { + if (is_null($batch_id)) { + throw new \InvalidArgumentException('non-nullable batch_id cannot be null'); + } $this->container['batch_id'] = $batch_id; return $this; @@ -562,7 +688,7 @@ public function setBatchId($batch_id) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -572,17 +698,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -598,7 +728,7 @@ public function setStatus($status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -608,22 +738,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -639,11 +770,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -651,13 +795,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuperAdjustmentModel.php b/src/lib/Model/SuperAdjustmentModel.php index d0e833e..7842558 100644 --- a/src/lib/Model/SuperAdjustmentModel.php +++ b/src/lib/Model/SuperAdjustmentModel.php @@ -2,63 +2,63 @@ /** * SuperAdjustmentModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuperAdjustmentModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuperAdjustmentModel implements ModelInterface, ArrayAccess +class SuperAdjustmentModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuperAdjustmentModel'; + protected static $openAPIModelName = 'SuperAdjustmentModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'notes' => 'string', - 'amount' => 'double', + 'amount' => 'float', 'contribution_type' => 'string', 'id' => 'int', 'external_id' => 'string', @@ -73,8 +73,10 @@ class SuperAdjustmentModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'notes' => null, 'amount' => 'double', 'contribution_type' => null, @@ -87,14 +89,39 @@ class SuperAdjustmentModel implements ModelInterface, ArrayAccess 'employee_external_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'notes' => false, + 'amount' => false, + 'contribution_type' => false, + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'location_name' => false, + 'employee_id' => false, + 'employee_name' => false, + 'employee_external_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['contribution_type'] = isset($data['contribution_type']) ? $data['contribution_type'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_external_id'] = isset($data['employee_external_id']) ? $data['employee_external_id'] : null; + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('contribution_type', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_external_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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets notes * - * @return string + * @return string|null */ public function getNotes() { @@ -271,12 +365,15 @@ public function getNotes() /** * Sets notes * - * @param string $notes + * @param string|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -285,7 +382,7 @@ public function setNotes($notes) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -295,12 +392,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -309,7 +409,7 @@ public function setAmount($amount) /** * Gets contribution_type * - * @return string + * @return string|null */ public function getContributionType() { @@ -319,12 +419,15 @@ public function getContributionType() /** * Sets contribution_type * - * @param string $contribution_type + * @param string|null $contribution_type * - * @return $this + * @return self */ public function setContributionType($contribution_type) { + if (is_null($contribution_type)) { + throw new \InvalidArgumentException('non-nullable contribution_type cannot be null'); + } $this->container['contribution_type'] = $contribution_type; return $this; @@ -333,7 +436,7 @@ public function setContributionType($contribution_type) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +446,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +463,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -367,12 +473,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -381,7 +490,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -391,12 +500,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -405,7 +517,7 @@ public function setLocationId($location_id) /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -415,12 +527,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -429,7 +544,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return string + * @return string|null */ public function getEmployeeId() { @@ -439,12 +554,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param string $employee_id + * @param string|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -453,7 +571,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -463,12 +581,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -477,7 +598,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_external_id * - * @return string + * @return string|null */ public function getEmployeeExternalId() { @@ -487,12 +608,15 @@ public function getEmployeeExternalId() /** * Sets employee_external_id * - * @param string $employee_external_id + * @param string|null $employee_external_id * - * @return $this + * @return self */ public function setEmployeeExternalId($employee_external_id) { + if (is_null($employee_external_id)) { + throw new \InvalidArgumentException('non-nullable employee_external_id cannot be null'); + } $this->container['employee_external_id'] = $employee_external_id; return $this; @@ -504,7 +628,7 @@ public function setEmployeeExternalId($employee_external_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuperContributionsReportExportModel.php b/src/lib/Model/SuperContributionsReportExportModel.php index fe8a5a4..aa2bb28 100644 --- a/src/lib/Model/SuperContributionsReportExportModel.php +++ b/src/lib/Model/SuperContributionsReportExportModel.php @@ -2,61 +2,61 @@ /** * SuperContributionsReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuperContributionsReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuperContributionsReportExportModel implements ModelInterface, ArrayAccess +class SuperContributionsReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuperContributionsReportExportModel'; + protected static $openAPIModelName = 'SuperContributionsReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'location_name' => 'string', 'employee_id' => 'int', 'first_name' => 'string', @@ -65,15 +65,17 @@ class SuperContributionsReportExportModel implements ModelInterface, ArrayAccess 'super_fund_name' => 'string', 'super_fund_number' => 'string', 'payment_type' => 'string', - 'amount' => 'double' + 'amount' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'location_name' => null, 'employee_id' => 'int32', 'first_name' => null, @@ -85,14 +87,38 @@ class SuperContributionsReportExportModel implements ModelInterface, ArrayAccess 'amount' => 'double' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'location_name' => false, + 'employee_id' => false, + 'first_name' => false, + 'surname' => false, + 'external_id' => false, + 'super_fund_name' => false, + 'super_fund_number' => false, + 'payment_type' => false, + 'amount' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['location_name'] = isset($data['location_name']) ? $data['location_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['surname'] = isset($data['surname']) ? $data['surname'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['super_fund_name'] = isset($data['super_fund_name']) ? $data['super_fund_name'] : null; - $this->container['super_fund_number'] = isset($data['super_fund_number']) ? $data['super_fund_number'] : null; - $this->container['payment_type'] = isset($data['payment_type']) ? $data['payment_type'] : null; - $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->setIfExists('location_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('surname', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('super_fund_name', $data ?? [], null); + $this->setIfExists('super_fund_number', $data ?? [], null); + $this->setIfExists('payment_type', $data ?? [], null); + $this->setIfExists('amount', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets location_name * - * @return string + * @return string|null */ public function getLocationName() { @@ -265,12 +358,15 @@ public function getLocationName() /** * Sets location_name * - * @param string $location_name + * @param string|null $location_name * - * @return $this + * @return self */ public function setLocationName($location_name) { + if (is_null($location_name)) { + throw new \InvalidArgumentException('non-nullable location_name cannot be null'); + } $this->container['location_name'] = $location_name; return $this; @@ -279,7 +375,7 @@ public function setLocationName($location_name) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -289,12 +385,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -303,7 +402,7 @@ public function setEmployeeId($employee_id) /** * Gets first_name * - * @return string + * @return string|null */ public function getFirstName() { @@ -313,12 +412,15 @@ public function getFirstName() /** * Sets first_name * - * @param string $first_name + * @param string|null $first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } $this->container['first_name'] = $first_name; return $this; @@ -327,7 +429,7 @@ public function setFirstName($first_name) /** * Gets surname * - * @return string + * @return string|null */ public function getSurname() { @@ -337,12 +439,15 @@ public function getSurname() /** * Sets surname * - * @param string $surname + * @param string|null $surname * - * @return $this + * @return self */ public function setSurname($surname) { + if (is_null($surname)) { + throw new \InvalidArgumentException('non-nullable surname cannot be null'); + } $this->container['surname'] = $surname; return $this; @@ -351,7 +456,7 @@ public function setSurname($surname) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -361,12 +466,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -375,7 +483,7 @@ public function setExternalId($external_id) /** * Gets super_fund_name * - * @return string + * @return string|null */ public function getSuperFundName() { @@ -385,12 +493,15 @@ public function getSuperFundName() /** * Sets super_fund_name * - * @param string $super_fund_name + * @param string|null $super_fund_name * - * @return $this + * @return self */ public function setSuperFundName($super_fund_name) { + if (is_null($super_fund_name)) { + throw new \InvalidArgumentException('non-nullable super_fund_name cannot be null'); + } $this->container['super_fund_name'] = $super_fund_name; return $this; @@ -399,7 +510,7 @@ public function setSuperFundName($super_fund_name) /** * Gets super_fund_number * - * @return string + * @return string|null */ public function getSuperFundNumber() { @@ -409,12 +520,15 @@ public function getSuperFundNumber() /** * Sets super_fund_number * - * @param string $super_fund_number + * @param string|null $super_fund_number * - * @return $this + * @return self */ public function setSuperFundNumber($super_fund_number) { + if (is_null($super_fund_number)) { + throw new \InvalidArgumentException('non-nullable super_fund_number cannot be null'); + } $this->container['super_fund_number'] = $super_fund_number; return $this; @@ -423,7 +537,7 @@ public function setSuperFundNumber($super_fund_number) /** * Gets payment_type * - * @return string + * @return string|null */ public function getPaymentType() { @@ -433,12 +547,15 @@ public function getPaymentType() /** * Sets payment_type * - * @param string $payment_type + * @param string|null $payment_type * - * @return $this + * @return self */ public function setPaymentType($payment_type) { + if (is_null($payment_type)) { + throw new \InvalidArgumentException('non-nullable payment_type cannot be null'); + } $this->container['payment_type'] = $payment_type; return $this; @@ -447,7 +564,7 @@ public function setPaymentType($payment_type) /** * Gets amount * - * @return double + * @return float|null */ public function getAmount() { @@ -457,12 +574,15 @@ public function getAmount() /** * Sets amount * - * @param double $amount + * @param float|null $amount * - * @return $this + * @return self */ public function setAmount($amount) { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } $this->container['amount'] = $amount; return $this; @@ -474,7 +594,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuperFundModel.php b/src/lib/Model/SuperFundModel.php index 3eef3a3..57e224c 100644 --- a/src/lib/Model/SuperFundModel.php +++ b/src/lib/Model/SuperFundModel.php @@ -2,68 +2,68 @@ /** * SuperFundModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuperFundModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuperFundModel implements ModelInterface, ArrayAccess +class SuperFundModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuperFundModel'; + protected static $openAPIModelName = 'SuperFundModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', 'name' => 'string', 'member_number' => 'string', - 'allocated_percentage' => 'double', - 'fixed_amount' => 'double', - 'super_product' => '\Swagger\Client\Model\SuperProductModel', + 'allocated_percentage' => 'float', + 'fixed_amount' => 'float', + 'super_product' => '\OpenAPI\Client\Model\SuperProductModel', 'allocate_balance' => 'bool', 'can_be_deleted' => 'bool', 'is_employer_nominated_fund' => 'bool' @@ -73,8 +73,10 @@ class SuperFundModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'name' => null, @@ -87,14 +89,39 @@ class SuperFundModel implements ModelInterface, ArrayAccess 'is_employer_nominated_fund' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'name' => false, + 'member_number' => false, + 'allocated_percentage' => false, + 'fixed_amount' => false, + 'super_product' => false, + 'allocate_balance' => false, + 'can_be_deleted' => false, + 'is_employer_nominated_fund' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['member_number'] = isset($data['member_number']) ? $data['member_number'] : null; - $this->container['allocated_percentage'] = isset($data['allocated_percentage']) ? $data['allocated_percentage'] : null; - $this->container['fixed_amount'] = isset($data['fixed_amount']) ? $data['fixed_amount'] : null; - $this->container['super_product'] = isset($data['super_product']) ? $data['super_product'] : null; - $this->container['allocate_balance'] = isset($data['allocate_balance']) ? $data['allocate_balance'] : null; - $this->container['can_be_deleted'] = isset($data['can_be_deleted']) ? $data['can_be_deleted'] : null; - $this->container['is_employer_nominated_fund'] = isset($data['is_employer_nominated_fund']) ? $data['is_employer_nominated_fund'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('member_number', $data ?? [], null); + $this->setIfExists('allocated_percentage', $data ?? [], null); + $this->setIfExists('fixed_amount', $data ?? [], null); + $this->setIfExists('super_product', $data ?? [], null); + $this->setIfExists('allocate_balance', $data ?? [], null); + $this->setIfExists('can_be_deleted', $data ?? [], null); + $this->setIfExists('is_employer_nominated_fund', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -271,12 +365,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -285,7 +382,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -295,12 +392,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -309,7 +409,7 @@ public function setEmployeeId($employee_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -319,12 +419,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -333,7 +436,7 @@ public function setName($name) /** * Gets member_number * - * @return string + * @return string|null */ public function getMemberNumber() { @@ -343,12 +446,15 @@ public function getMemberNumber() /** * Sets member_number * - * @param string $member_number + * @param string|null $member_number * - * @return $this + * @return self */ public function setMemberNumber($member_number) { + if (is_null($member_number)) { + throw new \InvalidArgumentException('non-nullable member_number cannot be null'); + } $this->container['member_number'] = $member_number; return $this; @@ -357,7 +463,7 @@ public function setMemberNumber($member_number) /** * Gets allocated_percentage * - * @return double + * @return float|null */ public function getAllocatedPercentage() { @@ -367,12 +473,15 @@ public function getAllocatedPercentage() /** * Sets allocated_percentage * - * @param double $allocated_percentage + * @param float|null $allocated_percentage * - * @return $this + * @return self */ public function setAllocatedPercentage($allocated_percentage) { + if (is_null($allocated_percentage)) { + throw new \InvalidArgumentException('non-nullable allocated_percentage cannot be null'); + } $this->container['allocated_percentage'] = $allocated_percentage; return $this; @@ -381,7 +490,7 @@ public function setAllocatedPercentage($allocated_percentage) /** * Gets fixed_amount * - * @return double + * @return float|null */ public function getFixedAmount() { @@ -391,12 +500,15 @@ public function getFixedAmount() /** * Sets fixed_amount * - * @param double $fixed_amount + * @param float|null $fixed_amount * - * @return $this + * @return self */ public function setFixedAmount($fixed_amount) { + if (is_null($fixed_amount)) { + throw new \InvalidArgumentException('non-nullable fixed_amount cannot be null'); + } $this->container['fixed_amount'] = $fixed_amount; return $this; @@ -405,7 +517,7 @@ public function setFixedAmount($fixed_amount) /** * Gets super_product * - * @return \Swagger\Client\Model\SuperProductModel + * @return \OpenAPI\Client\Model\SuperProductModel|null */ public function getSuperProduct() { @@ -415,12 +527,15 @@ public function getSuperProduct() /** * Sets super_product * - * @param \Swagger\Client\Model\SuperProductModel $super_product + * @param \OpenAPI\Client\Model\SuperProductModel|null $super_product super_product * - * @return $this + * @return self */ public function setSuperProduct($super_product) { + if (is_null($super_product)) { + throw new \InvalidArgumentException('non-nullable super_product cannot be null'); + } $this->container['super_product'] = $super_product; return $this; @@ -429,7 +544,7 @@ public function setSuperProduct($super_product) /** * Gets allocate_balance * - * @return bool + * @return bool|null */ public function getAllocateBalance() { @@ -439,12 +554,15 @@ public function getAllocateBalance() /** * Sets allocate_balance * - * @param bool $allocate_balance + * @param bool|null $allocate_balance * - * @return $this + * @return self */ public function setAllocateBalance($allocate_balance) { + if (is_null($allocate_balance)) { + throw new \InvalidArgumentException('non-nullable allocate_balance cannot be null'); + } $this->container['allocate_balance'] = $allocate_balance; return $this; @@ -453,7 +571,7 @@ public function setAllocateBalance($allocate_balance) /** * Gets can_be_deleted * - * @return bool + * @return bool|null */ public function getCanBeDeleted() { @@ -463,12 +581,15 @@ public function getCanBeDeleted() /** * Sets can_be_deleted * - * @param bool $can_be_deleted + * @param bool|null $can_be_deleted * - * @return $this + * @return self */ public function setCanBeDeleted($can_be_deleted) { + if (is_null($can_be_deleted)) { + throw new \InvalidArgumentException('non-nullable can_be_deleted cannot be null'); + } $this->container['can_be_deleted'] = $can_be_deleted; return $this; @@ -477,7 +598,7 @@ public function setCanBeDeleted($can_be_deleted) /** * Gets is_employer_nominated_fund * - * @return bool + * @return bool|null */ public function getIsEmployerNominatedFund() { @@ -487,12 +608,15 @@ public function getIsEmployerNominatedFund() /** * Sets is_employer_nominated_fund * - * @param bool $is_employer_nominated_fund + * @param bool|null $is_employer_nominated_fund * - * @return $this + * @return self */ public function setIsEmployerNominatedFund($is_employer_nominated_fund) { + if (is_null($is_employer_nominated_fund)) { + throw new \InvalidArgumentException('non-nullable is_employer_nominated_fund cannot be null'); + } $this->container['is_employer_nominated_fund'] = $is_employer_nominated_fund; return $this; @@ -504,7 +628,7 @@ public function setIsEmployerNominatedFund($is_employer_nominated_fund) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuperProductEditModel.php b/src/lib/Model/SuperProductEditModel.php index 78f7bde..4cc4135 100644 --- a/src/lib/Model/SuperProductEditModel.php +++ b/src/lib/Model/SuperProductEditModel.php @@ -2,61 +2,61 @@ /** * SuperProductEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuperProductEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuperProductEditModel implements ModelInterface, ArrayAccess +class SuperProductEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuperProductEditModel'; + protected static $openAPIModelName = 'SuperProductEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'abn' => 'string', 'product_code' => 'string', @@ -78,8 +78,10 @@ class SuperProductEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'abn' => null, 'product_code' => null, @@ -97,14 +99,44 @@ class SuperProductEditModel implements ModelInterface, ArrayAccess 'super_details_default_fund_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'abn' => false, + 'product_code' => false, + 'product_type' => false, + 'business_name' => false, + 'display_name' => false, + 'product_name' => false, + 'source' => false, + 'account_number' => false, + 'bsb' => false, + 'account_name' => false, + 'electronic_service_address' => false, + 'email' => false, + 'external_reference_id' => false, + 'super_details_default_fund_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -112,9 +144,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -225,88 +309,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -393,7 +475,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -410,21 +491,39 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['product_code'] = isset($data['product_code']) ? $data['product_code'] : null; - $this->container['product_type'] = isset($data['product_type']) ? $data['product_type'] : null; - $this->container['business_name'] = isset($data['business_name']) ? $data['business_name'] : null; - $this->container['display_name'] = isset($data['display_name']) ? $data['display_name'] : null; - $this->container['product_name'] = isset($data['product_name']) ? $data['product_name'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['electronic_service_address'] = isset($data['electronic_service_address']) ? $data['electronic_service_address'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; - $this->container['super_details_default_fund_id'] = isset($data['super_details_default_fund_id']) ? $data['super_details_default_fund_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('product_code', $data ?? [], null); + $this->setIfExists('product_type', $data ?? [], null); + $this->setIfExists('business_name', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('product_name', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('electronic_service_address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('external_reference_id', $data ?? [], null); + $this->setIfExists('super_details_default_fund_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; } /** @@ -439,7 +538,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -462,7 +562,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -472,12 +572,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -486,7 +589,7 @@ public function setId($id) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -496,12 +599,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -510,7 +616,7 @@ public function setAbn($abn) /** * Gets product_code * - * @return string + * @return string|null */ public function getProductCode() { @@ -520,12 +626,15 @@ public function getProductCode() /** * Sets product_code * - * @param string $product_code + * @param string|null $product_code * - * @return $this + * @return self */ public function setProductCode($product_code) { + if (is_null($product_code)) { + throw new \InvalidArgumentException('non-nullable product_code cannot be null'); + } $this->container['product_code'] = $product_code; return $this; @@ -534,7 +643,7 @@ public function setProductCode($product_code) /** * Gets product_type * - * @return string + * @return string|null */ public function getProductType() { @@ -544,12 +653,15 @@ public function getProductType() /** * Sets product_type * - * @param string $product_type + * @param string|null $product_type * - * @return $this + * @return self */ public function setProductType($product_type) { + if (is_null($product_type)) { + throw new \InvalidArgumentException('non-nullable product_type cannot be null'); + } $this->container['product_type'] = $product_type; return $this; @@ -558,7 +670,7 @@ public function setProductType($product_type) /** * Gets business_name * - * @return string + * @return string|null */ public function getBusinessName() { @@ -568,12 +680,15 @@ public function getBusinessName() /** * Sets business_name * - * @param string $business_name + * @param string|null $business_name * - * @return $this + * @return self */ public function setBusinessName($business_name) { + if (is_null($business_name)) { + throw new \InvalidArgumentException('non-nullable business_name cannot be null'); + } $this->container['business_name'] = $business_name; return $this; @@ -582,7 +697,7 @@ public function setBusinessName($business_name) /** * Gets display_name * - * @return string + * @return string|null */ public function getDisplayName() { @@ -592,12 +707,15 @@ public function getDisplayName() /** * Sets display_name * - * @param string $display_name + * @param string|null $display_name * - * @return $this + * @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; @@ -606,7 +724,7 @@ public function setDisplayName($display_name) /** * Gets product_name * - * @return string + * @return string|null */ public function getProductName() { @@ -616,12 +734,15 @@ public function getProductName() /** * Sets product_name * - * @param string $product_name + * @param string|null $product_name * - * @return $this + * @return self */ public function setProductName($product_name) { + if (is_null($product_name)) { + throw new \InvalidArgumentException('non-nullable product_name cannot be null'); + } $this->container['product_name'] = $product_name; return $this; @@ -630,7 +751,7 @@ public function setProductName($product_name) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -640,17 +761,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -663,7 +788,7 @@ public function setSource($source) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -673,12 +798,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -687,7 +815,7 @@ public function setAccountNumber($account_number) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -697,12 +825,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -711,7 +842,7 @@ public function setBsb($bsb) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -721,12 +852,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -735,7 +869,7 @@ public function setAccountName($account_name) /** * Gets electronic_service_address * - * @return string + * @return string|null */ public function getElectronicServiceAddress() { @@ -745,12 +879,15 @@ public function getElectronicServiceAddress() /** * Sets electronic_service_address * - * @param string $electronic_service_address + * @param string|null $electronic_service_address * - * @return $this + * @return self */ public function setElectronicServiceAddress($electronic_service_address) { + if (is_null($electronic_service_address)) { + throw new \InvalidArgumentException('non-nullable electronic_service_address cannot be null'); + } $this->container['electronic_service_address'] = $electronic_service_address; return $this; @@ -759,7 +896,7 @@ public function setElectronicServiceAddress($electronic_service_address) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -769,12 +906,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -783,7 +923,7 @@ public function setEmail($email) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -793,12 +933,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -807,7 +950,7 @@ public function setExternalReferenceId($external_reference_id) /** * Gets super_details_default_fund_id * - * @return int + * @return int|null */ public function getSuperDetailsDefaultFundId() { @@ -817,12 +960,15 @@ public function getSuperDetailsDefaultFundId() /** * Sets super_details_default_fund_id * - * @param int $super_details_default_fund_id + * @param int|null $super_details_default_fund_id * - * @return $this + * @return self */ public function setSuperDetailsDefaultFundId($super_details_default_fund_id) { + if (is_null($super_details_default_fund_id)) { + throw new \InvalidArgumentException('non-nullable super_details_default_fund_id cannot be null'); + } $this->container['super_details_default_fund_id'] = $super_details_default_fund_id; return $this; @@ -834,7 +980,7 @@ public function setSuperDetailsDefaultFundId($super_details_default_fund_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -844,22 +990,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -875,11 +1022,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -887,13 +1047,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SuperProductModel.php b/src/lib/Model/SuperProductModel.php index 96716ec..ba22bf9 100644 --- a/src/lib/Model/SuperProductModel.php +++ b/src/lib/Model/SuperProductModel.php @@ -2,61 +2,61 @@ /** * SuperProductModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SuperProductModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SuperProductModel implements ModelInterface, ArrayAccess +class SuperProductModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SuperProductModel'; + protected static $openAPIModelName = 'SuperProductModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'abn' => 'string', 'product_code' => 'string', @@ -77,8 +77,10 @@ class SuperProductModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'abn' => null, 'product_code' => null, @@ -95,14 +97,43 @@ class SuperProductModel implements ModelInterface, ArrayAccess 'external_reference_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'abn' => false, + 'product_code' => false, + 'product_type' => false, + 'business_name' => false, + 'display_name' => false, + 'product_name' => false, + 'account_number' => false, + 'bsb' => false, + 'account_name' => false, + 'source' => false, + 'electronic_service_address' => false, + 'email' => false, + 'external_reference_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -110,9 +141,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -220,88 +303,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -388,7 +469,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -405,20 +485,38 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['abn'] = isset($data['abn']) ? $data['abn'] : null; - $this->container['product_code'] = isset($data['product_code']) ? $data['product_code'] : null; - $this->container['product_type'] = isset($data['product_type']) ? $data['product_type'] : null; - $this->container['business_name'] = isset($data['business_name']) ? $data['business_name'] : null; - $this->container['display_name'] = isset($data['display_name']) ? $data['display_name'] : null; - $this->container['product_name'] = isset($data['product_name']) ? $data['product_name'] : null; - $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null; - $this->container['bsb'] = isset($data['bsb']) ? $data['bsb'] : null; - $this->container['account_name'] = isset($data['account_name']) ? $data['account_name'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['electronic_service_address'] = isset($data['electronic_service_address']) ? $data['electronic_service_address'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['external_reference_id'] = isset($data['external_reference_id']) ? $data['external_reference_id'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('abn', $data ?? [], null); + $this->setIfExists('product_code', $data ?? [], null); + $this->setIfExists('product_type', $data ?? [], null); + $this->setIfExists('business_name', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('product_name', $data ?? [], null); + $this->setIfExists('account_number', $data ?? [], null); + $this->setIfExists('bsb', $data ?? [], null); + $this->setIfExists('account_name', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('electronic_service_address', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('external_reference_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; } /** @@ -433,7 +531,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -456,7 +555,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -466,12 +565,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -480,7 +582,7 @@ public function setId($id) /** * Gets abn * - * @return string + * @return string|null */ public function getAbn() { @@ -490,12 +592,15 @@ public function getAbn() /** * Sets abn * - * @param string $abn + * @param string|null $abn * - * @return $this + * @return self */ public function setAbn($abn) { + if (is_null($abn)) { + throw new \InvalidArgumentException('non-nullable abn cannot be null'); + } $this->container['abn'] = $abn; return $this; @@ -504,7 +609,7 @@ public function setAbn($abn) /** * Gets product_code * - * @return string + * @return string|null */ public function getProductCode() { @@ -514,12 +619,15 @@ public function getProductCode() /** * Sets product_code * - * @param string $product_code + * @param string|null $product_code * - * @return $this + * @return self */ public function setProductCode($product_code) { + if (is_null($product_code)) { + throw new \InvalidArgumentException('non-nullable product_code cannot be null'); + } $this->container['product_code'] = $product_code; return $this; @@ -528,7 +636,7 @@ public function setProductCode($product_code) /** * Gets product_type * - * @return string + * @return string|null */ public function getProductType() { @@ -538,12 +646,15 @@ public function getProductType() /** * Sets product_type * - * @param string $product_type + * @param string|null $product_type * - * @return $this + * @return self */ public function setProductType($product_type) { + if (is_null($product_type)) { + throw new \InvalidArgumentException('non-nullable product_type cannot be null'); + } $this->container['product_type'] = $product_type; return $this; @@ -552,7 +663,7 @@ public function setProductType($product_type) /** * Gets business_name * - * @return string + * @return string|null */ public function getBusinessName() { @@ -562,12 +673,15 @@ public function getBusinessName() /** * Sets business_name * - * @param string $business_name + * @param string|null $business_name * - * @return $this + * @return self */ public function setBusinessName($business_name) { + if (is_null($business_name)) { + throw new \InvalidArgumentException('non-nullable business_name cannot be null'); + } $this->container['business_name'] = $business_name; return $this; @@ -576,7 +690,7 @@ public function setBusinessName($business_name) /** * Gets display_name * - * @return string + * @return string|null */ public function getDisplayName() { @@ -586,12 +700,15 @@ public function getDisplayName() /** * Sets display_name * - * @param string $display_name + * @param string|null $display_name * - * @return $this + * @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; @@ -600,7 +717,7 @@ public function setDisplayName($display_name) /** * Gets product_name * - * @return string + * @return string|null */ public function getProductName() { @@ -610,12 +727,15 @@ public function getProductName() /** * Sets product_name * - * @param string $product_name + * @param string|null $product_name * - * @return $this + * @return self */ public function setProductName($product_name) { + if (is_null($product_name)) { + throw new \InvalidArgumentException('non-nullable product_name cannot be null'); + } $this->container['product_name'] = $product_name; return $this; @@ -624,7 +744,7 @@ public function setProductName($product_name) /** * Gets account_number * - * @return string + * @return string|null */ public function getAccountNumber() { @@ -634,12 +754,15 @@ public function getAccountNumber() /** * Sets account_number * - * @param string $account_number + * @param string|null $account_number * - * @return $this + * @return self */ public function setAccountNumber($account_number) { + if (is_null($account_number)) { + throw new \InvalidArgumentException('non-nullable account_number cannot be null'); + } $this->container['account_number'] = $account_number; return $this; @@ -648,7 +771,7 @@ public function setAccountNumber($account_number) /** * Gets bsb * - * @return string + * @return string|null */ public function getBsb() { @@ -658,12 +781,15 @@ public function getBsb() /** * Sets bsb * - * @param string $bsb + * @param string|null $bsb * - * @return $this + * @return self */ public function setBsb($bsb) { + if (is_null($bsb)) { + throw new \InvalidArgumentException('non-nullable bsb cannot be null'); + } $this->container['bsb'] = $bsb; return $this; @@ -672,7 +798,7 @@ public function setBsb($bsb) /** * Gets account_name * - * @return string + * @return string|null */ public function getAccountName() { @@ -682,12 +808,15 @@ public function getAccountName() /** * Sets account_name * - * @param string $account_name + * @param string|null $account_name * - * @return $this + * @return self */ public function setAccountName($account_name) { + if (is_null($account_name)) { + throw new \InvalidArgumentException('non-nullable account_name cannot be null'); + } $this->container['account_name'] = $account_name; return $this; @@ -696,7 +825,7 @@ public function setAccountName($account_name) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -706,17 +835,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -729,7 +862,7 @@ public function setSource($source) /** * Gets electronic_service_address * - * @return string + * @return string|null */ public function getElectronicServiceAddress() { @@ -739,12 +872,15 @@ public function getElectronicServiceAddress() /** * Sets electronic_service_address * - * @param string $electronic_service_address + * @param string|null $electronic_service_address * - * @return $this + * @return self */ public function setElectronicServiceAddress($electronic_service_address) { + if (is_null($electronic_service_address)) { + throw new \InvalidArgumentException('non-nullable electronic_service_address cannot be null'); + } $this->container['electronic_service_address'] = $electronic_service_address; return $this; @@ -753,7 +889,7 @@ public function setElectronicServiceAddress($electronic_service_address) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -763,12 +899,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -777,7 +916,7 @@ public function setEmail($email) /** * Gets external_reference_id * - * @return string + * @return string|null */ public function getExternalReferenceId() { @@ -787,12 +926,15 @@ public function getExternalReferenceId() /** * Sets external_reference_id * - * @param string $external_reference_id + * @param string|null $external_reference_id * - * @return $this + * @return self */ public function setExternalReferenceId($external_reference_id) { + if (is_null($external_reference_id)) { + throw new \InvalidArgumentException('non-nullable external_reference_id cannot be null'); + } $this->container['external_reference_id'] = $external_reference_id; return $this; @@ -804,7 +946,7 @@ public function setExternalReferenceId($external_reference_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -814,22 +956,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -845,11 +988,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -857,13 +1013,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/SwapShiftModel.php b/src/lib/Model/SwapShiftModel.php index 8f43f40..520887c 100644 --- a/src/lib/Model/SwapShiftModel.php +++ b/src/lib/Model/SwapShiftModel.php @@ -2,61 +2,61 @@ /** * SwapShiftModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * SwapShiftModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class SwapShiftModel implements ModelInterface, ArrayAccess +class SwapShiftModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'SwapShiftModel'; + protected static $openAPIModelName = 'SwapShiftModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'roster_shift_id' => 'int', 'from_employee_id' => 'int', 'to_employee_id' => 'int', @@ -70,8 +70,10 @@ class SwapShiftModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'roster_shift_id' => 'int32', 'from_employee_id' => 'int32', 'to_employee_id' => 'int32', @@ -81,14 +83,36 @@ class SwapShiftModel implements ModelInterface, ArrayAccess 'token' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'roster_shift_id' => false, + 'from_employee_id' => false, + 'to_employee_id' => false, + 'note' => false, + 'date_created' => false, + 'created_by_user_id' => false, + 'token' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['roster_shift_id'] = isset($data['roster_shift_id']) ? $data['roster_shift_id'] : null; - $this->container['from_employee_id'] = isset($data['from_employee_id']) ? $data['from_employee_id'] : null; - $this->container['to_employee_id'] = isset($data['to_employee_id']) ? $data['to_employee_id'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['created_by_user_id'] = isset($data['created_by_user_id']) ? $data['created_by_user_id'] : null; - $this->container['token'] = isset($data['token']) ? $data['token'] : null; + $this->setIfExists('roster_shift_id', $data ?? [], null); + $this->setIfExists('from_employee_id', $data ?? [], null); + $this->setIfExists('to_employee_id', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('created_by_user_id', $data ?? [], null); + $this->setIfExists('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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets roster_shift_id * - * @return int + * @return int|null */ public function getRosterShiftId() { @@ -253,12 +344,15 @@ public function getRosterShiftId() /** * Sets roster_shift_id * - * @param int $roster_shift_id + * @param int|null $roster_shift_id * - * @return $this + * @return self */ public function setRosterShiftId($roster_shift_id) { + if (is_null($roster_shift_id)) { + throw new \InvalidArgumentException('non-nullable roster_shift_id cannot be null'); + } $this->container['roster_shift_id'] = $roster_shift_id; return $this; @@ -267,7 +361,7 @@ public function setRosterShiftId($roster_shift_id) /** * Gets from_employee_id * - * @return int + * @return int|null */ public function getFromEmployeeId() { @@ -277,12 +371,15 @@ public function getFromEmployeeId() /** * Sets from_employee_id * - * @param int $from_employee_id + * @param int|null $from_employee_id * - * @return $this + * @return self */ public function setFromEmployeeId($from_employee_id) { + if (is_null($from_employee_id)) { + throw new \InvalidArgumentException('non-nullable from_employee_id cannot be null'); + } $this->container['from_employee_id'] = $from_employee_id; return $this; @@ -291,7 +388,7 @@ public function setFromEmployeeId($from_employee_id) /** * Gets to_employee_id * - * @return int + * @return int|null */ public function getToEmployeeId() { @@ -301,12 +398,15 @@ public function getToEmployeeId() /** * Sets to_employee_id * - * @param int $to_employee_id + * @param int|null $to_employee_id * - * @return $this + * @return self */ public function setToEmployeeId($to_employee_id) { + if (is_null($to_employee_id)) { + throw new \InvalidArgumentException('non-nullable to_employee_id cannot be null'); + } $this->container['to_employee_id'] = $to_employee_id; return $this; @@ -315,7 +415,7 @@ public function setToEmployeeId($to_employee_id) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -325,12 +425,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -339,7 +442,7 @@ public function setNote($note) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -349,12 +452,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -363,7 +469,7 @@ public function setDateCreated($date_created) /** * Gets created_by_user_id * - * @return int + * @return int|null */ public function getCreatedByUserId() { @@ -373,12 +479,15 @@ public function getCreatedByUserId() /** * Sets created_by_user_id * - * @param int $created_by_user_id + * @param int|null $created_by_user_id * - * @return $this + * @return self */ public function setCreatedByUserId($created_by_user_id) { + if (is_null($created_by_user_id)) { + throw new \InvalidArgumentException('non-nullable created_by_user_id cannot be null'); + } $this->container['created_by_user_id'] = $created_by_user_id; return $this; @@ -387,7 +496,7 @@ public function setCreatedByUserId($created_by_user_id) /** * Gets token * - * @return string + * @return string|null */ public function getToken() { @@ -397,12 +506,15 @@ public function getToken() /** * Sets token * - * @param string $token + * @param string|null $token * - * @return $this + * @return self */ public function setToken($token) { + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } $this->container['token'] = $token; return $this; @@ -414,7 +526,7 @@ public function setToken($token) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TagViewModel.php b/src/lib/Model/TagViewModel.php index 6337a12..fac3b7b 100644 --- a/src/lib/Model/TagViewModel.php +++ b/src/lib/Model/TagViewModel.php @@ -2,61 +2,61 @@ /** * TagViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TagViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TagViewModel implements ModelInterface, ArrayAccess +class TagViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TagViewModel'; + protected static $openAPIModelName = 'TagViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class TagViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TasksReportExportModel.php b/src/lib/Model/TasksReportExportModel.php index 979f989..02a8a32 100644 --- a/src/lib/Model/TasksReportExportModel.php +++ b/src/lib/Model/TasksReportExportModel.php @@ -2,61 +2,61 @@ /** * TasksReportExportModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TasksReportExportModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TasksReportExportModel implements ModelInterface, ArrayAccess +class TasksReportExportModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TasksReportExportModel'; + protected static $openAPIModelName = 'TasksReportExportModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'pay_run_task_id' => 'int', 'employee_name' => 'string', 'employee_id' => 'int', @@ -66,7 +66,7 @@ class TasksReportExportModel implements ModelInterface, ArrayAccess 'created_date' => '\DateTime', 'due_date' => '\DateTime', 'completed' => 'bool', - 'notes' => '\Swagger\Client\Model\TasksReportNoteModel[]', + 'notes' => '\OpenAPI\Client\Model\TasksReportNoteModel[]', 'completed_by' => 'string', 'completed_date' => '\DateTime' ]; @@ -75,8 +75,10 @@ class TasksReportExportModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'pay_run_task_id' => 'int32', 'employee_name' => null, 'employee_id' => 'int32', @@ -91,14 +93,41 @@ class TasksReportExportModel implements ModelInterface, ArrayAccess 'completed_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'pay_run_task_id' => false, + 'employee_name' => false, + 'employee_id' => false, + 'external_id' => false, + 'task_description' => false, + 'created_by' => false, + 'created_date' => false, + 'due_date' => false, + 'completed' => false, + 'notes' => false, + 'completed_by' => false, + 'completed_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -210,12 +291,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -232,18 +310,36 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['pay_run_task_id'] = isset($data['pay_run_task_id']) ? $data['pay_run_task_id'] : null; - $this->container['employee_name'] = isset($data['employee_name']) ? $data['employee_name'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['task_description'] = isset($data['task_description']) ? $data['task_description'] : null; - $this->container['created_by'] = isset($data['created_by']) ? $data['created_by'] : null; - $this->container['created_date'] = isset($data['created_date']) ? $data['created_date'] : null; - $this->container['due_date'] = isset($data['due_date']) ? $data['due_date'] : null; - $this->container['completed'] = isset($data['completed']) ? $data['completed'] : null; - $this->container['notes'] = isset($data['notes']) ? $data['notes'] : null; - $this->container['completed_by'] = isset($data['completed_by']) ? $data['completed_by'] : null; - $this->container['completed_date'] = isset($data['completed_date']) ? $data['completed_date'] : null; + $this->setIfExists('pay_run_task_id', $data ?? [], null); + $this->setIfExists('employee_name', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('task_description', $data ?? [], null); + $this->setIfExists('created_by', $data ?? [], null); + $this->setIfExists('created_date', $data ?? [], null); + $this->setIfExists('due_date', $data ?? [], null); + $this->setIfExists('completed', $data ?? [], null); + $this->setIfExists('notes', $data ?? [], null); + $this->setIfExists('completed_by', $data ?? [], null); + $this->setIfExists('completed_date', $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; } /** @@ -273,7 +369,7 @@ public function valid() /** * Gets pay_run_task_id * - * @return int + * @return int|null */ public function getPayRunTaskId() { @@ -283,12 +379,15 @@ public function getPayRunTaskId() /** * Sets pay_run_task_id * - * @param int $pay_run_task_id + * @param int|null $pay_run_task_id * - * @return $this + * @return self */ public function setPayRunTaskId($pay_run_task_id) { + if (is_null($pay_run_task_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_task_id cannot be null'); + } $this->container['pay_run_task_id'] = $pay_run_task_id; return $this; @@ -297,7 +396,7 @@ public function setPayRunTaskId($pay_run_task_id) /** * Gets employee_name * - * @return string + * @return string|null */ public function getEmployeeName() { @@ -307,12 +406,15 @@ public function getEmployeeName() /** * Sets employee_name * - * @param string $employee_name + * @param string|null $employee_name * - * @return $this + * @return self */ public function setEmployeeName($employee_name) { + if (is_null($employee_name)) { + throw new \InvalidArgumentException('non-nullable employee_name cannot be null'); + } $this->container['employee_name'] = $employee_name; return $this; @@ -321,7 +423,7 @@ public function setEmployeeName($employee_name) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -331,12 +433,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -345,7 +450,7 @@ public function setEmployeeId($employee_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -355,12 +460,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -369,7 +477,7 @@ public function setExternalId($external_id) /** * Gets task_description * - * @return string + * @return string|null */ public function getTaskDescription() { @@ -379,12 +487,15 @@ public function getTaskDescription() /** * Sets task_description * - * @param string $task_description + * @param string|null $task_description * - * @return $this + * @return self */ public function setTaskDescription($task_description) { + if (is_null($task_description)) { + throw new \InvalidArgumentException('non-nullable task_description cannot be null'); + } $this->container['task_description'] = $task_description; return $this; @@ -393,7 +504,7 @@ public function setTaskDescription($task_description) /** * Gets created_by * - * @return string + * @return string|null */ public function getCreatedBy() { @@ -403,12 +514,15 @@ public function getCreatedBy() /** * Sets created_by * - * @param string $created_by + * @param string|null $created_by * - * @return $this + * @return self */ public function setCreatedBy($created_by) { + if (is_null($created_by)) { + throw new \InvalidArgumentException('non-nullable created_by cannot be null'); + } $this->container['created_by'] = $created_by; return $this; @@ -417,7 +531,7 @@ public function setCreatedBy($created_by) /** * Gets created_date * - * @return \DateTime + * @return \DateTime|null */ public function getCreatedDate() { @@ -427,12 +541,15 @@ public function getCreatedDate() /** * Sets created_date * - * @param \DateTime $created_date + * @param \DateTime|null $created_date * - * @return $this + * @return self */ public function setCreatedDate($created_date) { + if (is_null($created_date)) { + throw new \InvalidArgumentException('non-nullable created_date cannot be null'); + } $this->container['created_date'] = $created_date; return $this; @@ -441,7 +558,7 @@ public function setCreatedDate($created_date) /** * Gets due_date * - * @return \DateTime + * @return \DateTime|null */ public function getDueDate() { @@ -451,12 +568,15 @@ public function getDueDate() /** * Sets due_date * - * @param \DateTime $due_date + * @param \DateTime|null $due_date * - * @return $this + * @return self */ public function setDueDate($due_date) { + if (is_null($due_date)) { + throw new \InvalidArgumentException('non-nullable due_date cannot be null'); + } $this->container['due_date'] = $due_date; return $this; @@ -465,7 +585,7 @@ public function setDueDate($due_date) /** * Gets completed * - * @return bool + * @return bool|null */ public function getCompleted() { @@ -475,12 +595,15 @@ public function getCompleted() /** * Sets completed * - * @param bool $completed + * @param bool|null $completed * - * @return $this + * @return self */ public function setCompleted($completed) { + if (is_null($completed)) { + throw new \InvalidArgumentException('non-nullable completed cannot be null'); + } $this->container['completed'] = $completed; return $this; @@ -489,7 +612,7 @@ public function setCompleted($completed) /** * Gets notes * - * @return \Swagger\Client\Model\TasksReportNoteModel[] + * @return \OpenAPI\Client\Model\TasksReportNoteModel[]|null */ public function getNotes() { @@ -499,12 +622,15 @@ public function getNotes() /** * Sets notes * - * @param \Swagger\Client\Model\TasksReportNoteModel[] $notes + * @param \OpenAPI\Client\Model\TasksReportNoteModel[]|null $notes * - * @return $this + * @return self */ public function setNotes($notes) { + if (is_null($notes)) { + throw new \InvalidArgumentException('non-nullable notes cannot be null'); + } $this->container['notes'] = $notes; return $this; @@ -513,7 +639,7 @@ public function setNotes($notes) /** * Gets completed_by * - * @return string + * @return string|null */ public function getCompletedBy() { @@ -523,12 +649,15 @@ public function getCompletedBy() /** * Sets completed_by * - * @param string $completed_by + * @param string|null $completed_by * - * @return $this + * @return self */ public function setCompletedBy($completed_by) { + if (is_null($completed_by)) { + throw new \InvalidArgumentException('non-nullable completed_by cannot be null'); + } $this->container['completed_by'] = $completed_by; return $this; @@ -537,7 +666,7 @@ public function setCompletedBy($completed_by) /** * Gets completed_date * - * @return \DateTime + * @return \DateTime|null */ public function getCompletedDate() { @@ -547,12 +676,15 @@ public function getCompletedDate() /** * Sets completed_date * - * @param \DateTime $completed_date + * @param \DateTime|null $completed_date * - * @return $this + * @return self */ public function setCompletedDate($completed_date) { + if (is_null($completed_date)) { + throw new \InvalidArgumentException('non-nullable completed_date cannot be null'); + } $this->container['completed_date'] = $completed_date; return $this; @@ -564,7 +696,7 @@ public function setCompletedDate($completed_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -574,22 +706,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -605,11 +738,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -617,13 +763,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TasksReportNoteModel.php b/src/lib/Model/TasksReportNoteModel.php index 79815ed..2f8ffbc 100644 --- a/src/lib/Model/TasksReportNoteModel.php +++ b/src/lib/Model/TasksReportNoteModel.php @@ -2,61 +2,61 @@ /** * TasksReportNoteModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TasksReportNoteModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TasksReportNoteModel implements ModelInterface, ArrayAccess +class TasksReportNoteModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TasksReportNoteModel'; + protected static $openAPIModelName = 'TasksReportNoteModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'username' => 'string', 'date_created' => '\DateTime', 'note' => 'string', @@ -67,22 +67,43 @@ class TasksReportNoteModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'username' => null, 'date_created' => 'date-time', 'note' => null, 'is_visible_to_manager' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'username' => false, + 'date_created' => false, + 'note' => false, + 'is_visible_to_manager' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['date_created'] = isset($data['date_created']) ? $data['date_created'] : null; - $this->container['note'] = isset($data['note']) ? $data['note'] : null; - $this->container['is_visible_to_manager'] = isset($data['is_visible_to_manager']) ? $data['is_visible_to_manager'] : null; + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('date_created', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('is_visible_to_manager', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets username * - * @return string + * @return string|null */ public function getUsername() { @@ -235,12 +323,15 @@ public function getUsername() /** * Sets username * - * @param string $username + * @param string|null $username * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setUsername($username) /** * Gets date_created * - * @return \DateTime + * @return \DateTime|null */ public function getDateCreated() { @@ -259,12 +350,15 @@ public function getDateCreated() /** * Sets date_created * - * @param \DateTime $date_created + * @param \DateTime|null $date_created * - * @return $this + * @return self */ public function setDateCreated($date_created) { + if (is_null($date_created)) { + throw new \InvalidArgumentException('non-nullable date_created cannot be null'); + } $this->container['date_created'] = $date_created; return $this; @@ -273,7 +367,7 @@ public function setDateCreated($date_created) /** * Gets note * - * @return string + * @return string|null */ public function getNote() { @@ -283,12 +377,15 @@ public function getNote() /** * Sets note * - * @param string $note + * @param string|null $note * - * @return $this + * @return self */ public function setNote($note) { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } $this->container['note'] = $note; return $this; @@ -297,7 +394,7 @@ public function setNote($note) /** * Gets is_visible_to_manager * - * @return bool + * @return bool|null */ public function getIsVisibleToManager() { @@ -307,12 +404,15 @@ public function getIsVisibleToManager() /** * Sets is_visible_to_manager * - * @param bool $is_visible_to_manager + * @param bool|null $is_visible_to_manager * - * @return $this + * @return self */ public function setIsVisibleToManager($is_visible_to_manager) { + if (is_null($is_visible_to_manager)) { + throw new \InvalidArgumentException('non-nullable is_visible_to_manager cannot be null'); + } $this->container['is_visible_to_manager'] = $is_visible_to_manager; return $this; @@ -324,7 +424,7 @@ public function setIsVisibleToManager($is_visible_to_manager) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TasksReportRequestModel.php b/src/lib/Model/TasksReportRequestModel.php index 054d764..9109d66 100644 --- a/src/lib/Model/TasksReportRequestModel.php +++ b/src/lib/Model/TasksReportRequestModel.php @@ -2,61 +2,61 @@ /** * TasksReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TasksReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TasksReportRequestModel implements ModelInterface, ArrayAccess +class TasksReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TasksReportRequestModel'; + protected static $openAPIModelName = 'TasksReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'pay_run_id' => 'int', 'from_date' => '\DateTime', @@ -69,8 +69,10 @@ class TasksReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'pay_run_id' => 'int32', 'from_date' => 'date-time', @@ -79,14 +81,35 @@ class TasksReportRequestModel implements ModelInterface, ArrayAccess 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'pay_run_id' => false, + 'from_date' => false, + 'to_date' => false, + 'pay_schedule_id' => false, + 'status' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -180,15 +255,13 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_ALL = 'All'; - const STATUS_COMPLETED = 'Completed'; - const STATUS_NOT_COMPLETED = 'NotCompleted'; - + public const STATUS_ALL = 'All'; + public const STATUS_COMPLETED = 'Completed'; + public const STATUS_NOT_COMPLETED = 'NotCompleted'; - /** * Gets allowable values of the enum * @@ -202,7 +275,6 @@ public function getStatusAllowableValues() self::STATUS_NOT_COMPLETED, ]; } - /** * Associative array for storing property values @@ -219,12 +291,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['pay_run_id'] = isset($data['pay_run_id']) ? $data['pay_run_id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('pay_run_id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('status', $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; } /** @@ -239,7 +329,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -262,7 +353,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -272,12 +363,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -286,7 +380,7 @@ public function setEmployeeId($employee_id) /** * Gets pay_run_id * - * @return int + * @return int|null */ public function getPayRunId() { @@ -296,12 +390,15 @@ public function getPayRunId() /** * Sets pay_run_id * - * @param int $pay_run_id + * @param int|null $pay_run_id * - * @return $this + * @return self */ public function setPayRunId($pay_run_id) { + if (is_null($pay_run_id)) { + throw new \InvalidArgumentException('non-nullable pay_run_id cannot be null'); + } $this->container['pay_run_id'] = $pay_run_id; return $this; @@ -310,7 +407,7 @@ public function setPayRunId($pay_run_id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -320,12 +417,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -334,7 +434,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -344,12 +444,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -358,7 +461,7 @@ public function setToDate($to_date) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -368,12 +471,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -382,7 +488,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -392,17 +498,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -418,7 +528,7 @@ public function setStatus($status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -428,22 +538,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -459,11 +570,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -471,13 +595,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TerminateEmployeeRequest.php b/src/lib/Model/TerminateEmployeeRequest.php index ddd10bf..15d2d40 100644 --- a/src/lib/Model/TerminateEmployeeRequest.php +++ b/src/lib/Model/TerminateEmployeeRequest.php @@ -2,61 +2,61 @@ /** * TerminateEmployeeRequest * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TerminateEmployeeRequest Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TerminateEmployeeRequest implements ModelInterface, ArrayAccess +class TerminateEmployeeRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TerminateEmployeeRequest'; + protected static $openAPIModelName = 'TerminateEmployeeRequest'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'termination_reason' => 'string', 'termination_date' => '\DateTime' @@ -66,21 +66,41 @@ class TerminateEmployeeRequest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'termination_reason' => null, 'termination_date' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'termination_reason' => false, + 'termination_date' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['termination_reason'] = isset($data['termination_reason']) ? $data['termination_reason'] : null; - $this->container['termination_date'] = isset($data['termination_date']) ? $data['termination_date'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('termination_reason', $data ?? [], null); + $this->setIfExists('termination_date', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -229,12 +316,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -243,7 +333,7 @@ public function setEmployeeId($employee_id) /** * Gets termination_reason * - * @return string + * @return string|null */ public function getTerminationReason() { @@ -253,12 +343,15 @@ public function getTerminationReason() /** * Sets termination_reason * - * @param string $termination_reason + * @param string|null $termination_reason * - * @return $this + * @return self */ public function setTerminationReason($termination_reason) { + if (is_null($termination_reason)) { + throw new \InvalidArgumentException('non-nullable termination_reason cannot be null'); + } $this->container['termination_reason'] = $termination_reason; return $this; @@ -267,7 +360,7 @@ public function setTerminationReason($termination_reason) /** * Gets termination_date * - * @return \DateTime + * @return \DateTime|null */ public function getTerminationDate() { @@ -277,12 +370,15 @@ public function getTerminationDate() /** * Sets termination_date * - * @param \DateTime $termination_date + * @param \DateTime|null $termination_date * - * @return $this + * @return self */ public function setTerminationDate($termination_date) { + if (is_null($termination_date)) { + throw new \InvalidArgumentException('non-nullable termination_date cannot be null'); + } $this->container['termination_date'] = $termination_date; return $this; @@ -294,7 +390,7 @@ public function setTerminationDate($termination_date) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimeAndAttendanceBreakModel.php b/src/lib/Model/TimeAndAttendanceBreakModel.php index 9ed9de9..a21c1cf 100644 --- a/src/lib/Model/TimeAndAttendanceBreakModel.php +++ b/src/lib/Model/TimeAndAttendanceBreakModel.php @@ -2,61 +2,61 @@ /** * TimeAndAttendanceBreakModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimeAndAttendanceBreakModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimeAndAttendanceBreakModel implements ModelInterface, ArrayAccess +class TimeAndAttendanceBreakModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimeAndAttendanceBreakModel'; + protected static $openAPIModelName = 'TimeAndAttendanceBreakModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'start_time_utc' => '\DateTime', 'start_time_local' => '\DateTime', 'end_time_utc' => '\DateTime', @@ -68,8 +68,10 @@ class TimeAndAttendanceBreakModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'start_time_utc' => 'date-time', 'start_time_local' => 'date-time', 'end_time_utc' => 'date-time', @@ -77,14 +79,34 @@ class TimeAndAttendanceBreakModel implements ModelInterface, ArrayAccess 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_time_utc' => false, + 'start_time_local' => false, + 'end_time_utc' => false, + 'end_time_local' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['start_time_utc'] = isset($data['start_time_utc']) ? $data['start_time_utc'] : null; - $this->container['start_time_local'] = isset($data['start_time_local']) ? $data['start_time_local'] : null; - $this->container['end_time_utc'] = isset($data['end_time_utc']) ? $data['end_time_utc'] : null; - $this->container['end_time_local'] = isset($data['end_time_local']) ? $data['end_time_local'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('start_time_utc', $data ?? [], null); + $this->setIfExists('start_time_local', $data ?? [], null); + $this->setIfExists('end_time_utc', $data ?? [], null); + $this->setIfExists('end_time_local', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets start_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getStartTimeUtc() { @@ -241,12 +330,15 @@ public function getStartTimeUtc() /** * Sets start_time_utc * - * @param \DateTime $start_time_utc + * @param \DateTime|null $start_time_utc * - * @return $this + * @return self */ public function setStartTimeUtc($start_time_utc) { + if (is_null($start_time_utc)) { + throw new \InvalidArgumentException('non-nullable start_time_utc cannot be null'); + } $this->container['start_time_utc'] = $start_time_utc; return $this; @@ -255,7 +347,7 @@ public function setStartTimeUtc($start_time_utc) /** * Gets start_time_local * - * @return \DateTime + * @return \DateTime|null */ public function getStartTimeLocal() { @@ -265,12 +357,15 @@ public function getStartTimeLocal() /** * Sets start_time_local * - * @param \DateTime $start_time_local + * @param \DateTime|null $start_time_local * - * @return $this + * @return self */ public function setStartTimeLocal($start_time_local) { + if (is_null($start_time_local)) { + throw new \InvalidArgumentException('non-nullable start_time_local cannot be null'); + } $this->container['start_time_local'] = $start_time_local; return $this; @@ -279,7 +374,7 @@ public function setStartTimeLocal($start_time_local) /** * Gets end_time_utc * - * @return \DateTime + * @return \DateTime|null */ public function getEndTimeUtc() { @@ -289,12 +384,15 @@ public function getEndTimeUtc() /** * Sets end_time_utc * - * @param \DateTime $end_time_utc + * @param \DateTime|null $end_time_utc * - * @return $this + * @return self */ public function setEndTimeUtc($end_time_utc) { + if (is_null($end_time_utc)) { + throw new \InvalidArgumentException('non-nullable end_time_utc cannot be null'); + } $this->container['end_time_utc'] = $end_time_utc; return $this; @@ -303,7 +401,7 @@ public function setEndTimeUtc($end_time_utc) /** * Gets end_time_local * - * @return \DateTime + * @return \DateTime|null */ public function getEndTimeLocal() { @@ -313,12 +411,15 @@ public function getEndTimeLocal() /** * Sets end_time_local * - * @param \DateTime $end_time_local + * @param \DateTime|null $end_time_local * - * @return $this + * @return self */ public function setEndTimeLocal($end_time_local) { + if (is_null($end_time_local)) { + throw new \InvalidArgumentException('non-nullable end_time_local cannot be null'); + } $this->container['end_time_local'] = $end_time_local; return $this; @@ -327,7 +428,7 @@ public function setEndTimeLocal($end_time_local) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -337,12 +438,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -354,7 +458,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimeAndAttendanceKioskModel.php b/src/lib/Model/TimeAndAttendanceKioskModel.php index 1a8459f..225c8c6 100644 --- a/src/lib/Model/TimeAndAttendanceKioskModel.php +++ b/src/lib/Model/TimeAndAttendanceKioskModel.php @@ -2,68 +2,68 @@ /** * TimeAndAttendanceKioskModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimeAndAttendanceKioskModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess +class TimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimeAndAttendanceKioskModel'; + protected static $openAPIModelName = 'TimeAndAttendanceKioskModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'external_id' => 'string', 'location_id' => 'int', 'name' => 'string', 'time_zone' => 'string', 'allow_higher_classification_selection' => 'bool', - 'branding' => '\Swagger\Client\Model\WhiteLabelBrandingModel', + 'branding' => '\OpenAPI\Client\Model\WhiteLabelBrandingModel', 'is_location_required' => 'bool', 'is_work_type_required' => 'bool', 'restrict_locations_for_employees' => 'bool', @@ -81,8 +81,10 @@ class TimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'external_id' => null, 'location_id' => 'int32', @@ -103,14 +105,47 @@ class TimeAndAttendanceKioskModel implements ModelInterface, ArrayAccess 'paid_breaks_enabled' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'external_id' => false, + 'location_id' => false, + 'name' => false, + 'time_zone' => false, + 'allow_higher_classification_selection' => false, + 'branding' => false, + 'is_location_required' => false, + 'is_work_type_required' => false, + 'restrict_locations_for_employees' => false, + 'allow_employee_shift_selection' => false, + 'clock_on_window_minutes' => false, + 'clock_off_window_minutes' => false, + 'iana_time_zone' => false, + 'is_photo_required' => false, + 'can_add_employees' => false, + 'available_to_all_restricted_users_with_kiosk_access' => false, + 'paid_breaks_enabled' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -118,9 +153,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -240,12 +327,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -262,24 +346,42 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['time_zone'] = isset($data['time_zone']) ? $data['time_zone'] : null; - $this->container['allow_higher_classification_selection'] = isset($data['allow_higher_classification_selection']) ? $data['allow_higher_classification_selection'] : null; - $this->container['branding'] = isset($data['branding']) ? $data['branding'] : null; - $this->container['is_location_required'] = isset($data['is_location_required']) ? $data['is_location_required'] : null; - $this->container['is_work_type_required'] = isset($data['is_work_type_required']) ? $data['is_work_type_required'] : null; - $this->container['restrict_locations_for_employees'] = isset($data['restrict_locations_for_employees']) ? $data['restrict_locations_for_employees'] : null; - $this->container['allow_employee_shift_selection'] = isset($data['allow_employee_shift_selection']) ? $data['allow_employee_shift_selection'] : null; - $this->container['clock_on_window_minutes'] = isset($data['clock_on_window_minutes']) ? $data['clock_on_window_minutes'] : null; - $this->container['clock_off_window_minutes'] = isset($data['clock_off_window_minutes']) ? $data['clock_off_window_minutes'] : null; - $this->container['iana_time_zone'] = isset($data['iana_time_zone']) ? $data['iana_time_zone'] : null; - $this->container['is_photo_required'] = isset($data['is_photo_required']) ? $data['is_photo_required'] : null; - $this->container['can_add_employees'] = isset($data['can_add_employees']) ? $data['can_add_employees'] : null; - $this->container['available_to_all_restricted_users_with_kiosk_access'] = isset($data['available_to_all_restricted_users_with_kiosk_access']) ? $data['available_to_all_restricted_users_with_kiosk_access'] : null; - $this->container['paid_breaks_enabled'] = isset($data['paid_breaks_enabled']) ? $data['paid_breaks_enabled'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('time_zone', $data ?? [], null); + $this->setIfExists('allow_higher_classification_selection', $data ?? [], null); + $this->setIfExists('branding', $data ?? [], null); + $this->setIfExists('is_location_required', $data ?? [], null); + $this->setIfExists('is_work_type_required', $data ?? [], null); + $this->setIfExists('restrict_locations_for_employees', $data ?? [], null); + $this->setIfExists('allow_employee_shift_selection', $data ?? [], null); + $this->setIfExists('clock_on_window_minutes', $data ?? [], null); + $this->setIfExists('clock_off_window_minutes', $data ?? [], null); + $this->setIfExists('iana_time_zone', $data ?? [], null); + $this->setIfExists('is_photo_required', $data ?? [], null); + $this->setIfExists('can_add_employees', $data ?? [], null); + $this->setIfExists('available_to_all_restricted_users_with_kiosk_access', $data ?? [], null); + $this->setIfExists('paid_breaks_enabled', $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; } /** @@ -309,7 +411,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -319,12 +421,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -333,7 +438,7 @@ public function setId($id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -343,12 +448,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -357,7 +465,7 @@ public function setExternalId($external_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -367,12 +475,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -381,7 +492,7 @@ public function setLocationId($location_id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -391,12 +502,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -405,7 +519,7 @@ public function setName($name) /** * Gets time_zone * - * @return string + * @return string|null */ public function getTimeZone() { @@ -415,12 +529,15 @@ public function getTimeZone() /** * Sets time_zone * - * @param string $time_zone + * @param string|null $time_zone * - * @return $this + * @return self */ public function setTimeZone($time_zone) { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } $this->container['time_zone'] = $time_zone; return $this; @@ -429,7 +546,7 @@ public function setTimeZone($time_zone) /** * Gets allow_higher_classification_selection * - * @return bool + * @return bool|null */ public function getAllowHigherClassificationSelection() { @@ -439,12 +556,15 @@ public function getAllowHigherClassificationSelection() /** * Sets allow_higher_classification_selection * - * @param bool $allow_higher_classification_selection + * @param bool|null $allow_higher_classification_selection * - * @return $this + * @return self */ public function setAllowHigherClassificationSelection($allow_higher_classification_selection) { + if (is_null($allow_higher_classification_selection)) { + throw new \InvalidArgumentException('non-nullable allow_higher_classification_selection cannot be null'); + } $this->container['allow_higher_classification_selection'] = $allow_higher_classification_selection; return $this; @@ -453,7 +573,7 @@ public function setAllowHigherClassificationSelection($allow_higher_classificati /** * Gets branding * - * @return \Swagger\Client\Model\WhiteLabelBrandingModel + * @return \OpenAPI\Client\Model\WhiteLabelBrandingModel|null */ public function getBranding() { @@ -463,12 +583,15 @@ public function getBranding() /** * Sets branding * - * @param \Swagger\Client\Model\WhiteLabelBrandingModel $branding + * @param \OpenAPI\Client\Model\WhiteLabelBrandingModel|null $branding branding * - * @return $this + * @return self */ public function setBranding($branding) { + if (is_null($branding)) { + throw new \InvalidArgumentException('non-nullable branding cannot be null'); + } $this->container['branding'] = $branding; return $this; @@ -477,7 +600,7 @@ public function setBranding($branding) /** * Gets is_location_required * - * @return bool + * @return bool|null */ public function getIsLocationRequired() { @@ -487,12 +610,15 @@ public function getIsLocationRequired() /** * Sets is_location_required * - * @param bool $is_location_required + * @param bool|null $is_location_required * - * @return $this + * @return self */ public function setIsLocationRequired($is_location_required) { + if (is_null($is_location_required)) { + throw new \InvalidArgumentException('non-nullable is_location_required cannot be null'); + } $this->container['is_location_required'] = $is_location_required; return $this; @@ -501,7 +627,7 @@ public function setIsLocationRequired($is_location_required) /** * Gets is_work_type_required * - * @return bool + * @return bool|null */ public function getIsWorkTypeRequired() { @@ -511,12 +637,15 @@ public function getIsWorkTypeRequired() /** * Sets is_work_type_required * - * @param bool $is_work_type_required + * @param bool|null $is_work_type_required * - * @return $this + * @return self */ public function setIsWorkTypeRequired($is_work_type_required) { + if (is_null($is_work_type_required)) { + throw new \InvalidArgumentException('non-nullable is_work_type_required cannot be null'); + } $this->container['is_work_type_required'] = $is_work_type_required; return $this; @@ -525,7 +654,7 @@ public function setIsWorkTypeRequired($is_work_type_required) /** * Gets restrict_locations_for_employees * - * @return bool + * @return bool|null */ public function getRestrictLocationsForEmployees() { @@ -535,12 +664,15 @@ public function getRestrictLocationsForEmployees() /** * Sets restrict_locations_for_employees * - * @param bool $restrict_locations_for_employees + * @param bool|null $restrict_locations_for_employees * - * @return $this + * @return self */ public function setRestrictLocationsForEmployees($restrict_locations_for_employees) { + if (is_null($restrict_locations_for_employees)) { + throw new \InvalidArgumentException('non-nullable restrict_locations_for_employees cannot be null'); + } $this->container['restrict_locations_for_employees'] = $restrict_locations_for_employees; return $this; @@ -549,7 +681,7 @@ public function setRestrictLocationsForEmployees($restrict_locations_for_employe /** * Gets allow_employee_shift_selection * - * @return bool + * @return bool|null */ public function getAllowEmployeeShiftSelection() { @@ -559,12 +691,15 @@ public function getAllowEmployeeShiftSelection() /** * Sets allow_employee_shift_selection * - * @param bool $allow_employee_shift_selection + * @param bool|null $allow_employee_shift_selection * - * @return $this + * @return self */ public function setAllowEmployeeShiftSelection($allow_employee_shift_selection) { + if (is_null($allow_employee_shift_selection)) { + throw new \InvalidArgumentException('non-nullable allow_employee_shift_selection cannot be null'); + } $this->container['allow_employee_shift_selection'] = $allow_employee_shift_selection; return $this; @@ -573,7 +708,7 @@ public function setAllowEmployeeShiftSelection($allow_employee_shift_selection) /** * Gets clock_on_window_minutes * - * @return int + * @return int|null */ public function getClockOnWindowMinutes() { @@ -583,12 +718,15 @@ public function getClockOnWindowMinutes() /** * Sets clock_on_window_minutes * - * @param int $clock_on_window_minutes + * @param int|null $clock_on_window_minutes * - * @return $this + * @return self */ public function setClockOnWindowMinutes($clock_on_window_minutes) { + if (is_null($clock_on_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_on_window_minutes cannot be null'); + } $this->container['clock_on_window_minutes'] = $clock_on_window_minutes; return $this; @@ -597,7 +735,7 @@ public function setClockOnWindowMinutes($clock_on_window_minutes) /** * Gets clock_off_window_minutes * - * @return int + * @return int|null */ public function getClockOffWindowMinutes() { @@ -607,12 +745,15 @@ public function getClockOffWindowMinutes() /** * Sets clock_off_window_minutes * - * @param int $clock_off_window_minutes + * @param int|null $clock_off_window_minutes * - * @return $this + * @return self */ public function setClockOffWindowMinutes($clock_off_window_minutes) { + if (is_null($clock_off_window_minutes)) { + throw new \InvalidArgumentException('non-nullable clock_off_window_minutes cannot be null'); + } $this->container['clock_off_window_minutes'] = $clock_off_window_minutes; return $this; @@ -621,7 +762,7 @@ public function setClockOffWindowMinutes($clock_off_window_minutes) /** * Gets iana_time_zone * - * @return string + * @return string|null */ public function getIanaTimeZone() { @@ -631,12 +772,15 @@ public function getIanaTimeZone() /** * Sets iana_time_zone * - * @param string $iana_time_zone + * @param string|null $iana_time_zone * - * @return $this + * @return self */ public function setIanaTimeZone($iana_time_zone) { + if (is_null($iana_time_zone)) { + throw new \InvalidArgumentException('non-nullable iana_time_zone cannot be null'); + } $this->container['iana_time_zone'] = $iana_time_zone; return $this; @@ -645,7 +789,7 @@ public function setIanaTimeZone($iana_time_zone) /** * Gets is_photo_required * - * @return bool + * @return bool|null */ public function getIsPhotoRequired() { @@ -655,12 +799,15 @@ public function getIsPhotoRequired() /** * Sets is_photo_required * - * @param bool $is_photo_required + * @param bool|null $is_photo_required * - * @return $this + * @return self */ public function setIsPhotoRequired($is_photo_required) { + if (is_null($is_photo_required)) { + throw new \InvalidArgumentException('non-nullable is_photo_required cannot be null'); + } $this->container['is_photo_required'] = $is_photo_required; return $this; @@ -669,7 +816,7 @@ public function setIsPhotoRequired($is_photo_required) /** * Gets can_add_employees * - * @return bool + * @return bool|null */ public function getCanAddEmployees() { @@ -679,12 +826,15 @@ public function getCanAddEmployees() /** * Sets can_add_employees * - * @param bool $can_add_employees + * @param bool|null $can_add_employees * - * @return $this + * @return self */ public function setCanAddEmployees($can_add_employees) { + if (is_null($can_add_employees)) { + throw new \InvalidArgumentException('non-nullable can_add_employees cannot be null'); + } $this->container['can_add_employees'] = $can_add_employees; return $this; @@ -693,7 +843,7 @@ public function setCanAddEmployees($can_add_employees) /** * Gets available_to_all_restricted_users_with_kiosk_access * - * @return bool + * @return bool|null */ public function getAvailableToAllRestrictedUsersWithKioskAccess() { @@ -703,12 +853,15 @@ public function getAvailableToAllRestrictedUsersWithKioskAccess() /** * Sets available_to_all_restricted_users_with_kiosk_access * - * @param bool $available_to_all_restricted_users_with_kiosk_access + * @param bool|null $available_to_all_restricted_users_with_kiosk_access * - * @return $this + * @return self */ public function setAvailableToAllRestrictedUsersWithKioskAccess($available_to_all_restricted_users_with_kiosk_access) { + if (is_null($available_to_all_restricted_users_with_kiosk_access)) { + throw new \InvalidArgumentException('non-nullable available_to_all_restricted_users_with_kiosk_access cannot be null'); + } $this->container['available_to_all_restricted_users_with_kiosk_access'] = $available_to_all_restricted_users_with_kiosk_access; return $this; @@ -717,7 +870,7 @@ public function setAvailableToAllRestrictedUsersWithKioskAccess($available_to_al /** * Gets paid_breaks_enabled * - * @return bool + * @return bool|null */ public function getPaidBreaksEnabled() { @@ -727,12 +880,15 @@ public function getPaidBreaksEnabled() /** * Sets paid_breaks_enabled * - * @param bool $paid_breaks_enabled + * @param bool|null $paid_breaks_enabled * - * @return $this + * @return self */ public function setPaidBreaksEnabled($paid_breaks_enabled) { + if (is_null($paid_breaks_enabled)) { + throw new \InvalidArgumentException('non-nullable paid_breaks_enabled cannot be null'); + } $this->container['paid_breaks_enabled'] = $paid_breaks_enabled; return $this; @@ -744,7 +900,7 @@ public function setPaidBreaksEnabled($paid_breaks_enabled) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -754,22 +910,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -785,11 +942,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -797,13 +967,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetBreakManagerModel.php b/src/lib/Model/TimesheetBreakManagerModel.php index 1e4467d..4680220 100644 --- a/src/lib/Model/TimesheetBreakManagerModel.php +++ b/src/lib/Model/TimesheetBreakManagerModel.php @@ -2,61 +2,61 @@ /** * TimesheetBreakManagerModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetBreakManagerModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetBreakManagerModel implements ModelInterface, ArrayAccess +class TimesheetBreakManagerModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetBreakManagerModel'; + protected static $openAPIModelName = 'TimesheetBreakManagerModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'start' => '\DateTime', 'end' => '\DateTime', @@ -71,8 +71,10 @@ class TimesheetBreakManagerModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'start' => 'date-time', 'end' => 'date-time', @@ -83,14 +85,37 @@ class TimesheetBreakManagerModel implements ModelInterface, ArrayAccess 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'start' => false, + 'end' => false, + 'submitted_start' => false, + 'submitted_end' => false, + 'formatted_start' => false, + 'formatted_end' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['submitted_start'] = isset($data['submitted_start']) ? $data['submitted_start'] : null; - $this->container['submitted_end'] = isset($data['submitted_end']) ? $data['submitted_end'] : null; - $this->container['formatted_start'] = isset($data['formatted_start']) ? $data['formatted_start'] : null; - $this->container['formatted_end'] = isset($data['formatted_end']) ? $data['formatted_end'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('submitted_start', $data ?? [], null); + $this->setIfExists('submitted_end', $data ?? [], null); + $this->setIfExists('formatted_start', $data ?? [], null); + $this->setIfExists('formatted_end', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -259,12 +351,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -273,7 +368,7 @@ public function setId($id) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -283,12 +378,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -297,7 +395,7 @@ public function setStart($start) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -307,12 +405,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -321,7 +422,7 @@ public function setEnd($end) /** * Gets submitted_start * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedStart() { @@ -331,12 +432,15 @@ public function getSubmittedStart() /** * Sets submitted_start * - * @param \DateTime $submitted_start + * @param \DateTime|null $submitted_start * - * @return $this + * @return self */ public function setSubmittedStart($submitted_start) { + if (is_null($submitted_start)) { + throw new \InvalidArgumentException('non-nullable submitted_start cannot be null'); + } $this->container['submitted_start'] = $submitted_start; return $this; @@ -345,7 +449,7 @@ public function setSubmittedStart($submitted_start) /** * Gets submitted_end * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedEnd() { @@ -355,12 +459,15 @@ public function getSubmittedEnd() /** * Sets submitted_end * - * @param \DateTime $submitted_end + * @param \DateTime|null $submitted_end * - * @return $this + * @return self */ public function setSubmittedEnd($submitted_end) { + if (is_null($submitted_end)) { + throw new \InvalidArgumentException('non-nullable submitted_end cannot be null'); + } $this->container['submitted_end'] = $submitted_end; return $this; @@ -369,7 +476,7 @@ public function setSubmittedEnd($submitted_end) /** * Gets formatted_start * - * @return string + * @return string|null */ public function getFormattedStart() { @@ -379,12 +486,15 @@ public function getFormattedStart() /** * Sets formatted_start * - * @param string $formatted_start + * @param string|null $formatted_start * - * @return $this + * @return self */ public function setFormattedStart($formatted_start) { + if (is_null($formatted_start)) { + throw new \InvalidArgumentException('non-nullable formatted_start cannot be null'); + } $this->container['formatted_start'] = $formatted_start; return $this; @@ -393,7 +503,7 @@ public function setFormattedStart($formatted_start) /** * Gets formatted_end * - * @return string + * @return string|null */ public function getFormattedEnd() { @@ -403,12 +513,15 @@ public function getFormattedEnd() /** * Sets formatted_end * - * @param string $formatted_end + * @param string|null $formatted_end * - * @return $this + * @return self */ public function setFormattedEnd($formatted_end) { + if (is_null($formatted_end)) { + throw new \InvalidArgumentException('non-nullable formatted_end cannot be null'); + } $this->container['formatted_end'] = $formatted_end; return $this; @@ -417,7 +530,7 @@ public function setFormattedEnd($formatted_end) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -427,12 +540,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -444,7 +560,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetBreakModel.php b/src/lib/Model/TimesheetBreakModel.php index aab5bb1..316f3f5 100644 --- a/src/lib/Model/TimesheetBreakModel.php +++ b/src/lib/Model/TimesheetBreakModel.php @@ -2,61 +2,61 @@ /** * TimesheetBreakModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetBreakModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetBreakModel implements ModelInterface, ArrayAccess +class TimesheetBreakModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetBreakModel'; + protected static $openAPIModelName = 'TimesheetBreakModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'is_paid_break' => 'bool' @@ -66,21 +66,41 @@ class TimesheetBreakModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'start_time' => 'date-time', 'end_time' => 'date-time', 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_time' => false, + 'end_time' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -229,12 +316,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -243,7 +333,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -253,12 +343,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -267,7 +360,7 @@ public function setEndTime($end_time) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -277,12 +370,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -294,7 +390,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetBreakModelv3.php b/src/lib/Model/TimesheetBreakModelv3.php index 0e7e293..fe62f4b 100644 --- a/src/lib/Model/TimesheetBreakModelv3.php +++ b/src/lib/Model/TimesheetBreakModelv3.php @@ -2,61 +2,61 @@ /** * TimesheetBreakModelv3 * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetBreakModelv3 Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetBreakModelv3 implements ModelInterface, ArrayAccess +class TimesheetBreakModelv3 implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetBreakModelv3'; + protected static $openAPIModelName = 'TimesheetBreakModelv3'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'start_time' => '\DateTime', 'end_time' => '\DateTime', 'is_paid_break' => 'bool' @@ -66,21 +66,41 @@ class TimesheetBreakModelv3 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'start_time' => 'date-time', 'end_time' => 'date-time', 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_time' => false, + 'end_time' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -229,12 +316,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -243,7 +333,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -253,12 +343,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -267,7 +360,7 @@ public function setEndTime($end_time) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -277,12 +370,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -294,7 +390,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetBreakSubmitModel.php b/src/lib/Model/TimesheetBreakSubmitModel.php index 314b3e4..510f7e8 100644 --- a/src/lib/Model/TimesheetBreakSubmitModel.php +++ b/src/lib/Model/TimesheetBreakSubmitModel.php @@ -2,61 +2,61 @@ /** * TimesheetBreakSubmitModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetBreakSubmitModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetBreakSubmitModel implements ModelInterface, ArrayAccess +class TimesheetBreakSubmitModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetBreakSubmitModel'; + protected static $openAPIModelName = 'TimesheetBreakSubmitModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'start' => '\DateTime', 'end' => '\DateTime', 'is_paid_break' => 'bool' @@ -66,21 +66,41 @@ class TimesheetBreakSubmitModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'start' => 'date-time', 'end' => 'date-time', 'is_paid_break' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start' => false, + 'end' => false, + 'is_paid_break' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('is_paid_break', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -229,12 +316,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -243,7 +333,7 @@ public function setStart($start) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -253,12 +343,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -267,7 +360,7 @@ public function setEnd($end) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -277,12 +370,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -294,7 +390,7 @@ public function setIsPaidBreak($is_paid_break) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetBreakViewModel.php b/src/lib/Model/TimesheetBreakViewModel.php index 77e9186..c4bd672 100644 --- a/src/lib/Model/TimesheetBreakViewModel.php +++ b/src/lib/Model/TimesheetBreakViewModel.php @@ -2,61 +2,61 @@ /** * TimesheetBreakViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetBreakViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetBreakViewModel implements ModelInterface, ArrayAccess +class TimesheetBreakViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetBreakViewModel'; + protected static $openAPIModelName = 'TimesheetBreakViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'start' => '\DateTime', 'end' => '\DateTime', @@ -71,8 +71,10 @@ class TimesheetBreakViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'start' => 'date-time', 'end' => 'date-time', @@ -83,14 +85,37 @@ class TimesheetBreakViewModel implements ModelInterface, ArrayAccess 'formatted_end' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'start' => false, + 'end' => false, + 'submitted_start' => false, + 'submitted_end' => false, + 'is_paid_break' => false, + 'formatted_start' => false, + 'formatted_end' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['start'] = isset($data['start']) ? $data['start'] : null; - $this->container['end'] = isset($data['end']) ? $data['end'] : null; - $this->container['submitted_start'] = isset($data['submitted_start']) ? $data['submitted_start'] : null; - $this->container['submitted_end'] = isset($data['submitted_end']) ? $data['submitted_end'] : null; - $this->container['is_paid_break'] = isset($data['is_paid_break']) ? $data['is_paid_break'] : null; - $this->container['formatted_start'] = isset($data['formatted_start']) ? $data['formatted_start'] : null; - $this->container['formatted_end'] = isset($data['formatted_end']) ? $data['formatted_end'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('start', $data ?? [], null); + $this->setIfExists('end', $data ?? [], null); + $this->setIfExists('submitted_start', $data ?? [], null); + $this->setIfExists('submitted_end', $data ?? [], null); + $this->setIfExists('is_paid_break', $data ?? [], null); + $this->setIfExists('formatted_start', $data ?? [], null); + $this->setIfExists('formatted_end', $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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -259,12 +351,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -273,7 +368,7 @@ public function setId($id) /** * Gets start * - * @return \DateTime + * @return \DateTime|null */ public function getStart() { @@ -283,12 +378,15 @@ public function getStart() /** * Sets start * - * @param \DateTime $start + * @param \DateTime|null $start * - * @return $this + * @return self */ public function setStart($start) { + if (is_null($start)) { + throw new \InvalidArgumentException('non-nullable start cannot be null'); + } $this->container['start'] = $start; return $this; @@ -297,7 +395,7 @@ public function setStart($start) /** * Gets end * - * @return \DateTime + * @return \DateTime|null */ public function getEnd() { @@ -307,12 +405,15 @@ public function getEnd() /** * Sets end * - * @param \DateTime $end + * @param \DateTime|null $end * - * @return $this + * @return self */ public function setEnd($end) { + if (is_null($end)) { + throw new \InvalidArgumentException('non-nullable end cannot be null'); + } $this->container['end'] = $end; return $this; @@ -321,7 +422,7 @@ public function setEnd($end) /** * Gets submitted_start * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedStart() { @@ -331,12 +432,15 @@ public function getSubmittedStart() /** * Sets submitted_start * - * @param \DateTime $submitted_start + * @param \DateTime|null $submitted_start * - * @return $this + * @return self */ public function setSubmittedStart($submitted_start) { + if (is_null($submitted_start)) { + throw new \InvalidArgumentException('non-nullable submitted_start cannot be null'); + } $this->container['submitted_start'] = $submitted_start; return $this; @@ -345,7 +449,7 @@ public function setSubmittedStart($submitted_start) /** * Gets submitted_end * - * @return \DateTime + * @return \DateTime|null */ public function getSubmittedEnd() { @@ -355,12 +459,15 @@ public function getSubmittedEnd() /** * Sets submitted_end * - * @param \DateTime $submitted_end + * @param \DateTime|null $submitted_end * - * @return $this + * @return self */ public function setSubmittedEnd($submitted_end) { + if (is_null($submitted_end)) { + throw new \InvalidArgumentException('non-nullable submitted_end cannot be null'); + } $this->container['submitted_end'] = $submitted_end; return $this; @@ -369,7 +476,7 @@ public function setSubmittedEnd($submitted_end) /** * Gets is_paid_break * - * @return bool + * @return bool|null */ public function getIsPaidBreak() { @@ -379,12 +486,15 @@ public function getIsPaidBreak() /** * Sets is_paid_break * - * @param bool $is_paid_break + * @param bool|null $is_paid_break * - * @return $this + * @return self */ public function setIsPaidBreak($is_paid_break) { + if (is_null($is_paid_break)) { + throw new \InvalidArgumentException('non-nullable is_paid_break cannot be null'); + } $this->container['is_paid_break'] = $is_paid_break; return $this; @@ -393,7 +503,7 @@ public function setIsPaidBreak($is_paid_break) /** * Gets formatted_start * - * @return string + * @return string|null */ public function getFormattedStart() { @@ -403,12 +513,15 @@ public function getFormattedStart() /** * Sets formatted_start * - * @param string $formatted_start + * @param string|null $formatted_start * - * @return $this + * @return self */ public function setFormattedStart($formatted_start) { + if (is_null($formatted_start)) { + throw new \InvalidArgumentException('non-nullable formatted_start cannot be null'); + } $this->container['formatted_start'] = $formatted_start; return $this; @@ -417,7 +530,7 @@ public function setFormattedStart($formatted_start) /** * Gets formatted_end * - * @return string + * @return string|null */ public function getFormattedEnd() { @@ -427,12 +540,15 @@ public function getFormattedEnd() /** * Sets formatted_end * - * @param string $formatted_end + * @param string|null $formatted_end * - * @return $this + * @return self */ public function setFormattedEnd($formatted_end) { + if (is_null($formatted_end)) { + throw new \InvalidArgumentException('non-nullable formatted_end cannot be null'); + } $this->container['formatted_end'] = $formatted_end; return $this; @@ -444,7 +560,7 @@ public function setFormattedEnd($formatted_end) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +570,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +602,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +627,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetLineCommentsModel.php b/src/lib/Model/TimesheetLineCommentsModel.php index a691c27..d81379d 100644 --- a/src/lib/Model/TimesheetLineCommentsModel.php +++ b/src/lib/Model/TimesheetLineCommentsModel.php @@ -2,61 +2,61 @@ /** * TimesheetLineCommentsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetLineCommentsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetLineCommentsModel implements ModelInterface, ArrayAccess +class TimesheetLineCommentsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetLineCommentsModel'; + protected static $openAPIModelName = 'TimesheetLineCommentsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'comments' => 'string', 'hidden_comments' => 'string' @@ -66,21 +66,41 @@ class TimesheetLineCommentsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'comments' => null, 'hidden_comments' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'comments' => false, + 'hidden_comments' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -88,9 +108,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -165,12 +237,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -187,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('hidden_comments', $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; } /** @@ -219,7 +306,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -229,12 +316,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -243,7 +333,7 @@ public function setId($id) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -253,12 +343,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -267,7 +360,7 @@ public function setComments($comments) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -277,12 +370,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -294,7 +390,7 @@ public function setHiddenComments($hidden_comments) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,22 +400,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -335,11 +432,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -347,13 +457,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetLineModel.php b/src/lib/Model/TimesheetLineModel.php index c217e04..6245dc2 100644 --- a/src/lib/Model/TimesheetLineModel.php +++ b/src/lib/Model/TimesheetLineModel.php @@ -2,72 +2,72 @@ /** * TimesheetLineModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetLineModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetLineModel implements ModelInterface, ArrayAccess +class TimesheetLineModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetLineModel'; + protected static $openAPIModelName = 'TimesheetLineModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', 'start_time' => '\DateTime', 'end_time' => '\DateTime', - 'units' => 'double', + 'units' => 'float', 'work_type_id' => 'string', 'location_id' => 'string', 'comments' => 'string', - 'breaks' => '\Swagger\Client\Model\TimesheetBreakModel[]', + 'breaks' => '\OpenAPI\Client\Model\TimesheetBreakModel[]', 'status' => 'string', - 'rate' => 'double', + 'rate' => 'float', 'leave_category_id' => 'string', 'pay_category_id' => 'string', 'classification_id' => 'string', @@ -78,7 +78,7 @@ class TimesheetLineModel implements ModelInterface, ArrayAccess 'work_type' => 'string', 'fully_qualified_location_name' => 'string', 'classification' => 'string', - 'shift_conditions' => '\Swagger\Client\Model\TimesheetShiftConditionModel[]', + 'shift_conditions' => '\OpenAPI\Client\Model\TimesheetShiftConditionModel[]', 'hidden_comments' => 'string', 'submitted_by_user' => 'string' ]; @@ -87,8 +87,10 @@ class TimesheetLineModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'start_time' => 'date-time', @@ -115,14 +117,53 @@ class TimesheetLineModel implements ModelInterface, ArrayAccess 'submitted_by_user' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'start_time' => false, + 'end_time' => false, + 'units' => false, + 'work_type_id' => false, + 'location_id' => false, + 'comments' => false, + 'breaks' => false, + 'status' => false, + 'rate' => false, + 'leave_category_id' => false, + 'pay_category_id' => false, + 'classification_id' => false, + 'external_id' => false, + 'source' => false, + 'attachment_id' => false, + 'shift_condition_ids' => false, + 'work_type' => false, + 'fully_qualified_location_name' => false, + 'classification' => false, + 'shift_conditions' => false, + 'hidden_comments' => false, + 'submitted_by_user' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -130,9 +171,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -270,88 +363,86 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SOURCE_NONE = 'None'; - const SOURCE_SAASU = 'Saasu'; - const SOURCE_XERO = 'Xero'; - const SOURCE_MYOB = 'MYOB'; - const SOURCE_DEPUTY = 'Deputy'; - const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; - const SOURCE_CLICK_SUPER = 'ClickSuper'; - const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; - const SOURCE_FILE_IMPORT = 'FileImport'; - const SOURCE_FILE_EXPORT = 'FileExport'; - const SOURCE_QUICK_BOOKS = 'QuickBooks'; - const SOURCE_HARMONY = 'Harmony'; - const SOURCE_AWARD_STORE = 'AwardStore'; - const SOURCE_ATTACHE = 'Attache'; - const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; - const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; - const SOURCE_API = 'API'; - const SOURCE_MICRO_POWER = 'MicroPower'; - const SOURCE_ROSTER_LIVE = 'RosterLive'; - const SOURCE_NET_SUITE = 'NetSuite'; - const SOURCE_KOUNTA = 'Kounta'; - const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; - const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; - const SOURCE_JONAS_PREMIER = 'JonasPremier'; - const SOURCE_WAGE_EASY = 'WageEasy'; - const SOURCE_MAESTRANO = 'Maestrano'; - const SOURCE_WORK_ZONE = 'WorkZone'; - const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; - const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; - const SOURCE_ONBOARDING = 'Onboarding'; - const SOURCE_ADMIN = 'Admin'; - const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; - const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; - const SOURCE_SAGE50 = 'Sage50'; - const SOURCE_PENSION_SYNC = 'PensionSync'; - const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; - const SOURCE_PRONTO_XI = 'ProntoXI'; - const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; - const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; - const SOURCE_BEAM = 'Beam'; - const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; - const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; - const SOURCE_WIISE = 'Wiise'; - const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; - const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; - const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; - const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; - const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; - const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; - const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; - const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; - const SOURCE_O_AUTH = 'OAuth'; - const SOURCE_FRESH_BOOKS = 'FreshBooks'; - const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; - const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; - const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; - const SOURCE_TELLEROO = 'Telleroo'; - const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; - const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; - const SOURCE_PAYTRON = 'Paytron'; - const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; - const SOURCE_COMMA = 'Comma'; - const SOURCE_ZOHO = 'Zoho'; - const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; - const SOURCE_TWINFIELD = 'Twinfield'; - const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; - const SOURCE_SQUARE = 'Square'; - const SOURCE_QUICKFILE = 'Quickfile'; - const SOURCE_TIDE = 'Tide'; - const SOURCE_TIDE_SSO = 'TideSso'; - const SOURCE_FREE_AGENT = 'FreeAgent'; - const SOURCE_AKAHU = 'Akahu'; - const SOURCE_INSTA_PAY = 'InstaPay'; - const SOURCE_ZEPTO = 'Zepto'; - const SOURCE_SLACK = 'Slack'; - const SOURCE_CAXTON = 'Caxton'; - - - + return self::$openAPIModelName; + } + + public const SOURCE_NONE = 'None'; + public const SOURCE_SAASU = 'Saasu'; + public const SOURCE_XERO = 'Xero'; + public const SOURCE_MYOB = 'MYOB'; + public const SOURCE_DEPUTY = 'Deputy'; + public const SOURCE_EMPLOYEE_TIME_PUNCH = 'EmployeeTimePunch'; + public const SOURCE_CLICK_SUPER = 'ClickSuper'; + public const SOURCE_INTEGRATED_TIMESHEETS = 'IntegratedTimesheets'; + public const SOURCE_FILE_IMPORT = 'FileImport'; + public const SOURCE_FILE_EXPORT = 'FileExport'; + public const SOURCE_QUICK_BOOKS = 'QuickBooks'; + public const SOURCE_HARMONY = 'Harmony'; + public const SOURCE_AWARD_STORE = 'AwardStore'; + public const SOURCE_ATTACHE = 'Attache'; + public const SOURCE_INTEGRATED_ROSTERING = 'IntegratedRostering'; + public const SOURCE_RECKON_ACCOUNTS = 'ReckonAccounts'; + public const SOURCE_API = 'API'; + public const SOURCE_MICRO_POWER = 'MicroPower'; + public const SOURCE_ROSTER_LIVE = 'RosterLive'; + public const SOURCE_NET_SUITE = 'NetSuite'; + public const SOURCE_KOUNTA = 'Kounta'; + public const SOURCE_TIME_AND_ATTENDANCE_KIOSK = 'TimeAndAttendanceKiosk'; + public const SOURCE_DETAILED_FILE_EXPORT = 'DetailedFileExport'; + public const SOURCE_JONAS_PREMIER = 'JonasPremier'; + public const SOURCE_WAGE_EASY = 'WageEasy'; + public const SOURCE_MAESTRANO = 'Maestrano'; + public const SOURCE_WORK_ZONE = 'WorkZone'; + public const SOURCE_EMPLOYEE_PORTAL = 'EmployeePortal'; + public const SOURCE_ROSTER_TEMPLATE = 'RosterTemplate'; + public const SOURCE_ONBOARDING = 'Onboarding'; + public const SOURCE_ADMIN = 'Admin'; + public const SOURCE_WORK_ZONE_CLOCK_ON_OFF = 'WorkZoneClockOnOff'; + public const SOURCE_NET_SUITE_ONE_WORLD = 'NetSuiteOneWorld'; + public const SOURCE_SAGE50 = 'Sage50'; + public const SOURCE_PENSION_SYNC = 'PensionSync'; + public const SOURCE_FINANCIALS_OFFICE = 'FinancialsOffice'; + public const SOURCE_PRONTO_XI = 'ProntoXI'; + public const SOURCE_PAY_RUN_DEFAULT = 'PayRunDefault'; + public const SOURCE_STANDARD_WORK_DAY = 'StandardWorkDay'; + public const SOURCE_BEAM = 'Beam'; + public const SOURCE_PAY_RUN_AUTOMATION = 'PayRunAutomation'; + public const SOURCE_BUREAU_DASHBOARD = 'BureauDashboard'; + public const SOURCE_WIISE = 'Wiise'; + public const SOURCE_QBO_MIGRATION_TOOL = 'QBOMigrationTool'; + public const SOURCE_ABRIDGED_FILE_IMPORT = 'AbridgedFileImport'; + public const SOURCE_QBO_FORCED_MIGRATION = 'QBOForcedMigration'; + public const SOURCE_HMRC_DPS_UPDATE = 'HmrcDpsUpdate'; + public const SOURCE_HMRC_DPS_STUDENT_LOAN = 'HmrcDpsStudentLoan'; + public const SOURCE_HMRC_DPS_POST_GRAD_LOAN = 'HmrcDpsPostGradLoan'; + public const SOURCE_SAGE50_FILE_IMPORTER = 'Sage50FileImporter'; + public const SOURCE_FPS_FILE_IMPORTER = 'FPSFileImporter'; + public const SOURCE_O_AUTH = 'OAuth'; + public const SOURCE_FRESH_BOOKS = 'FreshBooks'; + public const SOURCE_STAR_FILE_IMPORTER = 'StarFileImporter'; + public const SOURCE_ACTIVE_CAMPAIGN = 'ActiveCampaign'; + public const SOURCE_SUMMARY_AND_DETAILS_EXPORT = 'SummaryAndDetailsExport'; + public const SOURCE_TELLEROO = 'Telleroo'; + public const SOURCE_EMPLOYEE_ADVANCED_HOURS_UPLOAD = 'EmployeeAdvancedHoursUpload'; + public const SOURCE_BUSINESS_CENTRAL = 'BusinessCentral'; + public const SOURCE_PAYTRON = 'Paytron'; + public const SOURCE_ACCESS_FINANCIALS = 'AccessFinancials'; + public const SOURCE_COMMA = 'Comma'; + public const SOURCE_ZOHO = 'Zoho'; + public const SOURCE_FLAT_FILE_EMPLOYEE_IMPORTER = 'FlatFileEmployeeImporter'; + public const SOURCE_TWINFIELD = 'Twinfield'; + public const SOURCE_SAGE_ACCOUNTING = 'SageAccounting'; + public const SOURCE_SQUARE = 'Square'; + public const SOURCE_QUICKFILE = 'Quickfile'; + public const SOURCE_TIDE = 'Tide'; + public const SOURCE_TIDE_SSO = 'TideSso'; + public const SOURCE_FREE_AGENT = 'FreeAgent'; + public const SOURCE_AKAHU = 'Akahu'; + public const SOURCE_INSTA_PAY = 'InstaPay'; + public const SOURCE_ZEPTO = 'Zepto'; + public const SOURCE_SLACK = 'Slack'; + public const SOURCE_CAXTON = 'Caxton'; + /** * Gets allowable values of the enum * @@ -438,7 +529,6 @@ public function getSourceAllowableValues() self::SOURCE_CAXTON, ]; } - /** * Associative array for storing property values @@ -455,30 +545,48 @@ public function getSourceAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null; - $this->container['end_time'] = isset($data['end_time']) ? $data['end_time'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['comments'] = isset($data['comments']) ? $data['comments'] : null; - $this->container['breaks'] = isset($data['breaks']) ? $data['breaks'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['rate'] = isset($data['rate']) ? $data['rate'] : null; - $this->container['leave_category_id'] = isset($data['leave_category_id']) ? $data['leave_category_id'] : null; - $this->container['pay_category_id'] = isset($data['pay_category_id']) ? $data['pay_category_id'] : null; - $this->container['classification_id'] = isset($data['classification_id']) ? $data['classification_id'] : null; - $this->container['external_id'] = isset($data['external_id']) ? $data['external_id'] : null; - $this->container['source'] = isset($data['source']) ? $data['source'] : null; - $this->container['attachment_id'] = isset($data['attachment_id']) ? $data['attachment_id'] : null; - $this->container['shift_condition_ids'] = isset($data['shift_condition_ids']) ? $data['shift_condition_ids'] : null; - $this->container['work_type'] = isset($data['work_type']) ? $data['work_type'] : null; - $this->container['fully_qualified_location_name'] = isset($data['fully_qualified_location_name']) ? $data['fully_qualified_location_name'] : null; - $this->container['classification'] = isset($data['classification']) ? $data['classification'] : null; - $this->container['shift_conditions'] = isset($data['shift_conditions']) ? $data['shift_conditions'] : null; - $this->container['hidden_comments'] = isset($data['hidden_comments']) ? $data['hidden_comments'] : null; - $this->container['submitted_by_user'] = isset($data['submitted_by_user']) ? $data['submitted_by_user'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('comments', $data ?? [], null); + $this->setIfExists('breaks', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('rate', $data ?? [], null); + $this->setIfExists('leave_category_id', $data ?? [], null); + $this->setIfExists('pay_category_id', $data ?? [], null); + $this->setIfExists('classification_id', $data ?? [], null); + $this->setIfExists('external_id', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('attachment_id', $data ?? [], null); + $this->setIfExists('shift_condition_ids', $data ?? [], null); + $this->setIfExists('work_type', $data ?? [], null); + $this->setIfExists('fully_qualified_location_name', $data ?? [], null); + $this->setIfExists('classification', $data ?? [], null); + $this->setIfExists('shift_conditions', $data ?? [], null); + $this->setIfExists('hidden_comments', $data ?? [], null); + $this->setIfExists('submitted_by_user', $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; } /** @@ -493,7 +601,8 @@ public function listInvalidProperties() $allowedValues = $this->getSourceAllowableValues(); if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'source', must be one of '%s'", + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], implode("', '", $allowedValues) ); } @@ -516,7 +625,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -526,12 +635,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -540,7 +652,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -550,12 +662,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -564,7 +679,7 @@ public function setEmployeeId($employee_id) /** * Gets start_time * - * @return \DateTime + * @return \DateTime|null */ public function getStartTime() { @@ -574,12 +689,15 @@ public function getStartTime() /** * Sets start_time * - * @param \DateTime $start_time + * @param \DateTime|null $start_time * - * @return $this + * @return self */ public function setStartTime($start_time) { + if (is_null($start_time)) { + throw new \InvalidArgumentException('non-nullable start_time cannot be null'); + } $this->container['start_time'] = $start_time; return $this; @@ -588,7 +706,7 @@ public function setStartTime($start_time) /** * Gets end_time * - * @return \DateTime + * @return \DateTime|null */ public function getEndTime() { @@ -598,12 +716,15 @@ public function getEndTime() /** * Sets end_time * - * @param \DateTime $end_time + * @param \DateTime|null $end_time * - * @return $this + * @return self */ public function setEndTime($end_time) { + if (is_null($end_time)) { + throw new \InvalidArgumentException('non-nullable end_time cannot be null'); + } $this->container['end_time'] = $end_time; return $this; @@ -612,7 +733,7 @@ public function setEndTime($end_time) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -622,12 +743,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -636,7 +760,7 @@ public function setUnits($units) /** * Gets work_type_id * - * @return string + * @return string|null */ public function getWorkTypeId() { @@ -646,12 +770,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param string $work_type_id + * @param string|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -660,7 +787,7 @@ public function setWorkTypeId($work_type_id) /** * Gets location_id * - * @return string + * @return string|null */ public function getLocationId() { @@ -670,12 +797,15 @@ public function getLocationId() /** * Sets location_id * - * @param string $location_id + * @param string|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -684,7 +814,7 @@ public function setLocationId($location_id) /** * Gets comments * - * @return string + * @return string|null */ public function getComments() { @@ -694,12 +824,15 @@ public function getComments() /** * Sets comments * - * @param string $comments + * @param string|null $comments * - * @return $this + * @return self */ public function setComments($comments) { + if (is_null($comments)) { + throw new \InvalidArgumentException('non-nullable comments cannot be null'); + } $this->container['comments'] = $comments; return $this; @@ -708,7 +841,7 @@ public function setComments($comments) /** * Gets breaks * - * @return \Swagger\Client\Model\TimesheetBreakModel[] + * @return \OpenAPI\Client\Model\TimesheetBreakModel[]|null */ public function getBreaks() { @@ -718,12 +851,15 @@ public function getBreaks() /** * Sets breaks * - * @param \Swagger\Client\Model\TimesheetBreakModel[] $breaks + * @param \OpenAPI\Client\Model\TimesheetBreakModel[]|null $breaks * - * @return $this + * @return self */ public function setBreaks($breaks) { + if (is_null($breaks)) { + throw new \InvalidArgumentException('non-nullable breaks cannot be null'); + } $this->container['breaks'] = $breaks; return $this; @@ -732,7 +868,7 @@ public function setBreaks($breaks) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -742,12 +878,15 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -756,7 +895,7 @@ public function setStatus($status) /** * Gets rate * - * @return double + * @return float|null */ public function getRate() { @@ -766,12 +905,15 @@ public function getRate() /** * Sets rate * - * @param double $rate + * @param float|null $rate * - * @return $this + * @return self */ public function setRate($rate) { + if (is_null($rate)) { + throw new \InvalidArgumentException('non-nullable rate cannot be null'); + } $this->container['rate'] = $rate; return $this; @@ -780,7 +922,7 @@ public function setRate($rate) /** * Gets leave_category_id * - * @return string + * @return string|null */ public function getLeaveCategoryId() { @@ -790,12 +932,15 @@ public function getLeaveCategoryId() /** * Sets leave_category_id * - * @param string $leave_category_id + * @param string|null $leave_category_id * - * @return $this + * @return self */ public function setLeaveCategoryId($leave_category_id) { + if (is_null($leave_category_id)) { + throw new \InvalidArgumentException('non-nullable leave_category_id cannot be null'); + } $this->container['leave_category_id'] = $leave_category_id; return $this; @@ -804,7 +949,7 @@ public function setLeaveCategoryId($leave_category_id) /** * Gets pay_category_id * - * @return string + * @return string|null */ public function getPayCategoryId() { @@ -814,12 +959,15 @@ public function getPayCategoryId() /** * Sets pay_category_id * - * @param string $pay_category_id + * @param string|null $pay_category_id * - * @return $this + * @return self */ public function setPayCategoryId($pay_category_id) { + if (is_null($pay_category_id)) { + throw new \InvalidArgumentException('non-nullable pay_category_id cannot be null'); + } $this->container['pay_category_id'] = $pay_category_id; return $this; @@ -828,7 +976,7 @@ public function setPayCategoryId($pay_category_id) /** * Gets classification_id * - * @return string + * @return string|null */ public function getClassificationId() { @@ -838,12 +986,15 @@ public function getClassificationId() /** * Sets classification_id * - * @param string $classification_id + * @param string|null $classification_id * - * @return $this + * @return self */ public function setClassificationId($classification_id) { + if (is_null($classification_id)) { + throw new \InvalidArgumentException('non-nullable classification_id cannot be null'); + } $this->container['classification_id'] = $classification_id; return $this; @@ -852,7 +1003,7 @@ public function setClassificationId($classification_id) /** * Gets external_id * - * @return string + * @return string|null */ public function getExternalId() { @@ -862,12 +1013,15 @@ public function getExternalId() /** * Sets external_id * - * @param string $external_id + * @param string|null $external_id * - * @return $this + * @return self */ public function setExternalId($external_id) { + if (is_null($external_id)) { + throw new \InvalidArgumentException('non-nullable external_id cannot be null'); + } $this->container['external_id'] = $external_id; return $this; @@ -876,7 +1030,7 @@ public function setExternalId($external_id) /** * Gets source * - * @return string + * @return string|null */ public function getSource() { @@ -886,17 +1040,21 @@ public function getSource() /** * Sets source * - * @param string $source + * @param string|null $source * - * @return $this + * @return self */ public function setSource($source) { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } $allowedValues = $this->getSourceAllowableValues(); - if (!is_null($source) && !in_array($source, $allowedValues, true)) { + if (!in_array($source, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'source', must be one of '%s'", + "Invalid value '%s' for 'source', must be one of '%s'", + $source, implode("', '", $allowedValues) ) ); @@ -909,7 +1067,7 @@ public function setSource($source) /** * Gets attachment_id * - * @return int + * @return int|null */ public function getAttachmentId() { @@ -919,12 +1077,15 @@ public function getAttachmentId() /** * Sets attachment_id * - * @param int $attachment_id + * @param int|null $attachment_id * - * @return $this + * @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; @@ -933,7 +1094,7 @@ public function setAttachmentId($attachment_id) /** * Gets shift_condition_ids * - * @return string[] + * @return string[]|null */ public function getShiftConditionIds() { @@ -943,12 +1104,15 @@ public function getShiftConditionIds() /** * Sets shift_condition_ids * - * @param string[] $shift_condition_ids + * @param string[]|null $shift_condition_ids * - * @return $this + * @return self */ public function setShiftConditionIds($shift_condition_ids) { + if (is_null($shift_condition_ids)) { + throw new \InvalidArgumentException('non-nullable shift_condition_ids cannot be null'); + } $this->container['shift_condition_ids'] = $shift_condition_ids; return $this; @@ -957,7 +1121,7 @@ public function setShiftConditionIds($shift_condition_ids) /** * Gets work_type * - * @return string + * @return string|null */ public function getWorkType() { @@ -967,12 +1131,15 @@ public function getWorkType() /** * Sets work_type * - * @param string $work_type + * @param string|null $work_type * - * @return $this + * @return self */ public function setWorkType($work_type) { + if (is_null($work_type)) { + throw new \InvalidArgumentException('non-nullable work_type cannot be null'); + } $this->container['work_type'] = $work_type; return $this; @@ -981,7 +1148,7 @@ public function setWorkType($work_type) /** * Gets fully_qualified_location_name * - * @return string + * @return string|null */ public function getFullyQualifiedLocationName() { @@ -991,12 +1158,15 @@ public function getFullyQualifiedLocationName() /** * Sets fully_qualified_location_name * - * @param string $fully_qualified_location_name + * @param string|null $fully_qualified_location_name * - * @return $this + * @return self */ public function setFullyQualifiedLocationName($fully_qualified_location_name) { + if (is_null($fully_qualified_location_name)) { + throw new \InvalidArgumentException('non-nullable fully_qualified_location_name cannot be null'); + } $this->container['fully_qualified_location_name'] = $fully_qualified_location_name; return $this; @@ -1005,7 +1175,7 @@ public function setFullyQualifiedLocationName($fully_qualified_location_name) /** * Gets classification * - * @return string + * @return string|null */ public function getClassification() { @@ -1015,12 +1185,15 @@ public function getClassification() /** * Sets classification * - * @param string $classification + * @param string|null $classification * - * @return $this + * @return self */ public function setClassification($classification) { + if (is_null($classification)) { + throw new \InvalidArgumentException('non-nullable classification cannot be null'); + } $this->container['classification'] = $classification; return $this; @@ -1029,7 +1202,7 @@ public function setClassification($classification) /** * Gets shift_conditions * - * @return \Swagger\Client\Model\TimesheetShiftConditionModel[] + * @return \OpenAPI\Client\Model\TimesheetShiftConditionModel[]|null */ public function getShiftConditions() { @@ -1039,12 +1212,15 @@ public function getShiftConditions() /** * Sets shift_conditions * - * @param \Swagger\Client\Model\TimesheetShiftConditionModel[] $shift_conditions + * @param \OpenAPI\Client\Model\TimesheetShiftConditionModel[]|null $shift_conditions * - * @return $this + * @return self */ public function setShiftConditions($shift_conditions) { + if (is_null($shift_conditions)) { + throw new \InvalidArgumentException('non-nullable shift_conditions cannot be null'); + } $this->container['shift_conditions'] = $shift_conditions; return $this; @@ -1053,7 +1229,7 @@ public function setShiftConditions($shift_conditions) /** * Gets hidden_comments * - * @return string + * @return string|null */ public function getHiddenComments() { @@ -1063,12 +1239,15 @@ public function getHiddenComments() /** * Sets hidden_comments * - * @param string $hidden_comments + * @param string|null $hidden_comments * - * @return $this + * @return self */ public function setHiddenComments($hidden_comments) { + if (is_null($hidden_comments)) { + throw new \InvalidArgumentException('non-nullable hidden_comments cannot be null'); + } $this->container['hidden_comments'] = $hidden_comments; return $this; @@ -1077,7 +1256,7 @@ public function setHiddenComments($hidden_comments) /** * Gets submitted_by_user * - * @return string + * @return string|null */ public function getSubmittedByUser() { @@ -1087,12 +1266,15 @@ public function getSubmittedByUser() /** * Sets submitted_by_user * - * @param string $submitted_by_user + * @param string|null $submitted_by_user * - * @return $this + * @return self */ public function setSubmittedByUser($submitted_by_user) { + if (is_null($submitted_by_user)) { + throw new \InvalidArgumentException('non-nullable submitted_by_user cannot be null'); + } $this->container['submitted_by_user'] = $submitted_by_user; return $this; @@ -1104,7 +1286,7 @@ public function setSubmittedByUser($submitted_by_user) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1114,22 +1296,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1145,11 +1328,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -1157,13 +1353,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetReportRequestModel.php b/src/lib/Model/TimesheetReportRequestModel.php index 71ec909..aab11c3 100644 --- a/src/lib/Model/TimesheetReportRequestModel.php +++ b/src/lib/Model/TimesheetReportRequestModel.php @@ -2,61 +2,61 @@ /** * TimesheetReportRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetReportRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetReportRequestModel implements ModelInterface, ArrayAccess +class TimesheetReportRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetReportRequestModel'; + protected static $openAPIModelName = 'TimesheetReportRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'include_costs' => 'bool', 'statuses' => 'string[]', @@ -73,8 +73,10 @@ class TimesheetReportRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'include_costs' => null, 'statuses' => null, @@ -87,14 +89,39 @@ class TimesheetReportRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'include_costs' => false, + 'statuses' => false, + 'work_type_id' => false, + 'pay_schedule_id' => false, + 'include_post_tax_deductions' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -200,17 +279,15 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUSES_MISSING = 'Missing'; - const STATUSES_SUBMITTED = 'Submitted'; - const STATUSES_APPROVED = 'Approved'; - const STATUSES_REJECTED = 'Rejected'; - const STATUSES_PROCESSED = 'Processed'; - + public const STATUSES_MISSING = 'Missing'; + public const STATUSES_SUBMITTED = 'Submitted'; + public const STATUSES_APPROVED = 'Approved'; + public const STATUSES_REJECTED = 'Rejected'; + public const STATUSES_PROCESSED = 'Processed'; - /** * Gets allowable values of the enum * @@ -226,7 +303,6 @@ public function getStatusesAllowableValues() self::STATUSES_PROCESSED, ]; } - /** * Associative array for storing property values @@ -243,16 +319,34 @@ public function getStatusesAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['include_costs'] = isset($data['include_costs']) ? $data['include_costs'] : null; - $this->container['statuses'] = isset($data['statuses']) ? $data['statuses'] : null; - $this->container['work_type_id'] = isset($data['work_type_id']) ? $data['work_type_id'] : null; - $this->container['pay_schedule_id'] = isset($data['pay_schedule_id']) ? $data['pay_schedule_id'] : null; - $this->container['include_post_tax_deductions'] = isset($data['include_post_tax_deductions']) ? $data['include_post_tax_deductions'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('include_costs', $data ?? [], null); + $this->setIfExists('statuses', $data ?? [], null); + $this->setIfExists('work_type_id', $data ?? [], null); + $this->setIfExists('pay_schedule_id', $data ?? [], null); + $this->setIfExists('include_post_tax_deductions', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -282,7 +376,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -292,12 +386,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -306,7 +403,7 @@ public function setEmployeeId($employee_id) /** * Gets include_costs * - * @return bool + * @return bool|null */ public function getIncludeCosts() { @@ -316,12 +413,15 @@ public function getIncludeCosts() /** * Sets include_costs * - * @param bool $include_costs + * @param bool|null $include_costs * - * @return $this + * @return self */ public function setIncludeCosts($include_costs) { + if (is_null($include_costs)) { + throw new \InvalidArgumentException('non-nullable include_costs cannot be null'); + } $this->container['include_costs'] = $include_costs; return $this; @@ -330,7 +430,7 @@ public function setIncludeCosts($include_costs) /** * Gets statuses * - * @return string[] + * @return string[]|null */ public function getStatuses() { @@ -340,14 +440,17 @@ public function getStatuses() /** * Sets statuses * - * @param string[] $statuses + * @param string[]|null $statuses * - * @return $this + * @return self */ public function setStatuses($statuses) { + if (is_null($statuses)) { + throw new \InvalidArgumentException('non-nullable statuses cannot be null'); + } $allowedValues = $this->getStatusesAllowableValues(); - if (!is_null($statuses) && array_diff($statuses, $allowedValues)) { + if (array_diff($statuses, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'statuses', must be one of '%s'", @@ -363,7 +466,7 @@ public function setStatuses($statuses) /** * Gets work_type_id * - * @return int + * @return int|null */ public function getWorkTypeId() { @@ -373,12 +476,15 @@ public function getWorkTypeId() /** * Sets work_type_id * - * @param int $work_type_id + * @param int|null $work_type_id * - * @return $this + * @return self */ public function setWorkTypeId($work_type_id) { + if (is_null($work_type_id)) { + throw new \InvalidArgumentException('non-nullable work_type_id cannot be null'); + } $this->container['work_type_id'] = $work_type_id; return $this; @@ -387,7 +493,7 @@ public function setWorkTypeId($work_type_id) /** * Gets pay_schedule_id * - * @return int + * @return int|null */ public function getPayScheduleId() { @@ -397,12 +503,15 @@ public function getPayScheduleId() /** * Sets pay_schedule_id * - * @param int $pay_schedule_id + * @param int|null $pay_schedule_id * - * @return $this + * @return self */ public function setPayScheduleId($pay_schedule_id) { + if (is_null($pay_schedule_id)) { + throw new \InvalidArgumentException('non-nullable pay_schedule_id cannot be null'); + } $this->container['pay_schedule_id'] = $pay_schedule_id; return $this; @@ -411,7 +520,7 @@ public function setPayScheduleId($pay_schedule_id) /** * Gets include_post_tax_deductions * - * @return bool + * @return bool|null */ public function getIncludePostTaxDeductions() { @@ -421,12 +530,15 @@ public function getIncludePostTaxDeductions() /** * Sets include_post_tax_deductions * - * @param bool $include_post_tax_deductions + * @param bool|null $include_post_tax_deductions * - * @return $this + * @return self */ public function setIncludePostTaxDeductions($include_post_tax_deductions) { + if (is_null($include_post_tax_deductions)) { + throw new \InvalidArgumentException('non-nullable include_post_tax_deductions cannot be null'); + } $this->container['include_post_tax_deductions'] = $include_post_tax_deductions; return $this; @@ -435,7 +547,7 @@ public function setIncludePostTaxDeductions($include_post_tax_deductions) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -445,12 +557,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -459,7 +574,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -469,12 +584,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -483,7 +601,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -493,12 +611,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -507,7 +628,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -517,12 +638,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -534,7 +658,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -544,22 +668,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -575,11 +700,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -587,13 +725,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetRequestFilterModel.php b/src/lib/Model/TimesheetRequestFilterModel.php index 7007888..db0547f 100644 --- a/src/lib/Model/TimesheetRequestFilterModel.php +++ b/src/lib/Model/TimesheetRequestFilterModel.php @@ -2,61 +2,61 @@ /** * TimesheetRequestFilterModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetRequestFilterModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetRequestFilterModel implements ModelInterface, ArrayAccess +class TimesheetRequestFilterModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetRequestFilterModel'; + protected static $openAPIModelName = 'TimesheetRequestFilterModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime', 'status' => 'string', @@ -73,8 +73,10 @@ class TimesheetRequestFilterModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time', 'status' => null, @@ -87,14 +89,39 @@ class TimesheetRequestFilterModel implements ModelInterface, ArrayAccess 'order_by' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => false, + 'status' => false, + 'employee_id' => false, + 'employee_group_id' => false, + 'location_id' => false, + 'include_costs' => false, + 'current_page' => false, + 'page_size' => false, + 'order_by' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -200,23 +279,21 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const STATUS_SUBMITTED = 'Submitted'; - const STATUS_APPROVED = 'Approved'; - const STATUS_REJECTED = 'Rejected'; - const STATUS_PROCESSED = 'Processed'; - const STATUS_ANY_EXCEPT_REJECTED = 'AnyExceptRejected'; - const ORDER_BY_LOCATION = 'Location'; - const ORDER_BY_WORK_TYPE = 'WorkType'; - const ORDER_BY_EMPLOYEE = 'Employee'; - const ORDER_BY_DATE = 'Date'; - const ORDER_BY_DEFAULT_LOCATION = 'DefaultLocation'; - const ORDER_BY_PAY_SCHEDULE = 'PaySchedule'; - + public const STATUS_SUBMITTED = 'Submitted'; + public const STATUS_APPROVED = 'Approved'; + public const STATUS_REJECTED = 'Rejected'; + public const STATUS_PROCESSED = 'Processed'; + public const STATUS_ANY_EXCEPT_REJECTED = 'AnyExceptRejected'; + public const ORDER_BY_LOCATION = 'Location'; + public const ORDER_BY_WORK_TYPE = 'WorkType'; + public const ORDER_BY_EMPLOYEE = 'Employee'; + public const ORDER_BY_DATE = 'Date'; + public const ORDER_BY_DEFAULT_LOCATION = 'DefaultLocation'; + public const ORDER_BY_PAY_SCHEDULE = 'PaySchedule'; - /** * Gets allowable values of the enum * @@ -232,7 +309,7 @@ public function getStatusAllowableValues() self::STATUS_ANY_EXCEPT_REJECTED, ]; } - + /** * Gets allowable values of the enum * @@ -249,7 +326,6 @@ public function getOrderByAllowableValues() self::ORDER_BY_PAY_SCHEDULE, ]; } - /** * Associative array for storing property values @@ -266,16 +342,34 @@ public function getOrderByAllowableValues() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['employee_group_id'] = isset($data['employee_group_id']) ? $data['employee_group_id'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['include_costs'] = isset($data['include_costs']) ? $data['include_costs'] : null; - $this->container['current_page'] = isset($data['current_page']) ? $data['current_page'] : null; - $this->container['page_size'] = isset($data['page_size']) ? $data['page_size'] : null; - $this->container['order_by'] = isset($data['order_by']) ? $data['order_by'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('employee_group_id', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('include_costs', $data ?? [], null); + $this->setIfExists('current_page', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('order_by', $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; } /** @@ -290,7 +384,8 @@ public function listInvalidProperties() $allowedValues = $this->getStatusAllowableValues(); if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'status', must be one of '%s'", + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } @@ -298,7 +393,8 @@ public function listInvalidProperties() $allowedValues = $this->getOrderByAllowableValues(); if (!is_null($this->container['order_by']) && !in_array($this->container['order_by'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'order_by', must be one of '%s'", + "invalid value '%s' for 'order_by', must be one of '%s'", + $this->container['order_by'], implode("', '", $allowedValues) ); } @@ -321,7 +417,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -331,12 +427,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -345,7 +444,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -355,12 +454,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -369,7 +471,7 @@ public function setToDate($to_date) /** * Gets status * - * @return string + * @return string|null */ public function getStatus() { @@ -379,17 +481,21 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string|null $status * - * @return $this + * @return self */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'status', must be one of '%s'", + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); @@ -402,7 +508,7 @@ public function setStatus($status) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -412,12 +518,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -426,7 +535,7 @@ public function setEmployeeId($employee_id) /** * Gets employee_group_id * - * @return int + * @return int|null */ public function getEmployeeGroupId() { @@ -436,12 +545,15 @@ public function getEmployeeGroupId() /** * Sets employee_group_id * - * @param int $employee_group_id + * @param int|null $employee_group_id * - * @return $this + * @return self */ public function setEmployeeGroupId($employee_group_id) { + if (is_null($employee_group_id)) { + throw new \InvalidArgumentException('non-nullable employee_group_id cannot be null'); + } $this->container['employee_group_id'] = $employee_group_id; return $this; @@ -450,7 +562,7 @@ public function setEmployeeGroupId($employee_group_id) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -460,12 +572,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -474,7 +589,7 @@ public function setLocationId($location_id) /** * Gets include_costs * - * @return bool + * @return bool|null */ public function getIncludeCosts() { @@ -484,12 +599,15 @@ public function getIncludeCosts() /** * Sets include_costs * - * @param bool $include_costs + * @param bool|null $include_costs * - * @return $this + * @return self */ public function setIncludeCosts($include_costs) { + if (is_null($include_costs)) { + throw new \InvalidArgumentException('non-nullable include_costs cannot be null'); + } $this->container['include_costs'] = $include_costs; return $this; @@ -498,7 +616,7 @@ public function setIncludeCosts($include_costs) /** * Gets current_page * - * @return int + * @return int|null */ public function getCurrentPage() { @@ -508,12 +626,15 @@ public function getCurrentPage() /** * Sets current_page * - * @param int $current_page + * @param int|null $current_page * - * @return $this + * @return self */ public function setCurrentPage($current_page) { + if (is_null($current_page)) { + throw new \InvalidArgumentException('non-nullable current_page cannot be null'); + } $this->container['current_page'] = $current_page; return $this; @@ -522,7 +643,7 @@ public function setCurrentPage($current_page) /** * Gets page_size * - * @return int + * @return int|null */ public function getPageSize() { @@ -532,12 +653,15 @@ public function getPageSize() /** * Sets page_size * - * @param int $page_size + * @param int|null $page_size * - * @return $this + * @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; @@ -546,7 +670,7 @@ public function setPageSize($page_size) /** * Gets order_by * - * @return string + * @return string|null */ public function getOrderBy() { @@ -556,17 +680,21 @@ public function getOrderBy() /** * Sets order_by * - * @param string $order_by + * @param string|null $order_by * - * @return $this + * @return self */ public function setOrderBy($order_by) { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } $allowedValues = $this->getOrderByAllowableValues(); - if (!is_null($order_by) && !in_array($order_by, $allowedValues, true)) { + if (!in_array($order_by, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'order_by', must be one of '%s'", + "Invalid value '%s' for 'order_by', must be one of '%s'", + $order_by, implode("', '", $allowedValues) ) ); @@ -582,7 +710,7 @@ public function setOrderBy($order_by) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -592,22 +720,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -623,11 +752,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -635,13 +777,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetRoundingRulesModel.php b/src/lib/Model/TimesheetRoundingRulesModel.php index 9b02cd8..1278cbd 100644 --- a/src/lib/Model/TimesheetRoundingRulesModel.php +++ b/src/lib/Model/TimesheetRoundingRulesModel.php @@ -2,61 +2,61 @@ /** * TimesheetRoundingRulesModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetRoundingRulesModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetRoundingRulesModel implements ModelInterface, ArrayAccess +class TimesheetRoundingRulesModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetRoundingRulesModel'; + protected static $openAPIModelName = 'TimesheetRoundingRulesModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'shift_start_rounding_direction' => 'string', 'shift_start_rounding_interval' => 'int', @@ -76,8 +76,10 @@ class TimesheetRoundingRulesModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'shift_start_rounding_direction' => null, 'shift_start_rounding_interval' => 'int32', @@ -93,14 +95,42 @@ class TimesheetRoundingRulesModel implements ModelInterface, ArrayAccess 'round_down_to_shift_end_time_rounding_interval' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'shift_start_rounding_direction' => false, + 'shift_start_rounding_interval' => false, + 'shift_end_rounding_direction' => false, + 'shift_end_rounding_interval' => false, + 'break_start_rounding_direction' => false, + 'break_start_rounding_interval' => false, + 'break_end_rounding_direction' => false, + 'break_end_rounding_interval' => false, + 'round_up_to_shift_start_time_rounding_interval' => false, + 'round_down_to_shift_start_time_rounding_interval' => false, + 'round_up_to_shift_end_time_rounding_interval' => false, + 'round_down_to_shift_end_time_rounding_interval' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -108,9 +138,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -215,28 +297,26 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; - } - - const SHIFT_START_ROUNDING_DIRECTION_NONE = 'None'; - const SHIFT_START_ROUNDING_DIRECTION_UP = 'Up'; - const SHIFT_START_ROUNDING_DIRECTION_DOWN = 'Down'; - const SHIFT_START_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; - const SHIFT_END_ROUNDING_DIRECTION_NONE = 'None'; - const SHIFT_END_ROUNDING_DIRECTION_UP = 'Up'; - const SHIFT_END_ROUNDING_DIRECTION_DOWN = 'Down'; - const SHIFT_END_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; - const BREAK_START_ROUNDING_DIRECTION_NONE = 'None'; - const BREAK_START_ROUNDING_DIRECTION_UP = 'Up'; - const BREAK_START_ROUNDING_DIRECTION_DOWN = 'Down'; - const BREAK_START_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; - const BREAK_END_ROUNDING_DIRECTION_NONE = 'None'; - const BREAK_END_ROUNDING_DIRECTION_UP = 'Up'; - const BREAK_END_ROUNDING_DIRECTION_DOWN = 'Down'; - const BREAK_END_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; - - - + return self::$openAPIModelName; + } + + public const SHIFT_START_ROUNDING_DIRECTION_NONE = 'None'; + public const SHIFT_START_ROUNDING_DIRECTION_UP = 'Up'; + public const SHIFT_START_ROUNDING_DIRECTION_DOWN = 'Down'; + public const SHIFT_START_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; + public const SHIFT_END_ROUNDING_DIRECTION_NONE = 'None'; + public const SHIFT_END_ROUNDING_DIRECTION_UP = 'Up'; + public const SHIFT_END_ROUNDING_DIRECTION_DOWN = 'Down'; + public const SHIFT_END_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; + public const BREAK_START_ROUNDING_DIRECTION_NONE = 'None'; + public const BREAK_START_ROUNDING_DIRECTION_UP = 'Up'; + public const BREAK_START_ROUNDING_DIRECTION_DOWN = 'Down'; + public const BREAK_START_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; + public const BREAK_END_ROUNDING_DIRECTION_NONE = 'None'; + public const BREAK_END_ROUNDING_DIRECTION_UP = 'Up'; + public const BREAK_END_ROUNDING_DIRECTION_DOWN = 'Down'; + public const BREAK_END_ROUNDING_DIRECTION_TO_THE_NEAREST = 'ToTheNearest'; + /** * Gets allowable values of the enum * @@ -251,7 +331,7 @@ public function getShiftStartRoundingDirectionAllowableValues() self::SHIFT_START_ROUNDING_DIRECTION_TO_THE_NEAREST, ]; } - + /** * Gets allowable values of the enum * @@ -266,7 +346,7 @@ public function getShiftEndRoundingDirectionAllowableValues() self::SHIFT_END_ROUNDING_DIRECTION_TO_THE_NEAREST, ]; } - + /** * Gets allowable values of the enum * @@ -281,7 +361,7 @@ public function getBreakStartRoundingDirectionAllowableValues() self::BREAK_START_ROUNDING_DIRECTION_TO_THE_NEAREST, ]; } - + /** * Gets allowable values of the enum * @@ -296,7 +376,6 @@ public function getBreakEndRoundingDirectionAllowableValues() self::BREAK_END_ROUNDING_DIRECTION_TO_THE_NEAREST, ]; } - /** * Associative array for storing property values @@ -313,19 +392,37 @@ public function getBreakEndRoundingDirectionAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['shift_start_rounding_direction'] = isset($data['shift_start_rounding_direction']) ? $data['shift_start_rounding_direction'] : null; - $this->container['shift_start_rounding_interval'] = isset($data['shift_start_rounding_interval']) ? $data['shift_start_rounding_interval'] : null; - $this->container['shift_end_rounding_direction'] = isset($data['shift_end_rounding_direction']) ? $data['shift_end_rounding_direction'] : null; - $this->container['shift_end_rounding_interval'] = isset($data['shift_end_rounding_interval']) ? $data['shift_end_rounding_interval'] : null; - $this->container['break_start_rounding_direction'] = isset($data['break_start_rounding_direction']) ? $data['break_start_rounding_direction'] : null; - $this->container['break_start_rounding_interval'] = isset($data['break_start_rounding_interval']) ? $data['break_start_rounding_interval'] : null; - $this->container['break_end_rounding_direction'] = isset($data['break_end_rounding_direction']) ? $data['break_end_rounding_direction'] : null; - $this->container['break_end_rounding_interval'] = isset($data['break_end_rounding_interval']) ? $data['break_end_rounding_interval'] : null; - $this->container['round_up_to_shift_start_time_rounding_interval'] = isset($data['round_up_to_shift_start_time_rounding_interval']) ? $data['round_up_to_shift_start_time_rounding_interval'] : null; - $this->container['round_down_to_shift_start_time_rounding_interval'] = isset($data['round_down_to_shift_start_time_rounding_interval']) ? $data['round_down_to_shift_start_time_rounding_interval'] : null; - $this->container['round_up_to_shift_end_time_rounding_interval'] = isset($data['round_up_to_shift_end_time_rounding_interval']) ? $data['round_up_to_shift_end_time_rounding_interval'] : null; - $this->container['round_down_to_shift_end_time_rounding_interval'] = isset($data['round_down_to_shift_end_time_rounding_interval']) ? $data['round_down_to_shift_end_time_rounding_interval'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('shift_start_rounding_direction', $data ?? [], null); + $this->setIfExists('shift_start_rounding_interval', $data ?? [], null); + $this->setIfExists('shift_end_rounding_direction', $data ?? [], null); + $this->setIfExists('shift_end_rounding_interval', $data ?? [], null); + $this->setIfExists('break_start_rounding_direction', $data ?? [], null); + $this->setIfExists('break_start_rounding_interval', $data ?? [], null); + $this->setIfExists('break_end_rounding_direction', $data ?? [], null); + $this->setIfExists('break_end_rounding_interval', $data ?? [], null); + $this->setIfExists('round_up_to_shift_start_time_rounding_interval', $data ?? [], null); + $this->setIfExists('round_down_to_shift_start_time_rounding_interval', $data ?? [], null); + $this->setIfExists('round_up_to_shift_end_time_rounding_interval', $data ?? [], null); + $this->setIfExists('round_down_to_shift_end_time_rounding_interval', $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; } /** @@ -340,7 +437,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftStartRoundingDirectionAllowableValues(); if (!is_null($this->container['shift_start_rounding_direction']) && !in_array($this->container['shift_start_rounding_direction'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_start_rounding_direction', must be one of '%s'", + "invalid value '%s' for 'shift_start_rounding_direction', must be one of '%s'", + $this->container['shift_start_rounding_direction'], implode("', '", $allowedValues) ); } @@ -348,7 +446,8 @@ public function listInvalidProperties() $allowedValues = $this->getShiftEndRoundingDirectionAllowableValues(); if (!is_null($this->container['shift_end_rounding_direction']) && !in_array($this->container['shift_end_rounding_direction'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'shift_end_rounding_direction', must be one of '%s'", + "invalid value '%s' for 'shift_end_rounding_direction', must be one of '%s'", + $this->container['shift_end_rounding_direction'], implode("', '", $allowedValues) ); } @@ -356,7 +455,8 @@ public function listInvalidProperties() $allowedValues = $this->getBreakStartRoundingDirectionAllowableValues(); if (!is_null($this->container['break_start_rounding_direction']) && !in_array($this->container['break_start_rounding_direction'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'break_start_rounding_direction', must be one of '%s'", + "invalid value '%s' for 'break_start_rounding_direction', must be one of '%s'", + $this->container['break_start_rounding_direction'], implode("', '", $allowedValues) ); } @@ -364,7 +464,8 @@ public function listInvalidProperties() $allowedValues = $this->getBreakEndRoundingDirectionAllowableValues(); if (!is_null($this->container['break_end_rounding_direction']) && !in_array($this->container['break_end_rounding_direction'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'break_end_rounding_direction', must be one of '%s'", + "invalid value '%s' for 'break_end_rounding_direction', must be one of '%s'", + $this->container['break_end_rounding_direction'], implode("', '", $allowedValues) ); } @@ -387,7 +488,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -397,12 +498,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -411,7 +515,7 @@ public function setId($id) /** * Gets shift_start_rounding_direction * - * @return string + * @return string|null */ public function getShiftStartRoundingDirection() { @@ -421,17 +525,21 @@ public function getShiftStartRoundingDirection() /** * Sets shift_start_rounding_direction * - * @param string $shift_start_rounding_direction + * @param string|null $shift_start_rounding_direction * - * @return $this + * @return self */ public function setShiftStartRoundingDirection($shift_start_rounding_direction) { + if (is_null($shift_start_rounding_direction)) { + throw new \InvalidArgumentException('non-nullable shift_start_rounding_direction cannot be null'); + } $allowedValues = $this->getShiftStartRoundingDirectionAllowableValues(); - if (!is_null($shift_start_rounding_direction) && !in_array($shift_start_rounding_direction, $allowedValues, true)) { + if (!in_array($shift_start_rounding_direction, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_start_rounding_direction', must be one of '%s'", + "Invalid value '%s' for 'shift_start_rounding_direction', must be one of '%s'", + $shift_start_rounding_direction, implode("', '", $allowedValues) ) ); @@ -444,7 +552,7 @@ public function setShiftStartRoundingDirection($shift_start_rounding_direction) /** * Gets shift_start_rounding_interval * - * @return int + * @return int|null */ public function getShiftStartRoundingInterval() { @@ -454,12 +562,15 @@ public function getShiftStartRoundingInterval() /** * Sets shift_start_rounding_interval * - * @param int $shift_start_rounding_interval + * @param int|null $shift_start_rounding_interval * - * @return $this + * @return self */ public function setShiftStartRoundingInterval($shift_start_rounding_interval) { + if (is_null($shift_start_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable shift_start_rounding_interval cannot be null'); + } $this->container['shift_start_rounding_interval'] = $shift_start_rounding_interval; return $this; @@ -468,7 +579,7 @@ public function setShiftStartRoundingInterval($shift_start_rounding_interval) /** * Gets shift_end_rounding_direction * - * @return string + * @return string|null */ public function getShiftEndRoundingDirection() { @@ -478,17 +589,21 @@ public function getShiftEndRoundingDirection() /** * Sets shift_end_rounding_direction * - * @param string $shift_end_rounding_direction + * @param string|null $shift_end_rounding_direction * - * @return $this + * @return self */ public function setShiftEndRoundingDirection($shift_end_rounding_direction) { + if (is_null($shift_end_rounding_direction)) { + throw new \InvalidArgumentException('non-nullable shift_end_rounding_direction cannot be null'); + } $allowedValues = $this->getShiftEndRoundingDirectionAllowableValues(); - if (!is_null($shift_end_rounding_direction) && !in_array($shift_end_rounding_direction, $allowedValues, true)) { + if (!in_array($shift_end_rounding_direction, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'shift_end_rounding_direction', must be one of '%s'", + "Invalid value '%s' for 'shift_end_rounding_direction', must be one of '%s'", + $shift_end_rounding_direction, implode("', '", $allowedValues) ) ); @@ -501,7 +616,7 @@ public function setShiftEndRoundingDirection($shift_end_rounding_direction) /** * Gets shift_end_rounding_interval * - * @return int + * @return int|null */ public function getShiftEndRoundingInterval() { @@ -511,12 +626,15 @@ public function getShiftEndRoundingInterval() /** * Sets shift_end_rounding_interval * - * @param int $shift_end_rounding_interval + * @param int|null $shift_end_rounding_interval * - * @return $this + * @return self */ public function setShiftEndRoundingInterval($shift_end_rounding_interval) { + if (is_null($shift_end_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable shift_end_rounding_interval cannot be null'); + } $this->container['shift_end_rounding_interval'] = $shift_end_rounding_interval; return $this; @@ -525,7 +643,7 @@ public function setShiftEndRoundingInterval($shift_end_rounding_interval) /** * Gets break_start_rounding_direction * - * @return string + * @return string|null */ public function getBreakStartRoundingDirection() { @@ -535,17 +653,21 @@ public function getBreakStartRoundingDirection() /** * Sets break_start_rounding_direction * - * @param string $break_start_rounding_direction + * @param string|null $break_start_rounding_direction * - * @return $this + * @return self */ public function setBreakStartRoundingDirection($break_start_rounding_direction) { + if (is_null($break_start_rounding_direction)) { + throw new \InvalidArgumentException('non-nullable break_start_rounding_direction cannot be null'); + } $allowedValues = $this->getBreakStartRoundingDirectionAllowableValues(); - if (!is_null($break_start_rounding_direction) && !in_array($break_start_rounding_direction, $allowedValues, true)) { + if (!in_array($break_start_rounding_direction, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'break_start_rounding_direction', must be one of '%s'", + "Invalid value '%s' for 'break_start_rounding_direction', must be one of '%s'", + $break_start_rounding_direction, implode("', '", $allowedValues) ) ); @@ -558,7 +680,7 @@ public function setBreakStartRoundingDirection($break_start_rounding_direction) /** * Gets break_start_rounding_interval * - * @return int + * @return int|null */ public function getBreakStartRoundingInterval() { @@ -568,12 +690,15 @@ public function getBreakStartRoundingInterval() /** * Sets break_start_rounding_interval * - * @param int $break_start_rounding_interval + * @param int|null $break_start_rounding_interval * - * @return $this + * @return self */ public function setBreakStartRoundingInterval($break_start_rounding_interval) { + if (is_null($break_start_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable break_start_rounding_interval cannot be null'); + } $this->container['break_start_rounding_interval'] = $break_start_rounding_interval; return $this; @@ -582,7 +707,7 @@ public function setBreakStartRoundingInterval($break_start_rounding_interval) /** * Gets break_end_rounding_direction * - * @return string + * @return string|null */ public function getBreakEndRoundingDirection() { @@ -592,17 +717,21 @@ public function getBreakEndRoundingDirection() /** * Sets break_end_rounding_direction * - * @param string $break_end_rounding_direction + * @param string|null $break_end_rounding_direction * - * @return $this + * @return self */ public function setBreakEndRoundingDirection($break_end_rounding_direction) { + if (is_null($break_end_rounding_direction)) { + throw new \InvalidArgumentException('non-nullable break_end_rounding_direction cannot be null'); + } $allowedValues = $this->getBreakEndRoundingDirectionAllowableValues(); - if (!is_null($break_end_rounding_direction) && !in_array($break_end_rounding_direction, $allowedValues, true)) { + if (!in_array($break_end_rounding_direction, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'break_end_rounding_direction', must be one of '%s'", + "Invalid value '%s' for 'break_end_rounding_direction', must be one of '%s'", + $break_end_rounding_direction, implode("', '", $allowedValues) ) ); @@ -615,7 +744,7 @@ public function setBreakEndRoundingDirection($break_end_rounding_direction) /** * Gets break_end_rounding_interval * - * @return int + * @return int|null */ public function getBreakEndRoundingInterval() { @@ -625,12 +754,15 @@ public function getBreakEndRoundingInterval() /** * Sets break_end_rounding_interval * - * @param int $break_end_rounding_interval + * @param int|null $break_end_rounding_interval * - * @return $this + * @return self */ public function setBreakEndRoundingInterval($break_end_rounding_interval) { + if (is_null($break_end_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable break_end_rounding_interval cannot be null'); + } $this->container['break_end_rounding_interval'] = $break_end_rounding_interval; return $this; @@ -639,7 +771,7 @@ public function setBreakEndRoundingInterval($break_end_rounding_interval) /** * Gets round_up_to_shift_start_time_rounding_interval * - * @return int + * @return int|null */ public function getRoundUpToShiftStartTimeRoundingInterval() { @@ -649,12 +781,15 @@ public function getRoundUpToShiftStartTimeRoundingInterval() /** * Sets round_up_to_shift_start_time_rounding_interval * - * @param int $round_up_to_shift_start_time_rounding_interval + * @param int|null $round_up_to_shift_start_time_rounding_interval * - * @return $this + * @return self */ public function setRoundUpToShiftStartTimeRoundingInterval($round_up_to_shift_start_time_rounding_interval) { + if (is_null($round_up_to_shift_start_time_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable round_up_to_shift_start_time_rounding_interval cannot be null'); + } $this->container['round_up_to_shift_start_time_rounding_interval'] = $round_up_to_shift_start_time_rounding_interval; return $this; @@ -663,7 +798,7 @@ public function setRoundUpToShiftStartTimeRoundingInterval($round_up_to_shift_st /** * Gets round_down_to_shift_start_time_rounding_interval * - * @return int + * @return int|null */ public function getRoundDownToShiftStartTimeRoundingInterval() { @@ -673,12 +808,15 @@ public function getRoundDownToShiftStartTimeRoundingInterval() /** * Sets round_down_to_shift_start_time_rounding_interval * - * @param int $round_down_to_shift_start_time_rounding_interval + * @param int|null $round_down_to_shift_start_time_rounding_interval * - * @return $this + * @return self */ public function setRoundDownToShiftStartTimeRoundingInterval($round_down_to_shift_start_time_rounding_interval) { + if (is_null($round_down_to_shift_start_time_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable round_down_to_shift_start_time_rounding_interval cannot be null'); + } $this->container['round_down_to_shift_start_time_rounding_interval'] = $round_down_to_shift_start_time_rounding_interval; return $this; @@ -687,7 +825,7 @@ public function setRoundDownToShiftStartTimeRoundingInterval($round_down_to_shif /** * Gets round_up_to_shift_end_time_rounding_interval * - * @return int + * @return int|null */ public function getRoundUpToShiftEndTimeRoundingInterval() { @@ -697,12 +835,15 @@ public function getRoundUpToShiftEndTimeRoundingInterval() /** * Sets round_up_to_shift_end_time_rounding_interval * - * @param int $round_up_to_shift_end_time_rounding_interval + * @param int|null $round_up_to_shift_end_time_rounding_interval * - * @return $this + * @return self */ public function setRoundUpToShiftEndTimeRoundingInterval($round_up_to_shift_end_time_rounding_interval) { + if (is_null($round_up_to_shift_end_time_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable round_up_to_shift_end_time_rounding_interval cannot be null'); + } $this->container['round_up_to_shift_end_time_rounding_interval'] = $round_up_to_shift_end_time_rounding_interval; return $this; @@ -711,7 +852,7 @@ public function setRoundUpToShiftEndTimeRoundingInterval($round_up_to_shift_end_ /** * Gets round_down_to_shift_end_time_rounding_interval * - * @return int + * @return int|null */ public function getRoundDownToShiftEndTimeRoundingInterval() { @@ -721,12 +862,15 @@ public function getRoundDownToShiftEndTimeRoundingInterval() /** * Sets round_down_to_shift_end_time_rounding_interval * - * @param int $round_down_to_shift_end_time_rounding_interval + * @param int|null $round_down_to_shift_end_time_rounding_interval * - * @return $this + * @return self */ public function setRoundDownToShiftEndTimeRoundingInterval($round_down_to_shift_end_time_rounding_interval) { + if (is_null($round_down_to_shift_end_time_rounding_interval)) { + throw new \InvalidArgumentException('non-nullable round_down_to_shift_end_time_rounding_interval cannot be null'); + } $this->container['round_down_to_shift_end_time_rounding_interval'] = $round_down_to_shift_end_time_rounding_interval; return $this; @@ -738,7 +882,7 @@ public function setRoundDownToShiftEndTimeRoundingInterval($round_down_to_shift_ * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -748,22 +892,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -779,11 +924,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -791,13 +949,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetShiftConditionModel.php b/src/lib/Model/TimesheetShiftConditionModel.php index 02cf2eb..b2bfa4d 100644 --- a/src/lib/Model/TimesheetShiftConditionModel.php +++ b/src/lib/Model/TimesheetShiftConditionModel.php @@ -2,61 +2,61 @@ /** * TimesheetShiftConditionModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetShiftConditionModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetShiftConditionModel implements ModelInterface, ArrayAccess +class TimesheetShiftConditionModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetShiftConditionModel'; + protected static $openAPIModelName = 'TimesheetShiftConditionModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class TimesheetShiftConditionModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TimesheetShiftConditionModelv3.php b/src/lib/Model/TimesheetShiftConditionModelv3.php index 06fa827..7c8b2c1 100644 --- a/src/lib/Model/TimesheetShiftConditionModelv3.php +++ b/src/lib/Model/TimesheetShiftConditionModelv3.php @@ -2,61 +2,61 @@ /** * TimesheetShiftConditionModelv3 * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TimesheetShiftConditionModelv3 Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TimesheetShiftConditionModelv3 implements ModelInterface, ArrayAccess +class TimesheetShiftConditionModelv3 implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TimesheetShiftConditionModelv3'; + protected static $openAPIModelName = 'TimesheetShiftConditionModelv3'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class TimesheetShiftConditionModelv3 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TitleViewModel.php b/src/lib/Model/TitleViewModel.php index 6db1284..de4ce32 100644 --- a/src/lib/Model/TitleViewModel.php +++ b/src/lib/Model/TitleViewModel.php @@ -2,61 +2,61 @@ /** * TitleViewModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TitleViewModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TitleViewModel implements ModelInterface, ArrayAccess +class TitleViewModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TitleViewModel'; + protected static $openAPIModelName = 'TitleViewModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'description' => 'string' ]; @@ -65,20 +65,39 @@ class TitleViewModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -247,12 +336,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -264,7 +356,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TopQueryOption.php b/src/lib/Model/TopQueryOption.php index 7a6ad97..b81acec 100644 --- a/src/lib/Model/TopQueryOption.php +++ b/src/lib/Model/TopQueryOption.php @@ -2,87 +2,108 @@ /** * TopQueryOption * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * TopQueryOption Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class TopQueryOption implements ModelInterface, ArrayAccess +class TopQueryOption implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'TopQueryOption'; + protected static $openAPIModelName = 'TopQueryOption'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'context' => '\Swagger\Client\Model\ODataQueryContext', + protected static $openAPITypes = [ + 'context' => '\OpenAPI\Client\Model\ODataQueryContext', 'raw_value' => 'string', 'value' => 'int', - 'validator' => '\Swagger\Client\Model\TopQueryValidator' + 'validator' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'context' => null, 'raw_value' => null, 'value' => 'int32', 'validator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'context' => false, + 'raw_value' => false, + 'value' => false, + 'validator' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['context'] = isset($data['context']) ? $data['context'] : null; - $this->container['raw_value'] = isset($data['raw_value']) ? $data['raw_value'] : null; - $this->container['value'] = isset($data['value']) ? $data['value'] : null; - $this->container['validator'] = isset($data['validator']) ? $data['validator'] : null; + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('raw_value', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('validator', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets context * - * @return \Swagger\Client\Model\ODataQueryContext + * @return \OpenAPI\Client\Model\ODataQueryContext|null */ public function getContext() { @@ -235,12 +323,15 @@ public function getContext() /** * Sets context * - * @param \Swagger\Client\Model\ODataQueryContext $context + * @param \OpenAPI\Client\Model\ODataQueryContext|null $context context * - * @return $this + * @return self */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -249,7 +340,7 @@ public function setContext($context) /** * Gets raw_value * - * @return string + * @return string|null */ public function getRawValue() { @@ -259,12 +350,15 @@ public function getRawValue() /** * Sets raw_value * - * @param string $raw_value + * @param string|null $raw_value * - * @return $this + * @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; @@ -273,7 +367,7 @@ public function setRawValue($raw_value) /** * Gets value * - * @return int + * @return int|null */ public function getValue() { @@ -283,12 +377,15 @@ public function getValue() /** * Sets value * - * @param int $value + * @param int|null $value * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setValue($value) /** * Gets validator * - * @return \Swagger\Client\Model\TopQueryValidator + * @return object|null */ public function getValidator() { @@ -307,12 +404,15 @@ public function getValidator() /** * Sets validator * - * @param \Swagger\Client\Model\TopQueryValidator $validator + * @param object|null $validator validator * - * @return $this + * @return self */ public function setValidator($validator) { + if (is_null($validator)) { + throw new \InvalidArgumentException('non-nullable validator cannot be null'); + } $this->container['validator'] = $validator; return $this; @@ -324,7 +424,7 @@ public function setValidator($validator) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/TopQueryValidator.php b/src/lib/Model/TopQueryValidator.php deleted file mode 100644 index d56b679..0000000 --- a/src/lib/Model/TopQueryValidator.php +++ /dev/null @@ -1,276 +0,0 @@ -listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/src/lib/Model/UnavailabilityEditModel.php b/src/lib/Model/UnavailabilityEditModel.php index ae2c21e..8ab100a 100644 --- a/src/lib/Model/UnavailabilityEditModel.php +++ b/src/lib/Model/UnavailabilityEditModel.php @@ -2,61 +2,61 @@ /** * UnavailabilityEditModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UnavailabilityEditModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UnavailabilityEditModel implements ModelInterface, ArrayAccess +class UnavailabilityEditModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UnavailabilityEditModel'; + protected static $openAPIModelName = 'UnavailabilityEditModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -74,8 +74,10 @@ class UnavailabilityEditModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -89,14 +91,40 @@ class UnavailabilityEditModel implements ModelInterface, ArrayAccess 'view_only' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'end_date' => false, + 'reason' => false, + 'recurring' => false, + 'recurring_day' => false, + 'recurring_days' => false, + 'recurring_days_csv' => false, + 'is_all_day' => false, + 'view_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -104,9 +132,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -205,26 +285,24 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const RECURRING_DAY_SUNDAY = 'Sunday'; - const RECURRING_DAY_MONDAY = 'Monday'; - const RECURRING_DAY_TUESDAY = 'Tuesday'; - const RECURRING_DAY_WEDNESDAY = 'Wednesday'; - const RECURRING_DAY_THURSDAY = 'Thursday'; - const RECURRING_DAY_FRIDAY = 'Friday'; - const RECURRING_DAY_SATURDAY = 'Saturday'; - const RECURRING_DAYS_SUNDAY = 'Sunday'; - const RECURRING_DAYS_MONDAY = 'Monday'; - const RECURRING_DAYS_TUESDAY = 'Tuesday'; - const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; - const RECURRING_DAYS_THURSDAY = 'Thursday'; - const RECURRING_DAYS_FRIDAY = 'Friday'; - const RECURRING_DAYS_SATURDAY = 'Saturday'; - + public const RECURRING_DAY_SUNDAY = 'Sunday'; + public const RECURRING_DAY_MONDAY = 'Monday'; + public const RECURRING_DAY_TUESDAY = 'Tuesday'; + public const RECURRING_DAY_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAY_THURSDAY = 'Thursday'; + public const RECURRING_DAY_FRIDAY = 'Friday'; + public const RECURRING_DAY_SATURDAY = 'Saturday'; + public const RECURRING_DAYS_SUNDAY = 'Sunday'; + public const RECURRING_DAYS_MONDAY = 'Monday'; + public const RECURRING_DAYS_TUESDAY = 'Tuesday'; + public const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAYS_THURSDAY = 'Thursday'; + public const RECURRING_DAYS_FRIDAY = 'Friday'; + public const RECURRING_DAYS_SATURDAY = 'Saturday'; - /** * Gets allowable values of the enum * @@ -242,7 +320,7 @@ public function getRecurringDayAllowableValues() self::RECURRING_DAY_SATURDAY, ]; } - + /** * Gets allowable values of the enum * @@ -260,7 +338,6 @@ public function getRecurringDaysAllowableValues() self::RECURRING_DAYS_SATURDAY, ]; } - /** * Associative array for storing property values @@ -277,17 +354,35 @@ public function getRecurringDaysAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['recurring_day'] = isset($data['recurring_day']) ? $data['recurring_day'] : null; - $this->container['recurring_days'] = isset($data['recurring_days']) ? $data['recurring_days'] : null; - $this->container['recurring_days_csv'] = isset($data['recurring_days_csv']) ? $data['recurring_days_csv'] : null; - $this->container['is_all_day'] = isset($data['is_all_day']) ? $data['is_all_day'] : null; - $this->container['view_only'] = isset($data['view_only']) ? $data['view_only'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('recurring_day', $data ?? [], null); + $this->setIfExists('recurring_days', $data ?? [], null); + $this->setIfExists('recurring_days_csv', $data ?? [], null); + $this->setIfExists('is_all_day', $data ?? [], null); + $this->setIfExists('view_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; } /** @@ -302,7 +397,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDayAllowableValues(); if (!is_null($this->container['recurring_day']) && !in_array($this->container['recurring_day'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_day', must be one of '%s'", + "invalid value '%s' for 'recurring_day', must be one of '%s'", + $this->container['recurring_day'], implode("', '", $allowedValues) ); } @@ -310,7 +406,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDaysAllowableValues(); if (!is_null($this->container['recurring_days']) && !in_array($this->container['recurring_days'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_days', must be one of '%s'", + "invalid value '%s' for 'recurring_days', must be one of '%s'", + $this->container['recurring_days'], implode("', '", $allowedValues) ); } @@ -333,7 +430,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +440,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +457,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -367,12 +467,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -381,7 +484,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -391,12 +494,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -405,7 +511,7 @@ public function setToDate($to_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -415,12 +521,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -429,7 +538,7 @@ public function setEndDate($end_date) /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -439,12 +548,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -453,7 +565,7 @@ public function setReason($reason) /** * Gets recurring * - * @return bool + * @return bool|null */ public function getRecurring() { @@ -463,12 +575,15 @@ public function getRecurring() /** * Sets recurring * - * @param bool $recurring + * @param bool|null $recurring * - * @return $this + * @return self */ public function setRecurring($recurring) { + if (is_null($recurring)) { + throw new \InvalidArgumentException('non-nullable recurring cannot be null'); + } $this->container['recurring'] = $recurring; return $this; @@ -477,7 +592,7 @@ public function setRecurring($recurring) /** * Gets recurring_day * - * @return string + * @return string|null */ public function getRecurringDay() { @@ -487,17 +602,21 @@ public function getRecurringDay() /** * Sets recurring_day * - * @param string $recurring_day + * @param string|null $recurring_day * - * @return $this + * @return self */ public function setRecurringDay($recurring_day) { + if (is_null($recurring_day)) { + throw new \InvalidArgumentException('non-nullable recurring_day cannot be null'); + } $allowedValues = $this->getRecurringDayAllowableValues(); - if (!is_null($recurring_day) && !in_array($recurring_day, $allowedValues, true)) { + if (!in_array($recurring_day, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_day', must be one of '%s'", + "Invalid value '%s' for 'recurring_day', must be one of '%s'", + $recurring_day, implode("', '", $allowedValues) ) ); @@ -510,7 +629,7 @@ public function setRecurringDay($recurring_day) /** * Gets recurring_days * - * @return string + * @return string|null */ public function getRecurringDays() { @@ -520,17 +639,21 @@ public function getRecurringDays() /** * Sets recurring_days * - * @param string $recurring_days + * @param string|null $recurring_days * - * @return $this + * @return self */ public function setRecurringDays($recurring_days) { + if (is_null($recurring_days)) { + throw new \InvalidArgumentException('non-nullable recurring_days cannot be null'); + } $allowedValues = $this->getRecurringDaysAllowableValues(); - if (!is_null($recurring_days) && !in_array($recurring_days, $allowedValues, true)) { + if (!in_array($recurring_days, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_days', must be one of '%s'", + "Invalid value '%s' for 'recurring_days', must be one of '%s'", + $recurring_days, implode("', '", $allowedValues) ) ); @@ -543,7 +666,7 @@ public function setRecurringDays($recurring_days) /** * Gets recurring_days_csv * - * @return string + * @return string|null */ public function getRecurringDaysCsv() { @@ -553,12 +676,15 @@ public function getRecurringDaysCsv() /** * Sets recurring_days_csv * - * @param string $recurring_days_csv + * @param string|null $recurring_days_csv * - * @return $this + * @return self */ public function setRecurringDaysCsv($recurring_days_csv) { + if (is_null($recurring_days_csv)) { + throw new \InvalidArgumentException('non-nullable recurring_days_csv cannot be null'); + } $this->container['recurring_days_csv'] = $recurring_days_csv; return $this; @@ -567,7 +693,7 @@ public function setRecurringDaysCsv($recurring_days_csv) /** * Gets is_all_day * - * @return bool + * @return bool|null */ public function getIsAllDay() { @@ -577,12 +703,15 @@ public function getIsAllDay() /** * Sets is_all_day * - * @param bool $is_all_day + * @param bool|null $is_all_day * - * @return $this + * @return self */ public function setIsAllDay($is_all_day) { + if (is_null($is_all_day)) { + throw new \InvalidArgumentException('non-nullable is_all_day cannot be null'); + } $this->container['is_all_day'] = $is_all_day; return $this; @@ -591,7 +720,7 @@ public function setIsAllDay($is_all_day) /** * Gets view_only * - * @return bool + * @return bool|null */ public function getViewOnly() { @@ -601,12 +730,15 @@ public function getViewOnly() /** * Sets view_only * - * @param bool $view_only + * @param bool|null $view_only * - * @return $this + * @return self */ public function setViewOnly($view_only) { + if (is_null($view_only)) { + throw new \InvalidArgumentException('non-nullable view_only cannot be null'); + } $this->container['view_only'] = $view_only; return $this; @@ -618,7 +750,7 @@ public function setViewOnly($view_only) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -628,22 +760,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -659,11 +792,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -671,13 +817,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UnavailabilityFilter.php b/src/lib/Model/UnavailabilityFilter.php index 62b3ae4..257df1b 100644 --- a/src/lib/Model/UnavailabilityFilter.php +++ b/src/lib/Model/UnavailabilityFilter.php @@ -2,61 +2,61 @@ /** * UnavailabilityFilter * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UnavailabilityFilter Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UnavailabilityFilter implements ModelInterface, ArrayAccess +class UnavailabilityFilter implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UnavailabilityFilter'; + protected static $openAPIModelName = 'UnavailabilityFilter'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'from_date' => '\DateTime', 'to_date' => '\DateTime', 'employee_id' => 'int', @@ -67,22 +67,43 @@ class UnavailabilityFilter implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'from_date' => 'date-time', 'to_date' => 'date-time', 'employee_id' => 'int32', 'default_location_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from_date' => false, + 'to_date' => false, + 'employee_id' => false, + 'default_location_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['default_location_id'] = isset($data['default_location_id']) ? $data['default_location_id'] : null; + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('default_location_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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -235,12 +323,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -249,7 +340,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -259,12 +350,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -273,7 +367,7 @@ public function setToDate($to_date) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -283,12 +377,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -297,7 +394,7 @@ public function setEmployeeId($employee_id) /** * Gets default_location_id * - * @return int + * @return int|null */ public function getDefaultLocationId() { @@ -307,12 +404,15 @@ public function getDefaultLocationId() /** * Sets default_location_id * - * @param int $default_location_id + * @param int|null $default_location_id * - * @return $this + * @return self */ public function setDefaultLocationId($default_location_id) { + if (is_null($default_location_id)) { + throw new \InvalidArgumentException('non-nullable default_location_id cannot be null'); + } $this->container['default_location_id'] = $default_location_id; return $this; @@ -324,7 +424,7 @@ public function setDefaultLocationId($default_location_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UnavailabilityModel.php b/src/lib/Model/UnavailabilityModel.php index e9b8c8a..d809737 100644 --- a/src/lib/Model/UnavailabilityModel.php +++ b/src/lib/Model/UnavailabilityModel.php @@ -2,61 +2,61 @@ /** * UnavailabilityModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UnavailabilityModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UnavailabilityModel implements ModelInterface, ArrayAccess +class UnavailabilityModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UnavailabilityModel'; + protected static $openAPIModelName = 'UnavailabilityModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'employee_id' => 'int', 'id' => 'int', 'from_date' => '\DateTime', @@ -75,8 +75,10 @@ class UnavailabilityModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'employee_id' => 'int32', 'id' => 'int32', 'from_date' => 'date-time', @@ -91,14 +93,41 @@ class UnavailabilityModel implements ModelInterface, ArrayAccess 'view_only' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'employee_id' => false, + 'id' => false, + 'from_date' => false, + 'to_date' => false, + 'end_date' => false, + 'reason' => false, + 'recurring' => false, + 'recurring_day' => false, + 'recurring_days' => false, + 'recurring_days_csv' => false, + 'is_all_day' => false, + 'view_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -106,9 +135,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -210,26 +291,24 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const RECURRING_DAY_SUNDAY = 'Sunday'; - const RECURRING_DAY_MONDAY = 'Monday'; - const RECURRING_DAY_TUESDAY = 'Tuesday'; - const RECURRING_DAY_WEDNESDAY = 'Wednesday'; - const RECURRING_DAY_THURSDAY = 'Thursday'; - const RECURRING_DAY_FRIDAY = 'Friday'; - const RECURRING_DAY_SATURDAY = 'Saturday'; - const RECURRING_DAYS_SUNDAY = 'Sunday'; - const RECURRING_DAYS_MONDAY = 'Monday'; - const RECURRING_DAYS_TUESDAY = 'Tuesday'; - const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; - const RECURRING_DAYS_THURSDAY = 'Thursday'; - const RECURRING_DAYS_FRIDAY = 'Friday'; - const RECURRING_DAYS_SATURDAY = 'Saturday'; - + public const RECURRING_DAY_SUNDAY = 'Sunday'; + public const RECURRING_DAY_MONDAY = 'Monday'; + public const RECURRING_DAY_TUESDAY = 'Tuesday'; + public const RECURRING_DAY_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAY_THURSDAY = 'Thursday'; + public const RECURRING_DAY_FRIDAY = 'Friday'; + public const RECURRING_DAY_SATURDAY = 'Saturday'; + public const RECURRING_DAYS_SUNDAY = 'Sunday'; + public const RECURRING_DAYS_MONDAY = 'Monday'; + public const RECURRING_DAYS_TUESDAY = 'Tuesday'; + public const RECURRING_DAYS_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAYS_THURSDAY = 'Thursday'; + public const RECURRING_DAYS_FRIDAY = 'Friday'; + public const RECURRING_DAYS_SATURDAY = 'Saturday'; - /** * Gets allowable values of the enum * @@ -247,7 +326,7 @@ public function getRecurringDayAllowableValues() self::RECURRING_DAY_SATURDAY, ]; } - + /** * Gets allowable values of the enum * @@ -265,7 +344,6 @@ public function getRecurringDaysAllowableValues() self::RECURRING_DAYS_SATURDAY, ]; } - /** * Associative array for storing property values @@ -282,18 +360,36 @@ public function getRecurringDaysAllowableValues() */ public function __construct(array $data = null) { - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['recurring_day'] = isset($data['recurring_day']) ? $data['recurring_day'] : null; - $this->container['recurring_days'] = isset($data['recurring_days']) ? $data['recurring_days'] : null; - $this->container['recurring_days_csv'] = isset($data['recurring_days_csv']) ? $data['recurring_days_csv'] : null; - $this->container['is_all_day'] = isset($data['is_all_day']) ? $data['is_all_day'] : null; - $this->container['view_only'] = isset($data['view_only']) ? $data['view_only'] : null; + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('recurring_day', $data ?? [], null); + $this->setIfExists('recurring_days', $data ?? [], null); + $this->setIfExists('recurring_days_csv', $data ?? [], null); + $this->setIfExists('is_all_day', $data ?? [], null); + $this->setIfExists('view_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; } /** @@ -308,7 +404,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDayAllowableValues(); if (!is_null($this->container['recurring_day']) && !in_array($this->container['recurring_day'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_day', must be one of '%s'", + "invalid value '%s' for 'recurring_day', must be one of '%s'", + $this->container['recurring_day'], implode("', '", $allowedValues) ); } @@ -316,7 +413,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDaysAllowableValues(); if (!is_null($this->container['recurring_days']) && !in_array($this->container['recurring_days'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_days', must be one of '%s'", + "invalid value '%s' for 'recurring_days', must be one of '%s'", + $this->container['recurring_days'], implode("', '", $allowedValues) ); } @@ -339,7 +437,7 @@ public function valid() /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -349,12 +447,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -363,7 +464,7 @@ public function setEmployeeId($employee_id) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -373,12 +474,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -387,7 +491,7 @@ public function setId($id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -397,12 +501,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -411,7 +518,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -421,12 +528,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -435,7 +545,7 @@ public function setToDate($to_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -445,12 +555,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -459,7 +572,7 @@ public function setEndDate($end_date) /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -469,12 +582,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -483,7 +599,7 @@ public function setReason($reason) /** * Gets recurring * - * @return bool + * @return bool|null */ public function getRecurring() { @@ -493,12 +609,15 @@ public function getRecurring() /** * Sets recurring * - * @param bool $recurring + * @param bool|null $recurring * - * @return $this + * @return self */ public function setRecurring($recurring) { + if (is_null($recurring)) { + throw new \InvalidArgumentException('non-nullable recurring cannot be null'); + } $this->container['recurring'] = $recurring; return $this; @@ -507,7 +626,7 @@ public function setRecurring($recurring) /** * Gets recurring_day * - * @return string + * @return string|null */ public function getRecurringDay() { @@ -517,17 +636,21 @@ public function getRecurringDay() /** * Sets recurring_day * - * @param string $recurring_day + * @param string|null $recurring_day * - * @return $this + * @return self */ public function setRecurringDay($recurring_day) { + if (is_null($recurring_day)) { + throw new \InvalidArgumentException('non-nullable recurring_day cannot be null'); + } $allowedValues = $this->getRecurringDayAllowableValues(); - if (!is_null($recurring_day) && !in_array($recurring_day, $allowedValues, true)) { + if (!in_array($recurring_day, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_day', must be one of '%s'", + "Invalid value '%s' for 'recurring_day', must be one of '%s'", + $recurring_day, implode("', '", $allowedValues) ) ); @@ -540,7 +663,7 @@ public function setRecurringDay($recurring_day) /** * Gets recurring_days * - * @return string + * @return string|null */ public function getRecurringDays() { @@ -550,17 +673,21 @@ public function getRecurringDays() /** * Sets recurring_days * - * @param string $recurring_days + * @param string|null $recurring_days * - * @return $this + * @return self */ public function setRecurringDays($recurring_days) { + if (is_null($recurring_days)) { + throw new \InvalidArgumentException('non-nullable recurring_days cannot be null'); + } $allowedValues = $this->getRecurringDaysAllowableValues(); - if (!is_null($recurring_days) && !in_array($recurring_days, $allowedValues, true)) { + if (!in_array($recurring_days, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_days', must be one of '%s'", + "Invalid value '%s' for 'recurring_days', must be one of '%s'", + $recurring_days, implode("', '", $allowedValues) ) ); @@ -573,7 +700,7 @@ public function setRecurringDays($recurring_days) /** * Gets recurring_days_csv * - * @return string + * @return string|null */ public function getRecurringDaysCsv() { @@ -583,12 +710,15 @@ public function getRecurringDaysCsv() /** * Sets recurring_days_csv * - * @param string $recurring_days_csv + * @param string|null $recurring_days_csv * - * @return $this + * @return self */ public function setRecurringDaysCsv($recurring_days_csv) { + if (is_null($recurring_days_csv)) { + throw new \InvalidArgumentException('non-nullable recurring_days_csv cannot be null'); + } $this->container['recurring_days_csv'] = $recurring_days_csv; return $this; @@ -597,7 +727,7 @@ public function setRecurringDaysCsv($recurring_days_csv) /** * Gets is_all_day * - * @return bool + * @return bool|null */ public function getIsAllDay() { @@ -607,12 +737,15 @@ public function getIsAllDay() /** * Sets is_all_day * - * @param bool $is_all_day + * @param bool|null $is_all_day * - * @return $this + * @return self */ public function setIsAllDay($is_all_day) { + if (is_null($is_all_day)) { + throw new \InvalidArgumentException('non-nullable is_all_day cannot be null'); + } $this->container['is_all_day'] = $is_all_day; return $this; @@ -621,7 +754,7 @@ public function setIsAllDay($is_all_day) /** * Gets view_only * - * @return bool + * @return bool|null */ public function getViewOnly() { @@ -631,12 +764,15 @@ public function getViewOnly() /** * Sets view_only * - * @param bool $view_only + * @param bool|null $view_only * - * @return $this + * @return self */ public function setViewOnly($view_only) { + if (is_null($view_only)) { + throw new \InvalidArgumentException('non-nullable view_only cannot be null'); + } $this->container['view_only'] = $view_only; return $this; @@ -648,7 +784,7 @@ public function setViewOnly($view_only) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -658,22 +794,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -689,11 +826,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -701,13 +851,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UnavailabilitySaveModel.php b/src/lib/Model/UnavailabilitySaveModel.php index a26c340..d3eef22 100644 --- a/src/lib/Model/UnavailabilitySaveModel.php +++ b/src/lib/Model/UnavailabilitySaveModel.php @@ -2,61 +2,61 @@ /** * UnavailabilitySaveModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UnavailabilitySaveModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UnavailabilitySaveModel implements ModelInterface, ArrayAccess +class UnavailabilitySaveModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UnavailabilitySaveModel'; + protected static $openAPIModelName = 'UnavailabilitySaveModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'employee_id' => 'int', 'from_date' => '\DateTime', @@ -71,8 +71,10 @@ class UnavailabilitySaveModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'employee_id' => 'int32', 'from_date' => 'date-time', @@ -83,14 +85,37 @@ class UnavailabilitySaveModel implements ModelInterface, ArrayAccess 'recurring_day' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'employee_id' => false, + 'from_date' => false, + 'to_date' => false, + 'end_date' => false, + 'reason' => false, + 'recurring' => false, + 'recurring_day' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,19 +267,17 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - const RECURRING_DAY_SUNDAY = 'Sunday'; - const RECURRING_DAY_MONDAY = 'Monday'; - const RECURRING_DAY_TUESDAY = 'Tuesday'; - const RECURRING_DAY_WEDNESDAY = 'Wednesday'; - const RECURRING_DAY_THURSDAY = 'Thursday'; - const RECURRING_DAY_FRIDAY = 'Friday'; - const RECURRING_DAY_SATURDAY = 'Saturday'; - + public const RECURRING_DAY_SUNDAY = 'Sunday'; + public const RECURRING_DAY_MONDAY = 'Monday'; + public const RECURRING_DAY_TUESDAY = 'Tuesday'; + public const RECURRING_DAY_WEDNESDAY = 'Wednesday'; + public const RECURRING_DAY_THURSDAY = 'Thursday'; + public const RECURRING_DAY_FRIDAY = 'Friday'; + public const RECURRING_DAY_SATURDAY = 'Saturday'; - /** * Gets allowable values of the enum * @@ -220,7 +295,6 @@ public function getRecurringDayAllowableValues() self::RECURRING_DAY_SATURDAY, ]; } - /** * Associative array for storing property values @@ -237,14 +311,32 @@ public function getRecurringDayAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; - $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; - $this->container['recurring'] = isset($data['recurring']) ? $data['recurring'] : null; - $this->container['recurring_day'] = isset($data['recurring_day']) ? $data['recurring_day'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('recurring', $data ?? [], null); + $this->setIfExists('recurring_day', $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; } /** @@ -259,7 +351,8 @@ public function listInvalidProperties() $allowedValues = $this->getRecurringDayAllowableValues(); if (!is_null($this->container['recurring_day']) && !in_array($this->container['recurring_day'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value for 'recurring_day', must be one of '%s'", + "invalid value '%s' for 'recurring_day', must be one of '%s'", + $this->container['recurring_day'], implode("', '", $allowedValues) ); } @@ -282,7 +375,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -292,12 +385,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -306,7 +402,7 @@ public function setId($id) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -316,12 +412,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -330,7 +429,7 @@ public function setEmployeeId($employee_id) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -340,12 +439,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -354,7 +456,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -364,12 +466,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -378,7 +483,7 @@ public function setToDate($to_date) /** * Gets end_date * - * @return \DateTime + * @return \DateTime|null */ public function getEndDate() { @@ -388,12 +493,15 @@ public function getEndDate() /** * Sets end_date * - * @param \DateTime $end_date + * @param \DateTime|null $end_date * - * @return $this + * @return self */ public function setEndDate($end_date) { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -402,7 +510,7 @@ public function setEndDate($end_date) /** * Gets reason * - * @return string + * @return string|null */ public function getReason() { @@ -412,12 +520,15 @@ public function getReason() /** * Sets reason * - * @param string $reason + * @param string|null $reason * - * @return $this + * @return self */ public function setReason($reason) { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } $this->container['reason'] = $reason; return $this; @@ -426,7 +537,7 @@ public function setReason($reason) /** * Gets recurring * - * @return bool + * @return bool|null */ public function getRecurring() { @@ -436,12 +547,15 @@ public function getRecurring() /** * Sets recurring * - * @param bool $recurring + * @param bool|null $recurring * - * @return $this + * @return self */ public function setRecurring($recurring) { + if (is_null($recurring)) { + throw new \InvalidArgumentException('non-nullable recurring cannot be null'); + } $this->container['recurring'] = $recurring; return $this; @@ -450,7 +564,7 @@ public function setRecurring($recurring) /** * Gets recurring_day * - * @return string + * @return string|null */ public function getRecurringDay() { @@ -460,17 +574,21 @@ public function getRecurringDay() /** * Sets recurring_day * - * @param string $recurring_day + * @param string|null $recurring_day * - * @return $this + * @return self */ public function setRecurringDay($recurring_day) { + if (is_null($recurring_day)) { + throw new \InvalidArgumentException('non-nullable recurring_day cannot be null'); + } $allowedValues = $this->getRecurringDayAllowableValues(); - if (!is_null($recurring_day) && !in_array($recurring_day, $allowedValues, true)) { + if (!in_array($recurring_day, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value for 'recurring_day', must be one of '%s'", + "Invalid value '%s' for 'recurring_day', must be one of '%s'", + $recurring_day, implode("', '", $allowedValues) ) ); @@ -486,7 +604,7 @@ public function setRecurringDay($recurring_day) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -496,22 +614,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -527,11 +646,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -539,13 +671,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UnitAndHourLeaveEstimateModel.php b/src/lib/Model/UnitAndHourLeaveEstimateModel.php index 1b90cac..b0ac1c7 100644 --- a/src/lib/Model/UnitAndHourLeaveEstimateModel.php +++ b/src/lib/Model/UnitAndHourLeaveEstimateModel.php @@ -2,63 +2,63 @@ /** * UnitAndHourLeaveEstimateModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UnitAndHourLeaveEstimateModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UnitAndHourLeaveEstimateModel implements ModelInterface, ArrayAccess +class UnitAndHourLeaveEstimateModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UnitAndHourLeaveEstimateModel'; + protected static $openAPIModelName = 'UnitAndHourLeaveEstimateModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ - 'hours' => 'double', - 'units' => 'double', + protected static $openAPITypes = [ + 'hours' => 'float', + 'units' => 'float', 'employee_id' => 'int', 'details' => 'string[]' ]; @@ -67,22 +67,43 @@ class UnitAndHourLeaveEstimateModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'hours' => 'double', 'units' => 'double', 'employee_id' => 'int32', 'details' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'hours' => false, + 'units' => false, + 'employee_id' => false, + 'details' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['hours'] = isset($data['hours']) ? $data['hours'] : null; - $this->container['units'] = isset($data['units']) ? $data['units'] : null; - $this->container['employee_id'] = isset($data['employee_id']) ? $data['employee_id'] : null; - $this->container['details'] = isset($data['details']) ? $data['details'] : null; + $this->setIfExists('hours', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('employee_id', $data ?? [], null); + $this->setIfExists('details', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets hours * - * @return double + * @return float|null */ public function getHours() { @@ -235,12 +323,15 @@ public function getHours() /** * Sets hours * - * @param double $hours + * @param float|null $hours * - * @return $this + * @return self */ public function setHours($hours) { + if (is_null($hours)) { + throw new \InvalidArgumentException('non-nullable hours cannot be null'); + } $this->container['hours'] = $hours; return $this; @@ -249,7 +340,7 @@ public function setHours($hours) /** * Gets units * - * @return double + * @return float|null */ public function getUnits() { @@ -259,12 +350,15 @@ public function getUnits() /** * Sets units * - * @param double $units + * @param float|null $units * - * @return $this + * @return self */ public function setUnits($units) { + if (is_null($units)) { + throw new \InvalidArgumentException('non-nullable units cannot be null'); + } $this->container['units'] = $units; return $this; @@ -273,7 +367,7 @@ public function setUnits($units) /** * Gets employee_id * - * @return int + * @return int|null */ public function getEmployeeId() { @@ -283,12 +377,15 @@ public function getEmployeeId() /** * Sets employee_id * - * @param int $employee_id + * @param int|null $employee_id * - * @return $this + * @return self */ public function setEmployeeId($employee_id) { + if (is_null($employee_id)) { + throw new \InvalidArgumentException('non-nullable employee_id cannot be null'); + } $this->container['employee_id'] = $employee_id; return $this; @@ -297,7 +394,7 @@ public function setEmployeeId($employee_id) /** * Gets details * - * @return string[] + * @return string[]|null */ public function getDetails() { @@ -307,12 +404,15 @@ public function getDetails() /** * Sets details * - * @param string[] $details + * @param string[]|null $details * - * @return $this + * @return self */ public function setDetails($details) { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } $this->container['details'] = $details; return $this; @@ -324,7 +424,7 @@ public function setDetails($details) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UpdateDocumentPermissionsModel.php b/src/lib/Model/UpdateDocumentPermissionsModel.php index 3854136..cd4d10f 100644 --- a/src/lib/Model/UpdateDocumentPermissionsModel.php +++ b/src/lib/Model/UpdateDocumentPermissionsModel.php @@ -2,61 +2,61 @@ /** * UpdateDocumentPermissionsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UpdateDocumentPermissionsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UpdateDocumentPermissionsModel implements ModelInterface, ArrayAccess +class UpdateDocumentPermissionsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UpdateDocumentPermissionsModel'; + protected static $openAPIModelName = 'UpdateDocumentPermissionsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'visible_to_all' => 'bool', 'employee_groups' => 'int[]', @@ -72,8 +72,10 @@ class UpdateDocumentPermissionsModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'visible_to_all' => null, 'employee_groups' => 'int32', @@ -85,14 +87,38 @@ class UpdateDocumentPermissionsModel implements ModelInterface, ArrayAccess 'send_reminder_every_x_days' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'visible_to_all' => false, + 'employee_groups' => false, + 'locations' => false, + 'requires_employee_acknowledgement' => false, + 'send_notification_to_employee' => false, + 'send_notification_immediately' => false, + 'send_initial_notification_on' => false, + 'send_reminder_every_x_days' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -100,9 +126,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -195,12 +273,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -217,15 +292,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['visible_to_all'] = isset($data['visible_to_all']) ? $data['visible_to_all'] : null; - $this->container['employee_groups'] = isset($data['employee_groups']) ? $data['employee_groups'] : null; - $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; - $this->container['requires_employee_acknowledgement'] = isset($data['requires_employee_acknowledgement']) ? $data['requires_employee_acknowledgement'] : null; - $this->container['send_notification_to_employee'] = isset($data['send_notification_to_employee']) ? $data['send_notification_to_employee'] : null; - $this->container['send_notification_immediately'] = isset($data['send_notification_immediately']) ? $data['send_notification_immediately'] : null; - $this->container['send_initial_notification_on'] = isset($data['send_initial_notification_on']) ? $data['send_initial_notification_on'] : null; - $this->container['send_reminder_every_x_days'] = isset($data['send_reminder_every_x_days']) ? $data['send_reminder_every_x_days'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('visible_to_all', $data ?? [], null); + $this->setIfExists('employee_groups', $data ?? [], null); + $this->setIfExists('locations', $data ?? [], null); + $this->setIfExists('requires_employee_acknowledgement', $data ?? [], null); + $this->setIfExists('send_notification_to_employee', $data ?? [], null); + $this->setIfExists('send_notification_immediately', $data ?? [], null); + $this->setIfExists('send_initial_notification_on', $data ?? [], null); + $this->setIfExists('send_reminder_every_x_days', $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; } /** @@ -255,7 +348,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -265,12 +358,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -279,7 +375,7 @@ public function setId($id) /** * Gets visible_to_all * - * @return bool + * @return bool|null */ public function getVisibleToAll() { @@ -289,12 +385,15 @@ public function getVisibleToAll() /** * Sets visible_to_all * - * @param bool $visible_to_all + * @param bool|null $visible_to_all * - * @return $this + * @return self */ public function setVisibleToAll($visible_to_all) { + if (is_null($visible_to_all)) { + throw new \InvalidArgumentException('non-nullable visible_to_all cannot be null'); + } $this->container['visible_to_all'] = $visible_to_all; return $this; @@ -303,7 +402,7 @@ public function setVisibleToAll($visible_to_all) /** * Gets employee_groups * - * @return int[] + * @return int[]|null */ public function getEmployeeGroups() { @@ -313,12 +412,15 @@ public function getEmployeeGroups() /** * Sets employee_groups * - * @param int[] $employee_groups + * @param int[]|null $employee_groups * - * @return $this + * @return self */ public function setEmployeeGroups($employee_groups) { + if (is_null($employee_groups)) { + throw new \InvalidArgumentException('non-nullable employee_groups cannot be null'); + } $this->container['employee_groups'] = $employee_groups; return $this; @@ -327,7 +429,7 @@ public function setEmployeeGroups($employee_groups) /** * Gets locations * - * @return int[] + * @return int[]|null */ public function getLocations() { @@ -337,12 +439,15 @@ public function getLocations() /** * Sets locations * - * @param int[] $locations + * @param int[]|null $locations * - * @return $this + * @return self */ public function setLocations($locations) { + if (is_null($locations)) { + throw new \InvalidArgumentException('non-nullable locations cannot be null'); + } $this->container['locations'] = $locations; return $this; @@ -351,7 +456,7 @@ public function setLocations($locations) /** * Gets requires_employee_acknowledgement * - * @return bool + * @return bool|null */ public function getRequiresEmployeeAcknowledgement() { @@ -361,12 +466,15 @@ public function getRequiresEmployeeAcknowledgement() /** * Sets requires_employee_acknowledgement * - * @param bool $requires_employee_acknowledgement + * @param bool|null $requires_employee_acknowledgement * - * @return $this + * @return self */ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledgement) { + if (is_null($requires_employee_acknowledgement)) { + throw new \InvalidArgumentException('non-nullable requires_employee_acknowledgement cannot be null'); + } $this->container['requires_employee_acknowledgement'] = $requires_employee_acknowledgement; return $this; @@ -375,7 +483,7 @@ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledg /** * Gets send_notification_to_employee * - * @return bool + * @return bool|null */ public function getSendNotificationToEmployee() { @@ -385,12 +493,15 @@ public function getSendNotificationToEmployee() /** * Sets send_notification_to_employee * - * @param bool $send_notification_to_employee + * @param bool|null $send_notification_to_employee * - * @return $this + * @return self */ public function setSendNotificationToEmployee($send_notification_to_employee) { + if (is_null($send_notification_to_employee)) { + throw new \InvalidArgumentException('non-nullable send_notification_to_employee cannot be null'); + } $this->container['send_notification_to_employee'] = $send_notification_to_employee; return $this; @@ -399,7 +510,7 @@ public function setSendNotificationToEmployee($send_notification_to_employee) /** * Gets send_notification_immediately * - * @return bool + * @return bool|null */ public function getSendNotificationImmediately() { @@ -409,12 +520,15 @@ public function getSendNotificationImmediately() /** * Sets send_notification_immediately * - * @param bool $send_notification_immediately + * @param bool|null $send_notification_immediately * - * @return $this + * @return self */ public function setSendNotificationImmediately($send_notification_immediately) { + if (is_null($send_notification_immediately)) { + throw new \InvalidArgumentException('non-nullable send_notification_immediately cannot be null'); + } $this->container['send_notification_immediately'] = $send_notification_immediately; return $this; @@ -423,7 +537,7 @@ public function setSendNotificationImmediately($send_notification_immediately) /** * Gets send_initial_notification_on * - * @return \DateTime + * @return \DateTime|null */ public function getSendInitialNotificationOn() { @@ -433,12 +547,15 @@ public function getSendInitialNotificationOn() /** * Sets send_initial_notification_on * - * @param \DateTime $send_initial_notification_on + * @param \DateTime|null $send_initial_notification_on * - * @return $this + * @return self */ public function setSendInitialNotificationOn($send_initial_notification_on) { + if (is_null($send_initial_notification_on)) { + throw new \InvalidArgumentException('non-nullable send_initial_notification_on cannot be null'); + } $this->container['send_initial_notification_on'] = $send_initial_notification_on; return $this; @@ -447,7 +564,7 @@ public function setSendInitialNotificationOn($send_initial_notification_on) /** * Gets send_reminder_every_x_days * - * @return int + * @return int|null */ public function getSendReminderEveryXDays() { @@ -457,12 +574,15 @@ public function getSendReminderEveryXDays() /** * Sets send_reminder_every_x_days * - * @param int $send_reminder_every_x_days + * @param int|null $send_reminder_every_x_days * - * @return $this + * @return self */ public function setSendReminderEveryXDays($send_reminder_every_x_days) { + if (is_null($send_reminder_every_x_days)) { + throw new \InvalidArgumentException('non-nullable send_reminder_every_x_days cannot be null'); + } $this->container['send_reminder_every_x_days'] = $send_reminder_every_x_days; return $this; @@ -474,7 +594,7 @@ public function setSendReminderEveryXDays($send_reminder_every_x_days) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -484,22 +604,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -515,11 +636,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -527,13 +661,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UpdateEmployeeDocumentPermissionsModel.php b/src/lib/Model/UpdateEmployeeDocumentPermissionsModel.php index 67a06b7..c4a57a1 100644 --- a/src/lib/Model/UpdateEmployeeDocumentPermissionsModel.php +++ b/src/lib/Model/UpdateEmployeeDocumentPermissionsModel.php @@ -2,61 +2,61 @@ /** * UpdateEmployeeDocumentPermissionsModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UpdateEmployeeDocumentPermissionsModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UpdateEmployeeDocumentPermissionsModel implements ModelInterface, ArrayAccess +class UpdateEmployeeDocumentPermissionsModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UpdateEmployeeDocumentPermissionsModel'; + protected static $openAPIModelName = 'UpdateEmployeeDocumentPermissionsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'visible' => 'bool', 'requires_employee_acknowledgement' => 'bool', @@ -70,8 +70,10 @@ class UpdateEmployeeDocumentPermissionsModel implements ModelInterface, ArrayAcc * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'visible' => null, 'requires_employee_acknowledgement' => null, @@ -81,14 +83,36 @@ class UpdateEmployeeDocumentPermissionsModel implements ModelInterface, ArrayAcc 'send_reminder_every_x_days' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'visible' => false, + 'requires_employee_acknowledgement' => false, + 'send_notification_to_employee' => false, + 'send_notification_immediately' => false, + 'send_initial_notification_on' => false, + 'send_reminder_every_x_days' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -96,9 +120,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -185,12 +261,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -207,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['visible'] = isset($data['visible']) ? $data['visible'] : null; - $this->container['requires_employee_acknowledgement'] = isset($data['requires_employee_acknowledgement']) ? $data['requires_employee_acknowledgement'] : null; - $this->container['send_notification_to_employee'] = isset($data['send_notification_to_employee']) ? $data['send_notification_to_employee'] : null; - $this->container['send_notification_immediately'] = isset($data['send_notification_immediately']) ? $data['send_notification_immediately'] : null; - $this->container['send_initial_notification_on'] = isset($data['send_initial_notification_on']) ? $data['send_initial_notification_on'] : null; - $this->container['send_reminder_every_x_days'] = isset($data['send_reminder_every_x_days']) ? $data['send_reminder_every_x_days'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('visible', $data ?? [], null); + $this->setIfExists('requires_employee_acknowledgement', $data ?? [], null); + $this->setIfExists('send_notification_to_employee', $data ?? [], null); + $this->setIfExists('send_notification_immediately', $data ?? [], null); + $this->setIfExists('send_initial_notification_on', $data ?? [], null); + $this->setIfExists('send_reminder_every_x_days', $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; } /** @@ -243,7 +334,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -253,12 +344,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -267,7 +361,7 @@ public function setId($id) /** * Gets visible * - * @return bool + * @return bool|null */ public function getVisible() { @@ -277,12 +371,15 @@ public function getVisible() /** * Sets visible * - * @param bool $visible + * @param bool|null $visible * - * @return $this + * @return self */ public function setVisible($visible) { + if (is_null($visible)) { + throw new \InvalidArgumentException('non-nullable visible cannot be null'); + } $this->container['visible'] = $visible; return $this; @@ -291,7 +388,7 @@ public function setVisible($visible) /** * Gets requires_employee_acknowledgement * - * @return bool + * @return bool|null */ public function getRequiresEmployeeAcknowledgement() { @@ -301,12 +398,15 @@ public function getRequiresEmployeeAcknowledgement() /** * Sets requires_employee_acknowledgement * - * @param bool $requires_employee_acknowledgement + * @param bool|null $requires_employee_acknowledgement * - * @return $this + * @return self */ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledgement) { + if (is_null($requires_employee_acknowledgement)) { + throw new \InvalidArgumentException('non-nullable requires_employee_acknowledgement cannot be null'); + } $this->container['requires_employee_acknowledgement'] = $requires_employee_acknowledgement; return $this; @@ -315,7 +415,7 @@ public function setRequiresEmployeeAcknowledgement($requires_employee_acknowledg /** * Gets send_notification_to_employee * - * @return bool + * @return bool|null */ public function getSendNotificationToEmployee() { @@ -325,12 +425,15 @@ public function getSendNotificationToEmployee() /** * Sets send_notification_to_employee * - * @param bool $send_notification_to_employee + * @param bool|null $send_notification_to_employee * - * @return $this + * @return self */ public function setSendNotificationToEmployee($send_notification_to_employee) { + if (is_null($send_notification_to_employee)) { + throw new \InvalidArgumentException('non-nullable send_notification_to_employee cannot be null'); + } $this->container['send_notification_to_employee'] = $send_notification_to_employee; return $this; @@ -339,7 +442,7 @@ public function setSendNotificationToEmployee($send_notification_to_employee) /** * Gets send_notification_immediately * - * @return bool + * @return bool|null */ public function getSendNotificationImmediately() { @@ -349,12 +452,15 @@ public function getSendNotificationImmediately() /** * Sets send_notification_immediately * - * @param bool $send_notification_immediately + * @param bool|null $send_notification_immediately * - * @return $this + * @return self */ public function setSendNotificationImmediately($send_notification_immediately) { + if (is_null($send_notification_immediately)) { + throw new \InvalidArgumentException('non-nullable send_notification_immediately cannot be null'); + } $this->container['send_notification_immediately'] = $send_notification_immediately; return $this; @@ -363,7 +469,7 @@ public function setSendNotificationImmediately($send_notification_immediately) /** * Gets send_initial_notification_on * - * @return \DateTime + * @return \DateTime|null */ public function getSendInitialNotificationOn() { @@ -373,12 +479,15 @@ public function getSendInitialNotificationOn() /** * Sets send_initial_notification_on * - * @param \DateTime $send_initial_notification_on + * @param \DateTime|null $send_initial_notification_on * - * @return $this + * @return self */ public function setSendInitialNotificationOn($send_initial_notification_on) { + if (is_null($send_initial_notification_on)) { + throw new \InvalidArgumentException('non-nullable send_initial_notification_on cannot be null'); + } $this->container['send_initial_notification_on'] = $send_initial_notification_on; return $this; @@ -387,7 +496,7 @@ public function setSendInitialNotificationOn($send_initial_notification_on) /** * Gets send_reminder_every_x_days * - * @return int + * @return int|null */ public function getSendReminderEveryXDays() { @@ -397,12 +506,15 @@ public function getSendReminderEveryXDays() /** * Sets send_reminder_every_x_days * - * @param int $send_reminder_every_x_days + * @param int|null $send_reminder_every_x_days * - * @return $this + * @return self */ public function setSendReminderEveryXDays($send_reminder_every_x_days) { + if (is_null($send_reminder_every_x_days)) { + throw new \InvalidArgumentException('non-nullable send_reminder_every_x_days cannot be null'); + } $this->container['send_reminder_every_x_days'] = $send_reminder_every_x_days; return $this; @@ -414,7 +526,7 @@ public function setSendReminderEveryXDays($send_reminder_every_x_days) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -424,22 +536,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -455,11 +568,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -467,13 +593,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UpdateUserModel.php b/src/lib/Model/UpdateUserModel.php index 976819e..bf40605 100644 --- a/src/lib/Model/UpdateUserModel.php +++ b/src/lib/Model/UpdateUserModel.php @@ -2,61 +2,61 @@ /** * UpdateUserModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UpdateUserModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UpdateUserModel implements ModelInterface, ArrayAccess +class UpdateUserModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UpdateUserModel'; + protected static $openAPIModelName = 'UpdateUserModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'username' => 'string', 'email_confirmed' => 'bool' ]; @@ -65,20 +65,39 @@ class UpdateUserModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'username' => null, 'email_confirmed' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'username' => false, + 'email_confirmed' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['email_confirmed'] = isset($data['email_confirmed']) ? $data['email_confirmed'] : null; + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('email_confirmed', $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; } /** @@ -228,10 +314,13 @@ public function getUsername() * * @param string $username Required * - * @return $this + * @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; @@ -240,7 +329,7 @@ public function setUsername($username) /** * Gets email_confirmed * - * @return bool + * @return bool|null */ public function getEmailConfirmed() { @@ -250,12 +339,15 @@ public function getEmailConfirmed() /** * Sets email_confirmed * - * @param bool $email_confirmed + * @param bool|null $email_confirmed * - * @return $this + * @return self */ public function setEmailConfirmed($email_confirmed) { + if (is_null($email_confirmed)) { + throw new \InvalidArgumentException('non-nullable email_confirmed cannot be null'); + } $this->container['email_confirmed'] = $email_confirmed; return $this; @@ -267,7 +359,7 @@ public function setEmailConfirmed($email_confirmed) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -277,22 +369,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -308,11 +401,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -320,13 +426,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UserModel.php b/src/lib/Model/UserModel.php index d40c8ef..e3f3c65 100644 --- a/src/lib/Model/UserModel.php +++ b/src/lib/Model/UserModel.php @@ -2,61 +2,61 @@ /** * UserModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UserModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UserModel implements ModelInterface, ArrayAccess +class UserModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UserModel'; + protected static $openAPIModelName = 'UserModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'email' => 'string', 'display_name' => 'string', @@ -67,22 +67,43 @@ class UserModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'email' => null, 'display_name' => null, 'time_zone' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'email' => false, + 'display_name' => false, + 'time_zone' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -90,9 +111,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -170,12 +243,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -192,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['display_name'] = isset($data['display_name']) ? $data['display_name'] : null; - $this->container['time_zone'] = isset($data['time_zone']) ? $data['time_zone'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('time_zone', $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; } /** @@ -225,7 +313,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -235,12 +323,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -249,7 +340,7 @@ public function setId($id) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -259,12 +350,15 @@ public function getEmail() /** * Sets email * - * @param string $email + * @param string|null $email * - * @return $this + * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } $this->container['email'] = $email; return $this; @@ -273,7 +367,7 @@ public function setEmail($email) /** * Gets display_name * - * @return string + * @return string|null */ public function getDisplayName() { @@ -283,12 +377,15 @@ public function getDisplayName() /** * Sets display_name * - * @param string $display_name + * @param string|null $display_name * - * @return $this + * @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; @@ -297,7 +394,7 @@ public function setDisplayName($display_name) /** * Gets time_zone * - * @return string + * @return string|null */ public function getTimeZone() { @@ -307,12 +404,15 @@ public function getTimeZone() /** * Sets time_zone * - * @param string $time_zone + * @param string|null $time_zone * - * @return $this + * @return self */ public function setTimeZone($time_zone) { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } $this->container['time_zone'] = $time_zone; return $this; @@ -324,7 +424,7 @@ public function setTimeZone($time_zone) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,22 +434,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,11 +466,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -377,13 +491,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/UserUpdatedModel.php b/src/lib/Model/UserUpdatedModel.php index d365256..de48d05 100644 --- a/src/lib/Model/UserUpdatedModel.php +++ b/src/lib/Model/UserUpdatedModel.php @@ -2,61 +2,61 @@ /** * UserUpdatedModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * UserUpdatedModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class UserUpdatedModel implements ModelInterface, ArrayAccess +class UserUpdatedModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'UserUpdatedModel'; + protected static $openAPIModelName = 'UserUpdatedModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'username' => 'string', 'email_confirmed' => 'bool' ]; @@ -65,20 +65,39 @@ class UserUpdatedModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'username' => null, 'email_confirmed' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'username' => false, + 'email_confirmed' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + 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); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['email_confirmed'] = isset($data['email_confirmed']) ? $data['email_confirmed'] : null; + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('email_confirmed', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets username * - * @return string + * @return string|null */ public function getUsername() { @@ -223,12 +309,15 @@ public function getUsername() /** * Sets username * - * @param string $username + * @param string|null $username * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setUsername($username) /** * Gets email_confirmed * - * @return bool + * @return bool|null */ public function getEmailConfirmed() { @@ -247,12 +336,15 @@ public function getEmailConfirmed() /** * Sets email_confirmed * - * @param bool $email_confirmed + * @param bool|null $email_confirmed * - * @return $this + * @return self */ public function setEmailConfirmed($email_confirmed) { + if (is_null($email_confirmed)) { + throw new \InvalidArgumentException('non-nullable email_confirmed cannot be null'); + } $this->container['email_confirmed'] = $email_confirmed; return $this; @@ -264,7 +356,7 @@ public function setEmailConfirmed($email_confirmed) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/WebHook.php b/src/lib/Model/WebHook.php index 7e0118a..573acce 100644 --- a/src/lib/Model/WebHook.php +++ b/src/lib/Model/WebHook.php @@ -2,77 +2,79 @@ /** * WebHook * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * WebHook Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class WebHook implements ModelInterface, ArrayAccess +class WebHook implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WebHook'; + protected static $openAPIModelName = 'WebHook'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'string', 'web_hook_uri' => 'string', 'secret' => 'string', 'description' => 'string', 'is_paused' => 'bool', 'filters' => 'string[]', - 'headers' => 'map[string,string]', - 'properties' => 'map[string,object]' + 'headers' => 'array', + 'properties' => 'array' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => null, 'web_hook_uri' => null, 'secret' => null, @@ -83,14 +85,37 @@ class WebHook implements ModelInterface, ArrayAccess 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'web_hook_uri' => false, + 'secret' => false, + 'description' => false, + 'is_paused' => false, + 'filters' => false, + 'headers' => false, + 'properties' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -98,9 +123,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -190,12 +267,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -212,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['web_hook_uri'] = isset($data['web_hook_uri']) ? $data['web_hook_uri'] : null; - $this->container['secret'] = isset($data['secret']) ? $data['secret'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; - $this->container['is_paused'] = isset($data['is_paused']) ? $data['is_paused'] : null; - $this->container['filters'] = isset($data['filters']) ? $data['filters'] : null; - $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; - $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('web_hook_uri', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('is_paused', $data ?? [], null); + $this->setIfExists('filters', $data ?? [], null); + $this->setIfExists('headers', $data ?? [], null); + $this->setIfExists('properties', $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; } /** @@ -249,7 +341,7 @@ public function valid() /** * Gets id * - * @return string + * @return string|null */ public function getId() { @@ -259,12 +351,15 @@ public function getId() /** * Sets id * - * @param string $id + * @param string|null $id * - * @return $this + * @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; @@ -273,7 +368,7 @@ public function setId($id) /** * Gets web_hook_uri * - * @return string + * @return string|null */ public function getWebHookUri() { @@ -283,12 +378,15 @@ public function getWebHookUri() /** * Sets web_hook_uri * - * @param string $web_hook_uri + * @param string|null $web_hook_uri * - * @return $this + * @return self */ public function setWebHookUri($web_hook_uri) { + if (is_null($web_hook_uri)) { + throw new \InvalidArgumentException('non-nullable web_hook_uri cannot be null'); + } $this->container['web_hook_uri'] = $web_hook_uri; return $this; @@ -297,7 +395,7 @@ public function setWebHookUri($web_hook_uri) /** * Gets secret * - * @return string + * @return string|null */ public function getSecret() { @@ -307,12 +405,15 @@ public function getSecret() /** * Sets secret * - * @param string $secret + * @param string|null $secret * - * @return $this + * @return self */ public function setSecret($secret) { + if (is_null($secret)) { + throw new \InvalidArgumentException('non-nullable secret cannot be null'); + } $this->container['secret'] = $secret; return $this; @@ -321,7 +422,7 @@ public function setSecret($secret) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -331,12 +432,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -345,7 +449,7 @@ public function setDescription($description) /** * Gets is_paused * - * @return bool + * @return bool|null */ public function getIsPaused() { @@ -355,12 +459,15 @@ public function getIsPaused() /** * Sets is_paused * - * @param bool $is_paused + * @param bool|null $is_paused * - * @return $this + * @return self */ public function setIsPaused($is_paused) { + if (is_null($is_paused)) { + throw new \InvalidArgumentException('non-nullable is_paused cannot be null'); + } $this->container['is_paused'] = $is_paused; return $this; @@ -369,7 +476,7 @@ public function setIsPaused($is_paused) /** * Gets filters * - * @return string[] + * @return string[]|null */ public function getFilters() { @@ -379,12 +486,17 @@ public function getFilters() /** * Sets filters * - * @param string[] $filters + * @param string[]|null $filters * - * @return $this + * @return self */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + + $this->container['filters'] = $filters; return $this; @@ -393,7 +505,7 @@ public function setFilters($filters) /** * Gets headers * - * @return map[string,string] + * @return array|null */ public function getHeaders() { @@ -403,12 +515,15 @@ public function getHeaders() /** * Sets headers * - * @param map[string,string] $headers + * @param array|null $headers * - * @return $this + * @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; @@ -417,7 +532,7 @@ public function setHeaders($headers) /** * Gets properties * - * @return map[string,object] + * @return array|null */ public function getProperties() { @@ -427,12 +542,15 @@ public function getProperties() /** * Sets properties * - * @param map[string,object] $properties + * @param array|null $properties * - * @return $this + * @return self */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,7 +562,7 @@ public function setProperties($properties) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -454,22 +572,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -485,11 +604,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -497,13 +629,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/WhiteLabelActiveEmployeesRequestModel.php b/src/lib/Model/WhiteLabelActiveEmployeesRequestModel.php index cad7205..555d1b6 100644 --- a/src/lib/Model/WhiteLabelActiveEmployeesRequestModel.php +++ b/src/lib/Model/WhiteLabelActiveEmployeesRequestModel.php @@ -2,61 +2,61 @@ /** * WhiteLabelActiveEmployeesRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * WhiteLabelActiveEmployeesRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class WhiteLabelActiveEmployeesRequestModel implements ModelInterface, ArrayAccess +class WhiteLabelActiveEmployeesRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WhiteLabelActiveEmployeesRequestModel'; + protected static $openAPIModelName = 'WhiteLabelActiveEmployeesRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'email_addresses' => 'string', 'include_inactive_businesses' => 'bool', 'from_date' => '\DateTime', @@ -69,8 +69,10 @@ class WhiteLabelActiveEmployeesRequestModel implements ModelInterface, ArrayAcce * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'email_addresses' => null, 'include_inactive_businesses' => null, 'from_date' => 'date-time', @@ -79,14 +81,35 @@ class WhiteLabelActiveEmployeesRequestModel implements ModelInterface, ArrayAcce 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_addresses' => false, + 'include_inactive_businesses' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 { - return self::$swaggerFormats; + $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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['email_addresses'] = isset($data['email_addresses']) ? $data['email_addresses'] : null; - $this->container['include_inactive_businesses'] = isset($data['include_inactive_businesses']) ? $data['include_inactive_businesses'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('include_inactive_businesses', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets email_addresses * - * @return string + * @return string|null */ public function getEmailAddresses() { @@ -247,12 +337,15 @@ public function getEmailAddresses() /** * Sets email_addresses * - * @param string $email_addresses + * @param string|null $email_addresses * - * @return $this + * @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; @@ -261,7 +354,7 @@ public function setEmailAddresses($email_addresses) /** * Gets include_inactive_businesses * - * @return bool + * @return bool|null */ public function getIncludeInactiveBusinesses() { @@ -271,12 +364,15 @@ public function getIncludeInactiveBusinesses() /** * Sets include_inactive_businesses * - * @param bool $include_inactive_businesses + * @param bool|null $include_inactive_businesses * - * @return $this + * @return self */ public function setIncludeInactiveBusinesses($include_inactive_businesses) { + if (is_null($include_inactive_businesses)) { + throw new \InvalidArgumentException('non-nullable include_inactive_businesses cannot be null'); + } $this->container['include_inactive_businesses'] = $include_inactive_businesses; return $this; @@ -285,7 +381,7 @@ public function setIncludeInactiveBusinesses($include_inactive_businesses) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -295,12 +391,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -309,7 +408,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -319,12 +418,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -333,7 +435,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -343,12 +445,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -357,7 +462,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -367,12 +472,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -384,7 +492,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/WhiteLabelBrandingModel.php b/src/lib/Model/WhiteLabelBrandingModel.php index 220ca2b..0542ec8 100644 --- a/src/lib/Model/WhiteLabelBrandingModel.php +++ b/src/lib/Model/WhiteLabelBrandingModel.php @@ -2,61 +2,61 @@ /** * WhiteLabelBrandingModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * WhiteLabelBrandingModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class WhiteLabelBrandingModel implements ModelInterface, ArrayAccess +class WhiteLabelBrandingModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WhiteLabelBrandingModel'; + protected static $openAPIModelName = 'WhiteLabelBrandingModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'logo_url' => 'string', 'background_image_url' => 'string', 'background_colour' => 'string', @@ -73,8 +73,10 @@ class WhiteLabelBrandingModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'logo_url' => null, 'background_image_url' => null, 'background_colour' => null, @@ -87,14 +89,39 @@ class WhiteLabelBrandingModel implements ModelInterface, ArrayAccess 'dark_mode_text_secondary_colour' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'logo_url' => false, + 'background_image_url' => false, + 'background_colour' => false, + 'text_colour' => false, + 'text_hover_colour' => false, + 'text_secondary_colour' => false, + 'dark_mode_logo_url' => false, + 'dark_mode_background_colour' => false, + 'dark_mode_text_colour' => false, + 'dark_mode_text_secondary_colour' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -102,9 +129,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array { - return self::$swaggerFormats; + 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); } /** @@ -200,12 +279,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -222,16 +298,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['logo_url'] = isset($data['logo_url']) ? $data['logo_url'] : null; - $this->container['background_image_url'] = isset($data['background_image_url']) ? $data['background_image_url'] : null; - $this->container['background_colour'] = isset($data['background_colour']) ? $data['background_colour'] : null; - $this->container['text_colour'] = isset($data['text_colour']) ? $data['text_colour'] : null; - $this->container['text_hover_colour'] = isset($data['text_hover_colour']) ? $data['text_hover_colour'] : null; - $this->container['text_secondary_colour'] = isset($data['text_secondary_colour']) ? $data['text_secondary_colour'] : null; - $this->container['dark_mode_logo_url'] = isset($data['dark_mode_logo_url']) ? $data['dark_mode_logo_url'] : null; - $this->container['dark_mode_background_colour'] = isset($data['dark_mode_background_colour']) ? $data['dark_mode_background_colour'] : null; - $this->container['dark_mode_text_colour'] = isset($data['dark_mode_text_colour']) ? $data['dark_mode_text_colour'] : null; - $this->container['dark_mode_text_secondary_colour'] = isset($data['dark_mode_text_secondary_colour']) ? $data['dark_mode_text_secondary_colour'] : null; + $this->setIfExists('logo_url', $data ?? [], null); + $this->setIfExists('background_image_url', $data ?? [], null); + $this->setIfExists('background_colour', $data ?? [], null); + $this->setIfExists('text_colour', $data ?? [], null); + $this->setIfExists('text_hover_colour', $data ?? [], null); + $this->setIfExists('text_secondary_colour', $data ?? [], null); + $this->setIfExists('dark_mode_logo_url', $data ?? [], null); + $this->setIfExists('dark_mode_background_colour', $data ?? [], null); + $this->setIfExists('dark_mode_text_colour', $data ?? [], null); + $this->setIfExists('dark_mode_text_secondary_colour', $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; } /** @@ -261,7 +355,7 @@ public function valid() /** * Gets logo_url * - * @return string + * @return string|null */ public function getLogoUrl() { @@ -271,12 +365,15 @@ public function getLogoUrl() /** * Sets logo_url * - * @param string $logo_url + * @param string|null $logo_url * - * @return $this + * @return self */ public function setLogoUrl($logo_url) { + if (is_null($logo_url)) { + throw new \InvalidArgumentException('non-nullable logo_url cannot be null'); + } $this->container['logo_url'] = $logo_url; return $this; @@ -285,7 +382,7 @@ public function setLogoUrl($logo_url) /** * Gets background_image_url * - * @return string + * @return string|null */ public function getBackgroundImageUrl() { @@ -295,12 +392,15 @@ public function getBackgroundImageUrl() /** * Sets background_image_url * - * @param string $background_image_url + * @param string|null $background_image_url * - * @return $this + * @return self */ public function setBackgroundImageUrl($background_image_url) { + if (is_null($background_image_url)) { + throw new \InvalidArgumentException('non-nullable background_image_url cannot be null'); + } $this->container['background_image_url'] = $background_image_url; return $this; @@ -309,7 +409,7 @@ public function setBackgroundImageUrl($background_image_url) /** * Gets background_colour * - * @return string + * @return string|null */ public function getBackgroundColour() { @@ -319,12 +419,15 @@ public function getBackgroundColour() /** * Sets background_colour * - * @param string $background_colour + * @param string|null $background_colour * - * @return $this + * @return self */ public function setBackgroundColour($background_colour) { + if (is_null($background_colour)) { + throw new \InvalidArgumentException('non-nullable background_colour cannot be null'); + } $this->container['background_colour'] = $background_colour; return $this; @@ -333,7 +436,7 @@ public function setBackgroundColour($background_colour) /** * Gets text_colour * - * @return string + * @return string|null */ public function getTextColour() { @@ -343,12 +446,15 @@ public function getTextColour() /** * Sets text_colour * - * @param string $text_colour + * @param string|null $text_colour * - * @return $this + * @return self */ public function setTextColour($text_colour) { + if (is_null($text_colour)) { + throw new \InvalidArgumentException('non-nullable text_colour cannot be null'); + } $this->container['text_colour'] = $text_colour; return $this; @@ -357,7 +463,7 @@ public function setTextColour($text_colour) /** * Gets text_hover_colour * - * @return string + * @return string|null */ public function getTextHoverColour() { @@ -367,12 +473,15 @@ public function getTextHoverColour() /** * Sets text_hover_colour * - * @param string $text_hover_colour + * @param string|null $text_hover_colour * - * @return $this + * @return self */ public function setTextHoverColour($text_hover_colour) { + if (is_null($text_hover_colour)) { + throw new \InvalidArgumentException('non-nullable text_hover_colour cannot be null'); + } $this->container['text_hover_colour'] = $text_hover_colour; return $this; @@ -381,7 +490,7 @@ public function setTextHoverColour($text_hover_colour) /** * Gets text_secondary_colour * - * @return string + * @return string|null */ public function getTextSecondaryColour() { @@ -391,12 +500,15 @@ public function getTextSecondaryColour() /** * Sets text_secondary_colour * - * @param string $text_secondary_colour + * @param string|null $text_secondary_colour * - * @return $this + * @return self */ public function setTextSecondaryColour($text_secondary_colour) { + if (is_null($text_secondary_colour)) { + throw new \InvalidArgumentException('non-nullable text_secondary_colour cannot be null'); + } $this->container['text_secondary_colour'] = $text_secondary_colour; return $this; @@ -405,7 +517,7 @@ public function setTextSecondaryColour($text_secondary_colour) /** * Gets dark_mode_logo_url * - * @return string + * @return string|null */ public function getDarkModeLogoUrl() { @@ -415,12 +527,15 @@ public function getDarkModeLogoUrl() /** * Sets dark_mode_logo_url * - * @param string $dark_mode_logo_url + * @param string|null $dark_mode_logo_url * - * @return $this + * @return self */ public function setDarkModeLogoUrl($dark_mode_logo_url) { + if (is_null($dark_mode_logo_url)) { + throw new \InvalidArgumentException('non-nullable dark_mode_logo_url cannot be null'); + } $this->container['dark_mode_logo_url'] = $dark_mode_logo_url; return $this; @@ -429,7 +544,7 @@ public function setDarkModeLogoUrl($dark_mode_logo_url) /** * Gets dark_mode_background_colour * - * @return string + * @return string|null */ public function getDarkModeBackgroundColour() { @@ -439,12 +554,15 @@ public function getDarkModeBackgroundColour() /** * Sets dark_mode_background_colour * - * @param string $dark_mode_background_colour + * @param string|null $dark_mode_background_colour * - * @return $this + * @return self */ public function setDarkModeBackgroundColour($dark_mode_background_colour) { + if (is_null($dark_mode_background_colour)) { + throw new \InvalidArgumentException('non-nullable dark_mode_background_colour cannot be null'); + } $this->container['dark_mode_background_colour'] = $dark_mode_background_colour; return $this; @@ -453,7 +571,7 @@ public function setDarkModeBackgroundColour($dark_mode_background_colour) /** * Gets dark_mode_text_colour * - * @return string + * @return string|null */ public function getDarkModeTextColour() { @@ -463,12 +581,15 @@ public function getDarkModeTextColour() /** * Sets dark_mode_text_colour * - * @param string $dark_mode_text_colour + * @param string|null $dark_mode_text_colour * - * @return $this + * @return self */ public function setDarkModeTextColour($dark_mode_text_colour) { + if (is_null($dark_mode_text_colour)) { + throw new \InvalidArgumentException('non-nullable dark_mode_text_colour cannot be null'); + } $this->container['dark_mode_text_colour'] = $dark_mode_text_colour; return $this; @@ -477,7 +598,7 @@ public function setDarkModeTextColour($dark_mode_text_colour) /** * Gets dark_mode_text_secondary_colour * - * @return string + * @return string|null */ public function getDarkModeTextSecondaryColour() { @@ -487,12 +608,15 @@ public function getDarkModeTextSecondaryColour() /** * Sets dark_mode_text_secondary_colour * - * @param string $dark_mode_text_secondary_colour + * @param string|null $dark_mode_text_secondary_colour * - * @return $this + * @return self */ public function setDarkModeTextSecondaryColour($dark_mode_text_secondary_colour) { + if (is_null($dark_mode_text_secondary_colour)) { + throw new \InvalidArgumentException('non-nullable dark_mode_text_secondary_colour cannot be null'); + } $this->container['dark_mode_text_secondary_colour'] = $dark_mode_text_secondary_colour; return $this; @@ -504,7 +628,7 @@ public function setDarkModeTextSecondaryColour($dark_mode_text_secondary_colour) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -514,22 +638,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -545,11 +670,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -557,13 +695,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/WhiteLabelModel.php b/src/lib/Model/WhiteLabelModel.php index d189830..275ce89 100644 --- a/src/lib/Model/WhiteLabelModel.php +++ b/src/lib/Model/WhiteLabelModel.php @@ -2,61 +2,61 @@ /** * WhiteLabelModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * WhiteLabelModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class WhiteLabelModel implements ModelInterface, ArrayAccess +class WhiteLabelModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WhiteLabelModel'; + protected static $openAPIModelName = 'WhiteLabelModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,20 +65,39 @@ class WhiteLabelModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'id' => 'int32', 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -86,9 +105,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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 self::$swaggerFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** @@ -160,12 +231,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -182,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->setIfExists('id', $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; } /** @@ -213,7 +299,7 @@ public function valid() /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -223,12 +309,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -237,7 +326,7 @@ public function setId($id) /** * Gets name * - * @return string + * @return string|null */ public function getName() { @@ -247,12 +336,15 @@ public function getName() /** * Sets name * - * @param string $name + * @param string|null $name * - * @return $this + * @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; @@ -264,7 +356,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -274,22 +366,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -305,11 +398,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -317,13 +423,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/WhiteLabelReportSignupsRequestModel.php b/src/lib/Model/WhiteLabelReportSignupsRequestModel.php index a2d2e64..381c611 100644 --- a/src/lib/Model/WhiteLabelReportSignupsRequestModel.php +++ b/src/lib/Model/WhiteLabelReportSignupsRequestModel.php @@ -2,61 +2,61 @@ /** * WhiteLabelReportSignupsRequestModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * WhiteLabelReportSignupsRequestModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class WhiteLabelReportSignupsRequestModel implements ModelInterface, ArrayAccess +class WhiteLabelReportSignupsRequestModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WhiteLabelReportSignupsRequestModel'; + protected static $openAPIModelName = 'WhiteLabelReportSignupsRequestModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'email_addresses' => 'string', 'from_date' => '\DateTime', 'to_date' => '\DateTime', @@ -68,8 +68,10 @@ class WhiteLabelReportSignupsRequestModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'email_addresses' => null, 'from_date' => 'date-time', 'to_date' => 'date-time', @@ -77,14 +79,34 @@ class WhiteLabelReportSignupsRequestModel implements ModelInterface, ArrayAccess 'employing_entity_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email_addresses' => false, + 'from_date' => false, + 'to_date' => false, + 'location_id' => false, + 'employing_entity_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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -92,9 +114,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + 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::$swaggerFormats; + 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); } /** @@ -175,12 +249,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -197,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['email_addresses'] = isset($data['email_addresses']) ? $data['email_addresses'] : null; - $this->container['from_date'] = isset($data['from_date']) ? $data['from_date'] : null; - $this->container['to_date'] = isset($data['to_date']) ? $data['to_date'] : null; - $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null; - $this->container['employing_entity_id'] = isset($data['employing_entity_id']) ? $data['employing_entity_id'] : null; + $this->setIfExists('email_addresses', $data ?? [], null); + $this->setIfExists('from_date', $data ?? [], null); + $this->setIfExists('to_date', $data ?? [], null); + $this->setIfExists('location_id', $data ?? [], null); + $this->setIfExists('employing_entity_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; } /** @@ -231,7 +320,7 @@ public function valid() /** * Gets email_addresses * - * @return string + * @return string|null */ public function getEmailAddresses() { @@ -241,12 +330,15 @@ public function getEmailAddresses() /** * Sets email_addresses * - * @param string $email_addresses + * @param string|null $email_addresses * - * @return $this + * @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; @@ -255,7 +347,7 @@ public function setEmailAddresses($email_addresses) /** * Gets from_date * - * @return \DateTime + * @return \DateTime|null */ public function getFromDate() { @@ -265,12 +357,15 @@ public function getFromDate() /** * Sets from_date * - * @param \DateTime $from_date + * @param \DateTime|null $from_date * - * @return $this + * @return self */ public function setFromDate($from_date) { + if (is_null($from_date)) { + throw new \InvalidArgumentException('non-nullable from_date cannot be null'); + } $this->container['from_date'] = $from_date; return $this; @@ -279,7 +374,7 @@ public function setFromDate($from_date) /** * Gets to_date * - * @return \DateTime + * @return \DateTime|null */ public function getToDate() { @@ -289,12 +384,15 @@ public function getToDate() /** * Sets to_date * - * @param \DateTime $to_date + * @param \DateTime|null $to_date * - * @return $this + * @return self */ public function setToDate($to_date) { + if (is_null($to_date)) { + throw new \InvalidArgumentException('non-nullable to_date cannot be null'); + } $this->container['to_date'] = $to_date; return $this; @@ -303,7 +401,7 @@ public function setToDate($to_date) /** * Gets location_id * - * @return int + * @return int|null */ public function getLocationId() { @@ -313,12 +411,15 @@ public function getLocationId() /** * Sets location_id * - * @param int $location_id + * @param int|null $location_id * - * @return $this + * @return self */ public function setLocationId($location_id) { + if (is_null($location_id)) { + throw new \InvalidArgumentException('non-nullable location_id cannot be null'); + } $this->container['location_id'] = $location_id; return $this; @@ -327,7 +428,7 @@ public function setLocationId($location_id) /** * Gets employing_entity_id * - * @return int + * @return int|null */ public function getEmployingEntityId() { @@ -337,12 +438,15 @@ public function getEmployingEntityId() /** * Sets employing_entity_id * - * @param int $employing_entity_id + * @param int|null $employing_entity_id * - * @return $this + * @return self */ public function setEmployingEntityId($employing_entity_id) { + if (is_null($employing_entity_id)) { + throw new \InvalidArgumentException('non-nullable employing_entity_id cannot be null'); + } $this->container['employing_entity_id'] = $employing_entity_id; return $this; @@ -354,7 +458,7 @@ public function setEmployingEntityId($employing_entity_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,22 +468,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -395,11 +500,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -407,13 +525,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/Model/WorkTypeSelectModel.php b/src/lib/Model/WorkTypeSelectModel.php index 0a48606..61c21bd 100644 --- a/src/lib/Model/WorkTypeSelectModel.php +++ b/src/lib/Model/WorkTypeSelectModel.php @@ -2,61 +2,61 @@ /** * WorkTypeSelectModel * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client\Model; +namespace OpenAPI\Client\Model; use \ArrayAccess; -use \Swagger\Client\ObjectSerializer; +use \OpenAPI\Client\ObjectSerializer; /** * WorkTypeSelectModel Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess */ -class WorkTypeSelectModel implements ModelInterface, ArrayAccess +class WorkTypeSelectModel implements ModelInterface, ArrayAccess, \JsonSerializable { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ - protected static $swaggerModelName = 'WorkTypeSelectModel'; + protected static $openAPIModelName = 'WorkTypeSelectModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ - protected static $swaggerTypes = [ + protected static $openAPITypes = [ 'is_unit_based' => 'bool', 'is_leave_type' => 'bool', 'unit_type' => 'string', @@ -69,8 +69,10 @@ class WorkTypeSelectModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ - protected static $swaggerFormats = [ + protected static $openAPIFormats = [ 'is_unit_based' => null, 'is_leave_type' => null, 'unit_type' => null, @@ -79,14 +81,35 @@ class WorkTypeSelectModel implements ModelInterface, ArrayAccess 'description' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_unit_based' => false, + 'is_leave_type' => false, + 'unit_type' => false, + 'business_award_package_id' => false, + 'id' => false, + 'description' => 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 swaggerTypes() + public static function openAPITypes() { - return self::$swaggerTypes; + return self::$openAPITypes; } /** @@ -94,9 +117,61 @@ public static function swaggerTypes() * * @return array */ - public static function swaggerFormats() + public static function openAPIFormats() { - return self::$swaggerFormats; + 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); } /** @@ -180,12 +255,9 @@ public static function getters() */ public function getModelName() { - return self::$swaggerModelName; + return self::$openAPIModelName; } - - - /** * Associative array for storing property values @@ -202,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['is_unit_based'] = isset($data['is_unit_based']) ? $data['is_unit_based'] : null; - $this->container['is_leave_type'] = isset($data['is_leave_type']) ? $data['is_leave_type'] : null; - $this->container['unit_type'] = isset($data['unit_type']) ? $data['unit_type'] : null; - $this->container['business_award_package_id'] = isset($data['business_award_package_id']) ? $data['business_award_package_id'] : null; - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->setIfExists('is_unit_based', $data ?? [], null); + $this->setIfExists('is_leave_type', $data ?? [], null); + $this->setIfExists('unit_type', $data ?? [], null); + $this->setIfExists('business_award_package_id', $data ?? [], null); + $this->setIfExists('id', $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; } /** @@ -237,7 +327,7 @@ public function valid() /** * Gets is_unit_based * - * @return bool + * @return bool|null */ public function getIsUnitBased() { @@ -247,12 +337,15 @@ public function getIsUnitBased() /** * Sets is_unit_based * - * @param bool $is_unit_based + * @param bool|null $is_unit_based * - * @return $this + * @return self */ public function setIsUnitBased($is_unit_based) { + if (is_null($is_unit_based)) { + throw new \InvalidArgumentException('non-nullable is_unit_based cannot be null'); + } $this->container['is_unit_based'] = $is_unit_based; return $this; @@ -261,7 +354,7 @@ public function setIsUnitBased($is_unit_based) /** * Gets is_leave_type * - * @return bool + * @return bool|null */ public function getIsLeaveType() { @@ -271,12 +364,15 @@ public function getIsLeaveType() /** * Sets is_leave_type * - * @param bool $is_leave_type + * @param bool|null $is_leave_type * - * @return $this + * @return self */ public function setIsLeaveType($is_leave_type) { + if (is_null($is_leave_type)) { + throw new \InvalidArgumentException('non-nullable is_leave_type cannot be null'); + } $this->container['is_leave_type'] = $is_leave_type; return $this; @@ -285,7 +381,7 @@ public function setIsLeaveType($is_leave_type) /** * Gets unit_type * - * @return string + * @return string|null */ public function getUnitType() { @@ -295,12 +391,15 @@ public function getUnitType() /** * Sets unit_type * - * @param string $unit_type + * @param string|null $unit_type * - * @return $this + * @return self */ public function setUnitType($unit_type) { + if (is_null($unit_type)) { + throw new \InvalidArgumentException('non-nullable unit_type cannot be null'); + } $this->container['unit_type'] = $unit_type; return $this; @@ -309,7 +408,7 @@ public function setUnitType($unit_type) /** * Gets business_award_package_id * - * @return int + * @return int|null */ public function getBusinessAwardPackageId() { @@ -319,12 +418,15 @@ public function getBusinessAwardPackageId() /** * Sets business_award_package_id * - * @param int $business_award_package_id + * @param int|null $business_award_package_id * - * @return $this + * @return self */ public function setBusinessAwardPackageId($business_award_package_id) { + if (is_null($business_award_package_id)) { + throw new \InvalidArgumentException('non-nullable business_award_package_id cannot be null'); + } $this->container['business_award_package_id'] = $business_award_package_id; return $this; @@ -333,7 +435,7 @@ public function setBusinessAwardPackageId($business_award_package_id) /** * Gets id * - * @return int + * @return int|null */ public function getId() { @@ -343,12 +445,15 @@ public function getId() /** * Sets id * - * @param int $id + * @param int|null $id * - * @return $this + * @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; @@ -357,7 +462,7 @@ public function setId($id) /** * Gets description * - * @return string + * @return string|null */ public function getDescription() { @@ -367,12 +472,15 @@ public function getDescription() /** * Sets description * - * @param string $description + * @param string|null $description * - * @return $this + * @return self */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -384,7 +492,7 @@ public function setDescription($description) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,22 +502,23 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,11 +534,24 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + 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 * @@ -437,13 +559,19 @@ public function offsetUnset($offset) */ public function __toString() { - if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } + 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/src/lib/ObjectSerializer.php b/src/lib/ObjectSerializer.php index 39b663b..e7d1de1 100644 --- a/src/lib/ObjectSerializer.php +++ b/src/lib/ObjectSerializer.php @@ -2,83 +2,109 @@ /** * ObjectSerializer * - * PHP version 5 + * PHP version 7.4 * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ /** * Australia * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * OpenAPI spec version: AU - * - * Generated by: https://github.com/swagger-api/swagger-codegen.git - * Swagger Codegen version: 2.4.21 + * The version of the OpenAPI document: AU + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.6.0 */ /** - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech * Do not edit the class manually. */ -namespace Swagger\Client; +namespace OpenAPI\Client; + +use GuzzleHttp\Psr7\Utils; +use OpenAPI\Client\Model\ModelInterface; /** * ObjectSerializer Class Doc Comment * * @category Class - * @package Swagger\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech */ class ObjectSerializer { + /** @var string */ + private static $dateTimeFormat = \DateTime::ATOM; + + /** + * Change the date format + * + * @param string $format the new date format to use + */ + public static function setDateTimeFormat($format) + { + self::$dateTimeFormat = $format; + } + /** * Serialize data * * @param mixed $data the data to serialize - * @param string $type the SwaggerType of the data - * @param string $format the format of the Swagger type of the data + * @param string $type the OpenAPIToolsType of the data + * @param string $format the format of the OpenAPITools type of the data * - * @return string|object serialized form of $data + * @return scalar|object|array|null serialized form of $data */ public static function sanitizeForSerialization($data, $type = null, $format = null) { if (is_scalar($data) || null === $data) { return $data; - } elseif ($data instanceof \DateTime) { - return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM); - } elseif (is_array($data)) { + } + + if ($data instanceof \DateTime) { + return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } return $data; - } elseif ($data instanceof \stdClass) { - foreach ($data as $property => $value) { - $data->$property = self::sanitizeForSerialization($value); - } - return $data; - } elseif (is_object($data)) { + } + + if (is_object($data)) { $values = []; - $formats = $data::swaggerFormats(); - foreach ($data::swaggerTypes() as $property => $swaggerType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null - && !in_array($swaggerType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) - && method_exists($swaggerType, 'getAllowableEnumValues') - && !in_array($value, $swaggerType::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'"); + 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]); + } } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]); + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); } } return (object)$values; @@ -104,6 +130,20 @@ public static function sanitizeFilename($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. @@ -118,22 +158,141 @@ public static function toPathValue($value) } /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. + * Checks if a value is empty, based on its OpenAPI type. * - * @param string[]|string|\DateTime $object an object to be serialized to a string + * @param mixed $value + * @param string $openApiType * - * @return string the serialized object + * @return bool true if $value is empty */ - public static function toQueryValue($object) + private static function isEmptyValue($value, string $openApiType): bool { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * 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 { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + 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; } /** @@ -147,6 +306,11 @@ public static function toQueryValue($object) */ public static function toHeaderValue($value) { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + return self::toString($value); } @@ -172,17 +336,20 @@ public static function toFormValue($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|\DateTime $value the value of the parameter + * @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(\DateTime::ATOM); + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; } else { - return $value; + return (string) $value; } } @@ -190,29 +357,32 @@ public static function toString($value) * Serialize an array to a string. * * @param array $collection collection to serialize to a string - * @param string $collectionFormat the format use for serialization (csv, + * @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, $collectionFormat, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) { - if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { + 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 ($collectionFormat) { + 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: @@ -228,13 +398,32 @@ public static function serializeCollection(array $collection, $collectionFormat, * @param string[] $httpHeaders HTTP headers * @param string $discriminator discriminator if polymorphism is used * - * @return object|array|null an single or an array of $class instances + * @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; - } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + } + + 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) { @@ -245,37 +434,48 @@ public static function deserialize($data, $class, $httpHeaders = null) } } return $deserialized; - } elseif (strcasecmp(substr($class, -2), '[]') === 0) { - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } elseif ($class === 'object') { + } + + if ($class === 'object') { settype($data, 'array'); return $data; - } elseif ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs 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)) { - return new \DateTime($data); + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs 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; } - } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } elseif ($class === '\SplFileObject') { + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (array_key_exists('Content-Disposition', $httpHeaders) && - preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + 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(), ''); @@ -288,35 +488,80 @@ public static function deserialize($data, $class, $httpHeaders = null) fclose($file); return new \SplFileObject($filename, 'r'); - } elseif (method_exists($class, 'getAllowableEnumValues')) { + } + + /** @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 = '\Swagger\Client\Model\\' . $data->{$discriminator}; + $subclass = '\OpenAPI\Client\Model\\' . $data->{$discriminator}; if (is_subclass_of($subclass, $class)) { $class = $subclass; } } + + /** @var ModelInterface $instance */ $instance = new $class(); - foreach ($instance::swaggerTypes() as $property => $type) { + foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } - $propertyValue = $data->{$instance::attributeMap()[$property]}; - if (isset($propertyValue)) { + 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); + } }